• Welcome to SQLitening Support Forum. Please login.
 
May 24, 2022, 01:21:12 AM

News:

Welcome to the SQLitening support forums!


Howdy!

Started by Jakesta42, August 02, 2013, 04:46:26 AM

Previous topic - Next topic

Jakesta42

Hey guys,

I'm new to SQLitening, but I'm really interested in making a database server running with a SQLite3 back, and this seems to be the only/one of the only ways to implement a client-server database application model, so...yeah

Thanks!

Jake

Paul Squires

Welcome Jake - great to have you you here  :-)

cj

August 02, 2013, 11:41:08 AM #2 Last Edit: August 02, 2013, 12:44:44 PM by cj
Here is a simple "Hello,world" client.
This is only one way.  Encryption and compression are also very easy.

Client/Server programs call slConnect and optionally slDisconnect.

The SQLitening server is configured in the text file SQLiteningServer.Cfg
which resides in the same folder running the service.

Client programs can run over the internet.
If you make a change to SQLiteningServer.Cfg the server must be restarted.
On the hosts line use IP address not a name.  I could not get that to work.
Databases must be in or under the path of where the server service is running.
To handle return error values see slSetProcessMods.

Here is part of SQLiteningServer.cfg for this demo running at IP 192.168.1.2 on port 51234.
[General]
ServiceNameSuffix=
Port = 51234
Hosts = 192.168.1.2
LogConnDcon=Yes
LogInvalidInMessage=Yes
CreateDatabaseAllowed=Yes
TrimLogManually=No
MaxChunkSize=
MaxConnections=10
ConnectionTimeOut=-1


#INCLUDE "\sql\inc\sqlitening.inc"                 
FUNCTION PBMAIN () AS LONG                           'start of program
  slConnect "192.168.1.2",0                          'connect, default port
  slOpen "MyDatabase.db3","C"                        'Open database
  slExe "Create Table If Not Exists Table1(Column1)" 'create table
  slExe  "Insert into Table1 values('Hello, world!')"'insert record
  MSGBOX SQL("Select * from Table1")                 'display recordset
  slDisconnect                                       'disconnect
END FUNCTION


FUNCTION SQL(SqlStatement AS STRING) AS STRING    'one method
LOCAL RowNumber,ColumnNumber,LastColumn AS LONG
LOCAL sData AS STRING 'define strings
slSel SqlStatement 
LastColumn = slGetColumnCount
DO WHILE slGetRow 'process each row
  FOR ColumnNumber = 1 TO LastColumn 'process each column
    sData = sData + slf(ColumnNumber)+ "," 'build a string
  NEXT
  ASC(sData,LEN(sData)) = 13  'replace last quote with $CR
LOOP
FUNCTION = sData
END FUNCTION