diff --git a/lib/dbd/sqlite3/statement.rb b/lib/dbd/sqlite3/statement.rb
index 7e3b41d..5ef03d3 100644
--- a/lib/dbd/sqlite3/statement.rb
+++ b/lib/dbd/sqlite3/statement.rb
@@ -44,21 +44,43 @@ class DBI::DBD::SQLite3::Statement < DBI::BaseStatement
             h = { 
               'name' => name,
               'type_name' => m[1],
-              'sql_type' => 
-                    begin
-                          DBI.const_get('SQL_'+m[1].upcase)
-                    rescue NameError
-                        DBI::SQL_OTHER
-                    end,
+              'sql_type' => nil,
             }
             h['precision'] = m[3].to_i if m[3]
             h['scale']     = m[5].to_i if m[5]
 
-            case h['type_name']
-            when 'double'
+            if h['type_name'].nil?
+              h['sql_type'] = DBI::SQL_OTHER;
+            else
+              type_downcase = h['type_name'].downcase
+              ## http://www.sqlite.org/datatype3.html (section 2.1)
+              if type_downcase =~ /int/
+                ## affinity INT
+                h['dbi_type'] = DBI::Type::Integer
+                h['sql_type'] = DBI::SQL_INTEGER;
+              elsif type_downcase =~ /char/ || type_downcase =~ /clob/ || type_downcase =~ /text/
+                ## affinity TEXT
+                h['dbi_type'] = DBI::Type::Varchar
+                h['sql_type'] = DBI::SQL_VARCHAR;
+              elsif type_downcase =~ /blob/
+                ## affinity NONE
+                h['dbi_type'] = DBI::Type::Varchar
+                h['sql_type'] = DBI::SQL_BLOB;
+              elsif type_downcase =~ /floa/ || type_downcase =~ /real/ || type_downcase =~ /doub/
+                ## affinity REAL
                 h['dbi_type'] = DBI::Type::Float
+                h['sql_type'] = DBI::SQL_DOUBLE;
+              else
+                ## affinity NUMERIC
+                #h['dbi_type'] = DBI::Type::Decimal
+                h['sql_type'] = begin
+                                  DBI.const_get('SQL_'+m[1].upcase)
+                                rescue NameError
+                                  h['dbi_type'] = DBI::Type::Decimal
+                                  DBI::SQL_NUMERIC
+                                end;
+              end
             end
-
             h
         }
     end
diff --git a/test/dbd/general/test_database.rb b/test/dbd/general/test_database.rb
index 3a977d5..30778d7 100644
--- a/test/dbd/general/test_database.rb
+++ b/test/dbd/general/test_database.rb
@@ -123,13 +123,13 @@
                 "views"
             ]
         end
-        
+        tables.reject! { |x| x =~ /^db_specific/ }
         case dbtype 
         when "postgresql"
             tables.reject! { |x| x =~ /^pg_/ }
-            assert_equal %w(array_test bit_test blob_test boolean_test bytea_test db_specific_types_test field_types_test names precision_test time_test timestamp_test view_names), tables
+            assert_equal %w(array_test bit_test blob_test boolean_test bytea_test  field_types_test names precision_test time_test timestamp_test view_names), tables
         else
-            assert_equal %w(bit_test blob_test boolean_test db_specific_types_test field_types_test names precision_test time_test timestamp_test view_names), tables
+            assert_equal %w(bit_test blob_test boolean_test field_types_test names precision_test time_test timestamp_test view_names), tables
         end
     end
 
diff --git a/test/dbd/sqlite3/test_statement.rb b/test/dbd/sqlite3/test_statement.rb
index 15650a2..a726672 100644
--- a/test/dbd/sqlite3/test_statement.rb
+++ b/test/dbd/sqlite3/test_statement.rb
@@ -42,12 +42,14 @@ class TestStatement < DBDConfig.testbase(:sqlite3)
             { 
                 :name  => "name",
                 :sql_type  => 12,
+                :dbi_type  => DBI::Type::Varchar,
                 :precision  => 255,
                 :type_name  => "varchar"
             }, 
             { 
                 :name  => "age",
                 :sql_type  => 4,
+                :dbi_type  => DBI::Type::Integer,
                 :type_name  => "integer"
             } 
         ], @sth.column_info
