Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SQLite wrapper
#1
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$)

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

Thanks for sharing!!!
Reply




Users browsing this thread: 2 Guest(s)