#I am confused about the following behaviour of Sqlite command inside NX object.
Object create o; o require namespace; sqlite3 o::db /tmp/my.db o db eval {create table mytable (data)}; o public method insert {data} {:db eval {insert into mytable values ($data)} };
#In the above, sqlite sees the variable $data as being empty (or non-existent); #If I rewrite the method in a following way (using double quotes instead of braces), it works:
o public method insert {data} {:db eval "insert into mytable values ($data)" };
#The problem is that I might want to insert binary/BLOB data etc, therefore use the : @ $ prefix for variables, I have to use braces, not double quotes. #After much trial and error I got the following to work:
o public method insert {data} {[self]::db eval {insert into mytable values ($data)} };
#why doesn't sqlite see the variable with :db AND braces syntax but it works fine with [self]::db or :db + double quotes syntax ? #as far as I am concerned, the problem is solved, I am just curious what is going on here.