From oliver.peng at skywave.com Wed Jul 6 11:36:33 2011 From: oliver.peng at skywave.com (Oliver Peng) Date: Wed, 6 Jul 2011 11:36:33 -0400 Subject: [ruby-dbi-users] find a bug for Real column for MS SQL Server Message-ID: In MS SQL Server, create following test database and table: CREATE DATABASE admin_test COLLATE SQL_Latin1_General_Cp850_CI_AI use admin_test; GO CREATE TABLE table5 ( table5_id int NOT NULL, column8 REAL, CONSTRAINT PK_table5 PRIMARY KEY(table5_id), ); go insert into table5 values (1, -1.11) go select * from table5 where table5_id = 1 go Connect to this database by using DBI and retrieve it: irb(main):011:0> require 'rubygems' => true irb(main):012:0> require 'dbi' => true irb(main):012:0> connstr = "DBI:ODBC:Driver={SQL Server};Server=(local);Database=admin_test;UID=AdminTest;PWD=123" => "DBI:ODBC:Driver={SQL Server};Server=(local);Database=admin_test;UID=AdminTes t;PWD=123" irb(main):014:0> connection = DBI.connect(connstr) => #, @attr={}>, @convert_types=true, @driver_nam e="odbc", @trace_output=nil, @trace_mode=nil> irb(main):015:0> sql = 'select * from table5 where table5_id = 1' => "select * from table5 where table5_id = 1" irb(main):016:0> sth = connection.execute(sql) => #, @arr=[], @statement="select * from table 5 where table5_id = 1", @params=[]>, @dbh=#, @att r={}>, @convert_types=true, @driver_name="odbc", @last_statement="select * from table5 where table5_id = 1", @trace_output=nil, @trace_mode=nil>, @executed=true , @convert_types=true, @row=[nil, nil], @prepared=true, @trace_output=nil, @colt ypes=[DBI::Type::Integer, DBI::Type::Float], @fetchable=true, @raise_error=nil, @trace_mode=nil, @cols=["table5_id", "column8"]> irb(main):017:0> dbr = sth.fetch_all => [[1, -1.11000001430511]] >From the result, the value of column8 is not correct. I am using latest Ruby 1.8.7 and latest ODBC gem and here is the gem list: *** LOCAL GEMS *** dbd-mysql (0.4.4) dbd-odbc (0.2.5) dbi (0.4.5) deprecated (2.0.1) mysql (2.8.1 x86-mingw32) ruby-oci8 (2.0.6 x86-mingw32) ruby-odbc (0.99994) Oliver -------------- next part -------------- An HTML attachment was scrubbed... URL: From oliver.peng at skywave.com Fri Jul 8 11:11:37 2011 From: oliver.peng at skywave.com (Oliver Peng) Date: Fri, 8 Jul 2011 11:11:37 -0400 Subject: [ruby-dbi-users] several issue Message-ID: Hi All: I found several issues after using DBI. Please have a look: For DATE column in MS SQL Server, the value in database is 2011-02-12 and what I get is 2011-02-1. For TINYINT column in MS SQL Server, DBI will convert value to Boolean type instead of number. For different date, timestamp columns, DBI will return different classes. Here is the table for all the classes which I got: Column type MySQL MS SQL Server Oracle DATE Date String Time TIME DateTime String DATETIME DateTime DateTime TIMESTAMP DateTime Time DATETIMEOFFSET String DATETIME2 String SMALLDATETIME DateTime It will be great if we can use unified interface for all these column types. Oliver -------------- next part -------------- An HTML attachment was scrubbed... URL: From kubo at jiubao.org Fri Jul 8 20:53:50 2011 From: kubo at jiubao.org (Kubo Takehiro) Date: Sat, 9 Jul 2011 09:53:50 +0900 Subject: [ruby-dbi-users] several issue In-Reply-To: References: Message-ID: The DBI maintainers moved to RDBI . I guess that they won't improve DBI anymore. On Sat, Jul 9, 2011 at 12:11 AM, Oliver Peng wrote: > Hi All: > > **** > > I found several issues after using DBI. Please have a look:**** > > ** ** > > For DATE column in MS SQL Server, the value in database is 2011-02-12 and > what I get is 2011-02-1.**** > > ** ** > > For TINYINT column in MS SQL Server, DBI will convert value to Boolean type > instead of number.**** > > ** ** > > For different date, timestamp columns, DBI will return different classes. > Here is the table for all the classes which I got:**** > > ** ** > > Column type**** > > MySQL**** > > MS SQL Server**** > > Oracle**** > > DATE**** > > Date**** > > String**** > > Time**** > > TIME**** > > DateTime**** > > String**** > > ** ** > > DATETIME**** > > DateTime**** > > DateTime**** > > ** ** > > TIMESTAMP**** > > DateTime**** > > ** ** > > Time**** > > DATETIMEOFFSET**** > > ** ** > > String**** > > ** ** > > DATETIME2**** > > ** ** > > String**** > > ** ** > > SMALLDATETIME**** > > ** ** > > DateTime**** > > ** ** > > ** ** > > It will be great if we can use unified interface for all these column > types.**** > > ** ** > > Oliver**** > > _______________________________________________ > ruby-dbi-users mailing list > ruby-dbi-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/ruby-dbi-users > > -------------- next part -------------- An HTML attachment was scrubbed... URL: