|
From: <cre...@us...> - 2007-10-12 20:18:11
|
Revision: 1753
http://frontierkernel.svn.sourceforge.net/frontierkernel/?rev=1753&view=rev
Author: creecode
Date: 2007-10-12 13:18:11 -0700 (Fri, 12 Oct 2007)
Log Message:
-----------
in function sqlitecompilequeryverb replaced call to sqliteDatabaseError with new sqliteCompileError function
created sqliteCompileError function
Modified Paths:
--------------
Frontier/trunk/Common/source/langsqlite.c
Modified: Frontier/trunk/Common/source/langsqlite.c
===================================================================
--- Frontier/trunk/Common/source/langsqlite.c 2007-10-03 21:54:30 UTC (rev 1752)
+++ Frontier/trunk/Common/source/langsqlite.c 2007-10-12 20:18:11 UTC (rev 1753)
@@ -254,13 +254,32 @@
bigstring bserrmsg;
copyctopstring (errmsg, bserrmsg); /* This creates a pstring at bserrmsg */
- getstringlist (langerrorlist, notfunctionerror, bserror);
+ getstringlist (langerrorlist, notfunctionerror, bserror);
parsedialogstring (bserror, bserrmsg, nil, nil, nil, bserror);
return;
} /*sqliteScriptError*/
+static void sqliteCompileError ( const char *errmsg, bigstring bserror ) {
+
+ //
+ // 2007-10-11 creedon: created, cribbed from sqliteDatabaseError function
+ //
+
+ bigstring bserrmsg;
+
+ copyctopstring ( errmsg, bserrmsg );
+
+ getstringlist ( langerrorlist, sqlitecompileerror, bserror );
+
+ parsedialogstring ( bserror, bserrmsg, nil, nil, nil, bserror );
+
+ return;
+
+ } // sqliteCompileError
+
+
boolean sqliteopenverb ( hdltreenode hparam1, tyvaluerecord *vreturned, bigstring bserror ) {
Handle dbfile; // path to database file
@@ -391,46 +410,54 @@
boolean sqlitecompilequeryverb (hdltreenode hparam1, tyvaluerecord *vreturned, bigstring bserror) {
+
+ //
+ // 2007-10-12 creedon: replaced call to sqliteDatabaseError with new
+ // sqliteCompileError function
+
+ // sqlite.compileQuery ( dbid, query )
+ //
+ // Action: compile an SQLite query
+ // Params: a database id and a query string
+ // Returns: a query id
+ // Usage: call in a try statement
+ // Notes: do not pass the opened database ID across threads.
+ //
+ // SQLite docs: http://www.sqlite.org/capi3ref.html#sqlite3_prepare.
+ //
+ // Code that is a good example of prepare in use: http://souptonuts.sourceforge.net/code/eatblob.c.html
+ //
+
Handle query; /* the SQL query passed to the SQLite engine */
sqlite3 *dbid; /* the SQLite database handle */
sqlite3_stmt *queryid = 0; /* the compiled query */
- int returnCode; /* return code from SQLite call */
-
- /*
- sqlite.compileQuery(dbid, query)
-
- Action: compile an SQLite query
- Params: a database id and a query string
- Returns: a query id
- Usage: call in a try statement
- Notes: do not pass the opened database ID across threads.
-
- SQLite docs: http://www.sqlite.org/capi3ref.html#sqlite3_prepare.
-
- Code that is a good example of prepare in use:
- http://souptonuts.sourceforge.net/code/eatblob.c.html
- */
-
+ int returnCode; /* return code from SQLite call */
+
if (!getlongvalue (hparam1, 1, (long *) &dbid)) /* Get the long value, which becomes the db pointer */
return (false);
-
+
flnextparamislast = true; /* makes sure Frontier throws an error if more than one param is passed */
if (!getreadonlytextvalue (hparam1, 2, &query)) /* get the query param */
return (false);
-
+
/* Process the SQLite sequence */
returnCode = sqlite3_prepare(dbid, *query, gethandlesize(query), &queryid, 0);
- if(returnCode != SQLITE_OK || queryid == NULL) {
- sqliteDatabaseError(sqlite3_errmsg(dbid), bserror); /* send database error */
- return (false);
- }
-
+
+ if ( returnCode != SQLITE_OK || queryid == NULL ) {
+
+ sqliteCompileError ( sqlite3_errmsg ( dbid ), bserror ); // send database error
+
+ return ( false );
+
+ }
+
return (setlongvalue ((long) queryid, vreturned)); /* return the db address to the scripter */
-} /* sqlitecompilequeryverb */
+ } // sqlitecompilequeryverb
+
boolean sqliteclearqueryverb (hdltreenode hparam1, tyvaluerecord *vreturned, bigstring bserror) {
sqlite3_stmt *queryid; /* query id */
int returnCode; /* return code from SQLite call */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|