JDBCDatabaseMetaDatapublic class JDBCDatabaseMetaData extends Object implements DatabaseMetaData
Fields Summary |
---|
private JDBCConnection | conn |
Constructors Summary |
---|
public JDBCDatabaseMetaData(JDBCConnection conn)
this.conn = conn;
|
Methods Summary |
---|
public boolean | allProceduresAreCallable()
return false;
| public boolean | allTablesAreSelectable()
return true;
| public boolean | dataDefinitionCausesTransactionCommit()
return false;
| public boolean | dataDefinitionIgnoredInTransactions()
return false;
| public boolean | deletesAreDetected(int type)
return false;
| public boolean | doesMaxRowSizeIncludeBlobs()
return true;
| public java.sql.ResultSet | getAttributes(java.lang.String catalog, java.lang.String schemaPattern, java.lang.String typeNamePattern, java.lang.String attributeNamePattern)
throw new SQLException("not supported");
| public java.sql.ResultSet | getBestRowIdentifier(java.lang.String catalog, java.lang.String schema, java.lang.String table, int scope, boolean nullable)
JDBCStatement s0 = new JDBCStatement(conn);
JDBCResultSet rs0 = null;
JDBCStatement s1 = new JDBCStatement(conn);
JDBCResultSet rs1 = null;
try {
rs0 = (JDBCResultSet)
(s0.executeQuery("PRAGMA index_list(" +
SQLite.Shell.sql_quote(table) + ")"));
rs1 = (JDBCResultSet)
(s1.executeQuery("PRAGMA table_info(" +
SQLite.Shell.sql_quote(table) + ")"));
} catch (SQLException e) {
throw e;
} finally {
s0.close();
s1.close();
}
String cols[] = {
"SCOPE", "COLUMN_NAME", "DATA_TYPE",
"TYPE_NAME", "COLUMN_SIZE", "BUFFER_LENGTH",
"DECIMAL_DIGITS", "PSEUDO_COLUMN"
};
int types[] = {
Types.SMALLINT, Types.VARCHAR, Types.SMALLINT,
Types.VARCHAR, Types.INTEGER, Types.INTEGER,
Types.SMALLINT, Types.SMALLINT
};
TableResultX tr = new TableResultX();
tr.columns(cols);
tr.sql_types(types);
JDBCResultSet rs = new JDBCResultSet((SQLite.TableResult) tr, null);
if (rs0 != null && rs0.tr != null && rs0.tr.nrows > 0 &&
rs1 != null && rs1.tr != null && rs1.tr.nrows > 0) {
Hashtable<String, Integer> h0 = new Hashtable<String, Integer>();
for (int i = 0; i < rs0.tr.ncolumns; i++) {
h0.put(rs0.tr.column[i], new Integer(i));
}
Hashtable<String, Integer> h1 = new Hashtable<String, Integer>();
for (int i = 0; i < rs1.tr.ncolumns; i++) {
h1.put(rs1.tr.column[i], new Integer(i));
}
for (int i = 0; i < rs0.tr.nrows; i++) {
String r0[] = (String [])(rs0.tr.rows.elementAt(i));
int col = ((Integer) h0.get("unique")).intValue();
String uniq = r0[col];
col = ((Integer) h0.get("name")).intValue();
String iname = r0[col];
if (uniq.charAt(0) == '0") {
continue;
}
JDBCStatement s2 = new JDBCStatement(conn);
JDBCResultSet rs2 = null;
try {
rs2 = (JDBCResultSet)
(s2.executeQuery("PRAGMA index_info(" +
SQLite.Shell.sql_quote(iname) + ")"));
} catch (SQLException e) {
} finally {
s2.close();
}
if (rs2 == null || rs2.tr == null || rs2.tr.nrows <= 0) {
continue;
}
Hashtable<String, Integer> h2 =
new Hashtable<String, Integer>();
for (int k = 0; k < rs2.tr.ncolumns; k++) {
h2.put(rs2.tr.column[k], new Integer(k));
}
for (int k = 0; k < rs2.tr.nrows; k++) {
String r2[] = (String [])(rs2.tr.rows.elementAt(k));
col = ((Integer) h2.get("name")).intValue();
String cname = r2[col];
for (int m = 0; m < rs1.tr.nrows; m++) {
String r1[] = (String [])(rs1.tr.rows.elementAt(m));
col = ((Integer) h1.get("name")).intValue();
if (cname.compareTo(r1[col]) == 0) {
String row[] = new String[cols.length];
row[0] = "" + scope;
row[1] = cname;
row[2] = "" + Types.VARCHAR;
row[3] = "VARCHAR";
row[4] = "65536";
row[5] = "0";
row[6] = "0";
row[7] = "" + bestRowNotPseudo;
tr.newrow(row);
}
}
}
}
}
if (tr.nrows <= 0) {
String row[] = new String[cols.length];
row[0] = "" + scope;
row[1] = "_ROWID_";
row[2] = "" + Types.INTEGER;
row[3] = "INTEGER";
row[4] = "10";
row[5] = "0";
row[6] = "0";
row[7] = "" + bestRowPseudo;
tr.newrow(row);
}
return rs;
| public java.lang.String | getCatalogSeparator()
return "";
| public java.lang.String | getCatalogTerm()
return "";
| public java.sql.ResultSet | getCatalogs()
String cols[] = { "TABLE_CAT" };
SQLite.TableResult tr = new SQLite.TableResult();
tr.columns(cols);
String row[] = { "" };
tr.newrow(row);
JDBCResultSet rs = new JDBCResultSet(tr, null);
return (ResultSet) rs;
| public java.sql.ResultSet | getColumnPrivileges(java.lang.String catalog, java.lang.String schema, java.lang.String table, java.lang.String columnNamePattern)
String cols[] = {
"TABLE_CAT", "TABLE_SCHEM", "TABLE_NAME",
"COLUMN_NAME", "GRANTOR", "GRANTEE",
"PRIVILEGE", "IS_GRANTABLE"
};
int types[] = {
Types.VARCHAR, Types.VARCHAR, Types.VARCHAR,
Types.VARCHAR, Types.VARCHAR, Types.VARCHAR,
Types.VARCHAR, Types.VARCHAR
};
TableResultX tr = new TableResultX();
tr.columns(cols);
tr.sql_types(types);
JDBCResultSet rs = new JDBCResultSet((SQLite.TableResult) tr, null);
return rs;
| public java.sql.ResultSet | getColumns(java.lang.String catalog, java.lang.String schemaPattern, java.lang.String tableNamePattern, java.lang.String columnNamePattern)
JDBCStatement s = new JDBCStatement(conn);
JDBCResultSet rs0 = null;
try {
rs0 = (JDBCResultSet)
(s.executeQuery("PRAGMA table_info(" +
SQLite.Shell.sql_quote(tableNamePattern) +
")"));
s.close();
} catch (SQLException e) {
throw e;
} finally {
s.close();
}
String cols[] = {
"TABLE_CAT", "TABLE_SCHEM", "TABLE_NAME",
"COLUMN_NAME", "DATA_TYPE", "TYPE_NAME",
"COLUMN_SIZE", "BUFFER_LENGTH", "DECIMAL_POINTS",
"NUM_PREC_RADIX", "NULLABLE", "REMARKS",
"COLUMN_DEF", "SQL_DATA_TYPE", "SQL_DATETIME_SUB",
"CHAR_OCTET_LENGTH", "ORDINAL_POSITION", "IS_NULLABLE"
};
int types[] = {
Types.VARCHAR, Types.VARCHAR, Types.VARCHAR,
Types.VARCHAR, Types.SMALLINT, Types.VARCHAR,
Types.INTEGER, Types.INTEGER, Types.INTEGER,
Types.INTEGER, Types.INTEGER, Types.VARCHAR,
Types.VARCHAR, Types.INTEGER, Types.INTEGER,
Types.INTEGER, Types.INTEGER, Types.VARCHAR
};
TableResultX tr = new TableResultX();
tr.columns(cols);
tr.sql_types(types);
JDBCResultSet rs = new JDBCResultSet((SQLite.TableResult) tr, null);
if (rs0 != null && rs0.tr != null && rs0.tr.nrows > 0) {
Hashtable<String, Integer> h = new Hashtable<String, Integer>();
for (int i = 0; i < rs0.tr.ncolumns; i++) {
h.put(rs0.tr.column[i], new Integer(i));
}
if (columnNamePattern != null &&
columnNamePattern.charAt(0) == '%") {
columnNamePattern = null;
}
for (int i = 0; i < rs0.tr.nrows; i++) {
String r0[] = (String [])(rs0.tr.rows.elementAt(i));
int col = ((Integer) h.get("name")).intValue();
if (columnNamePattern != null) {
if (r0[col].compareTo(columnNamePattern) != 0) {
continue;
}
}
String row[] = new String[cols.length];
row[0] = "";
row[1] = "";
row[2] = tableNamePattern;
row[3] = r0[col];
col = ((Integer) h.get("type")).intValue();
String typeStr = r0[col];
int type = mapSqlType(typeStr);
row[4] = "" + type;
row[5] = mapTypeName(type);
row[6] = "" + getD(typeStr, type);
row[7] = "" + getM(typeStr, type);
row[8] = "10";
row[9] = "0";
row[11] = null;
col = ((Integer) h.get("dflt_value")).intValue();
row[12] = r0[col];
row[13] = "0";
row[14] = "0";
row[15] = "65536";
col = ((Integer) h.get("cid")).intValue();
Integer cid = new Integer(r0[col]);
row[16] = "" + (cid.intValue() + 1);
col = ((Integer) h.get("notnull")).intValue();
row[17] = (r0[col].charAt(0) == '0") ? "YES" : "NO";
row[10] = (r0[col].charAt(0) == '0") ? "" + columnNullable :
"" + columnNoNulls;
tr.newrow(row);
}
}
return rs;
| public java.sql.Connection | getConnection()
return conn;
| public java.sql.ResultSet | getCrossReference(java.lang.String primaryCatalog, java.lang.String primarySchema, java.lang.String primaryTable, java.lang.String foreignCatalog, java.lang.String foreignSchema, java.lang.String foreignTable)
JDBCResultSet rs0 = null;
if (foreignTable != null && foreignTable.charAt(0) != '%") {
JDBCStatement s0 = new JDBCStatement(conn);
try {
rs0 = (JDBCResultSet)
(s0.executeQuery("PRAGMA foreign_key_list(" +
SQLite.Shell.sql_quote(foreignTable) + ")"));
} catch (SQLException e) {
throw e;
} finally {
s0.close();
}
}
String cols[] = {
"PKTABLE_CAT", "PKTABLE_SCHEM", "PKTABLE_NAME",
"PKCOLUMN_NAME", "FKTABLE_CAT", "FKTABLE_SCHEM",
"FKTABLE_NAME", "FKCOLUMN_NAME", "KEY_SEQ",
"UPDATE_RULE", "DELETE_RULE", "FK_NAME",
"PK_NAME", "DEFERRABILITY"
};
int types[] = {
Types.VARCHAR, Types.VARCHAR, Types.VARCHAR,
Types.VARCHAR, Types.VARCHAR, Types.VARCHAR,
Types.VARCHAR, Types.VARCHAR, Types.SMALLINT,
Types.SMALLINT, Types.SMALLINT, Types.VARCHAR,
Types.VARCHAR, Types.SMALLINT
};
TableResultX tr = new TableResultX();
tr.columns(cols);
tr.sql_types(types);
JDBCResultSet rs = new JDBCResultSet(tr, null);
if (rs0 != null && rs0.tr != null && rs0.tr.nrows > 0) {
String pktable = null;
if (primaryTable != null && primaryTable.charAt(0) != '%") {
pktable = primaryTable;
}
internalImportedKeys(foreignTable, pktable, rs0, tr);
}
return rs;
| static int | getD(java.lang.String typeStr, int type)
int d = 0;
switch (type) {
case Types.INTEGER: d = 10; break;
case Types.SMALLINT: d = 5; break;
case Types.FLOAT: d = 24; break;
case Types.DOUBLE: d = 53; break;
default: return getM(typeStr, type);
}
typeStr = typeStr.toLowerCase();
int i1 = typeStr.indexOf('(");
if (i1 > 0) {
++i1;
int i2 = typeStr.indexOf(',", i1);
if (i2 < 0) {
return getM(typeStr, type);
}
i1 = i2;
i2 = typeStr.indexOf(')", i1);
if (i2 - i1 > 0) {
String num = typeStr.substring(i1, i2);
try {
d = java.lang.Integer.parseInt(num, 10);
} catch (NumberFormatException e) {
}
}
}
return d;
| public int | getDatabaseMajorVersion()
return SQLite.JDBCDriver.MAJORVERSION;
| public int | getDatabaseMinorVersion()
return SQLite.JDBCDriver.MINORVERSION;
| public java.lang.String | getDatabaseProductName()
return "SQLite";
| public java.lang.String | getDatabaseProductVersion()
return SQLite.Database.version();
| public int | getDefaultTransactionIsolation()
return Connection.TRANSACTION_SERIALIZABLE;
| public int | getDriverMajorVersion()
return SQLite.JDBCDriver.MAJORVERSION;
| public int | getDriverMinorVersion()
return SQLite.JDBCDriver.MINORVERSION;
| public java.lang.String | getDriverName()
return "SQLite/JDBC";
| public java.lang.String | getDriverVersion()
return "" + SQLite.JDBCDriver.MAJORVERSION + "." +
SQLite.JDBCDriver.MINORVERSION;
| public java.sql.ResultSet | getExportedKeys(java.lang.String catalog, java.lang.String schema, java.lang.String table)
String cols[] = {
"PKTABLE_CAT", "PKTABLE_SCHEM", "PKTABLE_NAME",
"PKCOLUMN_NAME", "FKTABLE_CAT", "FKTABLE_SCHEM",
"FKTABLE_NAME", "FKCOLUMN_NAME", "KEY_SEQ",
"UPDATE_RULE", "DELETE_RULE", "FK_NAME",
"PK_NAME", "DEFERRABILITY"
};
int types[] = {
Types.VARCHAR, Types.VARCHAR, Types.VARCHAR,
Types.VARCHAR, Types.VARCHAR, Types.VARCHAR,
Types.VARCHAR, Types.VARCHAR, Types.SMALLINT,
Types.SMALLINT, Types.SMALLINT, Types.VARCHAR,
Types.VARCHAR, Types.SMALLINT
};
TableResultX tr = new TableResultX();
tr.columns(cols);
tr.sql_types(types);
JDBCResultSet rs = new JDBCResultSet(tr, null);
return rs;
| public java.lang.String | getExtraNameCharacters()
return "";
| public java.lang.String | getIdentifierQuoteString()
return "\"";
| public java.sql.ResultSet | getImportedKeys(java.lang.String catalog, java.lang.String schema, java.lang.String table)
JDBCStatement s0 = new JDBCStatement(conn);
JDBCResultSet rs0 = null;
try {
rs0 = (JDBCResultSet)
(s0.executeQuery("PRAGMA foreign_key_list(" +
SQLite.Shell.sql_quote(table) + ")"));
} catch (SQLException e) {
throw e;
} finally {
s0.close();
}
String cols[] = {
"PKTABLE_CAT", "PKTABLE_SCHEM", "PKTABLE_NAME",
"PKCOLUMN_NAME", "FKTABLE_CAT", "FKTABLE_SCHEM",
"FKTABLE_NAME", "FKCOLUMN_NAME", "KEY_SEQ",
"UPDATE_RULE", "DELETE_RULE", "FK_NAME",
"PK_NAME", "DEFERRABILITY"
};
int types[] = {
Types.VARCHAR, Types.VARCHAR, Types.VARCHAR,
Types.VARCHAR, Types.VARCHAR, Types.VARCHAR,
Types.VARCHAR, Types.VARCHAR, Types.SMALLINT,
Types.SMALLINT, Types.SMALLINT, Types.VARCHAR,
Types.VARCHAR, Types.SMALLINT
};
TableResultX tr = new TableResultX();
tr.columns(cols);
tr.sql_types(types);
JDBCResultSet rs = new JDBCResultSet((SQLite.TableResult) tr, null);
if (rs0 != null && rs0.tr != null && rs0.tr.nrows > 0) {
internalImportedKeys(table, null, rs0, tr);
}
return rs;
| public java.sql.ResultSet | getIndexInfo(java.lang.String catalog, java.lang.String schema, java.lang.String table, boolean unique, boolean approximate)
JDBCStatement s0 = new JDBCStatement(conn);
JDBCResultSet rs0 = null;
try {
rs0 = (JDBCResultSet)
(s0.executeQuery("PRAGMA index_list(" +
SQLite.Shell.sql_quote(table) + ")"));
} catch (SQLException e) {
throw e;
} finally {
s0.close();
}
String cols[] = {
"TABLE_CAT", "TABLE_SCHEM", "TABLE_NAME",
"NON_UNIQUE", "INDEX_QUALIFIER", "INDEX_NAME",
"TYPE", "ORDINAL_POSITION", "COLUMN_NAME",
"ASC_OR_DESC", "CARDINALITY", "PAGES",
"FILTER_CONDITION"
};
int types[] = {
Types.VARCHAR, Types.VARCHAR, Types.VARCHAR,
Types.BIT, Types.VARCHAR, Types.VARCHAR,
Types.SMALLINT, Types.SMALLINT, Types.VARCHAR,
Types.VARCHAR, Types.INTEGER, Types.INTEGER,
Types.VARCHAR
};
TableResultX tr = new TableResultX();
tr.columns(cols);
tr.sql_types(types);
JDBCResultSet rs = new JDBCResultSet(tr, null);
if (rs0 != null && rs0.tr != null && rs0.tr.nrows > 0) {
Hashtable<String, Integer> h0 = new Hashtable<String, Integer>();
for (int i = 0; i < rs0.tr.ncolumns; i++) {
h0.put(rs0.tr.column[i], new Integer(i));
}
for (int i = 0; i < rs0.tr.nrows; i++) {
String r0[] = (String [])(rs0.tr.rows.elementAt(i));
int col = ((Integer) h0.get("unique")).intValue();
String uniq = r0[col];
col = ((Integer) h0.get("name")).intValue();
String iname = r0[col];
if (unique && uniq.charAt(0) == '0") {
continue;
}
JDBCStatement s1 = new JDBCStatement(conn);
JDBCResultSet rs1 = null;
try {
rs1 = (JDBCResultSet)
(s1.executeQuery("PRAGMA index_info(" +
SQLite.Shell.sql_quote(iname) + ")"));
} catch (SQLException e) {
} finally {
s1.close();
}
if (rs1 == null || rs1.tr == null || rs1.tr.nrows <= 0) {
continue;
}
Hashtable<String, Integer> h1 =
new Hashtable<String, Integer>();
for (int k = 0; k < rs1.tr.ncolumns; k++) {
h1.put(rs1.tr.column[k], new Integer(k));
}
for (int k = 0; k < rs1.tr.nrows; k++) {
String r1[] = (String [])(rs1.tr.rows.elementAt(k));
String row[] = new String[cols.length];
row[0] = "";
row[1] = "";
row[2] = table;
row[3] = (uniq.charAt(0) != '0" ||
(iname.charAt(0) == '(" &&
iname.indexOf(" autoindex ") > 0)) ? "0" : "1";
row[4] = "";
row[5] = iname;
row[6] = "" + tableIndexOther;
col = ((Integer) h1.get("seqno")).intValue();
// BEGIN android-changed
row[7] = "" + (Integer.parseInt(r1[col]) + 1);
// END android-changed
col = ((Integer) h1.get("name")).intValue();
row[8] = r1[col];
row[9] = "A";
row[10] = "0";
row[11] = "0";
row[12] = null;
tr.newrow(row);
}
}
}
return rs;
| public int | getJDBCMajorVersion()
return 1;
| public int | getJDBCMinorVersion()
return 0;
| static int | getM(java.lang.String typeStr, int type)
int m = 65536;
switch (type) {
case Types.INTEGER: m = 11; break;
case Types.SMALLINT: m = 6; break;
case Types.FLOAT: m = 25; break;
case Types.DOUBLE: m = 54; break;
case Types.TIMESTAMP: return 30;
case Types.DATE: return 10;
case Types.TIME: return 8;
}
typeStr = typeStr.toLowerCase();
int i1 = typeStr.indexOf('(");
if (i1 > 0) {
++i1;
int i2 = typeStr.indexOf(',", i1);
if (i2 < 0) {
i2 = typeStr.indexOf(')", i1);
}
if (i2 - i1 > 0) {
String num = typeStr.substring(i1, i2);
try {
m = java.lang.Integer.parseInt(num, 10);
} catch (NumberFormatException e) {
}
}
}
return m;
| public int | getMaxBinaryLiteralLength()
return 0;
| public int | getMaxCatalogNameLength()
return 0;
| public int | getMaxCharLiteralLength()
return 0;
| public int | getMaxColumnNameLength()
return 0;
| public int | getMaxColumnsInGroupBy()
return 0;
| public int | getMaxColumnsInIndex()
return 0;
| public int | getMaxColumnsInOrderBy()
return 0;
| public int | getMaxColumnsInSelect()
return 0;
| public int | getMaxColumnsInTable()
return 0;
| public int | getMaxConnections()
return 0;
| public int | getMaxCursorNameLength()
return 8;
| public int | getMaxIndexLength()
return 0;
| public int | getMaxProcedureNameLength()
return 0;
| public int | getMaxRowSize()
return 0;
| public int | getMaxSchemaNameLength()
return 0;
| public int | getMaxStatementLength()
return 0;
| public int | getMaxStatements()
return 0;
| public int | getMaxTableNameLength()
return 0;
| public int | getMaxTablesInSelect()
return 0;
| public int | getMaxUserNameLength()
return 0;
| public java.lang.String | getNumericFunctions()
return "";
| public java.sql.ResultSet | getPrimaryKeys(java.lang.String catalog, java.lang.String schema, java.lang.String table)
JDBCStatement s0 = new JDBCStatement(conn);
JDBCResultSet rs0 = null;
try {
rs0 = (JDBCResultSet)
(s0.executeQuery("PRAGMA index_list(" +
SQLite.Shell.sql_quote(table) + ")"));
} catch (SQLException e) {
throw e;
} finally {
s0.close();
}
String cols[] = {
"TABLE_CAT", "TABLE_SCHEM", "TABLE_NAME",
"COLUMN_NAME", "KEY_SEQ", "PK_NAME"
};
int types[] = {
Types.VARCHAR, Types.VARCHAR, Types.VARCHAR,
Types.VARCHAR, Types.SMALLINT, Types.VARCHAR
};
TableResultX tr = new TableResultX();
tr.columns(cols);
tr.sql_types(types);
JDBCResultSet rs = new JDBCResultSet((SQLite.TableResult) tr, null);
if (rs0 != null && rs0.tr != null && rs0.tr.nrows > 0) {
Hashtable<String, Integer> h0 = new Hashtable<String, Integer>();
for (int i = 0; i < rs0.tr.ncolumns; i++) {
h0.put(rs0.tr.column[i], new Integer(i));
}
for (int i = 0; i < rs0.tr.nrows; i++) {
String r0[] = (String [])(rs0.tr.rows.elementAt(i));
int col = ((Integer) h0.get("unique")).intValue();
String uniq = r0[col];
col = ((Integer) h0.get("name")).intValue();
String iname = r0[col];
if (uniq.charAt(0) == '0") {
continue;
}
JDBCStatement s1 = new JDBCStatement(conn);
JDBCResultSet rs1 = null;
try {
rs1 = (JDBCResultSet)
(s1.executeQuery("PRAGMA index_info(" +
SQLite.Shell.sql_quote(iname) + ")"));
} catch (SQLException e) {
} finally {
s1.close();
}
if (rs1 == null || rs1.tr == null || rs1.tr.nrows <= 0) {
continue;
}
Hashtable<String, Integer> h1 =
new Hashtable<String, Integer>();
for (int k = 0; k < rs1.tr.ncolumns; k++) {
h1.put(rs1.tr.column[k], new Integer(k));
}
for (int k = 0; k < rs1.tr.nrows; k++) {
String r1[] = (String [])(rs1.tr.rows.elementAt(k));
String row[] = new String[cols.length];
row[0] = "";
row[1] = "";
row[2] = table;
col = ((Integer) h1.get("name")).intValue();
row[3] = r1[col];
col = ((Integer) h1.get("seqno")).intValue();
// BEGIN android-changed
row[4] = "" + (Integer.parseInt(r1[col]) + 1);
// END android-changed
row[5] = iname;
tr.newrow(row);
}
}
}
JDBCStatement s1 = new JDBCStatement(conn);
try {
rs0 = (JDBCResultSet)
(s1.executeQuery("PRAGMA table_info(" +
SQLite.Shell.sql_quote(table) + ")"));
} catch (SQLException e) {
throw e;
} finally {
s1.close();
}
if (rs0 != null && rs0.tr != null && rs0.tr.nrows > 0) {
Hashtable<String, Integer> h0 = new Hashtable<String, Integer>();
for (int i = 0; i < rs0.tr.ncolumns; i++) {
h0.put(rs0.tr.column[i], new Integer(i));
}
for (int i = 0; i < rs0.tr.nrows; i++) {
String r0[] = (String [])(rs0.tr.rows.elementAt(i));
int col = ((Integer) h0.get("type")).intValue();
String type = r0[col];
if (!type.equalsIgnoreCase("integer")) {
continue;
}
col = ((Integer) h0.get("pk")).intValue();
String pk = r0[col];
if (pk.charAt(0) == '0") {
continue;
}
String row[] = new String[cols.length];
row[0] = "";
row[1] = "";
row[2] = table;
col = ((Integer) h0.get("name")).intValue();
row[3] = r0[col];
col = ((Integer) h0.get("cid")).intValue();
// BEGIN android-changed
row[4] = "" + (Integer.parseInt(r0[col]) + 1);
// END android-changed
row[5] = "";
tr.newrow(row);
}
}
return rs;
| public java.sql.ResultSet | getProcedureColumns(java.lang.String catalog, java.lang.String schemaPattern, java.lang.String procedureNamePattern, java.lang.String columnNamePattern)
return null;
| public java.lang.String | getProcedureTerm()
return "";
| public java.sql.ResultSet | getProcedures(java.lang.String catalog, java.lang.String schemaPattern, java.lang.String procedureNamePattern)
return null;
| public int | getResultSetHoldability()
return ResultSet.HOLD_CURSORS_OVER_COMMIT;
| public java.lang.String | getSQLKeywords()
return "SELECT,UPDATE,CREATE,TABLE,VIEW,DELETE,FROM,WHERE" +
",COMMIT,ROLLBACK,TRIGGER";
| public int | getSQLStateType()
return sqlStateXOpen;
| public java.lang.String | getSchemaTerm()
return "";
| public java.sql.ResultSet | getSchemas()
String cols[] = { "TABLE_SCHEM" };
SQLite.TableResult tr = new SQLite.TableResult();
tr.columns(cols);
String row[] = { "" };
tr.newrow(row);
JDBCResultSet rs = new JDBCResultSet(tr, null);
return (ResultSet) rs;
| public java.lang.String | getSearchStringEscape()
return "\\";
| public java.lang.String | getStringFunctions()
return "";
| public java.sql.ResultSet | getSuperTables(java.lang.String catalog, java.lang.String schemaPattern, java.lang.String tableNamePattern)
throw new SQLException("not supported");
| public java.sql.ResultSet | getSuperTypes(java.lang.String catalog, java.lang.String schemaPattern, java.lang.String typeNamePattern)
throw new SQLException("not supported");
| public java.lang.String | getSystemFunctions()
return "";
| public java.sql.ResultSet | getTablePrivileges(java.lang.String catalog, java.lang.String schemaPattern, java.lang.String tableNamePattern)
String cols[] = {
"TABLE_CAT", "TABLE_SCHEM", "TABLE_NAME",
"COLUMN_NAME", "GRANTOR", "GRANTEE",
"PRIVILEGE", "IS_GRANTABLE"
};
int types[] = {
Types.VARCHAR, Types.VARCHAR, Types.VARCHAR,
Types.VARCHAR, Types.VARCHAR, Types.VARCHAR,
Types.VARCHAR, Types.VARCHAR
};
TableResultX tr = new TableResultX();
tr.columns(cols);
tr.sql_types(types);
JDBCResultSet rs = new JDBCResultSet((SQLite.TableResult) tr, null);
return rs;
| public java.sql.ResultSet | getTableTypes()
String cols[] = { "TABLE_TYPE" };
SQLite.TableResult tr = new SQLite.TableResult();
tr.columns(cols);
String row[] = new String[1];
row[0] = "TABLE";
tr.newrow(row);
row = new String[1];
row[0] = "VIEW";
tr.newrow(row);
JDBCResultSet rs = new JDBCResultSet(tr, null);
return (ResultSet) rs;
| public java.sql.ResultSet | getTables(java.lang.String catalog, java.lang.String schemaPattern, java.lang.String tableNamePattern, java.lang.String[] types)
JDBCStatement s = new JDBCStatement(conn);
StringBuffer sb = new StringBuffer();
sb.append("SELECT '' AS 'TABLE_CAT', " +
"'' AS 'TABLE_SCHEM', " +
"tbl_name AS 'TABLE_NAME', " +
"upper(type) AS 'TABLE_TYPE', " +
"'' AS REMARKS FROM sqlite_master " +
"WHERE tbl_name like ");
if (tableNamePattern != null) {
sb.append(SQLite.Shell.sql_quote(tableNamePattern));
} else {
sb.append("'%'");
}
sb.append(" AND ");
if (types == null || types.length == 0) {
sb.append("(type = 'table' or type = 'view')");
} else {
sb.append("(");
String sep = "";
for (int i = 0; i < types.length; i++) {
sb.append(sep);
sb.append("type = ");
sb.append(SQLite.Shell.sql_quote(types[i].toLowerCase()));
sep = " or ";
}
sb.append(")");
}
ResultSet rs = null;
try {
rs = s.executeQuery(sb.toString());
s.close();
} catch (SQLException e) {
throw e;
} finally {
s.close();
}
return rs;
| public java.lang.String | getTimeDateFunctions()
return "";
| public java.sql.ResultSet | getTypeInfo()
String cols[] = {
"TYPE_NAME", "DATA_TYPE", "PRECISION",
"LITERAL_PREFIX", "LITERAL_SUFFIX", "CREATE_PARAMS",
"NULLABLE", "CASE_SENSITIVE", "SEARCHABLE",
"UNSIGNED_ATTRIBUTE", "FIXED_PREC_SCALE", "AUTO_INCREMENT",
"LOCAL_TYPE_NAME", "MINIMUM_SCALE", "MAXIMUM_SCALE",
"SQL_DATA_TYPE", "SQL_DATETIME_SUB", "NUM_PREC_RADIX"
};
int types[] = {
Types.VARCHAR, Types.SMALLINT, Types.INTEGER,
Types.VARCHAR, Types.VARCHAR, Types.VARCHAR,
Types.SMALLINT, Types.BIT, Types.SMALLINT,
Types.BIT, Types.BIT, Types.BIT,
Types.VARCHAR, Types.SMALLINT, Types.SMALLINT,
Types.INTEGER, Types.INTEGER, Types.INTEGER
};
TableResultX tr = new TableResultX();
tr.columns(cols);
tr.sql_types(types);
JDBCResultSet rs = new JDBCResultSet(tr, null);
String row1[] = {
"VARCHAR", "" + Types.VARCHAR, "65536",
"'", "'", null,
"" + typeNullable, "1", "" + typeSearchable,
"0", "0", "0",
null, "0", "0",
"0", "0", "0"
};
tr.newrow(row1);
String row2[] = {
"INTEGER", "" + Types.INTEGER, "32",
null, null, null,
"" + typeNullable, "0", "" + typeSearchable,
"0", "0", "1",
null, "0", "0",
"0", "0", "2"
};
tr.newrow(row2);
String row3[] = {
"DOUBLE", "" + Types.DOUBLE, "16",
null, null, null,
"" + typeNullable, "0", "" + typeSearchable,
"0", "0", "1",
null, "0", "0",
"0", "0", "10"
};
tr.newrow(row3);
String row4[] = {
"FLOAT", "" + Types.FLOAT, "7",
null, null, null,
"" + typeNullable, "0", "" + typeSearchable,
"0", "0", "1",
null, "0", "0",
"0", "0", "10"
};
tr.newrow(row4);
String row5[] = {
"SMALLINT", "" + Types.SMALLINT, "16",
null, null, null,
"" + typeNullable, "0", "" + typeSearchable,
"0", "0", "1",
null, "0", "0",
"0", "0", "2"
};
tr.newrow(row5);
String row6[] = {
"BIT", "" + Types.BIT, "1",
null, null, null,
"" + typeNullable, "0", "" + typeSearchable,
"0", "0", "1",
null, "0", "0",
"0", "0", "2"
};
tr.newrow(row6);
String row7[] = {
"TIMESTAMP", "" + Types.TIMESTAMP, "30",
null, null, null,
"" + typeNullable, "0", "" + typeSearchable,
"0", "0", "1",
null, "0", "0",
"0", "0", "0"
};
tr.newrow(row7);
String row8[] = {
"DATE", "" + Types.DATE, "10",
null, null, null,
"" + typeNullable, "0", "" + typeSearchable,
"0", "0", "1",
null, "0", "0",
"0", "0", "0"
};
tr.newrow(row8);
String row9[] = {
"TIME", "" + Types.TIME, "8",
null, null, null,
"" + typeNullable, "0", "" + typeSearchable,
"0", "0", "1",
null, "0", "0",
"0", "0", "0"
};
tr.newrow(row9);
String row10[] = {
"BINARY", "" + Types.BINARY, "65536",
null, null, null,
"" + typeNullable, "0", "" + typeSearchable,
"0", "0", "1",
null, "0", "0",
"0", "0", "0"
};
tr.newrow(row10);
String row11[] = {
"VARBINARY", "" + Types.VARBINARY, "65536",
null, null, null,
"" + typeNullable, "0", "" + typeSearchable,
"0", "0", "1",
null, "0", "0",
"0", "0", "0"
};
tr.newrow(row11);
return rs;
| public java.sql.ResultSet | getUDTs(java.lang.String catalog, java.lang.String schemaPattern, java.lang.String typeNamePattern, int[] types)
return null;
| public java.lang.String | getURL()
return conn.url;
| public java.lang.String | getUserName()
return "";
| public java.sql.ResultSet | getVersionColumns(java.lang.String catalog, java.lang.String schema, java.lang.String table)
String cols[] = {
"SCOPE", "COLUMN_NAME", "DATA_TYPE",
"TYPE_NAME", "COLUMN_SIZE", "BUFFER_LENGTH",
"DECIMAL_DIGITS", "PSEUDO_COLUMN"
};
int types[] = {
Types.SMALLINT, Types.VARCHAR, Types.SMALLINT,
Types.VARCHAR, Types.INTEGER, Types.INTEGER,
Types.SMALLINT, Types.SMALLINT
};
TableResultX tr = new TableResultX();
tr.columns(cols);
tr.sql_types(types);
JDBCResultSet rs = new JDBCResultSet((SQLite.TableResult) tr, null);
return rs;
| public boolean | insertsAreDetected(int type)
return false;
| private void | internalImportedKeys(java.lang.String table, java.lang.String pktable, JDBCResultSet in, TableResultX out)
Hashtable<String, Integer> h0 = new Hashtable<String, Integer>();
for (int i = 0; i < in.tr.ncolumns; i++) {
h0.put(in.tr.column[i], new Integer(i));
}
for (int i = 0; i < in.tr.nrows; i++) {
String r0[] = (String [])(in.tr.rows.elementAt(i));
int col = ((Integer) h0.get("table")).intValue();
String pktab = r0[col];
if (pktable != null && !pktable.equalsIgnoreCase(pktab)) {
continue;
}
col = ((Integer) h0.get("from")).intValue();
String pkcol = r0[col];
col = ((Integer) h0.get("to")).intValue();
String fkcol = r0[col];
col = ((Integer) h0.get("seq")).intValue();
String seq = r0[col];
String row[] = new String[out.ncolumns];
row[0] = "";
row[1] = "";
row[2] = pktab;
row[3] = pkcol;
row[4] = "";
row[5] = "";
row[6] = table;
row[7] = fkcol == null ? pkcol : fkcol;
// BEGIN android-changed
row[8] = "" + ((Integer.parseInt(seq)) + 1);
// END android-changed
row[9] =
"" + java.sql.DatabaseMetaData.importedKeyNoAction;
row[10] =
"" + java.sql.DatabaseMetaData.importedKeyNoAction;
row[11] = null;
row[12] = null;
row[13] =
"" + java.sql.DatabaseMetaData.importedKeyNotDeferrable;
out.newrow(row);
}
| public boolean | isCatalogAtStart()
return false;
| public boolean | isReadOnly()
return false;
| public boolean | locatorsUpdateCopy()
throw new SQLException("not supported");
| static int | mapSqlType(java.lang.String type)
if (type == null) {
return Types.VARCHAR;
}
type = type.toLowerCase();
if (type.startsWith("inter")) {
return Types.VARCHAR;
}
if (type.startsWith("numeric") ||
type.startsWith("int")) {
return Types.INTEGER;
}
if (type.startsWith("tinyint") ||
type.startsWith("smallint")) {
return Types.SMALLINT;
}
if (type.startsWith("float")) {
return Types.FLOAT;
}
if (type.startsWith("double")) {
return Types.DOUBLE;
}
if (type.startsWith("datetime") ||
type.startsWith("timestamp")) {
return Types.TIMESTAMP;
}
if (type.startsWith("date")) {
return Types.DATE;
}
if (type.startsWith("time")) {
return Types.TIME;
}
if (type.startsWith("blob")) {
return Types.BINARY;
}
if (type.startsWith("binary")) {
return Types.BINARY;
}
if (type.startsWith("varbinary")) {
return Types.VARBINARY;
}
return Types.VARCHAR;
| static java.lang.String | mapTypeName(int type)
switch (type) {
case Types.INTEGER: return "integer";
case Types.SMALLINT: return "smallint";
case Types.FLOAT: return "float";
case Types.DOUBLE: return "double";
case Types.TIMESTAMP: return "timestamp";
case Types.DATE: return "date";
case Types.TIME: return "time";
case Types.BINARY: return "binary";
case Types.VARBINARY: return "varbinary";
}
return "varchar";
| public boolean | nullPlusNonNullIsNull()
return false;
| public boolean | nullsAreSortedAtEnd()
return false;
| public boolean | nullsAreSortedAtStart()
return false;
| public boolean | nullsAreSortedHigh()
return false;
| public boolean | nullsAreSortedLow()
return false;
| public boolean | othersDeletesAreVisible(int type)
return false;
| public boolean | othersInsertsAreVisible(int type)
return false;
| public boolean | othersUpdatesAreVisible(int type)
return false;
| public boolean | ownDeletesAreVisible(int type)
return false;
| public boolean | ownInsertsAreVisible(int type)
return false;
| public boolean | ownUpdatesAreVisible(int type)
return false;
| public boolean | storesLowerCaseIdentifiers()
return false;
| public boolean | storesLowerCaseQuotedIdentifiers()
return false;
| public boolean | storesMixedCaseIdentifiers()
return true;
| public boolean | storesMixedCaseQuotedIdentifiers()
return true;
| public boolean | storesUpperCaseIdentifiers()
return false;
| public boolean | storesUpperCaseQuotedIdentifiers()
return false;
| public boolean | supportsANSI92EntryLevelSQL()
return true;
| public boolean | supportsANSI92FullSQL()
return false;
| public boolean | supportsANSI92IntermediateSQL()
return false;
| public boolean | supportsAlterTableWithAddColumn()
return false;
| public boolean | supportsAlterTableWithDropColumn()
return false;
| public boolean | supportsBatchUpdates()
return false;
| public boolean | supportsCatalogsInDataManipulation()
return false;
| public boolean | supportsCatalogsInIndexDefinitions()
return false;
| public boolean | supportsCatalogsInPrivilegeDefinitions()
return false;
| public boolean | supportsCatalogsInProcedureCalls()
return false;
| public boolean | supportsCatalogsInTableDefinitions()
return false;
| public boolean | supportsColumnAliasing()
return true;
| public boolean | supportsConvert()
return false;
| public boolean | supportsConvert(int fromType, int toType)
return false;
| public boolean | supportsCoreSQLGrammar()
return false;
| public boolean | supportsCorrelatedSubqueries()
return false;
| public boolean | supportsDataDefinitionAndDataManipulationTransactions()
return true;
| public boolean | supportsDataManipulationTransactionsOnly()
return false;
| public boolean | supportsDifferentTableCorrelationNames()
return false;
| public boolean | supportsExpressionsInOrderBy()
return true;
| public boolean | supportsExtendedSQLGrammar()
return false;
| public boolean | supportsFullOuterJoins()
return false;
| public boolean | supportsGetGeneratedKeys()
return false;
| public boolean | supportsGroupBy()
return true;
| public boolean | supportsGroupByBeyondSelect()
return false;
| public boolean | supportsGroupByUnrelated()
return true;
| public boolean | supportsIntegrityEnhancementFacility()
return false;
| public boolean | supportsLikeEscapeClause()
return false;
| public boolean | supportsLimitedOuterJoins()
return false;
| public boolean | supportsMinimumSQLGrammar()
return true;
| public boolean | supportsMixedCaseIdentifiers()
return false;
| public boolean | supportsMixedCaseQuotedIdentifiers()
return false;
| public boolean | supportsMultipleOpenResults()
return false;
| public boolean | supportsMultipleResultSets()
return false;
| public boolean | supportsMultipleTransactions()
return false;
| public boolean | supportsNamedParameters()
return false;
| public boolean | supportsNonNullableColumns()
return true;
| public boolean | supportsOpenCursorsAcrossCommit()
return false;
| public boolean | supportsOpenCursorsAcrossRollback()
return false;
| public boolean | supportsOpenStatementsAcrossCommit()
return false;
| public boolean | supportsOpenStatementsAcrossRollback()
return false;
| public boolean | supportsOrderByUnrelated()
return true;
| public boolean | supportsOuterJoins()
return false;
| public boolean | supportsPositionedDelete()
return false;
| public boolean | supportsPositionedUpdate()
return false;
| public boolean | supportsResultSetConcurrency(int type, int concurrency)
return false;
| public boolean | supportsResultSetHoldability(int x)
return false;
| public boolean | supportsResultSetType(int type)
return type == ResultSet.CONCUR_READ_ONLY;
| public boolean | supportsSavepoints()
return false;
| public boolean | supportsSchemasInDataManipulation()
return false;
| public boolean | supportsSchemasInIndexDefinitions()
return false;
| public boolean | supportsSchemasInPrivilegeDefinitions()
return false;
| public boolean | supportsSchemasInProcedureCalls()
return false;
| public boolean | supportsSchemasInTableDefinitions()
return false;
| public boolean | supportsSelectForUpdate()
return true;
| public boolean | supportsStatementPooling()
return false;
| public boolean | supportsStoredProcedures()
return false;
| public boolean | supportsSubqueriesInComparisons()
return true;
| public boolean | supportsSubqueriesInExists()
return true;
| public boolean | supportsSubqueriesInIns()
return true;
| public boolean | supportsSubqueriesInQuantifieds()
return false;
| public boolean | supportsTableCorrelationNames()
return true;
| public boolean | supportsTransactionIsolationLevel(int level)
return level == Connection.TRANSACTION_SERIALIZABLE;
| public boolean | supportsTransactions()
return true;
| public boolean | supportsUnion()
return false;
| public boolean | supportsUnionAll()
return false;
| public boolean | updatesAreDetected(int type)
return false;
| public boolean | usesLocalFilePerTable()
return false;
| public boolean | usesLocalFiles()
return true;
|
|