We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I'm trying to use version 3.7.7.1 and encountered problem that GetShemaTable reports wrong types: var provider = SqliteClientFactory.Instance; var loader = new DataTableLoader(); using (var connection = provider.CreateConnection()) { connection.ConnectionString = "data source=:memory:"; connection.Open(); using (var cmd = connection.CreateCommand()) { cmd.CommandText = "SELECT CAST(1 AS INTEGER) AS INTCOL, CAST(1.0 AS REAL) AS DOUBLECOL, '1' AS STRINGCOL"; using (var reader = cmd.ExecuteReader()) { Assert.AreEqual(typeof(long), reader.GetFieldType(0)); Assert.AreEqual(typeof(double), reader.GetFieldType(1)); Assert.AreEqual(typeof(string), reader.GetFieldType(2)); var schema = reader.GetSchemaTable(); Assert.AreEqual(typeof(long), (Type)schema.Rows[0][SchemaTableColumn.DataType]); Assert.AreEqual(typeof(double), (Type)schema.Rows[1][SchemaTableColumn.DataType]); Assert.AreEqual(typeof(string), (Type)schema.Rows[2][SchemaTableColumn.DataType]); } } } I've checked the code and indeed 'DataType' columns value is 'hard-coded': <from Community.CsharpSqlite.SQLiteClient.SqliteDataReader.GetSchemaTable> ... for (int i = 0; i < this.FieldCount; i++) { DataRow dataRow = dataTable.NewRow(); dataRow["ColumnName"] = this.columns[i]; dataRow["ColumnOrdinal"] = i; dataRow["ColumnSize"] = 0; dataRow["NumericPrecision"] = 0; dataRow["NumericScale"] = 0; dataRow["IsUnique"] = false; dataRow["IsKey"] = false; dataRow["BaseCatalogName"] = ""; dataRow["BaseColumnName"] = this.columns[i]; dataRow["BaseSchemaName"] = ""; dataRow["BaseTableName"] = ""; dataRow["DataType"] = typeof(string); dataRow["AllowDBNull"] = true; dataRow["ProviderType"] = 0; dataRow["IsAliased"] = false; dataRow["IsExpression"] = false; dataRow["IsIdentity"] = false; dataRow["IsAutoIncrement"] = false; dataRow["IsRowVersion"] = false; dataRow["IsHidden"] = false; dataRow["IsLong"] = false; dataRow["IsReadOnly"] = false; dataTable.Rows.Add(dataRow); dataRow.AcceptChanges(); } ... This makes new DataTable().Load(reader) to create table with string columns and makes it unusable for any purposes.
Original issue reported on code.google.com by [email protected] on 14 May 2014 at 11:13
[email protected]
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Original issue reported on code.google.com by
[email protected]
on 14 May 2014 at 11:13The text was updated successfully, but these errors were encountered: