[mono-android] SqliteDataReader.GetDataTypeName() returns .Net data type instead of native SQLite data type in 4.2.1

Jonathan Pryor jonp at xamarin.com
Wed Jun 6 20:45:42 UTC 2012


On May 29, 2012, at 6:24 AM, rwittev1 wrote:
> Version 4.2.2 has been released, but it's still not working. We're still getting "system.Byte[]".

I'm not able to reproduce (i.e. it works for me). Please see the attached project [0], which prints:

	I/mono-stdout(27309): TESTTABLE.DATA type name: blob 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Scratch.Sqlite.zip
Type: application/zip
Size: 10305 bytes
Desc: not available
URL: <http://lists.ximian.com/pipermail/monodroid/attachments/20120606/6ec411b4/attachment-0001.zip>
-------------- next part --------------


Thanks,
 - Jon

[0] The core logic of the test:

	protected override void OnCreate (Bundle bundle)
	{
		base.OnCreate (bundle);

		string dbPath = System.IO.Path.Combine(
				System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal),
				"testdb.db");
		bool exists = System.IO.File.Exists (dbPath);
		var cn = new SqliteConnection ("Data Source=" + dbPath);
		cn.Open ();
		if (exists) {
			WithCommand (cn, c => {
				c.CommandText = "DROP TABLE TESTTABLE";
				c.ExecuteNonQuery ();
			});
		}
		WithCommand(cn, c => {
			c.CommandText = "CREATE TABLE TESTTABLE (DATA blob not null)";
			c.ExecuteNonQuery ();
		});
		WithCommand (cn, c => {
			c.CommandText = "SELECT * FROM TESTTABLE";
			using (var r = c.ExecuteReader ()) {
				string typeName = r.GetDataTypeName(0);
				Console.WriteLine ("TESTTABLE.DATA type name: {0}", typeName);
			}
		});
	}

	static void WithCommand (SqliteConnection connection, Action<SqliteCommand> action)
	{
		using (var command = connection.CreateCommand ()) {
			action (command);
		}
	}



More information about the Monodroid mailing list