SQLitening Support Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Welcome to the SQLitening support forums!

Pages: 1 [2] 3 4 ... 10
 11 
 on: December 06, 2018, 01:31:11 PM 
Started by Fredrick Ughimi - Last post by cj
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

 12 
 on: December 06, 2018, 02:43:42 AM 
Started by Fredrick Ughimi - Last post by Fredrick Ughimi
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.

 13 
 on: December 05, 2018, 06:56:26 AM 
Started by Fim - Last post by Fim
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

 14 
 on: December 05, 2018, 06:27:52 AM 
Started by Fim - Last post by cj

https://sqlite.org/2018/sqlite-dll-win32-x86-3260000.zip

477,151 bytes sqlite-dll-win32-x86-3260000.zip
911,698 bytes sqlite3.dll

 15 
 on: December 05, 2018, 03:51:40 AM 
Started by Fim - Last post by Fim
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

 16 
 on: December 05, 2018, 01:48:34 AM 
Started by Fredrick Ughimi - Last post by Fredrick Ughimi
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?

 17 
 on: December 04, 2018, 01:48:42 PM 
Started by Fim - Last post by cj
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

 18 
 on: December 04, 2018, 12:35:54 PM 
Started by Fim - Last post by Fim
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.

 19 
 on: November 20, 2018, 01:08:46 PM 
Started by Fim - Last post by cj
'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

 20 
 on: November 20, 2018, 08:51:52 AM 
Started by Fim - Last post by cj
Thanks, Paul for bringing up using table 61.
Unique keys can be created as needed for titles, totals, anything ...

#INCLUDE "sqlitening.inc"     'onthefly.bas
THREADED ts AS STRING         'combine results
'NOTE: if sql uses LIKE or SUBSTR a full table SCAN is always performed  instead of indexed SEARCH.
'If someone knows how to use search instead of scan using LIKE, please let us know!

FUNCTION PBMAIN () AS LONG

 LOCAL sql,s AS STRING

 slOpen "junk.db3","C"
 slexe "drop table if exists t61"
 slexe "create table t61(t61key text primary key,t61answer) without rowid"

 slexe "insert or replace into t61 values('t01-client','1')"
 slexe "insert or replace into t61 values('t01-total' ,'2')"
 slexe "insert or replace into t61 values('t01-client','1000')" 'replace client
 slexe "insert or replace into t61 values('t01-total' ,'2000')" 'replace total

 GetData "select t61answer from t61 where t61key = 't01-client'"
 GetData "select t61answer from t61 where substr(t61key,1,3) ='t01'" 'SCANS entire table
 ? ts
END FUNCTION

SUB Getdata(sql AS STRING)
 LOCAL sArray() AS STRING
 slSelAry sql,sArray(),"Q9c"
 IF UBOUND(sArray)> 0 THEN ts+= sql + $CR + JOIN$(sArray(),",") + $CR + $CR
END SUB

Pages: 1 [2] 3 4 ... 10