Subject | RE: [IBO] Using rdb$db_key with IBO |
---|---|
Author | Svein Erling Tysvær |
Post date | 2008-02-14T15:51:37Z |
Got help from a colleague, who told me to write
TIB_ColumnDB_KEY(TIB_DSQL1.Params[1]).Value:=...
rather than
TIB_DSQL1.Params[1].AsVariant:=...
Since the parameter is of type TIB_ColumnText, doing
(TIB_DSQL1.Params[1] as TIB_ColumnDB_KEY).Value fails.
I'm surprised that comparing rdb$db_key to a parameter value is more complex than other parameters (and I'm also surprised that I cannot remember having read about this on this list before - maybe rdb$db_key is less used as a parameter in TIB_DSQL than I thought).
But now I'm happy that everything works as I intended,
Set
-----Original Message-----
From: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com] On Behalf Of Svein Erling Tysvær
Sent: 13. februar 2008 14:04
To: IBObjects@yahoogroups.com
Subject: RE: [IBO] Using rdb$db_key with IBO
Sorry, forgot to say that the SQL of the TIB_DSQL is something like:
UPDATE <table>
SET <Field> = :Param1
WHERE RDB$DB_KEY = :Param2
and of the TIB_Cursor:
SELECT rdb$db_key FROM <table>
WHERE ...
-----Original Message-----
From: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com] On Behalf Of Svein Erling Tysvær
Sent: 13. februar 2008 13:59
To: IBObjects@yahoogroups.com
Subject: [IBO] Using rdb$db_key with IBO
Making myself a little tool, I discovered a problem assigning rdb$db_key to a parameter. Basically, what I've got, is one TIB_Cursor that selects rdb$db_key, and then a TIB_DSQL that tries to update the same record using this rdb$db_key. Doing
TIB_DSQL1.Params[1].AsVariant:=TIB_Cursor1.Fields[0].AsVariant; //rdb$db_key
Assigns 'A1000000' to the parameter when the field contains 'A100000001000000', i.e. IBO trims away half the value! First I tried using .AsString, then changed to .AsVariant and then changed to IBO 4.8.7 (probably a beta version from 26 August 2007), but this behaviour was consistent. If it is of any relevance, I generally use ISO8859_1 as the character set and NO_NO as collation.
To me, it seems like the statement
if strLen > SQLLen then
strLen := SQLLen;
in TIB_ColumnText.SetValue shortens the string from 16 to 8 characters.
Any way to use rdb$db_key with IBO? Of course I normally have a primary key (PK) on my tables, but I would like this little tool to work even for tables that don't have a PK.
Using Borland Developer Studio 2006.
Thanks for any answers,
Set
[Non-text portions of this message have been removed]
___________________________________________________________________________
IB Objects - direct, complete, custom connectivity to Firebird or InterBase
without the need for BDE, ODBC or any other layer.
___________________________________________________________________________
http://www.ibobjects.com - your IBO community resource for Tech Info papers,
keyword-searchable FAQ, community code contributions and more !
Yahoo! Groups Links
___________________________________________________________________________
IB Objects - direct, complete, custom connectivity to Firebird or InterBase
without the need for BDE, ODBC or any other layer.
___________________________________________________________________________
http://www.ibobjects.com - your IBO community resource for Tech Info papers,
keyword-searchable FAQ, community code contributions and more !
Yahoo! Groups Links
TIB_ColumnDB_KEY(TIB_DSQL1.Params[1]).Value:=...
rather than
TIB_DSQL1.Params[1].AsVariant:=...
Since the parameter is of type TIB_ColumnText, doing
(TIB_DSQL1.Params[1] as TIB_ColumnDB_KEY).Value fails.
I'm surprised that comparing rdb$db_key to a parameter value is more complex than other parameters (and I'm also surprised that I cannot remember having read about this on this list before - maybe rdb$db_key is less used as a parameter in TIB_DSQL than I thought).
But now I'm happy that everything works as I intended,
Set
-----Original Message-----
From: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com] On Behalf Of Svein Erling Tysvær
Sent: 13. februar 2008 14:04
To: IBObjects@yahoogroups.com
Subject: RE: [IBO] Using rdb$db_key with IBO
Sorry, forgot to say that the SQL of the TIB_DSQL is something like:
UPDATE <table>
SET <Field> = :Param1
WHERE RDB$DB_KEY = :Param2
and of the TIB_Cursor:
SELECT rdb$db_key FROM <table>
WHERE ...
-----Original Message-----
From: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com] On Behalf Of Svein Erling Tysvær
Sent: 13. februar 2008 13:59
To: IBObjects@yahoogroups.com
Subject: [IBO] Using rdb$db_key with IBO
Making myself a little tool, I discovered a problem assigning rdb$db_key to a parameter. Basically, what I've got, is one TIB_Cursor that selects rdb$db_key, and then a TIB_DSQL that tries to update the same record using this rdb$db_key. Doing
TIB_DSQL1.Params[1].AsVariant:=TIB_Cursor1.Fields[0].AsVariant; //rdb$db_key
Assigns 'A1000000' to the parameter when the field contains 'A100000001000000', i.e. IBO trims away half the value! First I tried using .AsString, then changed to .AsVariant and then changed to IBO 4.8.7 (probably a beta version from 26 August 2007), but this behaviour was consistent. If it is of any relevance, I generally use ISO8859_1 as the character set and NO_NO as collation.
To me, it seems like the statement
if strLen > SQLLen then
strLen := SQLLen;
in TIB_ColumnText.SetValue shortens the string from 16 to 8 characters.
Any way to use rdb$db_key with IBO? Of course I normally have a primary key (PK) on my tables, but I would like this little tool to work even for tables that don't have a PK.
Using Borland Developer Studio 2006.
Thanks for any answers,
Set
[Non-text portions of this message have been removed]
___________________________________________________________________________
IB Objects - direct, complete, custom connectivity to Firebird or InterBase
without the need for BDE, ODBC or any other layer.
___________________________________________________________________________
http://www.ibobjects.com - your IBO community resource for Tech Info papers,
keyword-searchable FAQ, community code contributions and more !
Yahoo! Groups Links
___________________________________________________________________________
IB Objects - direct, complete, custom connectivity to Firebird or InterBase
without the need for BDE, ODBC or any other layer.
___________________________________________________________________________
http://www.ibobjects.com - your IBO community resource for Tech Info papers,
keyword-searchable FAQ, community code contributions and more !
Yahoo! Groups Links