QB64 Phoenix Edition
SQLite wrapper - Printable Version

+- QB64 Phoenix Edition (https://qb64phoenix.com/forum)
+-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1)
+--- Forum: Code and Stuff (https://qb64phoenix.com/forum/forumdisplay.php?fid=3)
+---- Forum: Utilities (https://qb64phoenix.com/forum/forumdisplay.php?fid=8)
+---- Thread: SQLite wrapper (/showthread.php?tid=488)



SQLite wrapper - jakebullet70 - 05-25-2022

OK, this should be all you need to use SQLite 3 databases.  See GitHub for all code needed including sample stuff.

https://github.com/jakebullet70/QB64-SQLite

Supported Subs / Functions

Code: (Select All)
'--- open a sqlite DB
SUB DB_Open (CreateIfMissing AS _BYTE)
FUNCTION DB_Open%% (CreateIfMissing AS _BYTE)

'--- close a database
SUB DB_Close ()

'--- return primary key of last inserted record
FUNCTION DB_LastInsertedRowID& ()

'--- return number of rows the last query affected
FUNCTION DB_AffectedRows& ()

'--- return the last error message (if any)
FUNCTION DB_GetErrMsg$ ()

'--- return total of rows in a recordset
FUNCTION DB_RowCount& (RS() AS SQLITE_RESULTSET)

'--- return number of columns in a recordset
FUNCTION DB_ColCount& (RS() AS SQLITE_RESULTSET)

'--- Gets the value of a field
FUNCTION DB_GetField$ (RS() AS SQLITE_RESULTSET, Row AS LONG, FieldName AS STRING)

'--- Use for Scalar functions, returning 1 value
FUNCTION DB_ExecQuerySingleResult$ (sql_command AS STRING)

'--- Execute a SQL query and return a recordset
SUB DB_ExecQuery (sql_command AS STRING, RS() AS SQLITE_RESULTSET)
FUNCTION DB_ExecQuery& (sql_command AS STRING, RS() AS SQLITE_RESULTSET)

'--- Execute a SQL query with no return value
SUB DB_ExecNonQuery (sql_command AS STRING)
FUNCTION DB_ExecNonQuery& (sql_command AS STRING)

'--- Helper function to build SQL statements
FUNCTION DB_SqlParse$ (sql_str$, values_str$)

   
   


RE: SQLite wrapper - KingRat - 06-04-2022

Nice job man!
I´m gonna try it now.

Thanks for sharing!!!