• Welcome, Guest. Please login.
 
November 21, 2019, 03:20:48 pm

News:

Welcome to the SQLitening support forums!


SELECT strftime

Started by Fim, October 16, 2019, 01:02:33 pm

Previous topic - Next topic

Fim

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
Fim W

cj

October 16, 2019, 08:16:06 pm #1 Last Edit: October 16, 2019, 09:17:12 pm by cj
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

Fim

Ok, thanks for the answer.
/Fim W.
Fim W

Bern Ertl

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