![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I've noticed that there's no unsigned data types in ingres sql. This is a problem for us as we need to allow access to a table usign unsigned 64-bit integers generated from afar (an authentication agent)...The current solution is to base64 encode the 8byte values, producing 11byte varchars that can at least be stored, compared etc. safely. The further I go with this solution however the less I like it as I need to do quite a bit of base64 encoding and decoding in python, where previouslt I could do inserts etc with no fear of overflowing... ie. I'm using the python dbi driver to execute strings containing CRUD operations like INSERT into table (id) values (someNumberGreaterThan2TothePowerOf63) will produce an error as someNumberGreaterThan2TothePowerOf63 is in string form and will be out of range. |
#3
| |||
| |||
|
|
I've noticed that there's no unsigned data types in ingres sql. This is a problem for us as we need to allow access to a table usign unsigned 64-bit integers generated from afar (an authentication agent)...The current solution is to base64 encode the 8byte values, producing 11byte varchars that can at least be stored, compared etc. safely. The further I go with this solution however the less I like it as I need to do quite a bit of base64 encoding and decoding in python, where previouslt I could do inserts etc with no fear of overflowing... ie. I'm using the python dbi driver to execute strings containing CRUD operations like INSERT into table (id) values (someNumberGreaterThan2TothePowerOf63) will produce an error as someNumberGreaterThan2TothePowerOf63 is in string form and will be out of range. As this is the index to the table, I can't use the binary types. Any ideas? |
#4
| |||
| |||
|
|
At 5:30 PM +0100 9/8/2005, morgan brickley wrote: I've noticed that there's no unsigned data types in ingres sql. This is a problem for us as we need to allow access to a table usign unsigned 64-bit |
|
ie. I'm using the python dbi driver to execute strings containing CRUD operations like INSERT into table (id) values (someNumberGreaterThan2TothePowerOf63) will produce an error as someNumberGreaterThan2TothePowerOf63 is in string form and will be out of range. The SQL Standard doesn't allow for unsigned numeric types. You can however take your unsigned number and send it to Ingres as if it were signed. E.g. 2703443303 (0xa1234567) can be sent as -1591523993. It's the same bit-pattern, just ascii-ized differently. |
#5
| |||
| |||
|
|
"Karl & Betty Schendel" <schendel (AT) kbcomputer (DOT) com> wrote in message news:mailman.1126200001.15354.info-ingres (AT) cariboulake (DOT) com... At 5:30 PM +0100 9/8/2005, morgan brickley wrote: I've noticed that there's no unsigned data types in ingres sql. This is a problem for us as we need to allow access to a table usign unsigned 64-bit integers generated from afar (an authentication agent)...The current solution is to base64 encode the 8byte values, producing 11byte varchars that can at least be stored, compared etc. safely. The further I go with this solution however the less I like it as I need to do quite a bit of base64 encoding and decoding in python, where previouslt I could do inserts etc with no fear of overflowing... ie. I'm using the python dbi driver to execute strings containing CRUD operations like INSERT into table (id) values (someNumberGreaterThan2TothePowerOf63) will produce an error as someNumberGreaterThan2TothePowerOf63 is in string form and will be out of range. The SQL Standard doesn't allow for unsigned numeric types. You can however take your unsigned number and send it to Ingres as if it were signed. E.g. 2703443303 (0xa1234567) can be sent as -1591523993. It's the same bit-pattern, just ascii-ized differently. I'd be uncomfortable using a signed type for an unsigned value because it admits meaningless operations on the data, and worse still, apparently meaningful operations that are wrong. How about using BYTE(4) or BYTE(8)? In fact I would guess these types are *exactly* what is needed, since the value being stored is probably not from a domain in which integer arithmetic is even defined. Roy Hann (rhann at rationalcommerce dot com) Rational Commerce Ltd. www.rationalcommerce.com "Ingres development, tuning, and training experts" |
![]() |
| Thread Tools | |
| Display Modes | |
| |