@@ -69,4 +71,79 @@ class TestStatement < DBDConfig.testbase(:sqlite3)
             @sth.finish
         end
     end
+
+    def test_affinity_text
+        assert_nothing_raised do
+            @sth = @dbh.prepare("insert into db_specific_affinity_text_test(achar, aclob, atext) values (?,?,?)")
+            @sth.execute("A char", "A clob", "A text")
+            @sth.finish
+        end
+
+        assert_nothing_raised do
+            @sth = @dbh.prepare("select * from db_specific_affinity_text_test")
+            @sth.execute
+            assert_equal(["A char", "A clob", "A text"], @sth.fetch)
+            @sth.finish
+        end
+    end
+
+    def test_affinity_numeric
+        assert_nothing_raised do
+            @sth = @dbh.prepare("insert into db_specific_affinity_numeric_test(anummeric) values (?)")
+            @sth.execute(3.14)
+            @sth.finish
+        end
+
+        assert_nothing_raised do
+            @sth = @dbh.prepare("select * from db_specific_affinity_numeric_test")
+            @sth.execute
+            assert_equal([3.14], @sth.fetch)
+            @sth.finish
+        end
+    end
+
+    def test_affinity_integer
+        assert_nothing_raised do
+            @sth = @dbh.prepare("insert into db_specific_affinity_integer_test(aint) values (?)")
+            @sth.execute(42)
+            @sth.finish
+        end
+
+        assert_nothing_raised do
+            @sth = @dbh.prepare("select * from db_specific_affinity_integer_test")
+            @sth.execute
+            assert_equal([42], @sth.fetch)
+            @sth.finish
+        end
+    end
+
+    def test_affinity_real
+        assert_nothing_raised do
+            @sth = @dbh.prepare("insert into db_specific_affinity_real_test(adbl, afloat, areal) values (?,?,?)")
+            @sth.execute(3.14, 3.14, 3.14)
+            @sth.finish
+        end
+
+        assert_nothing_raised do
+            @sth = @dbh.prepare("select * from db_specific_affinity_real_test")
+            @sth.execute
+            assert_equal([3.14, 3.14, 3.14], @sth.fetch)
+            @sth.finish
+        end
+    end
+
+    def test_affinity_none
+        assert_nothing_raised do
+            @sth = @dbh.prepare("insert into db_specific_affinity_none_test(ablob) values (?)")
+            @sth.execute("blob")
+            @sth.finish
+        end
+
+        assert_nothing_raised do
+            @sth = @dbh.prepare("select * from db_specific_affinity_none_test")
+            @sth.execute
+            assert_equal(["blob"], @sth.fetch)
+            @sth.finish
+        end
+    end
 end
diff --git a/test/dbd/sqlite3/up.sql b/test/dbd/sqlite3/up.sql
index 326cfc9..e533958 100644
--- a/test/dbd/sqlite3/up.sql
+++ b/test/dbd/sqlite3/up.sql
@@ -23,3 +23,13 @@ create table bit_test (mybit bit);
 create table field_types_test (foo integer not null primary key default 1);
 ---
 create table db_specific_types_test (dbl double);
+--- 
+create table db_specific_affinity_text_test (achar mychartype, aclob myclobtype, atext mychartype);
+---
+create table db_specific_affinity_numeric_test (anummeric mynummerictype);
+---
+create table db_specific_affinity_integer_test (aint myinttype);
+---
+create table db_specific_affinity_real_test (adbl mydoubtype, afloat myfloatype, areal myrealtype);
+---
+create table db_specific_affinity_none_test (ablob myblobtype);
