[SQLite3EXDI]located the code causing data change (float/double)(was: Why data changed when inserting into SQLite3 database (and maybe other dbs))

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
J G
Reply | Threaded
Open this post in threaded view
|

[SQLite3EXDI]located the code causing data change (float/double)(was: Why data changed when inserting into SQLite3 database (and maybe other dbs))

J G
Reinout Heeck <vwnclist <at> soops.nl> writes:

>
> These seem to be conversion errors (going from decimal to binary and
> back again).
> ....

Hi, Reinout!
Sorry for post repeatedly.

I've found the codes in SQLite3EXDI which cause the problem though
have no Idea to overcome it except for using integers instead.

It's here:
SQLite3Cursor>>bindValue: aValue at: aPosition
        | res errs pos |
        pos := aPosition.
        aPosition isString
                ifTrue:
                        [pos := self xif sqlite3_bind_parameter_index: self statement
                                                with: aPosition asString copy].
        pos > (self xif sqlite3_bind_parameter_count: self statement)
                ifTrue: [^self class connectionClass invalidDescriptorCountSignal raise].
        (res := aValue sqliteBindOn: self at: pos) = self xif SQLITE_OK
                ifFalse:
                        [errs := Array with: ((ExternalDatabaseError new)
                                                                dbmsErrorCode: res;
                                                                dbmsErrorString: self getErrorString).
                        self class connectionClass unableToBindSignal raiseWith: errs
                                errorString: errs first dbmsErrorString]

Number>>sqliteBindOn: aCursor at: position
        ^aCursor bindReal: self asDouble at: position

Here any external real type is conversed to aDouble. And these are for use in:

session prepare: SQLString;
execute;
answer

So when I insert some records to a test db using AD Hoc SQL tool the problem
dosn't show up. And I guess this tool dosn't use binding
session prepare: SQLString
to insert values.

Now I am wonder what to do to overcome this in binding.

Thanks for any idea.

Regards,

Jim G