Subject Re: [IBO] Delphi 10 Seattle and latest IBO: date and timestamp
Author Gerhard Knapp
Thank you Helen,

Delphi 10 Seattle Enterprise
Firebird: 2.5.5 x64, also with 2.5.4 x64
Compiling win32
using: fbclient.dll 2.5.5 (win32)

If i do following in Dialect 1, i have to use timestamp,
with Delpi 2010 and D7 there was never a problem with date.
It produces with cast(active_day as date)
an exception in the execute part:
and you see, i didn't use try ... prepare ... except
         ....
          sql.add('update daily_active set last_entry = :le where ');
          //sql.add('pnr_id = :p and cast(active_day as date) = :h');    .... fires exception
          sql.add('pnr_id = :p and cast(active_day as timestamp) = :h');
          prepare;
          parambyname('p').AsInteger := v_pnr_id;
          parambyname('h').asDate := dateof(xnow);
          parambyname('le').AsDateTime := xnow;
          try
            execute;
          except  //  --------------------> exception
            on E: Exception do
            begin
              isDBError := True;
              xlog('Error_23> '#13#10 + E.Message);
              IB_Transaction.Rollback;
              raise ;
            end;
          end;
         ....

what i also tried is to create a table in dialect 1 with "timestamp",
instead of "date", and it worked without an exception, whether
db was in dialect1 and IBO was set do dialect1
And IBExpert shows the field in the new table as "Date".

As nearly all of my database-code is now in win32 services,
i have often also to use try ... except in the prepare part too.

It seems depenting from what delphi version i use. And there are some
other surprising things with the newest Delphi version not only this in IBO.
Unfortunately there are many reasons to use the newest Delphi.

I have till now a mixed exe world that all are using the same Databases.
also older D7 client/server exe files. If i migrate the databases to dialect 3
then i fear all this older exes will not work any longer.

So, you mean i have to change all my code (in the win32 services e.g.)
using "timestamp" where i used "date", and can stay on dialect 1 ?
As first step to migrate to dialect 3?
(And let the older programms working on the same dialect 1 databases?)


best regards and thanks for answering
Gerhard





Am 18.12.2015 um 20:44 schrieb Helen Borrie helebor@... [IBObjects]:
 

Tuesday, December 15, 2015, 9:09:56 PM, Gerhard Knapp wrote:


firebird 2.5.4.
database: SQLDialect 1
Connectin SQLDialect 1

and if i try to create a table comes error:

.....
   sql.add('bdat date,');
.....

---------------------------
Benachrichtigung über Debugger-Exception
---------------------------
Exception der Klasse EIB_ISCError mit der Meldung 'ISC ERROR CODE:0

ISC ERROR MESSAGE:
SQL warning code = 301
DATE data type is now called TIMESTAMP
SQL warning code = 301
DATE data type is now called TIMESTAMP


I am curious to know what the actual problem is.
Are you saying that your current Delphi/IBO interface interprets the warning as an exception and won't allow the table to be created?

This warning has been generated throughout Firebird's life.  It is a warning, not an error.


What in the hell is there going on?
Has someone an idea, what i can do?


Using the latest build of IB_SQL from the IBO website and Fb 2.5.4, I created a Dialect 1 database, no problems with that.

Then:

create table test1 (
 f1 integer,
 f2 date)

On Prepare, that raised the same warning that you saw.
On Execute, it created the table.  

Browse shows the data type as

(Timestamp) DATE

Next:

create table test2 (
 f1 integer,
 f2 timestamp)

Prepare and execute, no warning.

Browse shows the data type as

(Timestamp) DATE

So, it seems, whatever version of IBO Jason used to compile that executable knows about the Dialect 1 data type transposition and does the right thing, either way.

Sorry, I can't compile anything in your environment.  The youngest Delphi I have is D7.

Helen