public ResultSet getPseudoColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern) throws SQLException { this.conn.lock(); try { RowSet rs = this.service.getSchemaMetaData( ServiceMetaDataCall.PSEUDOCOLUMNS, new ServiceMetaDataArgs() .setDriverType(ClientConfiguration.DRIVER_TYPE) .setSchema(schemaPattern).setTable(tableNamePattern) .setColumnName(columnNamePattern)); return new ClientResultSet(this.conn, this.metaAttrs, rs); } catch (SnappyException se) { throw ThriftExceptionUtil.newSQLException(se); } finally { this.conn.unlock(); } } }
public Object getFieldValue(_Fields field) { switch (field) { case CONN_ID: return getConnId(); return getDriverType(); return getToken(); return getSchema(); return getTable(); return getTableTypes(); return getColumnName(); return getForeignSchema(); return getForeignTable(); return getProcedureName(); return getFunctionName(); return getAttributeName(); return getTypeName(); return getTypeId();
/** * {@inheritDoc} */ @Override public ResultSet getCrossReference(String parentCatalog, String parentSchema, String parentTable, String foreignCatalog, String foreignSchema, String foreignTable) throws SQLException { this.conn.lock(); try { RowSet rs = this.service.getSchemaMetaData( ServiceMetaDataCall.CROSSREFERENCE, new ServiceMetaDataArgs() .setDriverType(ClientConfiguration.DRIVER_TYPE) .setSchema(parentSchema).setTable(parentTable) .setForeignSchema(foreignSchema).setForeignTable(foreignTable)); return new ClientResultSet(this.conn, this.metaAttrs, rs); } catch (SnappyException se) { throw ThriftExceptionUtil.newSQLException(se); } finally { this.conn.unlock(); } }
/** * {@inheritDoc} */ @Override public ResultSet getAttributes(String catalog, String schemaPattern, String typeNamePattern, String attributeNamePattern) throws SQLException { this.conn.lock(); try { RowSet rs = this.service.getSchemaMetaData( ServiceMetaDataCall.ATTRIBUTES, new ServiceMetaDataArgs() .setDriverType(ClientConfiguration.DRIVER_TYPE) .setSchema(schemaPattern).setTypeName(typeNamePattern) .setAttributeName(attributeNamePattern)); return new ClientResultSet(this.conn, this.metaAttrs, rs); } catch (SnappyException se) { throw ThriftExceptionUtil.newSQLException(se); } finally { this.conn.unlock(); } }
/** * {@inheritDoc} */ @Override public ResultSet getProcedureColumns(String catalog, String schemaPattern, String procedureNamePattern, String columnNamePattern) throws SQLException { this.conn.lock(); try { RowSet rs = this.service.getSchemaMetaData( ServiceMetaDataCall.PROCEDURECOLUMNS, new ServiceMetaDataArgs() .setDriverType(ClientConfiguration.DRIVER_TYPE) .setSchema(schemaPattern).setProcedureName(procedureNamePattern) .setColumnName(columnNamePattern)); return new ClientResultSet(this.conn, this.metaAttrs, rs); } catch (SnappyException se) { throw ThriftExceptionUtil.newSQLException(se); } finally { this.conn.unlock(); } }
/** * {@inheritDoc} */ @Override public ResultSet getFunctionColumns(String catalog, String schemaPattern, String functionNamePattern, String columnNamePattern) throws SQLException { this.conn.lock(); try { RowSet rs = this.service.getSchemaMetaData( ServiceMetaDataCall.FUNCTIONCOLUMNS, new ServiceMetaDataArgs() .setDriverType(ClientConfiguration.DRIVER_TYPE) .setSchema(schemaPattern).setFunctionName(functionNamePattern) .setColumnName(columnNamePattern)); return new ClientResultSet(this.conn, this.metaAttrs, rs); } catch (SnappyException se) { throw ThriftExceptionUtil.newSQLException(se); } finally { this.conn.unlock(); } }
/** * {@inheritDoc} */ @Override public ResultSet getSchemas() throws SQLException { this.conn.lock(); try { RowSet rs = this.service.getSchemaMetaData(ServiceMetaDataCall.SCHEMAS, new ServiceMetaDataArgs() .setDriverType(ClientConfiguration.DRIVER_TYPE)); return new ClientResultSet(this.conn, this.metaAttrs, rs); } catch (SnappyException se) { throw ThriftExceptionUtil.newSQLException(se); } finally { this.conn.unlock(); } }
/** * {@inheritDoc} */ @Override public RowSet getIndexInfo(ServiceMetaDataArgs args, boolean unique, boolean approximate) throws SnappyException { ResultSet rs = null; try { final ConnectionHolder connHolder = getValidConnection(args.connId, args.token); EmbedDatabaseMetaData dmd = (EmbedDatabaseMetaData)connHolder .getConnection().getMetaData(); boolean isODBC = args.getDriverType() == snappydataConstants.DRIVER_ODBC; rs = isODBC ? dmd.getIndexInfoForODBC(null, args.getSchema(), args.getTable(), unique, approximate) : dmd.getIndexInfo(null, args.getSchema(), args.getTable(), unique, approximate); return getRowSet(null, null, rs, INVALID_ID, null, args.connId, null, 0, false, false, 0, connHolder, "getIndexInfo"); } catch (Throwable t) { cleanupResultSet(rs); checkSystemFailure(t); throw SnappyException(t); } }
/** * {@inheritDoc} */ @Override public ResultSet getSchemas(String catalog, String schemaPattern) throws SQLException { this.conn.lock(); try { RowSet rs = this.service.getSchemaMetaData( ServiceMetaDataCall.SCHEMAS, new ServiceMetaDataArgs().setDriverType( ClientConfiguration.DRIVER_TYPE).setSchema(schemaPattern)); return new ClientResultSet(this.conn, this.metaAttrs, rs); } catch (SnappyException se) { throw ThriftExceptionUtil.newSQLException(se); } finally { this.conn.unlock(); } }
/** * {@inheritDoc} */ @Override public RowSet getUDTs(ServiceMetaDataArgs args, List<SnappyType> types) throws SnappyException { ResultSet rs = null; try { final ConnectionHolder connHolder = getValidConnection(args.connId, args.token); EmbedDatabaseMetaData dmd = (EmbedDatabaseMetaData)connHolder .getConnection().getMetaData(); int[] sqlTypes = null; if (types != null && !types.isEmpty()) { sqlTypes = new int[types.size()]; for (int index = 0; index < types.size(); index++) { sqlTypes[index] = Converters.getJdbcType(types.get(index)); } } rs = dmd.getUDTs(null, args.getSchema(), args.getTypeName(), sqlTypes); return getRowSet(null, null, rs, INVALID_ID, null, args.connId, null, 0, false, false, 0, connHolder, "getUDTs"); } catch (Throwable t) { cleanupResultSet(rs); checkSystemFailure(t); throw SnappyException(t); } }
public ServiceMetaDataArgs deepCopy() { return new ServiceMetaDataArgs(this); }
/** * {@inheritDoc} */ @Override public ResultSet getSuperTypes(String catalog, String schemaPattern, String typeNamePattern) throws SQLException { this.conn.lock(); try { RowSet rs = this.service.getSchemaMetaData( ServiceMetaDataCall.SUPERTYPES, new ServiceMetaDataArgs() .setDriverType(ClientConfiguration.DRIVER_TYPE) .setSchema(schemaPattern).setTypeName(typeNamePattern)); return new ClientResultSet(this.conn, this.metaAttrs, rs); } catch (SnappyException se) { throw ThriftExceptionUtil.newSQLException(se); } finally { this.conn.unlock(); } }
/** * {@inheritDoc} */ @Override public ResultSet getProcedures(String catalog, String schemaPattern, String procedureNamePattern) throws SQLException { this.conn.lock(); try { RowSet rs = this.service.getSchemaMetaData( ServiceMetaDataCall.PROCEDURES, new ServiceMetaDataArgs() .setDriverType(ClientConfiguration.DRIVER_TYPE) .setSchema(schemaPattern).setProcedureName(procedureNamePattern)); return new ClientResultSet(this.conn, this.metaAttrs, rs); } catch (SnappyException se) { throw ThriftExceptionUtil.newSQLException(se); } finally { this.conn.unlock(); } }
/** * {@inheritDoc} */ @Override public ResultSet getFunctions(String catalog, String schemaPattern, String functionNamePattern) throws SQLException { this.conn.lock(); try { RowSet rs = this.service.getSchemaMetaData( ServiceMetaDataCall.FUNCTIONS, new ServiceMetaDataArgs() .setDriverType(ClientConfiguration.DRIVER_TYPE) .setSchema(schemaPattern).setFunctionName(functionNamePattern)); return new ClientResultSet(this.conn, this.metaAttrs, rs); } catch (SnappyException se) { throw ThriftExceptionUtil.newSQLException(se); } finally { this.conn.unlock(); } }
/** * {@inheritDoc} */ @Override public ResultSet getTypeInfo() throws SQLException { this.conn.lock(); try { RowSet rs = this.service.getSchemaMetaData(ServiceMetaDataCall.TYPEINFO, new ServiceMetaDataArgs() .setDriverType(ClientConfiguration.DRIVER_TYPE)); return new ClientResultSet(this.conn, this.metaAttrs, rs); } catch (SnappyException se) { throw ThriftExceptionUtil.newSQLException(se); } finally { this.conn.unlock(); } }
/** * {@inheritDoc} */ @Override public RowSet getBestRowIdentifier(ServiceMetaDataArgs args, int scope, boolean nullable) throws SnappyException { ResultSet rs = null; try { final ConnectionHolder connHolder = getValidConnection(args.connId, args.token); EmbedDatabaseMetaData dmd = (EmbedDatabaseMetaData)connHolder .getConnection().getMetaData(); boolean isODBC = args.getDriverType() == snappydataConstants.DRIVER_ODBC; rs = isODBC ? dmd.getBestRowIdentifierForODBC(null, args.getSchema(), args.getTable(), scope, nullable) : dmd.getBestRowIdentifier(null, args.getSchema(), args.getTable(), scope, nullable); return getRowSet(null, null, rs, INVALID_ID, null, args.connId, null, 0, false, false, 0, connHolder, "getBestRowIdentifier"); } catch (Throwable t) { cleanupResultSet(rs); checkSystemFailure(t); throw SnappyException(t); } } }
EmbedDatabaseMetaData dmd = (EmbedDatabaseMetaData)connHolder .getConnection().getMetaData(); boolean isODBC = args.getDriverType() == snappydataConstants.DRIVER_ODBC; switch (schemaCall) { case ATTRIBUTES: rs = dmd.getAttributes(null, args.getSchema(), args.getTypeName(), args.getAttributeName()); break; case CATALOGS: break; case COLUMNPRIVILEGES: rs = dmd.getColumnPrivileges(null, args.getSchema(), args.getTable(), args.getColumnName()); break; case COLUMNS: if (isODBC) { rs = dmd.getColumnsForODBC(null, args.getSchema(), args.getTable(), args.getColumnName()); } else { rs = dmd.getColumns(null, args.getSchema(), args.getTable(), args.getColumnName()); rs = dmd.getCrossReferenceForODBC(null, args.getSchema(), args.getTable(), null, args.getForeignSchema(), args.getForeignTable()); } else { rs = dmd.getCrossReference(null, args.getSchema(), args.getTable(), null, args.getForeignSchema(), args.getForeignTable());
/** * {@inheritDoc} */ @Override public ResultSet getColumnPrivileges(String catalog, String schema, String table, String columnNamePattern) throws SQLException { this.conn.lock(); try { RowSet rs = this.service.getSchemaMetaData( ServiceMetaDataCall.COLUMNPRIVILEGES, new ServiceMetaDataArgs() .setDriverType(ClientConfiguration.DRIVER_TYPE).setSchema(schema) .setTable(table).setColumnName(columnNamePattern)); return new ClientResultSet(this.conn, this.metaAttrs, rs); } catch (SnappyException se) { throw ThriftExceptionUtil.newSQLException(se); } finally { this.conn.unlock(); } }
/** * {@inheritDoc} */ @Override public ResultSet getUDTs(String catalog, String schemaPattern, String typeNamePattern, int[] types) throws SQLException { this.conn.lock(); try { List<SnappyType> sqlTypes = null; if (types != null) { // convert to thrift SQL types sqlTypes = new ArrayList<>(types.length); for (int type : types) { sqlTypes.add(Converters.getThriftSQLType(type)); } } RowSet rs = this.service.getUDTs( new ServiceMetaDataArgs() .setDriverType(ClientConfiguration.DRIVER_TYPE) .setSchema(schemaPattern).setTypeName(typeNamePattern), sqlTypes); return new ClientResultSet(this.conn, this.metaAttrs, rs); } catch (SnappyException se) { throw ThriftExceptionUtil.newSQLException(se); } finally { this.conn.unlock(); } }
/** * {@inheritDoc} */ @Override public ResultSet getClientInfoProperties() throws SQLException { this.conn.lock(); try { RowSet rs = this.service.getSchemaMetaData( ServiceMetaDataCall.CLIENTINFOPROPS, new ServiceMetaDataArgs() .setDriverType(ClientConfiguration.DRIVER_TYPE)); return new ClientResultSet(this.conn, this.metaAttrs, rs); } catch (SnappyException se) { throw ThriftExceptionUtil.newSQLException(se); } finally { this.conn.unlock(); } }