/** * @see java.lang.Object#toString() */ public String toString() { try { return buildURL().getJDBCURL(); } catch (TeiidSQLException e) { return e.getMessage(); } }
public boolean absolute( int row) throws SQLException { checkClosed(); checkNotForwardOnly(); return batchResults.absolute(row, getOffset()); }
public boolean previous() throws SQLException { checkClosed(); checkNotForwardOnly(); return batchResults.previous(); }
public void testKerberos() throws SQLException { TeiidDataSource tds = new TeiidDataSource(); tds.setDatabaseName("y"); tds.setUser("%25user"); tds.setJaasName("x"); tds.setKerberosServicePrincipleName("z"); tds.setServerName("t"); compareUrls("jdbc:teiid:y@mm://t:0;fetchSize=2048;ApplicationName=JDBC;user=%2525user;jaasName=x;VirtualDatabaseName=y;kerberosServicePrincipleName=z", tds.buildURL().getJDBCURL()); }
public void testBuildURL_AdditionalProperties() throws TeiidSQLException { final TeiidDataSource ds = new TeiidDataSource(); ds.setAdditionalProperties("foo=bar;a=b"); //$NON-NLS-1$ ds.setServerName("hostName"); //$NON-NLS-1$ ds.setDatabaseName("vdbName"); //$NON-NLS-1$ ds.setPortNumber(1); assertEquals("jdbc:teiid:vdbName@mm://hostname:1;ApplicationName=JDBC;VirtualDatabaseName=vdbName;a=b;fetchSize=2048;foo=bar", ds.buildURL().getJDBCURL()); //$NON-NLS-1$ }
public void testBuildURLEncryptRequests() throws TeiidSQLException { final TeiidDataSource ds = new TeiidDataSource(); ds.setServerName("hostName"); //$NON-NLS-1$ ds.setDatabaseName("vdbName"); //$NON-NLS-1$ ds.setEncryptRequests(true); compareUrls("jdbc:teiid:vdbName@mm://hostname:0;fetchSize=2048;ApplicationName=JDBC;encryptRequests=true;VirtualDatabaseName=vdbName", ds.buildURL().getJDBCURL()); //$NON-NLS-1$ }
BatchResults getBatchResults(List<?>[] batch, boolean isLast) { Batch batch2 = new Batch(batch, 1, batch.length); if (isLast) { batch2.setLastRow(batch.length); } BatchResults results = new BatchResults(null, batch2, BatchResults.DEFAULT_SAVED_BATCHES); if (!isLast) { results.setBatchFetcher(new MockBatchFetcher()); } return results; }
protected void validateProperties( final String userName, final String password) throws java.sql.SQLException { super.validateProperties(userName, password); String reason = reasonWhyInvalidPortNumber(this.portNumber); if ( reason != null ) { throw createConnectionError(reason); } reason = reasonWhyInvalidServerName(this.serverName); if ( reason != null ) { throw createConnectionError(reason); } }
@Override public int available() throws SQLException { int current = batchResults.getCurrentRowNumber(); int highest = batchResults.getHighestRowNumber(); return highest - current - getOffset() - (batchResults.isTailLast()?1:0); }
public boolean next() throws SQLException { checkClosed(); if (hasNext()) { return batchResults.next(); } batchResults.next(); return false; }
private ResultSetImpl helpGetResultSetImpl(int type) throws SQLException { ResultsMessage rsMsg = exampleResultsMsg2(); statement = TestResultSet.createMockStatement(type); ResultSetImpl rs = new ResultSetImpl(rsMsg, statement); return rs; }
private ResultSetImpl helpGetNoResults(int type) throws SQLException { ResultsMessage rsMsg = exampleResultsMsg3(); statement = TestResultSet.createMockStatement(type); ResultSetImpl rs = new ResultSetImpl(rsMsg, statement); return rs; }
/** * This method will return the value in the current row as a int value. * * @param The * index of the column whose value needs to be fetched. * @return The value of the column as a int value. * @throws SQLException * if a results access error occurs or transform fails. */ public int getInt(int columnIndex) throws SQLException { return DataTypeTransformer.getInteger(getObject(columnIndex)); }
/** * This method will return the value in the current row as a long value. * * @param The * index of the column whose value needs to be fetched. * @return The value of the column as a long value. * @throws SQLException * if a results access error occurs or transform fails. */ public long getLong(int columnIndex) throws SQLException { return DataTypeTransformer.getLong(getObject(columnIndex)); }
public boolean getMoreResults(int current) throws SQLException { checkStatement(); if ((current == CLOSE_ALL_RESULTS || current == CLOSE_CURRENT_RESULT) && resultSet != null) { resultSet.close(); resultSet = null; } // indicate that there are no more results this.updateCounts = null; return false; }
public String getColumnName(int index) throws SQLException { if (!useJDBC4ColumnNameAndLabelSemantics) { String result = provider.getStringValue(adjustColumn(index), ResultsMetadataConstants.ELEMENT_LABEL); if (result != null) { return result; } } return provider.getStringValue(adjustColumn(index), ResultsMetadataConstants.ELEMENT_NAME); }
public DatabaseMetaDataImpl getMetaData() throws SQLException { //Check to see the connection is open checkConnection(); if (dbmm == null) { dbmm = new DatabaseMetaDataImpl(this); } return dbmm; }
@Override public Object getValue(int columnIndex, Integer metadataPropertyKey) throws SQLException { if(!loaded && !(metadataPropertyKey == ResultsMetadataConstants.ELEMENT_LABEL || metadataPropertyKey == ResultsMetadataConstants.DATA_TYPE)) { loadFullMetadata(); loaded = true; } return super.getValue(columnIndex, metadataPropertyKey); }
/** * @see java.lang.Object#toString() */ public String toString() { try { return buildURL().getJDBCURL(); } catch (TeiidSQLException e) { return e.getMessage(); } }
public boolean absolute( int row) throws SQLException { checkClosed(); checkNotForwardOnly(); return batchResults.absolute(row, getOffset()); }