• Welcome, Guest. Please login.
 
May 07, 2021, 10:38:10 PM

News:

Welcome to the SQLitening support forums!


Active Connections

Started by Marty Francom, June 29, 2010, 12:12:43 AM

Previous topic - Next topic

Marty Francom

Is there a command which will cause SQLitening to report the number of active connections?    If so, what is the syntax?

What I want to know is how many programs are currently attached/running sqlitening for a given database.

Rolf Brandt

slGetStatus(2) would return all connections.

Extracted from the HelpFile:
2 = Return all connections.  Will always return an empty string if running in local mode.  Each connection will be delimited by vertical tabs ($VT). Connection data will be delimited by  backspaces ($BS) as follows:
1 = Tcp file number
2 = User
3 = Computer
4 = IPAddress
5 = Connect Date-Time
I like to cook with wine - sometimes I even add it to the food.
www.rbsoft.eu

Marty Francom

June 29, 2010, 04:15:40 AM #2 Last Edit: June 29, 2010, 04:33:18 AM by Marty Francom
Rolf,
   Thank you for pointing me in the right direction.  This looks like just what I need.

   Are  $BS  and  $VT  native constants in PowerBasic?   
   I assume  $BS  =  chr$( 8 )       and      $VT  =  chr$(11)     is that correct?


So if i want to find out the number of connections to the database  I would  do:

                                   nc = parsecount ( slGetStatus (2) ,  chr$(11) )         

               

Rolf Brandt

slGetStatus will of course not tell you which database any connection uses, but if you use the SQLitening server just for one dedicated business (as I assume in your case), then this should not be too much of drawback.

If you need just the number of connections you use ParseCT on the string that slGetStatus delivers.
I like to cook with wine - sometimes I even add it to the food.
www.rbsoft.eu

Marty Francom

Yes, then this should work:

    nc = parsecount ( slGetStatus (2) ,  chr$(11) )         


Rolf Brandt

I like to cook with wine - sometimes I even add it to the food.
www.rbsoft.eu

Fred Meier

June 29, 2010, 03:52:03 PM #6 Last Edit: June 29, 2010, 03:55:09 PM by Fred Meier
PB has built in equates for chr$( 8 ) and chr$(11), they are $BS and $VT.   

IMO "nc = parsecount(slGetStatus(2),  $VT)" is better doc and will perform faster.

Marty Francom

Thanks Fred.

