Changes between Version 17 and Version 18 of Docs/Prog/Manual/ApplicationLibraries/lib825db
- Timestamp:
- 10/23/25 07:49:51 (3 weeks ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Docs/Prog/Manual/ApplicationLibraries/lib825db
v17 v18 7 7 Most 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. 8 8 9 Existing apps will have 10 {{{ 9 Existing apps will have: 10 {{{#!c++ 11 11 #include "sqlite3.h" 12 12 #include "sq3.hpp" … … 16 16 17 17 Replace with 18 {{{ 18 {{{#!c++ 19 19 #include "dbsql.h" 20 20 }}} 21 21 22 22 Existing apps will have global database instance such as: 23 {{{ 23 {{{#!c++ 24 24 database db; 25 25 }}} 26 26 27 27 Replace with: 28 {{{ 28 {{{#!c++ 29 29 CDB* appDB = nullptr; 30 30 }}} 31 31 32 32 Existing apps will have code to open the database such as: 33 {{{ 33 {{{#!c++ 34 34 db.open("/mnt/nand/apps/<appdir>/myapp.db3"); 35 35 if(!db.is_open) { … … 39 39 40 40 Replace with code similar to: 41 {{{ 41 {{{#!c++ 42 42 CAppDatabaseCfg appDBcfg; 43 43 string path = appDataPath + CFGFILE_DB; … … 62 62 63 63 Existing apps with have sql execute statements such as: 64 {{{ 64 {{{#!c++ 65 65 int ct; 66 66 string sql = "SELECT COUNT(*) FROM [Trucks];"; … … 69 69 70 70 Replace with: 71 {{{ 71 {{{#!c++ 72 72 int ct; 73 73 string sql = "SELECT COUNT(*) FROM Trucks;"; … … 77 77 78 78 Existing apps may have code such as: 79 {{{ 79 {{{#!c++ 80 80 string sql = "INSERT INTO [Trucks] ([ID],[TareWt]) VALUES ('" + truckID +"'," + IntToStr(tare) + ");"; 81 81 if (rc_is_okay(db.execute(sql)) == false) { … … 84 84 }}} 85 85 Replace with: 86 {{{ 86 {{{#!c++ 87 87 string sql = "INSERT INTO Trucks (ID,TareWt) VALUES ('" + truckID +"'," + IntToStr(tare) + ");"; 88 88 if (appDB->execute(sql) == false) { … … 92 92 93 93 Existing apps will have code such as: 94 {{{ 94 {{{#!c++ 95 95 string sql = "SELECT * FROM [railcars] WHERE [ID] = '" + strId + "';"; 96 96 statement st(db, sql); … … 103 103 104 104 Replace with: 105 {{{ 105 {{{#!c++ 106 106 string sql = "SELECT * FROM railcars WHERE ID = '" + strId + "';"; 107 107 CDBStatement stmt(appDB, sql); … … 112 112 }}} 113 113 114 When app finishs existing apps 115 {{{ 114 When app finishs existing apps: 115 {{{#!c++ 116 116 db.close; 117 117 }}} 118 118 Replace with: 119 {{{ 119 {{{#!c++ 120 120 appDB->Close(); 121 121 delete appDB;
![(please configure the [header_logo] section in trac.ini)](/chrome/site/cardinal.gif)