![]() |
||
| Home | SwiftForth Archive | SwiftX Archive | |

Here is a short program that opens and closes an sqlite3 database:
------------------------------------------------------------------
LIBRARY sqlite3.dll
CFunction: sqlite3_open ( zName 'dbHandle -- res )
CFunction: sqlite3_close ( dbHandle -- res )
CFunction: sqlite3_errmsg ( dbHandle -- zErrorText )
VARIABLE 'dbHandle
: .RESULT ( nresult -- )
. 'dbHandle @ sqlite3_errmsg ." (" ZCOUNT TYPE ." )"
;
: TEST ( zName -- )
'dbHandle sqlite3_open CR ." sqlite3_open: " .RESULT
'dbHandle @ sqlite3_close CR ." sqlite3_close: " .
;
------------------------------------------------------------------
sqlite3_open stores a pointer to an sqlite3 object into 'dbHandle.
The value of 'dbHandle is used as an argument to subsequent API functions.
Z" :memory:" TEST
sqlite3_open: 0 (not an error)
sqlite3_close: 0 ok
Z" :memor:" TEST
sqlite3_open: 14 (unable to open database file)
sqlite3_close: 0 ok
----------------------------------------------------------------------
sftalk_at_forth.com The SwiftForth programming discussion email list
To unsubscribe, send subject "unsubscribe" to sftalk-request_at_forth.com
For list command help, send subject "help" to sftalk-request_at_forth.com
Message archives are located at http://www.forth.com/archive/sftalk
----------------------------------------------------------------------
This list is a forum for SwiftForth users. For product support and
bug reports, please send email to support_at_forth.com
----------------------------------------------------------------------
Received on Tue Oct 09 2007 - 07:43:48 PDT
This archive was generated by hypermail 2.2.0 : Tue Dec 02 2008 - 03:04:43 PST