예제 #1
0
 function __get($var)
 {
     $func = 'BitcoinAcct_' . $var . '_get';
     if (function_exists($func)) {
         return call_user_func($func, $this->_cPtr);
     }
     if ($var === 'thisown') {
         return swig_otapi_get_newobject($this->_cPtr);
     }
     return Acct::__get($var);
 }
예제 #2
0
                     $db->commitTransaction();
                     $committed = true;
                     $result->successMsg .= sprintf(_t('crud.idUpdated'), _t('crud.acct.tableDescription', 'Account'), $row->id) . "\n";
                 }
             }
             if (!$success) {
                 if ($result->errorMsg == '' && empty($result->fieldErrors)) {
                     $result->errorMsg .= sprintf(_t('crud.rowCouldNotBeUpdated'), _t('crud.acct.tableDescription', 'Account')) . "\n";
                 }
             }
         }
     }
 } else {
     // if ($row->id > 0)
     // Convert the value object into the actual entity.
     $newRow = new Acct();
     $newRow->loadFromArray((array) $row);
     if (function_exists('preInsertHook')) {
         preInsertHook();
     }
     try {
         $success = $acctDAO->insert($newRow);
     } catch (Exception $ex) {
         $success = false;
     }
     if ($success) {
         $row->id = $newRow->id;
         $justInsertedRowId = $newRow->id;
         if (function_exists('postInsertHook')) {
             postInsertHook();
         }
예제 #3
0
<?php

// DO NOT EDIT THIS FILE.
// This file was generated by searchgen.
// If you need to customize this file, please edit the corresponding
// yaml file in the gencfg directory, and then re-generate this file
// by running searchgen, passing in the table name.
if (isset($command) && $command == 'loadAcct') {
    header('Content-Type: application/json');
    $db = ConnectionFactory::getConnection();
    $acctDAO = new AcctDAO($db);
    $id = isset($params['id']) ? (int) trim($params['id']) : 0;
    if ($id <= 0) {
        $rows = array(Acct::createDefault());
    } else {
        $sql = <<<EOF
select * from acct pri where pri.id = ?
EOF;
        $ps = new PreparedStatement($sql, 0, 1);
        $ps->setInt($id);
        $rows = $acctDAO->findWithPreparedStatement($ps);
    }
    echo json_encode($rows);
    $db->close();
    exit;
}
예제 #4
0
 public function findWithPreparedStatement($ps)
 {
     $cacheKey = null;
     if ($this->cache !== null) {
         $cacheKey = serialize($ps);
         if (($rows = $this->cache->get($cacheKey)) !== false) {
             return $rows;
         }
     }
     $rows = array();
     $rs = $this->connection->executeQuery($ps);
     while ($arr = $this->connection->fetchArray($rs)) {
         $row = new Acct();
         $row->loadFromArray($arr);
         $rows[] = $row;
     }
     $this->connection->freeResult($rs);
     if ($this->cache !== null) {
         $this->cache->set($cacheKey, $rows);
     }
     return $rows;
 }
예제 #5
0
 public static function createDefault()
 {
     $v = new Acct();
     $v->defaultAllFields();
     return $v;
 }
예제 #6
0
 function __get($var)
 {
     $func = 'BitcoinAcct_' . $var . '_get';
     if (function_exists($func)) {
         $r = call_user_func($func, $this->_cPtr);
         if (!is_resource($r)) {
             return $r;
         }
         $c = substr(get_resource_type($r), strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3);
         return new $c($r);
     }
     if ($var === 'thisown') {
         return swig_otapi_get_newobject($this->_cPtr);
     }
     return Acct::__get($var);
 }