use of nl.topicus.jdbc.statement.CloudSpannerPreparedStatement in project spanner-jdbc by olavloite.
the class CloudSpannerDatabaseMetaData method getTablePrivileges.
@Override
public ResultSet getTablePrivileges(String catalog, String schemaPattern, String tableNamePattern) throws SQLException {
String sql = "SELECT '' AS TABLE_CAT, '' AS TABLE_SCHEM, '' AS TABLE_NAME, '' AS GRANTOR, '' AS GRANTEE, '' AS PRIVILEGE, 'NO' AS IS_GRANTABLE " + FROM_STATEMENT_WITHOUT_RESULTS;
CloudSpannerPreparedStatement statement = prepareStatement(sql);
return statement.executeQuery();
}
use of nl.topicus.jdbc.statement.CloudSpannerPreparedStatement in project spanner-jdbc by olavloite.
the class CloudSpannerDatabaseMetaData method getPseudoColumns.
@Override
public ResultSet getPseudoColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern) throws SQLException {
String sql = "select TABLE_CATALOG AS TABLE_CAT, TABLE_SCHEMA AS TABLE_SCHEM, TABLE_NAME, COLUMN_NAME, " + "CASE " + " WHEN SPANNER_TYPE = 'ARRAY' THEN " + Types.ARRAY + " " + " WHEN SPANNER_TYPE = 'BOOL' THEN " + Types.BOOLEAN + " " + " WHEN SPANNER_TYPE = 'BYTES' THEN " + Types.BINARY + " " + " WHEN SPANNER_TYPE = 'DATE' THEN " + Types.DATE + " " + " WHEN SPANNER_TYPE = 'FLOAT64' THEN " + Types.DOUBLE + " " + " WHEN SPANNER_TYPE = 'INT64' THEN " + Types.BIGINT + " " + " WHEN SPANNER_TYPE = 'STRING' THEN " + Types.NVARCHAR + " " + " WHEN SPANNER_TYPE = 'STRUCT' THEN " + Types.STRUCT + " " + " WHEN SPANNER_TYPE = 'TIMESTAMP' THEN " + Types.TIMESTAMP + " " + "END AS DATA_TYPE, " + "0 AS COLUMN_SIZE, NULL AS DECIMAL_DIGITS, 0 AS NUM_PREC_RADIX, 'USAGE_UNKNOWN' AS COLUMN_USAGE, NULL AS REMARKS, 0 AS CHAR_OCTET_LENGTH, IS_NULLABLE " + FROM_STATEMENT_WITHOUT_RESULTS;
sql = sql + getCatalogSchemaTableWhereClause("T", catalog, schemaPattern, tableNamePattern);
if (columnNamePattern != null)
sql = sql + "AND UPPER(COLUMN_NAME) LIKE ? ";
sql = sql + "ORDER BY TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, ORDINAL_POSITION ";
CloudSpannerPreparedStatement statement = prepareStatement(sql, catalog, schemaPattern, tableNamePattern, columnNamePattern);
return statement.executeQuery();
}
use of nl.topicus.jdbc.statement.CloudSpannerPreparedStatement in project spanner-jdbc by olavloite.
the class CloudSpannerDatabaseMetaData method getVersionColumnsOrBestRowIdentifier.
/**
* A simple private method that combines the result of two methods that
* return exactly the same result
*
* @return An empty {@link ResultSet} containing the columns for the methods
* {@link DatabaseMetaData#getBestRowIdentifier(String, String, String, int, boolean)}
* and
* {@link DatabaseMetaData#getVersionColumns(String, String, String)}
* @throws SQLException
*/
private ResultSet getVersionColumnsOrBestRowIdentifier() throws SQLException {
String sql = VERSION_AND_IDENTIFIER_COLUMNS_SELECT_STATEMENT + FROM_STATEMENT_WITHOUT_RESULTS;
CloudSpannerPreparedStatement statement = prepareStatement(sql);
return statement.executeQuery();
}
use of nl.topicus.jdbc.statement.CloudSpannerPreparedStatement in project spanner-jdbc by olavloite.
the class CloudSpannerDatabaseMetaData method getCatalogs.
@Override
public ResultSet getCatalogs() throws SQLException {
String sql = "SELECT '' AS TABLE_CAT " + FROM_STATEMENT_WITHOUT_RESULTS;
CloudSpannerPreparedStatement statement = prepareStatement(sql);
return statement.executeQuery();
}
use of nl.topicus.jdbc.statement.CloudSpannerPreparedStatement in project spanner-jdbc by olavloite.
the class CloudSpannerDatabaseMetaData method getColumnPrivileges.
@Override
public ResultSet getColumnPrivileges(String catalog, String schema, String table, String columnNamePattern) throws SQLException {
String sql = "SELECT '' AS TABLE_CAT, '' AS TABLE_SCHEM, '' AS TABLE_NAME, '' AS COLUMN_NAME, '' AS GRANTOR, '' AS GRANTEE, '' AS PRIVILEGE, 'NO' AS IS_GRANTABLE " + FROM_STATEMENT_WITHOUT_RESULTS;
CloudSpannerPreparedStatement statement = prepareStatement(sql);
return statement.executeQuery();
}
Aggregations