Package org.apache.turbine.util.db.pool

Examples of org.apache.turbine.util.db.pool.DBConnection


        // Check for Transaction support.  Give warning message if
        // IDBroker is being used with a database that does not
        // support transactions.
        String dbName = tMap.getDatabaseMap().getName();
        DBConnection dbCon = null;
        try
        {
            dbCon = TurbineDB.getConnection(dbName);
            transactionsSupported = dbCon.getConnection()
                .getMetaData().supportsTransactions();
        }
        catch (Exception e)
        {
            transactionsSupported = false;
View Full Code Here


//        synchronized(tMap)  see comment in the getNextIds method
//        {
            if (adjustQuantity)
                checkTiming(tableName);

            DBConnection dbCon = null;
            try
            {
                String databaseName = dbMap.getName();

                // Get a connection to the db by starting a
                // transaction.
                if (transactionsSupported)
                {
                    dbCon = BasePeer.beginTransaction(databaseName);
                }
                else
                {
                    dbCon = TurbineDB.getConnection(databaseName);
                }
                Connection connection = dbCon.getConnection();

                // Write the current value of quantity of keys to grab
                // to the database, primarily to obtain a write lock
                // on the table/row, but this value will also be used
                // as the starting value when an IDBroker is
View Full Code Here

        {
            quantity = (BigDecimal)quantityStore.get(tableName);
        }
        else
        {
            DBConnection dbCon = null;
            try
            {
                String databaseName = tableMap.getDatabaseMap().getName();

                // Get a connection to the db
                dbCon = TurbineDB.getConnection(databaseName);
                Connection connection = dbCon.getConnection();

                // Read the row from the ID_TABLE.
                BigDecimal[] results = selectRow(connection, tableName);

                // QUANTITY column.
View Full Code Here

     */
    public static Schema initTableSchema(String tableName,
                                         String dbName)
    {
        Schema schema = null;
        DBConnection db = null;

        try
        {
            if (dbName == null)
            {
                // Get a connection to the db.
                db = TurbineDB.getConnection();
            }
            else
            {
                // Get a connection to the db.
                db = TurbineDB.getConnection( dbName );
            }

            Connection connection = db.getConnection();

            schema = new Schema().schema(connection, tableName);
        }
        catch(Exception e)
        {
View Full Code Here

     * @exception Exception, a generic exception.
     */
    public static DBConnection beginTransaction(String dbName)
        throws Exception
    {
        DBConnection dbCon = TurbineDB.getConnection( dbName );
        if ( dbCon.getConnection().getMetaData().supportsTransactions() )
        {
            dbCon.setAutoCommit(false);
        }
       
        return dbCon;
    }
View Full Code Here

    public static void deleteAll( String table,
                                  String column,
                                  int value )
        throws Exception
    {
        DBConnection dbCon = null;
        try
        {
            // Get a connection to the db.
            dbCon = TurbineDB.getConnection();
View Full Code Here

     * @exception Exception, a generic exception.
     */
    public static void doDelete(Criteria criteria)
        throws Exception
    {
        DBConnection dbCon = null;
        try
        {
            // Get a connection to the db.
            dbCon = TurbineDB.getConnection( criteria.getDbName() );
            doDelete(criteria, dbCon);
View Full Code Here

     * @exception Exception, a generic exception.
     */
    public static ObjectKey doInsert(Criteria criteria)
        throws Exception
    {
        DBConnection dbCon = null;
        ObjectKey id = null;

        // Transaction stuff added for postgres.
        boolean doTransaction = (TurbineDB.getDB(criteria.getDbName()).
            objectDataNeedsTrans() &&
View Full Code Here

        Vector results = null;
        if (TurbineDB.getDB(criteria.getDbName())
              .objectDataNeedsTrans() &&
              criteria.containsObjectColumn(criteria.getDbName()))
        {
            DBConnection dbCon = beginTransaction(criteria.getDbName());
            try
            {
                results = executeQuery( createQueryString(criteria),
                                        criteria.isSingleRecord(), dbCon );
                commitTransaction(dbCon);
View Full Code Here

                                      int numberOfResults,
                                      String dbName,
                                      boolean singleRecord)
        throws Exception
    {
        DBConnection db = null;
        Vector results = null;
        try
        {
            // get a connection to the db
            db = TurbineDB.getConnection( dbName );
View Full Code Here

TOP

Related Classes of org.apache.turbine.util.db.pool.DBConnection

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.