1. Additions to EDS (ATTN Rob)

Rob,

I've added the following because they serve my needs right now. If they are
already implemented, please let me know! Thanks... smile

global function list_db_names() -- quick list of open databases
    return db_names
end function

global function db_current() -- return name of current database
    return db_names[ find( current_db , db_file_nums ) ]
end function

Need your help wit' this one:

global function db_current_table() -- return name of current table
    -- ???
end function

If you could provide this function for me, I'd appreciate it.

Thanks!
ck

new topic     » topic index » view message » categorize

2. Re: Additions to EDS (ATTN Rob)

C.K. Lester writes:
> Need your help wit' this one:
>
> global function db_current_table() -- return name of current table
>    -- ???
> end function

You could simply record the name whenever you call
db_select_table(name).

Or, you could use the value of current_table
to get the name, something like:

-- warning: untested code taken from table_find():

safe_seek(current_table)
name_ptr = get4()
safe_seek(name_ptr)
name = get_string()

This might break if the data structures are ever changed.

Regards,
   Rob Craig
   Rapid Deployment Software
   http://www.RapidEuphoria.com

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

3. Re: Additions to EDS (ATTN Rob)

I am in the process of writing an on-line front end to EDS with a few extra
facilities (built into the calling code rather than DATABASE.E). However I
did add the following code to DATABASE.E which may be of use:


global function db_return_currentdb()
sequence db_return
integer current
if current_db > 0 then
   current=find(current_db,db_file_nums)
   db_return=sprintf("%s",{db_names[current]})
else
   db_return="No database open"
end if
return db_return
end function

global function db_return_currenttable()
sequence db_return
object current
integer pointer
if current_table > 0 then
   safe_seek(current_table)
   pointer = get4()
   safe_seek(pointer)
   current = get_string()
   db_return = sprintf("%s",{current})
else
   db_return = "No tables current"
end if

return db_return
end function


global function db_return_alldbworking()
sequence db_return
db_return={}
if length(db_names)>0 then
   for count = 1 to length(db_names) do
      db_return = db_return & sprintf("%s",{db_names[count]})
      if count<length(db_names) then
         db_return = db_return & ','
      end if
   end for
   --? db_return
   --key=wait_key()
else
   db_return="No databases loaded"
end if
return db_return
end function

global function db_return_alldb()
object db_return
db_return={}
if length(db_names)>0 then
   for count = 1 to length(db_names) do
   db_return=db_return & sprintf("%s",{db_names[count]})
   if count < length(db_names) then db_return=db_return & ',' end if
   end for
else
   db_return="No databases loaded"
end if
return db_return
end function

If they are useful please feel free to adopt/change/ignore. I will post the
on-line front end in a few weeks.

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

Search



Quick Links

User menu

Not signed in.

Misc Menu