/** {@inheritDoc} */ @Override public DbStatement createStatement(String sql) throws MException { return createStatement(sql, provider.getDialect().detectLanguage(sql)); }
public DbPrepared getStatement(String name) throws MException { String[] query = provider.getQuery(name); return new DbPrepared(this, query[1], query[0]); }
/** * Return a statement with a new connection from the pool. * * @return x * @throws Exception */ public DbStatement getStatement() throws Exception { DbConnection con = pool.getConnection(); return con.createStatement(this); }
/** * Create a pool with the DbProvider. * * @param provider */ public DbPool(DbProvider provider) { doCreateConfig(); setProvider(provider); init(); }
DbPrepared(DbPool pool, String queryString, String language) throws MException { this.original = queryString; this.pool = pool; query = pool.getDialect().getQueryParser(language).compileString(queryString); // query = new SimpleQueryParser().compileString(queryString); // query = new SqlCompiler().compileString(queryString); }
public SqlResultNode(DbConnection con, DbResult res) throws Exception { this.con = con; this.res = res; hasNext = res.next(); }
@Override public DbConnection createTransactionalConnection() { try { return getConnection(); } catch (Exception e) { return null; } }
/** {@inheritDoc} */ @Override protected void alterTableChangePrimaryKey(Statement sth, String tn, String keys) { alterTableDropPrimaryKey(sth, tn); alterTableAddPrimaryKey(sth, tn, keys); }
/** * Return a statement for the given connection - hopefully from the same pool. * * @param con * @return x * @throws Exception */ public DbStatement getStatement(DbConnection con) throws Exception { return con.createStatement(this); }
public DbManagerJdbc(DbPool pool, DbSchema schema, MActivator activator, boolean cleanup) throws Exception { this.pool = pool; this.schema = schema; this.activator = activator == null ? pool.getProvider().getActivator() : activator; initDatabase(cleanup); }
/** {@inheritDoc} */ @Override public DbStatement getStatement(String name) throws MException { synchronized (this) { if (closed) throw new MException("Connection not valid"); String[] query = provider.getQuery(name); if (query == null) return null; return new JdbcStatement(this, query[1],query[0]); } }
@Override public boolean isClosed() { if (instance == null) return true; return instance.isClosed(); }
@Override public void setUsed(boolean used) { if (instance == null) return; instance.setUsed(used); if (!used) instance = null; // invalidate this proxy }
/** {@inheritDoc} */ @Override public DbStatement createStatement(DbPrepared dbPrepared) { return new JdbcStatement(this, dbPrepared); }
/** * Returns the database dialect object. (Delegated to DbProvider). * @return x */ public Dialect getDialect() { return provider.getDialect(); }
@Override public String[] getLanguages() { return instance.getLanguages(); }
public SqlResultCase(DbConnection con, DbResult res) throws Exception { this.con = con; this.res = res; hasNext = res.next(); }