PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: James Reeder on March 15, 2016, 03:17:25 PM

Title: Having Trouble with SQL Tool and FF3 (PB version)
Post by: James Reeder on March 15, 2016, 03:17:25 PM
I have a multi-threaded application that I am adding a feature that requires SQL support.  I have read the SQL Tools documentation and have used it for many years, however, I am running into a runtime issue where I get an error setting up the SQL_Threads

I am using the #LINK version of SQL Tools version 3.14

My code is placed in FF_WinMain and basically looks like the following (minus the error checking conditionals)

SQL_Authorize %mycode
Sql_Initialize(1,32,32,3,3,0,0,0)
SQL_Thread(%THREAD_MAX,16)  <--- I get a runtime error: Untrapped Error #9 (Subscript/Pointer out of Range)

Is FF_WinMain executed in the primary thread (Thread 0) or is it in another thread of execution?  I assume it is the primary thread.
If it is not the primary thread, where would one setup the initialization of SQL Tools?

I am check here before contacting Perfect Sync for support.



Title: Re: Having Trouble with SQL Tool and FF3 (PB version)
Post by: Klaas Holland on March 15, 2016, 07:12:48 PM
This is my way of connecting to a DataBase.

'----------------------------------------------------------------------------------------------------
Function FF_WINMAIN( ByVal hInstance     As Dword, _
                     ByVal hPrevInstance As Dword, _
                     ByVal lpCmdLine     As Asciiz Ptr, _
                     ByVal iCmdShow      As Long ) As Long

   ' If this function returns TRUE (non-zero) then the actual WinMain will exit
   ' thus ending the program. You can do program initialization in this function.

    Function = %FALSE    'return %TRUE if you want the program to end.

    SQL_Authorize %MY_SQLT_AUTHCODE
    SQL_Init
'    SQL_ErrorClearAll
    SQL_OpenDB "DSN=SQLxxxxxxx"

End Function

Klaas
Title: Re: Having Trouble with SQL Tool and FF3 (PB version)
Post by: Paul Squires on March 15, 2016, 10:33:58 PM
FF_WinMain would be in the primary thread.
Title: Re: Having Trouble with SQL Tool and FF3 (PB version)
Post by: James Reeder on March 16, 2016, 04:28:09 PM
Thank you all.  I figured that FF_WinMain is within the primary thread, but I wanted to verify. 

I may have found a bug in SQL Tools SQL_Thread function. I will need to contact Perfect Sync to verify.

When the SLL version is linked in, the function fails with an Run Time error 9.  Using the DLL version, I receive ERROR_BAD_PARAM_VALUE.