I am getting a copiler error:   message says:

     Error 516:  DEFTYPE, TYPE ID ((?%&!#$), OR AS... REQUIRED    SLGETSTATUS


This is the statement that the error points to:

      st  =  slGetStatus (2)                                       


Do I have a syntax problem?

Fred Meier

The only way I can get that error is to NOT have #Dim All and to NOT #Include "SQLitening.Inc"
Make sure you have both #Dim All and #Include "SQLitening.Inc"

Marty Francom

Fred,
    I have both of those suggestions inplimented.   Stil get the compiler error.    Could I possibly have an out of date version of the SQLitening.Inc file?  It's dated 11/08/2009    I did a search of the SQLitening.Inc file and did not find any Declare statement for  slGetStatus.
    Here's the contents of the  SQLitening.Inc  file:


'  ====================================================================
'  |                                                                  |
'  | SQLitening Include                                               |
'  |                                                                  |
'  ====================================================================
'   This include file is intended to be used by PowerBASIC programs
'   that use the SQLitening.Dll (also any other language that fully
'   supports OLE string parameter passing). See SQLitening.Txt or
'   SQLitening.Chm for information on each command.
'
'  ====================================================================
'  PUBLIC DOMAIN SOFTWARE
'  The author or authors of this code dedicate any and all
'  copyright interest in this code to the public domain.
'  Anyone is free to copy, modify, publish, use, compile,
'  sell, or distribute the original code, either in source
'  code form or as a compiled binary, for any purpose,
'  commercial or non-commercial, and by any means.
'  Fred Meier - June 2009
'
'  ====================================================================

'============================<[ Equates ]>=============================
%SQLite_OK        = 0         'Successful result
%SQLite_Busy      = 5         'Database is locked
%SQLite_Dups      = 19        'Constraint violation.  Normally caused by
                              'trying to add a non unique key to an index
                              'during an Insert or Update.

'============================<[ Declares ]>============================
DECLARE FUNCTION slAttach LIB "SQLitening.Dll" ALIAS "slAttach" (BYREF rsFileName AS STRING, BYREF rsAsDatabaseName AS STRING, OPTIONAL BYVAL rsModChars AS STRING) AS LONG
DECLARE FUNCTION slBuildBindDat LIB "SQLitening.Dll" ALIAS "slBuildBindDat" (BYREF rsData AS STRING, OPTIONAL BYVAL rsModChars AS STRING) AS STRING
DECLARE FUNCTION slBuildInsertOrUpdate LIB "SQLitening.Dll" ALIAS "slBuildInsertOrUpdate" (BYREF rsTable AS STRING, BYREF rsValues AS STRING, OPTIONAL BYVAL rsColumns AS STRING, OPTIONAL BYVAL rsWhere AS STRING) AS STRING
DECLARE SUB      slClose LIB "SQLitening.Dll" ALIAS "slClose"
DECLARE SUB      slCloseSet LIB "SQLitening.Dll" ALIAS "slCloseSet" (OPTIONAL BYVAL rlSetNumber AS LONG)
DECLARE FUNCTION slConnect LIB "SQLitening.Dll" ALIAS "slConnect" (OPTIONAL BYVAL rsServer AS STRING, OPTIONAL BYVAL rlPort AS LONG, OPTIONAL BYVAL rsModChars AS STRING, OPTIONAL wsOutData AS STRING)AS LONG
DECLARE FUNCTION slConvertDat LIB "SQLitening.Dll" ALIAS "slConvertDat" (rsData AS STRING, OPTIONAL BYVAL rsModChars AS STRING) AS STRING
DECLARE SUB      slDisconnect LIB "SQLitening.Dll" ALIAS "slDisconnect"
DECLARE FUNCTION slExe LIB "SQLitening.Dll" ALIAS "slExe" (BYREF rsStatement AS STRING, OPTIONAL BYVAL rsModChars AS STRING) AS LONG
DECLARE FUNCTION slExeBind LIB "SQLitening.Dll" ALIAS "slExeBind" (BYREF rsStatement AS STRING, BYREF rsData AS STRING, OPTIONAL BYVAL rsModChars AS STRING) AS LONG
DECLARE FUNCTION slF LIB "SQLitening.Dll" ALIAS "slF" (BYVAL rlColumnNumber AS LONG, OPTIONAL BYVAL rlSetNumber AS LONG) AS STRING
DECLARE FUNCTION slFN LIB "SQLitening.Dll" ALIAS "slFN" (BYREF rsColumnName AS STRING, OPTIONAL BYVAL rlSetNumber AS LONG) AS STRING
DECLARE FUNCTION slFNX LIB "SQLitening.Dll" ALIAS "slFNX" (BYREF rsColumnName AS STRING, OPTIONAL BYVAL rsModChars AS STRING, OPTIONAL BYVAL rlSetNumber AS LONG) AS STRING
DECLARE FUNCTION slFX LIB "SQLitening.Dll" ALIAS "slFX" (BYVAL rlColumnNumber AS LONG, OPTIONAL BYVAL rsModChars AS STRING, OPTIONAL BYVAL rlSetNumber AS LONG) AS STRING
DECLARE FUNCTION slGetChangeCount LIB "SQLitening.Dll" ALIAS "slGetChangeCount" (OPTIONAL BYVAL rsModChars AS STRING) AS LONG
DECLARE FUNCTION slGetColumnCount LIB "SQLitening.Dll" ALIAS "slGetColumnCount" (OPTIONAL BYVAL rlSetNumber AS LONG) AS LONG
DECLARE FUNCTION slGetColumnName LIB "SQLitening.Dll" ALIAS "slGetColumnName" (OPTIONAL BYVAL rlColumnNumber AS LONG, OPTIONAL BYVAL rlSetNumber AS LONG) AS STRING
DECLARE FUNCTION slGetColumnNumber LIB "SQLitening.Dll" ALIAS "slGetColumnNumber" (BYREF rsColumnName AS STRING, OPTIONAL BYVAL rlSetNumber AS LONG) AS LONG
DECLARE FUNCTION slGetError LIB "SQLitening.Dll" ALIAS "slGetError" () AS STRING
DECLARE FUNCTION slGetErrorNumber LIB "SQLitening.Dll" ALIAS "slGetErrorNumber" () AS LONG
DECLARE FUNCTION slGetFile LIB "SQLitening.Dll" ALIAS "slGetFile" (BYREF rsFileName AS STRING, BYREF wsFileData AS STRING, OPTIONAL BYVAL rsModChars AS STRING) AS LONG
DECLARE FUNCTION slGetHandle LIB "SQLitening.Dll" ALIAS "slGetHandle" (OPTIONAL BYVAL rsModChars AS STRING, OPTIONAL BYVAL rlSetNumber AS LONG) AS DWORD
DECLARE FUNCTION slGetInsertID LIB "SQLitening.Dll" ALIAS "slGetInsertID" () AS QUAD
DECLARE FUNCTION slGetRow LIB "SQLitening.Dll" ALIAS "slGetRow" (OPTIONAL BYVAL rlSetNumber AS LONG, OPTIONAL BYVAL rsModChars AS STRING) AS LONG
DECLARE FUNCTION slGetTableColumnNames LIB "SQLitening.Dll" ALIAS "slGetTableColumnNames" (BYREF rsTable AS STRING) AS STRING
DECLARE FUNCTION slGetTableNames LIB "SQLitening.Dll" ALIAS "slGetTableNames" (OPTIONAL BYVAL rsDataBase AS STRING) AS STRING
DECLARE FUNCTION slGetUnusedSetNumber LIB "SQLitening.Dll" ALIAS "slGetUnusedSetNumber" AS LONG
DECLARE FUNCTION slIsColumnNameValid LIB "SQLitening.Dll" ALIAS "slIsColumnNameValid" (BYREF rsColumnName AS STRING, OPTIONAL BYVAL rlSetNumber AS LONG) AS LONG
DECLARE FUNCTION slIsColumnNumberValid LIB "SQLitening.Dll" ALIAS "slIsColumnNumberValid" (BYVAL rlColumnNumber AS LONG, OPTIONAL BYVAL rlSetNumber AS LONG) AS LONG
DECLARE FUNCTION slIsOpen LIB "SQLitening.Dll" ALIAS "slIsOpen" () AS LONG
DECLARE FUNCTION slIsFieldNull LIB "SQLitening.Dll" ALIAS "slIsFieldNull" (BYVAL rlColumnNumber AS LONG, OPTIONAL BYVAL rlSetNumber AS LONG) AS LONG
DECLARE FUNCTION slIsSetNumberValid LIB "SQLitening.Dll" ALIAS "slIsSetNumberValid"(OPTIONAL BYVAL rlSetNumber AS LONG) AS LONG
DECLARE FUNCTION slOpen LIB "SQLitening.Dll" ALIAS "slOpen" (OPTIONAL BYVAL rsFileName AS STRING, OPTIONAL BYVAL rsModChars AS STRING) AS LONG
DECLARE SUB      slPopDatabase LIB "SQLitening.Dll" ALIAS "slPopDatabase" (OPTIONAL rsSave AS STRING)
DECLARE SUB      slPopSet LIB "SQLitening.Dll" ALIAS "slPopSet" (OPTIONAL BYVAL rlSetNumber AS LONG, OPTIONAL rsSave AS STRING)
DECLARE SUB      slPushDatabase LIB "SQLitening.Dll" ALIAS "slPushDatabase" (OPTIONAL wsSave AS STRING)
DECLARE SUB      slPushSet LIB "SQLitening.Dll" ALIAS "slPushSet" (OPTIONAL BYVAL rlSetNumber AS LONG, OPTIONAL wsSave AS STRING)
DECLARE FUNCTION slPutFile LIB "SQLitening.Dll" ALIAS "slPutFile" (BYREF rsFileName AS STRING, BYREF rsFileData AS STRING, OPTIONAL BYVAL rsModChars AS STRING) AS LONG
DECLARE FUNCTION slRunProc LIB "SQLitening.Dll" ALIAS "slRunProc" (rsProcName AS STRING, blParm1 AS LONG, blParm2 AS LONG, bsParm3 AS STRING, bsParm4 AS STRING, OPTIONAL BYVAL rsModChars AS STRING) AS LONG
DECLARE FUNCTION slSel LIB "SQLitening.Dll" ALIAS "slSel" (BYREF rsStatement AS STRING, OPTIONAL BYVAL rlSetNumber AS LONG, OPTIONAL BYVAL rsModChars AS STRING) AS LONG
DECLARE FUNCTION slSelAry LIB "SQLitening.Dll" ALIAS "slSelAry" (BYREF rsStatement AS STRING, BYREF wsaColsAndRows() AS STRING, OPTIONAL BYVAL rsModChars AS STRING) AS LONG
DECLARE SUB      slSetProcessMods LIB "SQLitening.Dll" ALIAS "slSetProcessMods" (BYREF rsModChars AS STRING)

Marty Francom

I just redownloaded the SQLitening 1.30 zip and the include file their does have it.   So, I must have been using an old version of the file.   I will give the new version of the include a try.  I'm sure that will fix the problem.