int SQLiteExec(char *query);


Executes an SQL query on the currently opened database.


Return Value


Returns the number of rows returned by the query or negative one if an error was encountered.





Specifies the query to be executed on the database.  Can be any valid SQL statement.




SQLiteExec() executes a query on the currently opened SQLite database and returns the number of rows returned by the query.


Watch the console window for any errors and the number of rows returned by the query.


For more information about the SQL syntax understood by SQLite, please see the SQLite Documentation.


DragonFireSDK supports SQLite version




Available in DragonFireSDK 2.0 and later.




#include "DragonFireSDK.h"


int OnColumn(char *value, char *name)


  // Print the column name and value to the console window:

   printf("OnColumn: %s\t%s\n", name, value);




int OnRow(char *value)


  // Print the row to the console window:

   printf("OnRow: %s\n", value);




void AppMain()


  int result;


  // Create or open the database:


   printf("SQLiteOpen result: %d\n", result);


  // Set up the OnColumn callback:


   printf("SQLiteSetOnColumn result: %d\n", result);


  // Set up the OnRow callback:


   printf("SQLiteSetOnRow result: %d\n", result);


  // Drop the any existing 'mytable':

   result=SQLiteExec("drop table mytable");

   printf("SQLiteExec (drop table query) result: %d\n", result);


  // Create a table called 'mytable':

   result=SQLiteExec("create table mytable (firstname varchar(30), lastname varchar(30), address varchar(50))");

   printf("SQLiteExec (create query) result: %d\n", result);


  // Insert a record into 'mytable':

   result=SQLiteExec("insert into mytable (firstname, lastname, address) values ('John','Doe','123 Main Street')");

   printf("SQLiteExec (insert query) result: %d\n", result);


  // Select all the rows from 'mytable':

   result=SQLiteExec("select * from mytable");

   printf("SQLiteExec (select query) result: %d\n", result);


  // Print the last encountered error to the console:

   printf("SQLiteGetLastError: %s\n", SQLiteGetLastError());



void AppExit()


  int result;


  // Close the database:


   printf("SQLiteClose result: %d\n", result);



void OnTimer()