277
319
return stmt.executeQuery(query);
280
public boolean generatedKeyAlwaysReturned() throws SQLException {
284
public ResultSet getPseudoColumns(String arg0, String arg1, String arg2,
285
String arg3) throws SQLException {
286
return MySQLResultSet.EMPTY;
322
public boolean generatedKeyAlwaysReturned() throws SQLException {
326
public ResultSet getPseudoColumns(String arg0, String arg1, String arg2,
327
String arg3) throws SQLException {
328
return MySQLResultSet.EMPTY;
331
public boolean allProceduresAreCallable() throws SQLException {
335
public boolean allTablesAreSelectable() throws SQLException {
339
public String getURL() throws SQLException {
343
public String getUserName() throws SQLException {
348
public boolean isReadOnly() throws SQLException {
353
public boolean nullsAreSortedHigh() throws SQLException {
358
public boolean nullsAreSortedLow() throws SQLException {
359
return !nullsAreSortedHigh();
363
public boolean nullsAreSortedAtStart() throws SQLException {
367
public boolean nullsAreSortedAtEnd() throws SQLException {
368
return !nullsAreSortedAtStart();
372
public String getDatabaseProductName() throws SQLException {
373
return databaseProductName;
377
public String getDatabaseProductVersion() throws SQLException {
378
if (version == null) {
379
ResultSet rs = connection.createStatement().executeQuery("select version()");
381
version = rs.getString(1);
387
public String getDriverName() throws SQLException {
388
return "mariadb-jdbc"; // TODO: get from constants file
391
public String getDriverVersion() throws SQLException {
392
return String.format("%d.%d",getDriverMajorVersion(),getDriverMinorVersion());
396
public int getDriverMajorVersion() {
400
public int getDriverMinorVersion() {
405
public boolean usesLocalFiles() throws SQLException {
409
public boolean usesLocalFilePerTable() throws SQLException {
413
public boolean supportsMixedCaseIdentifiers() throws SQLException {
417
public boolean storesUpperCaseIdentifiers() throws SQLException {
421
public boolean storesLowerCaseIdentifiers() throws SQLException {
422
return !storesUpperCaseIdentifiers();
425
public boolean storesMixedCaseIdentifiers() throws SQLException {
429
public boolean supportsMixedCaseQuotedIdentifiers() throws SQLException {
433
public boolean storesUpperCaseQuotedIdentifiers() throws SQLException {
434
return !storesMixedCaseQuotedIdentifiers();
437
public boolean storesLowerCaseQuotedIdentifiers() throws SQLException {
441
public boolean storesMixedCaseQuotedIdentifiers() throws SQLException {
445
public String getIdentifierQuoteString() throws SQLException {
449
public String getSQLKeywords() throws SQLException {
516
"MINUTE_MICROSECOND,"+
520
"NO_WRITE_TO_BINLOG,"+
539
"SECOND_MICROSECOND,"+
547
"SQL_CALC_FOUND_ROWS,"+
572
"IGNORE_SERVER_IDS,"+
573
"MASTER_HEARTBEAT_PERIOD,"+
580
public String getNumericFunctions() throws SQLException {
581
return ""; //TODO : fix
585
public String getStringFunctions() throws SQLException {
586
return ""; //TODO: fix
589
public String getSystemFunctions() throws SQLException {
590
return "DATABASE,USER,SYSTEM_USER,SESSION_USER,LAST_INSERT_ID,VERSION";
594
public String getTimeDateFunctions() throws SQLException {
595
return ""; //TODO : fix
598
public String getSearchStringEscape() throws SQLException {
602
public String getExtraNameCharacters() throws SQLException {
606
public boolean supportsAlterTableWithAddColumn() throws SQLException {
610
public boolean supportsAlterTableWithDropColumn() throws SQLException {
614
public boolean supportsColumnAliasing() throws SQLException {
618
public boolean nullPlusNonNullIsNull() throws SQLException {
622
public boolean supportsConvert() throws SQLException {
623
return false; //TODO: fix
626
public boolean supportsConvert(final int fromType, final int toType)
627
throws SQLException {
628
return false; // TODO: fix
631
public boolean supportsTableCorrelationNames() throws SQLException {
635
public boolean supportsDifferentTableCorrelationNames() throws SQLException {
639
public boolean supportsExpressionsInOrderBy() throws SQLException {
643
public boolean supportsOrderByUnrelated() throws SQLException {
647
public boolean supportsGroupBy() throws SQLException {
651
public boolean supportsGroupByUnrelated() throws SQLException {
655
public boolean supportsGroupByBeyondSelect() throws SQLException {
659
public boolean supportsLikeEscapeClause() throws SQLException {
663
public boolean supportsMultipleResultSets() throws SQLException {
667
public boolean supportsMultipleTransactions() throws SQLException {
671
public boolean supportsNonNullableColumns() throws SQLException {
675
public boolean supportsMinimumSQLGrammar() throws SQLException {
679
public boolean supportsCoreSQLGrammar() throws SQLException {
683
public boolean supportsExtendedSQLGrammar() throws SQLException {
687
public boolean supportsANSI92EntryLevelSQL() throws SQLException {
691
public boolean supportsANSI92IntermediateSQL() throws SQLException {
695
public boolean supportsANSI92FullSQL() throws SQLException {
699
public boolean supportsIntegrityEnhancementFacility() throws SQLException {
700
return false; //TODO: verify
703
public boolean supportsOuterJoins() throws SQLException {
706
public boolean supportsFullOuterJoins() throws SQLException {
710
public boolean supportsLimitedOuterJoins() throws SQLException {
714
public String getSchemaTerm() throws SQLException {
719
public String getProcedureTerm() throws SQLException {
723
public String getCatalogTerm() throws SQLException {
728
public boolean isCatalogAtStart() throws SQLException {
733
public String getCatalogSeparator() throws SQLException {
738
public boolean supportsSchemasInDataManipulation() throws SQLException {
743
public boolean supportsSchemasInProcedureCalls() throws SQLException {
747
public boolean supportsSchemasInTableDefinitions() throws SQLException {
751
public boolean supportsSchemasInIndexDefinitions() throws SQLException {
755
public boolean supportsSchemasInPrivilegeDefinitions() throws SQLException {
759
public boolean supportsCatalogsInDataManipulation() throws SQLException {
763
public boolean supportsCatalogsInProcedureCalls() throws SQLException {
767
public boolean supportsCatalogsInTableDefinitions() throws SQLException {
771
public boolean supportsCatalogsInIndexDefinitions() throws SQLException {
775
public boolean supportsCatalogsInPrivilegeDefinitions() throws SQLException {
779
public boolean supportsPositionedDelete() throws SQLException {
783
public boolean supportsPositionedUpdate() throws SQLException {
787
public boolean supportsSelectForUpdate() throws SQLException {
791
public boolean supportsStoredProcedures() throws SQLException {
796
public boolean supportsSubqueriesInComparisons() throws SQLException {
800
public boolean supportsSubqueriesInExists() throws SQLException {
805
public boolean supportsSubqueriesInIns() throws SQLException {
809
public boolean supportsSubqueriesInQuantifieds() throws SQLException {
814
public boolean supportsCorrelatedSubqueries() throws SQLException {
819
public boolean supportsUnion() throws SQLException {
824
public boolean supportsUnionAll() throws SQLException {
829
public boolean supportsOpenCursorsAcrossCommit() throws SQLException {
833
public boolean supportsOpenCursorsAcrossRollback() throws SQLException {
837
public boolean supportsOpenStatementsAcrossCommit() throws SQLException {
841
public boolean supportsOpenStatementsAcrossRollback() throws SQLException {
845
public int getMaxBinaryLiteralLength() throws SQLException {
849
public int getMaxCharLiteralLength() throws SQLException {
853
public int getMaxColumnNameLength() throws SQLException {
857
public int getMaxColumnsInGroupBy() throws SQLException {
862
public int getMaxColumnsInIndex() throws SQLException {
867
public int getMaxColumnsInOrderBy() throws SQLException {
871
public int getMaxColumnsInSelect() throws SQLException {
876
public int getMaxColumnsInTable() throws SQLException {
880
public int getMaxConnections() throws SQLException {
885
public int getMaxCursorNameLength() throws SQLException {
890
public int getMaxIndexLength() throws SQLException {
893
public int getMaxSchemaNameLength() throws SQLException {
897
public int getMaxProcedureNameLength() throws SQLException {
901
public int getMaxCatalogNameLength() throws SQLException {
905
public int getMaxRowSize() throws SQLException {
909
public boolean doesMaxRowSizeIncludeBlobs() throws SQLException {
913
public int getMaxStatementLength() throws SQLException {
917
public int getMaxStatements() throws SQLException {
921
public int getMaxTableNameLength() throws SQLException {
925
public int getMaxTablesInSelect() throws SQLException {
929
public int getMaxUserNameLength() throws SQLException {
933
public int getDefaultTransactionIsolation() throws SQLException {
934
return Connection.TRANSACTION_REPEATABLE_READ;
937
public boolean supportsTransactions() throws SQLException {
942
public boolean supportsTransactionIsolationLevel(final int level)
943
throws SQLException {
945
case Connection.TRANSACTION_READ_UNCOMMITTED:
946
case Connection.TRANSACTION_READ_COMMITTED:
947
case Connection.TRANSACTION_REPEATABLE_READ:
948
case Connection.TRANSACTION_SERIALIZABLE:
956
public boolean supportsDataDefinitionAndDataManipulationTransactions()
957
throws SQLException {
961
public boolean supportsDataManipulationTransactionsOnly()
962
throws SQLException {
966
public boolean dataDefinitionCausesTransactionCommit() throws SQLException {
971
public boolean dataDefinitionIgnoredInTransactions() throws SQLException {
976
public ResultSet getProcedures(final String catalog, final String schemaPattern, final String procedureNamePattern)
977
throws SQLException {
979
return MySQLResultSet.EMPTY; /*TODO: return real ones */
982
public ResultSet getProcedureColumns(final String catalog, final String schemaPattern, final String procedureNamePattern,
983
String columnNamePattern) throws SQLException {
984
return MySQLResultSet.EMPTY; /*TODO: return real ones */
987
protected String getSchemaPattern(String schemaPattern) {
988
if(schemaPattern != null && ((MySQLConnection)connection).noSchemaPattern == false) {
989
return " AND table_schema LIKE '" + schemaPattern + "'";
991
return " AND table_schema LIKE IFNULL(database(), '%')";
995
public ResultSet getSchemas() throws SQLException {
996
final Statement stmt = connection.createStatement();
997
return stmt.executeQuery("SELECT schema_name table_schem, catalog_name table_catalog " +
998
"FROM information_schema.schemata");
1002
public ResultSet getCatalogs() throws SQLException {
1003
final Statement stmt = connection.createStatement();
1004
return stmt.executeQuery("SELECT null as table_cat");
1007
public ResultSet getTableTypes() throws SQLException {
1008
final Statement stmt = connection.createStatement();
1009
return stmt.executeQuery("SELECT DISTINCT(table_type) FROM information_schema.tables");
1012
public ResultSet getColumnPrivileges(final String catalog, final String schema, final String table,
1013
final String columnNamePattern) throws SQLException {
1014
return MySQLResultSet.EMPTY;
1018
public ResultSet getTablePrivileges(final String catalog, final String schemaPattern, final String tableNamePattern)
1019
throws SQLException {
1020
final Statement stmt = connection.createStatement();
1021
final String query = "SELECT null table_cat, " +
1022
"table_schema table_schem, " +
1025
"user() grantee, " +
1026
"'update' privilege, " +
1027
"'yes' is_grantable " +
1028
"FROM information_schema.columns " +
1029
"WHERE table_schema LIKE '" + ((schemaPattern == null) ? "%" : schemaPattern) + "'" +
1030
" AND table_name LIKE '" + ((tableNamePattern == null) ? "%" : tableNamePattern) + "'";
1032
return stmt.executeQuery(query);
1035
public ResultSet getVersionColumns(final String catalog, final String schema, final String table)
1036
throws SQLException {
1037
return MySQLResultSet.EMPTY;
1040
public ResultSet getCrossReference(final String parentCatalog, final String parentSchema, final String parentTable,
1041
final String foreignCatalog, final String foreignSchema, final String foreignTable) throws SQLException {
1042
return MySQLResultSet.EMPTY;
1045
public ResultSet getTypeInfo() throws SQLException {
1046
return MySQLResultSet.EMPTY;
1049
public ResultSet getIndexInfo(final String catalog, final String schema, final String table,
1050
final boolean unique, final boolean approximate) throws SQLException {
1051
final String query = "SELECT null table_cat," +
1052
" table_schema table_schem," +
1055
" table_schema index_qualifier," +
1057
" " + tableIndexOther + " type," +
1058
" seq_in_index ordinal_position," +
1060
" collation asc_or_desc," +
1063
" null as filter_condition" +
1064
" FROM information_schema.statistics" +
1065
" WHERE table_name='" + table + "' " +
1066
((schema != null) ? (" AND table_schema like '" + schema + "' ") : "") +
1067
(unique ? " AND NON_UNIQUE = 0" : "") +
1068
" ORDER BY NON_UNIQUE, TYPE, INDEX_NAME, ORDINAL_POSITION";
1069
final Statement stmt = connection.createStatement();
1070
return stmt.executeQuery(query);
1072
public boolean supportsResultSetType(final int type) throws SQLException {
1077
public boolean supportsResultSetConcurrency(final int type, final int concurrency)
1078
throws SQLException {
1079
return concurrency == ResultSet.CONCUR_READ_ONLY;
1082
public boolean ownUpdatesAreVisible(final int type) throws SQLException {
1087
public boolean ownDeletesAreVisible(final int type) throws SQLException {
1092
public boolean ownInsertsAreVisible(final int type) throws SQLException {
1097
public boolean othersUpdatesAreVisible(final int type) throws SQLException {
1102
public boolean othersDeletesAreVisible(final int type) throws SQLException {
1106
public boolean othersInsertsAreVisible(final int type) throws SQLException {
1110
public boolean updatesAreDetected(final int type) throws SQLException {
1115
public boolean deletesAreDetected(final int type) throws SQLException {
1120
public boolean insertsAreDetected(final int type) throws SQLException {
1125
public boolean supportsBatchUpdates() throws SQLException {
1130
public ResultSet getUDTs(final String catalog, final String schemaPattern, final String typeNamePattern, final int[] types)
1131
throws SQLException {
1132
return MySQLResultSet.EMPTY;
1137
public Connection getConnection() throws SQLException {
1142
public boolean supportsSavepoints() throws SQLException {
1147
public boolean supportsNamedParameters() throws SQLException {
1152
public boolean supportsMultipleOpenResults() throws SQLException {
1157
public boolean supportsGetGeneratedKeys() throws SQLException {
1162
public ResultSet getSuperTypes(final String catalog, final String schemaPattern, final String typeNamePattern)
1163
throws SQLException {
1165
return MySQLResultSet.EMPTY;
1169
public ResultSet getSuperTables(final String catalog, final String schemaPattern, final String tableNamePattern)
1170
throws SQLException {
1171
return MySQLResultSet.EMPTY;
1175
public ResultSet getAttributes(final String catalog, final String schemaPattern, final String typeNamePattern,
1176
final String attributeNamePattern) throws SQLException {
1177
return MySQLResultSet.EMPTY;
1180
public boolean supportsResultSetHoldability(final int holdability)
1181
throws SQLException {
1182
return holdability == ResultSet.HOLD_CURSORS_OVER_COMMIT;
1186
public int getResultSetHoldability() throws SQLException {
1187
return ResultSet.HOLD_CURSORS_OVER_COMMIT;
1191
public int getDatabaseMajorVersion() throws SQLException {
1192
String components[] = version.split("\\.");
1193
return Integer.parseInt(components[0]);
1197
public int getDatabaseMinorVersion() throws SQLException {
1198
String components[] = version.split("\\.");
1199
return Integer.parseInt(components[1]);
1203
public int getJDBCMajorVersion() throws SQLException {
1207
public int getJDBCMinorVersion() throws SQLException {
1212
public int getSQLStateType() throws SQLException {
1217
public boolean locatorsUpdateCopy() throws SQLException {
1222
public boolean supportsStatementPooling() throws SQLException {
1227
public java.sql.RowIdLifetime getRowIdLifetime() throws SQLException {
1228
return java.sql.RowIdLifetime.ROWID_UNSUPPORTED;
1232
public ResultSet getSchemas(final String catalog, final String schemaPattern) throws SQLException {
1233
final String query = "SELECT schema_name table_schem, " +
1234
"null table_catalog " +
1235
"FROM information_schema.schemata " +
1236
(schemaPattern != null ? "WHERE schema_name like '" + schemaPattern + "'" : "") +
1237
" ORDER BY table_schem";
1238
final Statement stmt = connection.createStatement();
1239
return stmt.executeQuery(query);
1242
public boolean supportsStoredFunctionsUsingCallSyntax() throws SQLException {
1246
public boolean autoCommitFailureClosesAllResultSets() throws SQLException {
1247
return false; //TODO: look into this
1251
public ResultSet getClientInfoProperties() throws SQLException {
1252
return MySQLResultSet.EMPTY; //TODO: look into this
1256
public ResultSet getFunctions(final String catalog, final String schemaPattern, final String functionNamePattern)
1257
throws SQLException {
1258
return MySQLResultSet.EMPTY; //TODO: fix
1262
public ResultSet getFunctionColumns(final String catalog, final String schemaPattern, final String functionNamePattern,
1263
final String columnNamePattern) throws SQLException {
1264
return MySQLResultSet.EMPTY; //TODO: fix
1268
public <T> T unwrap(final Class<T> iface) throws SQLException {
1272
public boolean isWrapperFor(final Class<?> iface) throws SQLException {