Page 1 of 1

[patch_done] TimeStamp patch

Posted: 11.12.2012, 15:21
by Shagrat3
TimeStamp patch

[code]Index: ZDbcPostgreSqlStatement.pas
===================================================================
--- ZDbcPostgreSqlStatement.pas (revision 1553)
+++ ZDbcPostgreSqlStatement.pas (working copy)
@@ -436,7 +436,7 @@
[FormatDateTime('hh":"mm":"ss', SoftVarManager.GetAsDateTime(Value))]);
stTimestamp:
Result := Format('''%s''::timestamp',
- [FormatDateTime('yyyy-mm-dd hh":"mm":"ss',
+ [FormatDateTime('yyyy-mm-dd hh":"mm":"ss"."zzz',
SoftVarManager.GetAsDateTime(Value))]);
stAsciiStream:
begin
[/code]

Posted: 12.12.2012, 08:06
by EgonHugeist
Shagrat3,

first of all, is see you use my old branch. Please stop doing this use http://svn.code.sf.net/p/zeoslib/code-0 ... es/testing instead.

Accordingly you patch: Do you know if all postgre servers do understand the milliseconds syntax? If no than we can bind your patch to a server or client version xUP. What do you think?

Posted: 12.12.2012, 12:52
by Shagrat3
http://www.postgresql.org/docs/7.1/stat ... etime.html
Version 7.1 has "ms"

http://www.postgresql.org/docs/9.2/stat ... etime.html
Version 9.2 has "ms" to

When i use synchronization from table1 to table2 without "ms"
I have a wrong values

Posted: 12.12.2012, 19:59
by marcov

Posted: 14.12.2012, 22:36
by EgonHugeist
Shagrat3,

thanks. Patch applied Rev. 2076 \testing-7.1 (behavior freeze on Zeos7.0.x) with some little changes. On Zeos7 \testing-7.1 we've got some more Statement-Types. I've also opened this door for ftTime-Fields + PostgreSQL.

marcov,

thanks for the cross-links to SQLDB. The MSec support for FireBird exists longer than i'm team-member on ZeosLib

Posted: 15.12.2012, 21:34
by marcov
Note that I couldn't quickly find reports for other database types doesn't mean they don't support it.

It might be that those changes were bundled with other fixes for e.g. Mysql.

Posted: 16.12.2012, 12:59
by EgonHugeist
marcov,

yes that's right, Marco.

I've googled some RDBMS we do support:

MySQL does support it since v5.6: https://blogs.oracle.com/MySqlOnWindows ... n_datetime
So we can add this support by checking the version (not very cool)

The SQLDB for SQLite does use Double values. We currently store formated strings without msecs. But i can imagine this will work too (SQLite is lazy on proofing the values). Also do i think about supporting a generic way to read DateTime values written with SQLDB.

All other Drivers do allready support the msecs.