suggestion for database.e
- Posted by Markus Schaller <markus.schaller at web.de> Oct 10, 2003
- 407 views
Hello, I've added three functions, which I missed several times, to database.e Are there any suggestions, or is there a better way to get the following infos? global function db_list() -- return all open databases return db_names end function ----- global function db_current() -- return name of current selected database if length(db_names) then return db_names[find(current_db,db_file_nums)] else return -1 end if end function ----- global function db_current_table() -- find a table, given its t_header -- return table name atom tables, nt, t_header, name_ptr sequence tname safe_seek(TABLE_HEADERS) tables = get4() safe_seek(tables) nt = get4() t_header = tables+4 for i = 1 to nt do safe_seek(t_header) name_ptr = get4() safe_seek(name_ptr) tname = get_string() if t_header = current_table then -- found it return tname end if t_header += SIZEOF_TABLE_HEADER end for return -1 end function bye Markus