[Mono-dev] Problem with sqlite in mono 1.1.13
Joshua Tauberer
tauberer at for.net
Sun Jan 22 18:22:15 EST 2006
Aaron Bockover wrote:
> Wow. I'm not sure why this change was made, but in
> Mono.Data.SqliteClient/SqliteDataReader.cs, this happens now for columns
> declared as INT/INTEGER:
There was some confusion, I think either in bugzilla or on the mail
lists, about DATETIME columns returning strings or something, so I
figured that if you've declared a column as an INTEGER or DATETIME,
that's probably the type of data you're going to be putting into it.
Except, I realize now that there's no BIGINT equivalent in Sqlite.
It was sort of a compromise between doing what one would expect of any
data adapter versus doing exactly what Sqlite does.
So... I'll undo that. Do you think I should also undo string conversion
to DateTime for DATETIME columns?
--
- Joshua Tauberer
http://taubz.for.net
** Nothing Unreal Exists **
>
> ...
> data_row[i] = (int)Sqlite.sqlite3_column_int64 (pVm, i);
> ...
>
> An explicit cast from an Int64 to an Int32. So that change completely
> breaks compatibility with older databases.
>
> A local fix for you is to use the NUMBER column type instead of INTEGER
> if you need to store an Int64, though I do not agree with this change,
> and I bet this breaks my application too:
>
> 2006-01-02 Joshua Tauberer <xxxxx>
> ...
> * SqliteDataReader.cs:
> * Use object[] in place of ArrayList for each row.
> * For Sqlite3, which remembers whether a value was
> an integer, text, real, or blob, actually return
> longs, strings, doubles, and byte[]s.
> * GetDataTypeName() works where possible (Sqlite3).
> * INT/INTEGER columns are now returned as ints,
> rather than longs, for Sqlite3. Similarly for
> DATE and DATETIME columns, now returning DateTimes.
>
> I'll do some more probing of this issue.
>
> Cheers,
> Aaron Bockover
>
>
> On Sun, 2006-01-22 at 22:49 +0100, Fredrik Nilsson wrote:
>> Sorry, forgot to attach output of testcase:
>>
>> Value to store: 127824400782036290
>> Value in database: -2109895358
>>
>> /Fredrik Nilsson
>>
>>
>> Fredrik Nilsson wrote:
>>> Hi,
>>>
>>> I'm having problem with sqlite since mono version 1.1.13.
>>> Getting a long (Int64) value doesn't work anymore.
>>> I didn't have any problems with this in version 1.1.12.
>>>
>>> Small test case will follow.
>>>
>>> /Fredrik Nilsson
>>>
>>>
>>> using System;
>>> using Mono.Data.SqliteClient;
>>>
>>> class MainClass
>>> {
>>> public static void Main(string[] args)
>>> {
>>> long filetime = DateTime.Now.ToFileTime ();
>>>
>>> Console.WriteLine ("Value to store: " + filetime);
>>> SqliteCommand cmd = new SqliteCommand();
>>> SqliteConnection connection = new
>>> SqliteConnection(@"version=3,URI=file:test.db");
>>> connection.Open();
>>> cmd.Connection = connection;
>>> cmd.CommandText = "CREATE TABLE Test (Date INTEGER NOT NULL);";
>>> cmd.ExecuteNonQuery ();
>>>
>>> cmd = new SqliteCommand ();
>>> cmd.Connection = connection;
>>> cmd.CommandText = "INSERT INTO Test (Date) VALUES ('" +
>>> filetime + "');";
>>> cmd.ExecuteNonQuery ();
>>>
>>> cmd = new SqliteCommand ();
>>> cmd.Connection = connection;
>>> cmd.CommandText = "SELECT * FROM Test;";
>>> SqliteDataReader reader = cmd.ExecuteReader ();
>>> while (reader.Read ()) {
>>> Console.WriteLine ("Value in database: " + reader[0]);
>>> }
>>> connection.Close();
>>> }
>>> }
>>> _______________________________________________
>>> Mono-devel-list mailing list
>>> Mono-devel-list at lists.ximian.com
>>> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>>>
>> _______________________________________________
>> Mono-devel-list mailing list
>> Mono-devel-list at lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
More information about the Mono-devel-list
mailing list