Hi,

On Tue, May 22, 2012 at 10:00 AM, activa <[email protected]> wrote:

> It seems that SqliteDataReader.GetSchemaTable() doesn't return any key
> information ("IsKey","IsUnique", ...) in MonoTouch, while it does in Mono.
> The source code for GetSchemaTable contains the following:
>
> #if !MONOTOUCH
>         strColumn = 
> _command.Connection._sql.ColumnOriginalName(_activeStatement, n);
>         if (String.IsNullOrEmpty(strColumn) == false) 
> row[SchemaTableColumn.BaseColumnName] = strColumn;
>
>         row[SchemaTableColumn.IsExpression] = String.IsNullOrEmpty(strColumn);
>         row[SchemaTableColumn.IsAliased] = (String.Compare(GetName(n), 
> strColumn, true, CultureInfo.InvariantCulture) != 0);
>
>         temp = _command.Connection._sql.ColumnTableName(_activeStatement, n);
>         if (String.IsNullOrEmpty(temp) == false) 
> row[SchemaTableColumn.BaseTableName] = temp;
>
>         temp = _command.Connection._sql.ColumnDatabaseName(_activeStatement, 
> n);
>         if (String.IsNullOrEmpty(temp) == false) 
> row[SchemaTableOptionalColumn.BaseCatalogName] = temp;
> #endif
>
>         string dataType = null;
>         // If we have a table-bound column, extract the extra information 
> from it
>         if (String.IsNullOrEmpty(strColumn) == false)
>         {
>              // Determine key information....
>         }
>
> So it seems the code for determining the key information is explicitly
> removed for MonoTouch. Why is that? Is there any other way except by
> querying "pragma table_info()" ?


This is because the sqlite library included in iOS don't have support for
querying column metadata. You can still build your own libcustomsqlite.a
and use that instead (how to: http://stackoverflow.com/a/5602717/183422)

Rolf


>
> ------------------------------
> View this message in context: Key information not returned in
> GetSchemaTable()<http://monotouch.2284126.n4.nabble.com/Key-information-not-returned-in-GetSchemaTable-tp4649539.html>
> Sent from the MonoTouch mailing list 
> archive<http://monotouch.2284126.n4.nabble.com/>at Nabble.com.
>
> _______________________________________________
> MonoTouch mailing list
> [email protected]
> http://lists.ximian.com/mailman/listinfo/monotouch
>
>
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to