Skip to content

Instantly share code, notes, and snippets.

@donv
Created March 10, 2011 08:14
Show Gist options
  • Save donv/863739 to your computer and use it in GitHub Desktop.
Save donv/863739 to your computer and use it in GitHub Desktop.
SqldroidConnection con;
private PreparedStatement getTypeInfo = null;
public ResultSet getTypeInfo() throws SQLException {
if (getTypeInfo == null) {
getTypeInfo = con.prepareStatement(
"select "
+ "tn as TYPE_NAME, "
+ "dt as DATA_TYPE, "
+ "0 as PRECISION, "
+ "null as LITERAL_PREFIX, "
+ "null as LITERAL_SUFFIX, "
+ "null as CREATE_PARAMS, "
+ typeNullable + " as NULLABLE, "
+ "1 as CASE_SENSITIVE, "
+ typeSearchable + " as SEARCHABLE, "
+ "0 as UNSIGNED_ATTRIBUTE, "
+ "0 as FIXED_PREC_SCALE, "
+ "0 as AUTO_INCREMENT, "
+ "null as LOCAL_TYPE_NAME, "
+ "0 as MINIMUM_SCALE, "
+ "0 as MAXIMUM_SCALE, "
+ "0 as SQL_DATA_TYPE, "
+ "0 as SQL_DATETIME_SUB, "
+ "10 as NUM_PREC_RADIX from ("
+ " select 'BLOB' as tn, " + Types.BLOB + " as dt union"
+ " select 'NULL' as tn, " + Types.NULL + " as dt union"
+ " select 'REAL' as tn, " + Types.REAL+ " as dt union"
+ " select 'TEXT' as tn, " + Types.VARCHAR + " as dt union"
+ " select 'INTEGER' as tn, "+ Types.INTEGER +" as dt"
+ ") order by TYPE_NAME"
);
}
getTypeInfo.clearParameters();
return getTypeInfo.executeQuery();
}
@jeremyd
Copy link

jeremyd commented Mar 10, 2011

sqlite returned: error code = 1, msg = no such column: tn
E/Database( 663): Failure 1 (no such column: tn) on 0x2ac040 when preparing 'select tn as TYPE_NAME, dt as DATA_TYPE, 0 as PRECISION, null as LITERAL_PREFIX, null as LITERAL_SUFFIX, null as CREATE_PARAMS, 1 as CASE_SENSITIVE, 0 as UNSIGNED_ATTRIBUTE, 0 as FIXED_PREC_SCALE, 0 as AUTO_INCREMENT, null as LOCAL_TYPE_NAME, 0 as MINIMUM_SCALE, 0 as MAXIMUM_SCALE, 0 as SQL_DATA_TYPE, 0 as SQL_DATETIME_SUB order by TYPE_NAME'.
W/System.err( 663): android/database/sqlite/SQLiteDatabase.java:-2:in native_execSQL': android.database.sqlite.SQLiteException: no such column: tn: select tn as TYPE_NAME, dt as DATA_TYPE, 0 as PRECISION, null as LITERAL_PREFIX, null as LITERAL_SUFFIX, null as CREATE_PARAMS, 1 as CASE_SENSITIVE, 0 as UNSIGNED_ATTRIBUTE, 0 as FIXED_PREC_SCALE, 0 as AUTO_INCREMENT, null as LOCAL_TYPE_NAME, 0 as MINIMUM_SCALE, 0 as MAXIMUM_SCALE, 0 as SQL_DATA_TYPE, 0 as SQL_DATETIME_SUB order by TYPE_NAME (NativeException) W/System.err( 663): from android/database/sqlite/SQLiteDatabase.java:1727:inexecSQL'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment