WOW !!

The story goes on:

I wrote the UDF-Functions (and64/or64) and while and it seems
to work:

mysql> select and64('9223372036854775809',127);
+----------------------------------+
| and64('9223372036854775809',127) |
+----------------------------------+
|                                1 |
+----------------------------------+
1 row in set (0.00 sec)

I noted that mysql can't really dial with unsigned:
(you can't even declare it unsigned)

mysql> select or64('9223372036854775809',127);
+---------------------------------+
| or64('9223372036854775809',127) |
+---------------------------------+
|            -9223372036854775681 |
+---------------------------------+
1 row in set (0.00 sec)



On Sun, Feb 01, 2004 at 01:09:34AM +0100, Stefan Traby wrote:
> Hi !
> 
> select 129 & 127;                             -- ok(1)
> select '129' & 127;                           -- ok(1)
> select (0+'129') & 127;                       -- ok(1)
> select CAST('129' AS UNSIGNED INTEGER) & 127; -- ok(1)
> select CONVERT('129', UNSIGNED INTEGER) & 127;-- ok(1)
> 
> Doing the same with 64 bit values gives strange results:
> 
> select 9223372036854775809 & 127;                             -- returns 1, correct
> select '9223372036854775809' & 127;                           -- ERROR: returns 127
> select (0+'9223372036854775809') & 127;                       -- ERROR: returns 0
> select CAST('9223372036854775809' AS UNSIGNED INTEGER) & 127; -- ERROR: returns 127
> select CONVERT('9223372036854775809', UNSIGNED INTEGER) & 127;-- ERROR: returns 127
> 
> So please tell me how to perform a bitwise 64bit-AND if
> a value is quoted.
> 
> Never seen such a strange bug for a long time.
> 
> Well, I just found it because DBD::mysql quotes large integer
> bind-variables even on perl int64...
> 
> So do I need to write an UDF-Function to get the correct behavior
> or is there another work-arround to fix this?
> 
> -- 
> 
>   ciao - 
>     Stefan
> 
> -- 
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]
> 
> 

-- 

  ciao - 
    Stefan

"            aclocal - emit a warning if -ac kernel is used.             "

Stefan Traby                Linux/ia32             office: +49-721-3523165
Mathystr. 18-20 V/8         Linux/alpha              cell: +XX-XXX-XXXXXXX
76133 Karlsruhe             Linux/sparc               http://graz03.kwc.at
Germany                     Linux/arm               mailto:[EMAIL PROTECTED]
Europe                      Linux/mips     mailto:[EMAIL PROTECTED]

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to