Changes between Version 17 and Version 18 of Docs/Prog/Manual/ApplicationLibraries/lib825db


Ignore:
Timestamp:
10/23/25 07:49:51 (3 weeks ago)
Author:
Don Wilson
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Docs/Prog/Manual/ApplicationLibraries/lib825db

    v17 v18  
    77Most of our existing apps using SQLite use the C++ wrapper code namespace sq3 provided by libsql, libsql3_7_9, or lib825sql. To edit this code to use lib825db instead is fairly simple.
    88
    9 Existing apps will have 
    10 {{{
     9Existing apps will have:
     10{{{#!c++
    1111#include "sqlite3.h"
    1212#include "sq3.hpp"
     
    1616
    1717Replace with
    18 {{{
     18{{{#!c++
    1919#include "dbsql.h"
    2020}}}
    2121
    2222Existing apps will have global database instance such as:
    23 {{{
     23{{{#!c++
    2424database db;
    2525}}}
    2626
    2727Replace with:
    28 {{{
     28{{{#!c++
    2929CDB* appDB = nullptr;
    3030}}}
    3131
    3232Existing apps will have code to open the database such as:
    33 {{{
     33{{{#!c++
    3434db.open("/mnt/nand/apps/<appdir>/myapp.db3");
    3535if(!db.is_open) {
     
    3939
    4040Replace with code similar to:
    41 {{{
     41{{{#!c++
    4242CAppDatabaseCfg appDBcfg;
    4343string path = appDataPath + CFGFILE_DB;
     
    6262
    6363Existing apps with have sql execute statements such as:
    64 {{{
     64{{{#!c++
    6565int ct;
    6666string sql = "SELECT COUNT(*) FROM [Trucks];";
     
    6969
    7070Replace with:
    71 {{{
     71{{{#!c++
    7272int ct;
    7373string sql = "SELECT COUNT(*) FROM Trucks;";
     
    7777
    7878Existing apps may have code such as:
    79 {{{
     79{{{#!c++
    8080string sql = "INSERT INTO [Trucks] ([ID],[TareWt]) VALUES ('" + truckID +"'," + IntToStr(tare) + ");";
    8181if (rc_is_okay(db.execute(sql)) == false) {
     
    8484}}}
    8585Replace with:
    86 {{{
     86{{{#!c++
    8787string sql = "INSERT INTO Trucks (ID,TareWt) VALUES ('" + truckID +"'," + IntToStr(tare) + ");";
    8888if (appDB->execute(sql) == false) {
     
    9292
    9393Existing apps will have code such as:
    94 {{{
     94{{{#!c++
    9595string sql = "SELECT * FROM [railcars] WHERE [ID] = '" + strId + "';";
    9696statement st(db, sql);
     
    103103
    104104Replace with:
    105 {{{
     105{{{#!c++
    106106string sql = "SELECT * FROM railcars WHERE ID = '" + strId + "';";
    107107CDBStatement stmt(appDB, sql);
     
    112112}}}
    113113
    114 When app finishs existing apps
    115 {{{
     114When app finishs existing apps:
     115{{{#!c++
    116116db.close;
    117117}}}
    118118Replace with:
    119 {{{
     119{{{#!c++
    120120appDB->Close();
    121121delete appDB;