suggestion for database.e

new topic     » topic index » view thread      » older message » newer message

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

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu