1. How can a table be the current table if it's parent database is closed?

I have a routine which lists the current database, current table and all other open databases.

If I open a table and then close its parent database db_current_table still reports it as the current table.

If I select or open another database, db_current becomes undefined as expected and the routine likewise performs as expected:

procedure db_banner(sequence operation) 
    set_top_line(" ") 
    text_color(TOP_LINE_TEXT_COLOR) 
    current_db = filebase(db_current()) 
    printf(SCREEN, "%s",{current_db}) 
    text_color(TOP_LINE_DIM_COLOR) 
    puts(SCREEN, ":") 
    current_table = db_current_table()    --<<----------------- 
    text_color(TOP_LINE_TEXT_COLOR) 
    printf(SCREEN, "%s", {current_table}) 
    text_color(TOP_LINE_DIM_COLOR) 
----- 
-- snip 
----- 
end procedure 

Shouldn't the db_current_table become undefined if its parent db is closed?

Regards, Kenneth Rhodes

new topic     » topic index » view message » categorize

2. Re: How can a table be the current table if it's parent database is closed?

K_D_R said...

Shouldn't the db_current_table become undefined if its parent db is closed?

Yes it should. I'll raise an bug report for it.

new topic     » goto parent     » topic index » view message » categorize

3. Re: How can a table be the current table if it's parent database is closed?

DerekParnell said...
K_D_R said...

Shouldn't the db_current_table become undefined if its parent db is closed?

Yes it should. I'll raise an bug report for it.

Ok, thanks.... this was on Linux.

new topic     » goto parent     » topic index » view message » categorize

4. EDS: fix for db_close() failure to render current table undefined

While studying the EDS include file std/eds.e

I noticed that the routines which appropriately rendered the current table as "undefined" included these two lines:

current_table_pos = -1                                                                                                            
current_table_name = "" 

Inserting those two lines in the end of the eds.e routine db_close() at line 1430 after the statement, current_db = -1, and before the statement, key_pointers = {}, seems to correct the problem:

public procedure db_close() 
-- 
-- snip 
-- 
current_db = -1                                                                                                                   
current_table_pos = -1   --<--- insert                                                                                                         
current_table_name = ""  --<--- insert                                                                                                         
key_pointers = {}    
end procedure 

I have not tested this extensively. Please advice if this is not an appropriate "fix".

Regards, Kenneth Rhodes

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu