Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 6 of 6 total
Thread LargeInt to String
Fri, Oct 28 2011 4:05 AMPermanent Link

Petter Topp

Hi.

I just converted a couple of Lagreint fields to String using Dbsys.
No errors were thorwn during the alter process, but ALL values are
completely changed.
Some values are even converted to a negative value (-)

Petter Topp
Dbisam 4.30 b7
Fri, Oct 28 2011 5:37 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Petter


>I just converted a couple of Lagreint fields to String using Dbsys.
>No errors were thorwn during the alter process, but ALL values are
>completely changed.
>Some values are even converted to a negative value (-)

Just tried here using the old version (4.25) that I have and no problems. Without working my way through the code I would guess that Tim simply uses the .As functionality built into Delphi and this is what's not working.

As a simple test can you try a quick bit of SQL

SELECT largeintcolumn, CAST(largeintcolumn as varchar(40)) from table

and see if there's a difference there. If not then you have a way to do the conversion - add the varchar column, use SQL to do the conversion and drop the largeint column.

Which version of Delphi are you using?

Roy Lambert [Team Elevate]
Fri, Oct 28 2011 9:22 AMPermanent Link

Petter Topp

Hi Roy.

The Dbisam CAST Function works as expected - IOW The values are the same.
I'm running Delphi 2010

Thanks Roy, I will not dig into this, just as you say add a new column and
move data, then drop the old column

Petter

"Roy Lambert"  skrev i nyhetsmeldingen:
2DE67C63-99B4-4002-81C6-94E911B42F75@news.elevatesoft.com ...

Petter


>I just converted a couple of Lagreint fields to String using Dbsys.
>No errors were thorwn during the alter process, but ALL values are
>completely changed.
>Some values are even converted to a negative value (-)

Just tried here using the old version (4.25) that I have and no problems.
Without working my way through the code I would guess that Tim simply uses
the .As functionality built into Delphi and this is what's not working.

As a simple test can you try a quick bit of SQL

SELECT largeintcolumn, CAST(largeintcolumn as varchar(40)) from table

and see if there's a difference there. If not then you have a way to do the
conversion - add the varchar column, use SQL to do the conversion and drop
the largeint column.

Which version of Delphi are you using?

Roy Lambert [Team Elevate]
Fri, Oct 28 2011 9:28 AMPermanent Link

Petter Topp

Roy,

There is something going on that I don't quite understand.
I have looked at another conversion of a different customer table - and with
this one things worked out right...
Could this be related to OS/Locale on which the conversion was performed
(where Dbsys was executed)?

Petter

"Roy Lambert"  skrev i nyhetsmeldingen:
2DE67C63-99B4-4002-81C6-94E911B42F75@news.elevatesoft.com ...

Petter


>I just converted a couple of Lagreint fields to String using Dbsys.
>No errors were thorwn during the alter process, but ALL values are
>completely changed.
>Some values are even converted to a negative value (-)

Just tried here using the old version (4.25) that I have and no problems.
Without working my way through the code I would guess that Tim simply uses
the .As functionality built into Delphi and this is what's not working.

As a simple test can you try a quick bit of SQL

SELECT largeintcolumn, CAST(largeintcolumn as varchar(40)) from table

and see if there's a difference there. If not then you have a way to do the
conversion - add the varchar column, use SQL to do the conversion and drop
the largeint column.

Which version of Delphi are you using?

Roy Lambert [Team Elevate]
Fri, Oct 28 2011 12:58 PMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Petter

>There is something going on that I don't quite understand.
>I have looked at another conversion of a different customer table - and with
>this one things worked out right...
>Could this be related to OS/Locale on which the conversion was performed
>(where Dbsys was executed)?

I actually had two ideas. One was that if Tim is just using the .As functions (.AsString, .AsInteger) it could be down to Delphi thinking that they're just integers not largeints which could account for the "wrong" values with wrapping / truncation. The second was that it was an effect of unicode. I suppose it could be down to the locate or OS version.

I'm sure Tim will have the answer next time he drops by.

Roy Lambert [Team Elevate]
Mon, Oct 31 2011 8:50 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Petter,

<< Could this be related to OS/Locale on which the conversion was performed
(where Dbsys was executed)? >>

No, integers aren't affected by locale settings.  Can you send me a copy of
the table prior to the alteration ?  I can try it here and tell you what is
going on.

--
Tim Young
Elevate Software
www.elevatesoft.com
Image