Re: EDS:: select or create table
- Posted by K_D_R Feb 10, 2012
- 1504 views
[quote jimcbrown]
Key_gets was not the problem.
I'm not convinced that you are correct with this assertion. What does key_gets() do?
I suspect that this is the key_gets() routine from ed.ex
Could the problem be that you called key_gets() differently. When using it after the NO_TABLE test, you called it with a string containing one blank ... key_gets(" ", {}) but when calling it after the length(dbtblst) < 1 test, you callied with an empty string key_gets("",{}).
Is that significant?
My understanding is that this is very significant. In the former, a hot key is passed in (so pressing spacebar triggers a hot key), but in the latter, no hot keys are passed in.
The list of hot-keys is optional. Key_gets is the same routine that ed.ex uses to select/open new files, command_history, file_history, as well as the get_escape routine which uses hot keys for ed.ex 's menu etc. - but you are right as far as the difference between "" and " " being significant and in fact causes the same "freeze" in the block of code that other wise functions properly.
db table names generally don't include spaces, however, if a space was entered then an empty string would be returned and assigned to answer.
So, I should check for the return of a space in answer and reset the input routine ( loop back ), if necessary, right?
The functional code suggests that db_table_list() is never returning an atom.
BINGO! When I run the first block of code without evaluating dbtblst for atom status on a new db which has no table, I get a "true false condition must be an atom" for the line:
if dbtblst = NO_TABLE then
Shouldn't NO_Table be an atom?
Regards, Kenneth Rhodes