Oscar
Googled your error .. here are some ideas as what to look for ....
https://www.percona.com/blog/2019/07/05 ... 045-error/
Rick Lipkin
cSet := Set( _SET_DATEFORMAT, 'yyyy-mm-dd' )
cSql := "SELECT * FROM test_timestamp WHERE col_timestamp >= '" + dtoc( LDATE ) + "' AND col_timestamp < '" + dtoc( HDATE ) + "'"
Set( _SET_DATEFORMAT, cSet )
ORibeiro wrote:Raw,
I tried to run your example but returned the error: 1045 Acess denied for user 'sql7148817@'189-46-180-40.dsl.telesp.net.br (using password: YES).
Thanks
oCn := FW_DemoDB( 6 )
FWCONNECT oCn HOST "208.91.198.197:3306" USER "gnraofwh" PASSWORD "Bharat@1950" DATABASE "fwhdemo" PORT "3306"
#include "fivewin.ch"
function Main()
local oCn, oRs
local t
SET DATE ITALIAN
SET CENTURY ON
FWCONNECT oCn HOST "208.91.198.197:3306" USER "gnraofwh" PASSWORD "Bharat@1950" DATABASE "fwhdemo" PORT "3306" // oCn := FW_DemoDB( 6 )
if oCn == nil
? "connect fail"
return nil
endif
oCn:lShowErrors := .t.
oRs := oCn:RowSet( "SELECT * FROM test_timestamp WHERE col_created >= '2022-01-01' AND col_created < '2022-01-13'" )
XBROWSER oRs TITLE "01 JAN TO 12 JAN"
oRs:Close()
oRs := oCn:RowSet( "SELECT COUNT(*) FROM test_timestamp WHERE col_created >= '2022-01-01' AND col_created < '2022-01-13'" )
XBROWSER oRs TITLE "01 JAN TO 12 JAN"
oRs:Close()
oCn:Close()
return nil
#include "fivewin.ch"
function Main()
local oCn, oRs
local t
SET DATE ITALIAN
SET CENTURY ON
FWCONNECT oCn HOST "208.91.198.197:3306" USER "gnraofwh" PASSWORD "Bharat@1950" DATABASE "fwhdemo" PORT "3306" // oCn := FW_DemoDB( 6 )
if oCn == nil
? "connect fail"
return nil
endif
oCn:lShowErrors := .t.
oRs := oCn:RowSet( "SELECT COUNT(*) FROM test_timestamp WHERE col_created >= '2022-01-01' AND col_created < '2022-01-14';" )
XBROWSER oRs TITLE "01 JAT TO 13 JAN = 45 RECORDS (OK)"
oRs:Close()
oRs := oCn:RowSet( "SELECT COUNT(*) FROM test_timestamp WHERE col_created >= '2022-01-01' AND col_created < '2022-01-13';" )
XBROWSER oRs TITLE "01 JAN TO 12 JAN = 31 RECORDS -> (ERR) CORRECT = 29"
oRs:Close()
oRs := oCn:RowSet( "SELECT COUNT(*) FROM test_timestamp WHERE col_created >= '2022-01-13' AND col_created < '2022-01-14';" )
XBROWSER oRs TITLE "ONLY 13 JAN = 14 RECORDS -> (ERR) CORRECT = 16"
oRs:Close()
oCn:Close()
return nil
#include "fivewin.ch"
function Main()
local oCn, oRs
local t
SET DATE ITALIAN
SET CENTURY ON
SET TIME FORMAT TO "HH:MM:SS"
FWCONNECT oCn HOST "208.91.198.197:3306" USER "gnraofwh" PASSWORD "Bharat@1950" DATABASE "fwhdemo" PORT "3306"
if oCn == nil
? "connect fail"
return nil
endif
oCn:lShowErrors := .t.
? "Time Now in my place", oCn:Now()
oRs := oCn:RowSet( "SELECT * FROM test_timestamp ORDER BY col_created" )
XBROWSER oRs TITLE "AS VIEWED FROM MY COUNTRY TIMEZONE (" + oCn:time_zone + ")" SHOW SLNUM
oCn:time_zone := "+00:00"
? "Time Now in England", oCn:Now()
oRs:Requery()
XBROWSER oRs TITLE "AS VIEWED FROM UTC TIMEZONE (GMT) (ENGLAND) (+00:00)" SHOW SLNUM
oRs:Close()
oCn:Close()
return nil
function Main()
local oCn, oRs[4], oDlg, oFont
SET DATE ITALIAN
SET CENTURY ON
SET TIME FORMAT TO "HH:MM:SS"
FWCONNECT oCn HOST "208.91.198.197:3306" USER "gnraofwh" PASSWORD "Bharat@1950" DATABASE "fwhdemo" PORT "3306" // oCn := FW_DemoDB( 6 )
if oCn == nil
? "connect fail"
return nil
endif
oCn:lShowErrors := .t.
oCn:time_zone := '+00:00'
? "Time Now in my place", oCn:Now()
DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-12 BOLD
DEFINE DIALOG oDlg SIZE 800,900 PIXEL TRUEPIXEL TITLE "Test on native MySQL with TIMESTAMP fields -> With oCn:time_zone := '+00:00'" TRANSPARENT STYLE nOr( WS_CAPTION, WS_THICKFRAME, WS_SYSMENU, WS_MAXIMIZEBOX )
oRs[1] := oCn:RowSet( "SELECT id,col_created FROM test_timestamp;" )
@ 010,10 SAY "All 10 records: 5 from the 12th and 5 from the 13th." FONT oFont PIXEL
@ 025,10 SAY "SELECT id,col_created FROM test_timestamp;" FONT oFont PIXEL
@ 040,10 XBROWSE oRs[1] SIZE 300,250 DATASOURCE oRs[1] PIXEL OF oDlg AUTOCOLS AUTOSORT CELL LINES NOBORDER FASTEDIT FOOTERS
oRs[1]:aCols[1]:bFooter := {||"Records: "+Str( oRs[1]:nLen ) }
oRs[1]:CreateFromCode()
oRs[2] := oCn:RowSet( "SELECT id,col_created FROM test_timestamp WHERE col_created > '2022-01-11' AND col_created < '2022-01-13';" )
@ 310,10 SAY "Only the 5 records of the 12th: There are 5." FONT oFont PIXEL
@ 325,10 SAY "SELECT id,col_created FROM test_timestamp WHERE col_created > '2022-01-11' AND col_created < '2022-01-13';" FONT oFont PIXEL
@ 340,10 XBROWSE oRs[2] SIZE 300,250 DATASOURCE oRs[2] PIXEL OF oDlg AUTOCOLS AUTOSORT CELL LINES NOBORDER FASTEDIT FOOTERS
oRs[2]:aCols[1]:bFooter := {||"Records: "+Str( oRs[2]:nLen ) }
oRs[2]:CreateFromCode()
oRs[3] := oCn:RowSet( "SELECT id,col_created FROM test_timestamp WHERE col_created >= '2022-01-13 00:00:00';" )
@ 610,10 SAY "Only the 5 records of the 13th: There are 5." FONT oFont PIXEL
@ 625,10 SAY "SELECT id,col_created FROM test_timestamp WHERE col_created >= '2022-01-13 00:00:00';" FONT oFont PIXEL
@ 640,10 XBROWSE oRs[3] SIZE 300,250 DATASOURCE oRs[3] PIXEL OF oDlg AUTOCOLS AUTOSORT CELL LINES NOBORDER FASTEDIT FOOTERS
oRs[3]:aCols[1]:bFooter := {||"Records: "+Str( oRs[3]:nLen ) }
oRs[3]:CreateFromCode()
ACTIVATE DIALOG oDlg CENTERED // ON INIT ( oDlg:Maximize() )
oRs[1]:Close()
oRs[2]:Close()
oRs[3]:Close()
oCn:Close()
return nil
With oCn:time_zone := '+00:00' is Correct.
SELECT NOW();
SET @@session.time_zone = '-03:00';
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot], Jimmy and 91 guests