SQLite3 BaseFunction-Include for Win + Lin + Unicode
Small Bugfix in both versions, thx to kiffi for bugreport
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

I really apreciate all the effort that has gone into putting this together.
I do have a question regarding converting to use this.
I have a rather involved program using sqlite3 somewhat extensively, based on Kiffi's fine wrapper. In looking to convert it to this code, I find it to be a little more involved than just replacing the function names. Parameters have been switched in the procedures, callback's added, etc.). Net is it will involve some work, and based on my history, then some re-work
.
My question is, what are the benefits to the prototype approach over the previous approach. When I start looking at the database access itself, I don't really see any appreciable differences, but I may well be missing something.
In the opinion of the 'experts' are their benefits sufficient to make it worth my while converting, and if so, how might I understand what they are?
Sorry for the 'newbie'ish question, but I still have a lot to learn about both sqlite and PureBasic.
Thanks for your time.
cheers
I do have a question regarding converting to use this.
I have a rather involved program using sqlite3 somewhat extensively, based on Kiffi's fine wrapper. In looking to convert it to this code, I find it to be a little more involved than just replacing the function names. Parameters have been switched in the procedures, callback's added, etc.). Net is it will involve some work, and based on my history, then some re-work

My question is, what are the benefits to the prototype approach over the previous approach. When I start looking at the database access itself, I don't really see any appreciable differences, but I may well be missing something.
In the opinion of the 'experts' are their benefits sufficient to make it worth my while converting, and if so, how might I understand what they are?
Sorry for the 'newbie'ish question, but I still have a lot to learn about both sqlite and PureBasic.
Thanks for your time.
cheers
This Version is a bit easier then PBOSL_SQLite3, i hope, only real usefull
functions implemented.
This Version have full Unicode-Support (UTF-8 in Ansi- or Unicode-Mode)
Full Support for Linux, MacOS and Windows.
Kiffi himself uses my version
functions implemented.
This Version have full Unicode-Support (UTF-8 in Ansi- or Unicode-Mode)
Full Support for Linux, MacOS and Windows.
Kiffi himself uses my version

PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Thanks for your quick response. You must never sleep, or you're a 'team' of people
- And I'm in no way attempting to criticise or belittle your fine work.
I have no reservations about using this code and will do so in future sqlite based projects. My qustion is really regarding any benefit to be achieved in converting an existing program which uses Kiffi's wrapper to utilize this instead. Would there be any 'benefits' I would see in that program, besides access to unicode and a few more functions? Is this code in any way more 'robust' than kiffi's. That is - is "If SQ3\exec" in some way 'better' than "hResult = CallCFunctionFast(sqlite3_exec, lDataBaseHandle, sSQLQuery, #Null, #Null, @ReturnValue)"? And if it is, could someone explain how?
Just wanting to understand if it's worth the effort of converting an existing large program, or if should just wait for the next project
cheers

I have no reservations about using this code and will do so in future sqlite based projects. My qustion is really regarding any benefit to be achieved in converting an existing program which uses Kiffi's wrapper to utilize this instead. Would there be any 'benefits' I would see in that program, besides access to unicode and a few more functions? Is this code in any way more 'robust' than kiffi's. That is - is "If SQ3\exec" in some way 'better' than "hResult = CallCFunctionFast(sqlite3_exec, lDataBaseHandle, sSQLQuery, #Null, #Null, @ReturnValue)"? And if it is, could someone explain how?
Just wanting to understand if it's worth the effort of converting an existing large program, or if should just wait for the next project

cheers
rsts wrote:That is - is "If SQ3\exec" in some way 'better' than "hResult = CallCFunctionFast(sqlite3_exec, lDataBaseHandle, sSQLQuery, #Null, #Null, @ReturnValue)"? And if it is, could someone explain how?
Code: Select all
Procedure.l SQLiteExecute(hDB.l, Statement.s, callback.l = 0)
If SQ3\exec ; check only if functionpointer
If Not SQ3\exec(hDB, Statement, callback); give only on #SQLite_OK a #true, errormessage is stored in errmsg, is not required to check here
ProcedureReturn #True
EndIf
EndIf
ProcedureReturn #False
EndProcedure
Code: Select all
CallCFunctionFast

PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Thanks again for your response.
Might there be any explanation of the return values of true or false for sqlitestep? In looking at the code I can't determine how it's determining an appropriate return. Is it checking for #SQLITE3_OK and returning true/false based on that? If so, how might I determine when either #SQLITE3_ROW or #SQLITE3_DONE are returned versus some other return code?
cheers
Might there be any explanation of the return values of true or false for sqlitestep? In looking at the code I can't determine how it's determining an appropriate return. Is it checking for #SQLITE3_OK and returning true/false based on that? If so, how might I determine when either #SQLITE3_ROW or #SQLITE3_DONE are returned versus some other return code?
cheers
All results like PB, <> 0 is good!
If a value 0, so you have to check this with for example: SQLiteErrorMsg(hDB.l)
SQLiteErrorCode(hDB) give you the normal errorcode, in errorcode is 0 the best
If a value 0, so you have to check this with for example: SQLiteErrorMsg(hDB.l)
SQLiteErrorCode(hDB) give you the normal errorcode, in errorcode is 0 the best

PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

or here: http://www.purebasic.fr/english/viewtop ... 667#194667
also fixed
also fixed
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Update, both Version!
SQLiteExecute(), added optional para for callback
SQLiteOpen(), added flag for ASCII(Ansi) Mode
This works only in ASCII-Mode and is only to convert your old db's
In Unicode-Mode this flag is ignored!
The ASCII-Flag have global affect, please use it only in this form:
SQLiteExecute(), added optional para for callback
SQLiteOpen(), added flag for ASCII(Ansi) Mode
This works only in ASCII-Mode and is only to convert your old db's
In Unicode-Mode this flag is ignored!
The ASCII-Flag have global affect, please use it only in this form:
Code: Select all
If SQLiteInit()
hDB = SQLiteOpen("MyDB", #True)
; reading
SQLiteClose(hDB.l)
hDB = SQLiteOpen("MyDB", #False)
;writing
SQLiteClose(hDB.l)
EndIf
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

- Fangbeast
- PureBasic Protozoa
- Posts: 4789
- Joined: Fri Apr 25, 2003 3:08 pm
- Location: Not Sydney!!! (Bad water, no goats)
More examples
Thomas, I can't see how to use blobs in a complex table from the example, feeling pretty dumb at the moment.
Could you combine your example that stores 5 records with your example that stores blobs so there are blobs in every record and show how to select a specific record including the blob for that record?
Sorry to bother you.
Could you combine your example that stores 5 records with your example that stores blobs so there are blobs in every record and show how to select a specific record including the blob for that record?
Sorry to bother you.
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet