• Welcome, Guest. Please login.
 
April 20, 2019, 05:57:44 am

News:

Welcome to the SQLitening support forums!


Recent posts

Pages 1 2 3 4 5 ... 10
21
You've got Questions? We've got Answers! / Re: Auto Switching and Uploadi...
Last post by cj - December 06, 2018, 03:36:08 pm
I don't think slpushdatabase and slpopdatabase will help much
The big thing is keep the databases in sync and how to prevent duplicate keys from being rejected.
I'm thinking like an ATM machine can't give out money if central server is down.
One thing about cloud computing is the data is duplicated and maintained by different locations.
Some may not know that they have to pay for that duplicated data if sent to different servers.
Is cloud safer and more secure?  Yes, in my opinion.  Sorry for getting off subject.

#DIM ALL
#INCLUDE "sqlitening.inc"
GLOBAL gConnect AS LONG
'-------------------------------------------------------
FUNCTION PBMAIN () AS LONG
LOCAL x,ecode,portnumber AS LONG
LOCAL sHost AS STRING
slSetProcessMods "E0"

sHost = "192.168.0.12"
PortNumber = 80

FOR x = 1 TO 1 'try multiple times to connect
  ecode = slConnect(shost,portnumber)
  IF ecode = 0 THEN gConnect = 1:EXIT FOR ELSE BEEP
NEXT
IF gConnect = 0 THEN
  IF MSGBOX("Could not connect, work local?",%MB_YESNO OR %MB_SYSTEMMODAL,"Connect error") = %IDNO THEN
   ? "Ending the program",%MB_SYSTEMMODAL,"Thank you"
   EXIT FUNCTION
  END IF
END IF

IF gConnect THEN
  slDisconnect
  ? "disconnect and end"
ELSE
  ? "end"
END IF
END FUNCTION
22
You've got Questions? We've got Answers! / Re: Auto Switching and Uploadi...
Last post by cj - December 06, 2018, 03:01:11 pm
If you slPushDatabase the current database is no longer available until you slPopDatabase
Be careful if connection fails, etc.

This might work just as well without rotating database handle
1 IF can't get to host then no need to push and pop database handles
2 If can get to host then disconnect, read local log, reconnect, send local log
Sounds like good planning like no cloud no work.

Did this way to try to avoid lots of IF statements.

After looking at it awhile workinglocal  and workingremote would need to duplicate code.
The program would probably need to use IF gconnect to share the routines.

#DIM ALL
#INCLUDE "sqlitening.inc"
GLOBAL gConnect AS LONG
'-------------------------------------------------------
FUNCTION PBMAIN () AS LONG
LOCAL x,ecode,portnumber AS LONG
LOCAL sHost AS STRING
slSetProcessMods "E0"

sHost = "192.168.0.13"
PortNumber = 80

FOR x = 1 TO 1 'try multiple times to connect
  ecode = slConnect(shost,portnumber)
  IF ecode = 0 THEN gConnect = 1:EXIT FOR ELSE BEEP
NEXT
IF gConnect THEN
  WorkingRemote
ELSE
  IF MSGBOX("Could not connect, work local?",%MB_YESNO OR %MB_SYSTEMMODAL,"Connect error") = %IDYES THEN
   WorkingLocal
  ELSE
   ? "Ending the program",%MB_SYSTEMMODAL,"Thank you"
  END IF
END IF

END FUNCTION
'-------------------------------------------------------
SUB WorkingLocal
? "Local routines create log"
END SUB
'-------------------------------------------------------
SUB WorkingRemote
slDisconnect
? "Connected/Disconnected"
END SUB
23
Not sure if the applies here.

https://www.sqlitening.planetsquires.com/index.php?topic=3204.msg16315#msg16315

Quote
Yes, you can switch back and forth between local and remote mode by using
slPushDatabasae, slSetProcessMods, and slPopDatabase.  Look at ExampleA.Bas
and study the L modchar in slSetProcessMods.

The below does a connect, switches to local mode, gets the data from a local
file and then switches back to remote mode.
Code: [Select]
   slConnect
   slPushDatabase
   slSetProcessMods "L0"
   slGetFile "Your file name here", YourStringVariable
   slPopDatabase
   slSetProcessMods "L1"


Would give it a shot.
24
You've got Questions? We've got Answers! / Re: Can not start the server
Last post by Fim - December 05, 2018, 08:26:26 am
cj,
Many thanks.
Now it works as it should with 32 bit version.
The error was that I had downloaded the 64 bit version.

/Fim W
26
You've got Questions? We've got Answers! / Re: Can not start the server
Last post by Fim - December 05, 2018, 05:21:40 am
Cj,
With version 3.14, everything works as it should.
But with version 3.26 I get the error.
So I have had to switch back to version3.14, and then it works. Strange.

I was wrong, the version that works as i should is 3.7.13
/Fim W
27
Hello,

Wondering if these two scenarios could work. Program running over the internet with the client machines having their own database as well.

1. Automatically switch between Local and Remote access depending on the availability of internet connection. If internetconnection do remote else do local.

2. Automatically upload records entered in local database to the remote server when the internet connection is available.

Are these scenarios feasible?
28
You've got Questions? We've got Answers! / Re: Can not start the server
Last post by cj - December 04, 2018, 03:18:42 pm
1) See if your shortcut has "Run as administrator checked
2) If not that, then "Allow an app  through Windows Firewall"
3) If neither of these then "IPCONFIG" at command prompt and see if IP address is different in sqliteningserver.cfg
29
You've got Questions? We've got Answers! / Can not start the server
Last post by Fim - December 04, 2018, 02:05:54 pm
All I've done is to change sqlite3.dll from versions 3.14 to 3.26. Then I get wrong. There is nothing in the log file.
30
You've got Questions? We've got Answers! / Re: Using rowid zero
Last post by cj - November 20, 2018, 02:38:46 pm
'Upsert without rowid might be optimal

'A big advantage of binding is text doesn't have to be encoded with single quotes (strings and even files can be insert or updated into column "as is".)
'A good example of this is trying to save a SQL statement that has single quotes, commas and (punctuation) that would be very hard to insert.
'The Upsert is definitely optional, but highly suggest using binding.

$Insert ="Insert into t1 values(?,?) ON conflict(c1) DO update SET c2=?"
#INCLUDE "sqlitening.inc" 'upsert.bas

FUNCTION PBMAIN () AS LONG
slOpen "upsert.db3","C"
slexe  "create table if not exists t1(c1 text primary key,c2 text) without rowid"
Upsert "key1","Jane Doe"
Upsert "key1","Heidi Klum"
END FUNCTION

FUNCTION Upsert(sKey AS STRING, sData AS STRING) AS LONG
LOCAL sBind AS STRING
sBind  = slBuildBindDat(sKey, "T") +_   'bind key as text
          slBuildBindDat(sData,"T") +_   'insert
          slBuildBindDat(sData,"T")      'on conflict (update)
slexebind $Insert,sBind
END FUNCTION
Pages 1 2 3 4 5 ... 10