Feature Requests: Browse | Submit New | Admin

[#3576] BIT values not converted to Integer

Date:
2006-02-16 16:31
Priority:
5
Submitted By:
Nobody
Assigned To:
Nobody (None)
Category:
None
State:
Open
Summary:
BIT values not converted to Integer

Detailed description
BIT values are kept as String instead of being converted to Integer.

This small test unit illustrates this :

require 'test/unit'
require 'dbi'

class TC_Bit < Test::Unit::TestCase
	def test_bit
		db = DBI.connect('DBI:Mysql:your_database', 'your_user', 'your_password')
		db.do "DROP TABLE IF EXISTS test_dbi"
		db.do "CREATE TABLE test_dbi (bit_value BIT, int_value INTEGER)"
		db.do "INSERT INTO test_dbi (bit_value, int_value) VALUES (0,0)"
		assert_equal [0,0], db.select_one("SELECT bit_value, int_value FROM test_dbi")
	end
end

The result is :
<[0, 0]> expected but was
<["0", 0]>.

Add A Comment: Notepad

Please login


Followup

Message
Date: 2008-03-08 09:04
Sender: Erik Hollensbe

Long story short: the type system needs to be overhauled. I was
able to get 3 different responses testing against 4 different
DBDs.
Date: 2006-02-16 16:39
Sender: Nobody

Also, I've encountered very weird cases where the value is converted
to Integer. I can't reproduce this in a small test unit, because
it seems to depend on memory usage (creating an totally unrelated
object or not changed the behavior).
Date: 2006-02-16 16:36
Sender: Nobody

I've forgotten version informations. I'm using Ubuntu Breezy
with these packages :
libdbi-ruby1.8                         0.0.23-2
libdbd-mysql-ruby                      0.0.23-2
libmysql-ruby1.8                       2.4.5-6.1
ruby                                   1.8.2-1

Attached Files:

Name Description Download
No Files Currently Attached

Changes:

Field Old Value Date By
artifact_group_idDBD2008-03-09 03:30erikh
priority32008-03-08 09:04erikh
artifact_group_idNone2008-02-24 07:18erikh