A few sqlite confusions, all bundled together.  I am having so much fun
learning factor, it's keeping me up at night, which hasn't happened to me
for a long time.  THANKS!

0) When I try to step through #3 below, trying to see the code that is
appending the result row to the result set, the walker doesn't reveal the
magic.  I see a vector with the rows in it on the stack and/or retain stack,
but can't figure out what word puts them there.  I suspect it has something
to do with the continuation c> word, but haven't grokked that yet.  Can
someone shed some light?

1)  Main, underlying goal: I want to get the column headings returned after
a sqlite query is run.  I know how to use PRAGMA to get the def of a table,
but I need to process ad-hoc queries (on an intranet from secure users).  I
managed to do this for ODBC by capturing the column structure as it's
processed for the first row, but can't find the equivalent in the sqlite
library.  Below is what I've tried, please point out where I've gone wrong.

2)  I see row-column, which says it takes a result set and a column index.
I tried sticking this into advance-row, but don't get what I expect.  When I
step through #3 below, row-column returns a 0.

3)  M: sqlite-result-set advance-row ( result-set -- )
B   dup 0 row-column drop  ! trying to apply row-column in a place it should
be valid, but only get a 0
 dup handle>> sqlite-next >>has-more? drop ;

4)  I tried decomposing the words along the way to get a good result-set
data structure that row-column could work against, but keep striking out:

5) "select tbl_name from sqlite_master where type = 'table'"
       [  f f <simple-statement> [ query-results ] with-disposal ]
with-sample-db
       results in:
       T{ sqlite-result-set
           { sql
               "select tbl_name from sqlite_master where type = 'table'"
           }
           { handle ALIEN: 1001b1e48 }
           { has-more? t }
       }

6) which will get me a sqlite-result-set, but I can't figure out how to use
it: the results from #5 above, when I execute #columns on it, I get
65536000, which isn't right.

Any light you can shed is greatly appreciated!

-- 
Jim
"I'm for extending the working Medicare program for our seniors all the way
back to contraception, so Americans can concentrate on living their lives
without fear of changing a job, going bankrupt from deductibles or fighting
HMO bureaucracy."
------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to