Support Forums > General Board

SQLite Client Server Source

(1/10) > >>

Richard Kelly:
We're moving into the nitty gritty. To keep the uploads centralized, I'll keep the attachment here updated with the latest. It includes all the class includes as well as copies of test scripts.

I ran into http://www.freebasic.net/forum/viewtopic.php?f=8&t=25251&p=227089&hilit=zstr+function#p227089 and now I revamped the includes so that you always work with them using STRING and each class grabs a ZSTRING pointer when one is needed.

All the includes are now named with the *.bi suffix. On my system they are in the standard FB include folder under subfolder cCTSQL and I'll be including the classes from there when needed. The SQLite class has the backup api's added although I have yet to test the progress callbacks.

Rick

Paul Squires:
I assume you need to #INCLUDE the *.bi into your test scripts. I just started trying the ConnectionPool and ran into various issues. I'll post here:

Need to add:

#Include Once "string.bi"
#include once "\cCTSQL\cCTConnectionPool.bi"

Declare Sub thread( ByVal userdata as Any Ptr )

Dim Shared oPool as cCTConnectionPool


Lots of Warning 38 that occur when mixing boolean and non-boolean compound expressions such as:
        If This.arConnection(iIndex).DatabaseID = iDatabaseID AndAlso _
           This.arConnection(iIndex).ConnectionID = iConnectionID AndAlso _
           This.arConnection(iIndex).SlotFree = False AndAlso _
           This.arConnection(iIndex).ConnectionInUse = False Then

You will need to use CBOOL() to fix those.

The line:
ThreadDetach(ThreadCreate(@thread,iPoolID))

Should be:
ThreadDetach(ThreadCreate(@thread,cast(any ptr, iPoolID)))


Maybe you should test using WinFBE rather than FireFly because WinFBE will catch many more errors and warnings.

Paul Squires:
Curious as to why you structure your TYPE classes with your DIM's exposes as PUBLIC (the default member access for TYPEs is Public).

Type cCTConnectionPool Extends Object

Dim lpCriticalSection as CRITICAL_SECTION
Dim arConnection(0 To 99) as POOL_CONNECTION

    Private:

    Public:

    Declare Function AddPoolConnection(ByVal iDatabaseID as Long, _
                                       ByVal iConnectionID as Long) as BOOLEAN
   etc...


I would move those two DIM's under the PRIVATE access because you want it to be private to the class and all of its instances.
...and you can omit the DIM and simply say:

lpCriticalSection as CRITICAL_SECTION
arConnection(0 To 99) as POOL_CONNECTION

Paul Squires:
Looks like you've put a lot of work into this project so far! looks good  :)

Paul Squires:
I see that you are using the sqlite3_get_table interface for your SQLExec functionality. I suggest that you re-evaluate that choice because sqlite3_get_table does not scale well in situations with very large result sets. I believe that the sqlite documentation even suggests that it is deprecated. I would use the Prepare/Step/Finalize sequence instead.

Navigation

[0] Message Index

[#] Next page

Go to full version