SQLitening Support Forum

SQLitening Support => You've got Questions? We've got Answers! => Topic started by: Fim on October 16, 2019, 01:02:33 pm

Title: SELECT strftime
Post by: Fim on October 16, 2019, 01:02:33 pm
SELECT strftime('%H:%M:%f','now','localtime')
Is it the timestamp from the server or the client.
I can't find it in the manual, or I'm bad at finding it.

And, if it is from the client, how to get it from the server?
/Fim W
Title: Re: SELECT strftime
Post by: cj on October 16, 2019, 08:16:06 pm
If slConnect is used and successful (returns 0) all data returned is from the machine running SQLiteningServer.exe.
If slConnect fails the program would normally exit function.

This demonstrates returning to local mode after slConnect failed (remote routines are still loaded.)
Not doing this will reward the user with transmission errors.

#INCLUDE "sqlitening.inc"
FUNCTION PBMAIN () AS LONG
 LOCAL sIpAddress,sarray() AS STRING,PortNumber AS LONG
 slconnect sIpAddress,PortNumber,"E0"
 IF slGetErrorNumber THEN 'connect error
  ? "Switching to local mode  ",%MB_SYSTEMMODAL,slGetError
  slSetProcessMods "L0"
 ELSE
  ? "Running in remote mode"
 END IF
 slopen "sample.db3"
 slselary "select rowid,manuf from parts limit 3",sarray(),"Q9"
 sldisconnect
 ? JOIN$(sarray(),$CR),%MB_SYSTEMMODAL,"bye"
END FUNCTION
Title: Re: SELECT strftime
Post by: Fim on October 17, 2019, 04:30:56 am
Ok, thanks for the answer.
/Fim W.
Title: Re: SELECT strftime
Post by: Bern Ertl on November 06, 2019, 12:06:48 pm
Quote from: Fim on October 16, 2019, 01:02:33 pm... how to get it from the server?

I posted some code years ago for creating and using a server side time stamp.  It uses Windows FILETIME data, but it's easily converted to whatever format you need:

https://sqlitening.planetsquires.com/index.php?topic=3539.0