Changeset 437

Show
Ignore:
Timestamp:
11/10/07 10:24:32 (1 year ago)
Author:
kaste
Message:

Implemented transactions-wrapper in AkDbAdapter?.
AkActiveRecord? and AkInstaller? transaction-methods pointing to AkDbAdapter?.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/kaste/framework/lib/AkActiveRecord.php

    r436 r437  
    34483448    function transactionStart() 
    34493449    { 
    3450         if(!$this->isConnected()){ 
    3451             $this->setConnection(); 
    3452         } 
    3453         return $this->_db->StartTrans(); 
     3450        return $this->_db->startTransaction(); 
    34543451    } 
    34553452 
    34563453    function transactionComplete() 
    34573454    { 
    3458         return $this->_db->CompleteTrans(); 
     3455        return $this->_db->stopTransaction(); 
    34593456    } 
    34603457 
    34613458    function transactionFail() 
    34623459    { 
    3463         $this->_db->FailTrans(); 
     3460        $this->_db->failTransaction(); 
    34643461        return false; 
    34653462    } 
     
    34673464    function transactionHasFailed() 
    34683465    { 
    3469         return $this->_db->HasFailedTrans(); 
     3466        return $this->_db->hasTransactionFailed(); 
    34703467    } 
    34713468 
  • branches/kaste/framework/lib/AkActiveRecord/AkDbAdapter.php

    r435 r437  
    4040    function __destruct() 
    4141    { 
    42         //var_dump(self::$delegated_methods); 
     42        var_dump(self::$delegated_methods); 
    4343        //var_dump(self::$delegated_properties); 
    4444    } 
     
    8484        } else { 
    8585            $this->connection->debug = AK_DEBUG == 2; 
    86             //$this->connection->SetFetchMode(ADODB_FETCH_ASSOC); 
     86            $this->connection->SetFetchMode(ADODB_FETCH_ASSOC); 
    8787            defined('AK_DATABASE_CONNECTION_AVAILABLE') ? null : define('AK_DATABASE_CONNECTION_AVAILABLE', true); 
    8888        } 
     
    247247     
    248248    /** 
    249      * Returns a record array with the column names as keys and column values 
    250      * as values. 
    251      */ 
    252     function selectOne($sql) 
    253     { 
    254         $result = $this->select($sql); 
    255         return  !is_null($result) ? array_shift($result) : null; 
    256     } 
    257  
    258     /** 
    259249    * Returns a single value from a record 
    260250    */ 
     
    274264        if($results = $this->select($sql)){ 
    275265            foreach ($results as $result){ 
    276                 //$values[] = array_slice(array_values($result),0,1); ??  
    277266                $values[] = array_shift($result);  
    278267            } 
    279268        } 
    280269        return $values; 
     270    } 
     271 
     272    /** 
     273     * Returns a record array with the column names as keys and column values 
     274     * as values. 
     275     */ 
     276    function selectOne($sql) 
     277    { 
     278        $result = $this->select($sql); 
     279        return  !is_null($result) ? array_shift($result) : null; 
    281280    } 
    282281 
     
    317316    } 
    318317     
     318    /* TRANSACTIONS */ 
     319     
     320    function startTransaction() 
     321    { 
     322        return $this->connection->StartTrans();   
     323    } 
     324 
     325    function stopTransaction() 
     326    { 
     327        return $this->connection->CompleteTrans();     
     328    } 
     329     
     330    function failTransaction() 
     331    { 
     332        return $this->connection->FailTrans(); 
     333    } 
     334     
     335    function hasTransactionFailed() 
     336    { 
     337        return $this->connection->HasFailedTrans(); 
     338    } 
     339     
     340    /* META */ 
     341    function availableTables() 
     342    { 
     343        return $this->connection->MetaTables(); 
     344    } 
     345     
     346    function getColumnDetails($table_name) 
     347    { 
     348         
     349    } 
    319350} 
    320351 
  • branches/kaste/framework/lib/AkInstaller.php

    r436 r437  
    541541    function transactionStart() 
    542542    { 
    543         return $this->db->StartTrans(); 
     543        return $this->db->startTransaction(); 
    544544    } 
    545545 
    546546    function transactionComplete() 
    547547    { 
    548         return $this->db->CompleteTrans(); 
     548        return $this->db->stopTransaction(); 
    549549    } 
    550550 
    551551    function transactionFail() 
    552552    { 
    553         return $this->db->FailTrans(); 
     553        return $this->db->failTransaction(); 
    554554    } 
    555555 
    556556    function transactionHasFailed() 
    557557    { 
    558         return $this->db->HasFailedTrans(); 
     558        return $this->db->hasTransactionFailed(); 
    559559    } 
    560560