dotnet database return values problem

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 08 August 2012   #1
dotnet database return values problem

hello! I am querying a sqlite database. The returned values are correct with the exception that the values returned are being appended with some string characters. For example, I have position Z and ID being returned here:

1180.13d0 160683L
345.175d0 176874L
345.186d0 176295L
1477.99d0 82286L
dotNetObject:System.DBNull 176191L

the position z is really 1180.13546 and the ID is 160683. Here is the part of the code that prints the values
Code:
for i = 0 to (readerObject.FieldCount - 1) do format "%\t" precord[i] format "\n"


Does anyone know why this is happening?
__________________
www.davetyner.com
 
Old 08 August 2012   #2
d0 means double precision 64bit value, L means long integer value.

you could try casting them to float and integer, respectively.
 
Old 08 August 2012   #3
Unless you need these values as a string, it shouldn't a problem. It's the formatting that adds the d0/L to the string, they're not part of the actual value.
 
Old 08 August 2012   #4
Thank you for the replies! Oddly enough the values are being returned with the d0 and L appended even when I remove formatting.

Code:
while readerObject.read() do ( local record = readerObject.item append arr[1] record["engx"] append arr[1] record["engy"] append arr[1] record["engz"] append arr[2] record["p2z"] append arr[2] record["p2y"] append arr[2] record["p2x"] )


returns

Code:
#(306.02d0, 67.8741d0, 881.926d0, 306.02d0, 67.8741d0, 881.926d0, 625.894d0, 67.8861d0, 881.926d0...
__________________
www.davetyner.com
 
Old 08 August 2012   #5
This is expected behaviour. In what way is this a problem, or - what are you eventually doing with the values?
 
Old 08 August 2012   #6
lo, the values are xyz coordinates / names / descriptions for objects in the scene.

EDIT: I was assuming the data was wrong based on the return without actually testing it first. Everything looks to be in order. MY BAD, thanks for the help!
__________________
www.davetyner.com
 
Old 08 August 2012   #7
I think it just looked wrong, instead of actually being wrong Because any time a long value is converted to a string, the L is appended. Same for the double precision float.
 
Old 08 August 2012   #8
Quote:
Originally Posted by Pjanssen
I think it just looked wrong, instead of actually being wrong Because any time a long value is converted to a string, the L is appended. Same for the double precision float.


haha yep! Thank you for the help!!
__________________
www.davetyner.com
 
Old 08 August 2012   #9
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright ©2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 12:30 PM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.