EDS:: select or create table
- Posted by K_D_R Feb 10, 2012
- 1650 views
I am having a wreck of a heck of a time trying to figure out how to create a database after db_table_list returns and a NO_TABLE error.
If the db has a table there is no problem. But if there is no table everything freezes up pronto.
This is my latest failing effort:
-- select or create table procedure select_or_create_table() db_banner("Select Table") sequence answer = {} tables = {} object dbtblst dbtblst = db_table_list() if atom(dbtblst) then if dbtblst = NO_TABLE then answer = delete_trailing_white(key_gets(" ", {})) end if else for i = 1 to length(dbtblst) do tables = update_history(tables, sprintf("%s", {dbtblst[i]})) end for answer = delete_trailing_white(key_gets("", tables)) end if if length(answer) != 0 then if db_select_table(answer)!= DB_OK then if db_create_table(answer) != DB_OK then db_banner("tb") any_key("Failed to create/select table! ") end if end if tables = update_history(tables, answer) end if end procedure
Any suggestions will be much appreciated.
Regards, Kenneth Rhodes