Patches: Browse | Submit New | Admin

[#22132] dbd-sqlite3 returns strings even when type is double

Date:
2008-09-23 13:28
Priority:
3
Submitted By:
Jarl Friis (jarl)
Assigned To:
Nobody (None)
Category:
DBD::SQLite3
State:
Open
Summary:
dbd-sqlite3 returns strings even when type is double

Detailed description
when fetching data from a SQLite3 database using dbh.select_all I get all columns as strings, even though some of them
are numbers (double)

using rubygems dbd-sqlite3 (1.2.2) and dbi 0.4.0

Add A Comment: Notepad

Please login


Followup

Message
Date: 2008-11-28 10:56
Sender: Erik Hollensbe

Jarl,

I've tried with both a prepared statement and select_all, and
I can't recreate this bug. Can you confirm it still exists with
the latest driver?
Date: 2008-10-06 09:42
Sender: Jarl Friis

The tests (in the patch) demonstrates the issues...
Date: 2008-10-03 02:54
Sender: Erik Hollensbe

Moving this to the patches tracker.
Date: 2008-09-29 13:51
Sender: Erik Hollensbe

Actually, it was released on 27/09/2008.

As for your other additions, lets discuss those on the -users
list, as that will be a better place for them than this report.

Closing this bug.
Date: 2008-09-29 13:24
Sender: Jarl Friis

I will propose the following patch to implement types more 
closely to the affinities described in sectino 2.1 on
http://www.sqlite.org/datatype3.html

I have further introduced ignorings of tables prefixed 
with "db_specific", such that any tables prefixed with
this is ignored in the general test for list of tables.

Hope you like the patch and will include it.
Date: 2008-09-29 09:36
Sender: Jarl Friis

I just made a git pull. Thanks a lot, it looks like what I 
was looking for.

I also figured out the rake test, but ran into failures in 
PG driver and was grabed by fixing it (see patch #22219)

Can't wait to see this issue being released.
Date: 2008-09-29 08:06
Sender: Jarl Friis

What is the latest "master bracnh"? I have done "git
clone
git://rubyforge.org/ruby-dbi.git" is that what you mean?
Date: 2008-09-27 21:45
Sender: Erik Hollensbe

This should be fixed in the latest master branch, pull the changes
and test if you want. I expect to release these changes later
today as new DBDs, and I'll close the ticket at that point.
Date: 2008-09-27 02:20
Sender: Erik Hollensbe

Sorry I missed this, my mailbox as of late has been a mess and
I started at a new job this week.

Anyways, I'll try and look into it this weekend, and hopefully
get a patch out for the issue. If you want to know how to setup
the DBD tests, there should be a file named test/DBD_TESTS that
explains how to setup a yaml file that will run the DBD tests
against the databases you choose (both DBD type and literal database).
You can run 'rake test' to run the whole (DBI and DBD) test suite,
or rake 'test_dbd' to just run the DBD tests. rake 'test_dbi'
does what you expect. :)

If it's unclear, let me know what's confusing and I'll clean
it up, mostly me and 1-2 other people have been running those
tests in different environments.

Thanks again for your report.
Date: 2008-09-24 08:46
Sender: Jarl Friis

If you change the up.sql (under test)
to
create table names (name varchar(255), age double);

you will experience problems, i.e. test will fail.

I had plans on adding a column for each sqlite3 type 
affinity: TEXT, NUMERIC, INTEGER, REAL, NONE (see 
http://www.sqlite.org/datatype3.html) in the tests, and 
then fix the driver to handle these correctly, but as a 
completely newbie ruby guy I got stock after git pulling 
the source code.

An example of a table having all 5 affinities could be
create table names (name varchar(255), age integer, height 
double, photo BLOB, wealth numeric);

Could some one tell me the steps after git pulling the 
source code what to do to run the tests?
Date: 2008-09-24 02:01
Sender: Erik Hollensbe

Can you give me a description of the table? Feel free to change
the column names; the types (the exact definition) are what are
important.

Attached Files:

Name Description Download
sqlite3_affinity.patch affinity patch Download
sqlite3_affinity-2.patch sqlite3 affinity patch Download

Changes:

Field Old Value Date By
category_idNone2008-11-09 12:36erikh
File Added4082: sqlite3_affinity-2.patch2008-10-06 09:42jarl
status_idClosed2008-10-03 02:54erikh
artifact_group_idDBD2008-10-03 02:54erikh
status_idOpen2008-09-29 13:51erikh
close_date2008-09-29 13:512008-09-29 13:51erikh
File Added4066: sqlite3_affinity.patch2008-09-29 13:24jarl