Sa sledeceg linka:
http://www.vitavoom.com/Produc...ress_Driver/docs/appendix.html
nasao sam ovo... mozda pomogne ;)
I'm having problems with queries with timestamp/datetime fields.
The problem is caused by a dbExpress™ VCL/CLX bug. There is an interface called ISQLCursor.isSearchable() making an update query, and that would create a statement that would have a non-existent value, like this:
update test set b = '2002-08-02 18:36:50' where b = '2002-08-02 18:36:52';
Obviously PostgreSQL will not be able to find the b value from the WHERE clause, and a exception message like this will be raised:
Record not found or changed by another user
To solve this, use a primary key/index and the UpdateMode to upWhereKeyOnly mode with keys on fields that are not timestamp/ datetime/etc (do not make the timestamp values indexed). This will keep VCL/CLX from generating a wrong WHERE statement.
If in your database these fields are indexed, removing the pfInWhere option from the TField.ProviderFlags property for that field should be enough. If the actual value in your table that have no fraction or timezone value values, the generated SQL will be able to find that record (because it will use only the indexed fields in the WHERE clause, and the update will suceed.
Another way of solving this issue is by using a view using the date_trunc function, like this:
create view TestView as select a, date_trunc('second', b) as b from test;
and then create a rule to INSERT/UPDATE/DELETE rows, but this method is more complicated.
The pgExpress Suite does not suffer from this problem since it maps the fields to custom types. Just to document, the Delphi 7 Readme.txt file has a similar "Known Issues" note for the DB2™ dbExpress™ driver.
kao i sledece :
http://mc-computing.com/Databases/Delphi/Firebird/Dates.html
DateTimeToStr fails
This code fragment fails because of how the time is formatted.
DateTime := DateTimeToStr(Now);
// CREATE TABLE "xyz_tbl" (
// "xyz_ID" VARCHAR(5) NOT NULL /* "Experiment_ID" */ ,
// "Date_Time" TIMESTAMP /* "Date_Time" */
// );
s :=
'INSERT into "xyz_tbl" ' +
'("xyz_ID", "Date_Time")' +
' Values (''' +
Experiment_ID + ''', ''' +
DateTime + '''' +
' ) '
;
ExecuteSQL(s); // a routine I wrote
On my system
LongTimeFormat = 'h:mm:ss AMPM'
which produces the standard 12 hour clock format
'1/30/2005 3:06:32 AM'
that fails with Firebird.
Notice that LongTimeFormat uses mm for both month and minutes, but that nn always produces minutes. From the Delphi help
mm Displays the month as a number with a leading zero (01-12).
If the mm specifier immediately follows an h or hh specifier,
the minute rather than the month is displayed.
Tests indicate that LongTimeFormat is not a system variable, meaning that once you change its value, you do not have to restore it. In other words, changes made by your program only affect your program.
Here are some miscellaneous instructions used to format date/times
DT_Str := Date + ' ' + Time;
DT := StrToDateTime(DT_Str);
DateTimeToString(DT_Str, 'mm/dd/yyyy hh:mm:ss am/pm', DT);// ok for display, not for Firebird
DateTimeToString(d, 'yyyymmdd', DT);
DateTimeToString(m, 'yyyymmdd_hhnnss', DT);
pozdrav!