/**
  * Inserta datos desde un archivo de datos de migración en una tabla
  *
  * @param string $tableName
  * @param string $fields
  */
 public function batchInsert($tableName, $fields)
 {
     $migrationData = self::$_migrationPath . '/' . $tableName . '.dat';
     if (file_exists($migrationData)) {
         self::$_connection->begin();
         self::$_connection->delete($tableName);
         $batchHandler = fopen($migrationData, 'r');
         while (($line = fgets($batchHandler)) !== false) {
             self::$_connection->insert($tableName, explode('|', rtrim($line)), $fields, false);
             unset($line);
         }
         fclose($batchHandler);
         self::$_connection->commit();
     }
 }
 /**
  * Delete All data from Relational Map Table
  *
  * @param string $conditions
  * @return boolean
  */
 public function delete_all($conditions = '')
 {
     $limit = '';
     if ($this->schema) {
         $table = $this->schema . "." . $this->source;
     } else {
         $table = $this->source;
     }
     if (func_num_args() > 1) {
         $params = Util::getParams(func_get_args());
         $limit_args = array($select);
         if (isset($params['limit'])) {
             array_push($limit_args, "limit: {$params['limit']}");
         }
         if (isset($params['offset'])) {
             array_push($limit_args, "offset: {$params['offset']}");
         }
         if (count($limit_args) > 1) {
             $select = call_user_func_array(array($this, 'limit'), $limit_args);
         }
     }
     return $this->db->delete($table, $conditions);
 }
Esempio n. 3
0
 /**
  * Borra registros de una tabla!
  *
  * @param string $table
  * @param string $where_condition
  */
 public function delete($table, $where_condition)
 {
     $this->set_return_rows(false);
     return parent::delete($table, $where_condition);
 }
Esempio n. 4
0
 function __construct($dbInfos)
 {
     $dbtables = array('xt_config' => array(array('name' => 'electionId', 'digits' => '100', 'json' => false), array('name' => 'checkTokenUrl', 'digits' => '100', 'json' => false)));
     parent::__construct($dbInfos, $dbtables, true);
 }
Esempio n. 5
0
 function __construct($dbInfos)
 {
     $dbtables = array('elections' => array(array('name' => 'electionId', 'digits' => '100', 'json' => false), array('name' => 'config', 'digits' => '50000', 'json' => true), array('name' => 'hash', 'digits' => '257', 'json' => false)));
     parent::__construct($dbInfos, $dbtables, true);
 }
Esempio n. 6
0
 function __construct($dbInfos)
 {
     $dbtables = array('storedCorrectVotes' => array(array('name' => 'electionId', 'digits' => '100', 'json' => false), array('name' => 'votingno', 'digits' => '5000', 'json' => false), array('name' => 'vote', 'digits' => '50', 'json' => false), array('name' => 'storedCorrectVotes', 'digits' => '10000', 'json' => true)));
     parent::__construct($dbInfos, $dbtables, true);
 }
Esempio n. 7
0
 /**
  * Ejecuta la consulta
  *
  * @return	ActiveRecordResultset
  */
 public function execute()
 {
     $sqlStatement = $this->getSQLString();
     if ($this->_connection == null) {
         $this->_connection = DbPool::getConnection();
     }
     $resultResource = $this->_connection->query($sqlStatement);
     $count = $this->_connection->numRows($resultResource);
     if ($count > 0) {
         $rowObject = new ActiveRecordRow();
         $rowObject->setConnection($this->_connection);
         return new ActiveRecordResultset($rowObject, $resultResource, $sqlStatement);
     } else {
         return new ActiveRecordResultset(new stdClass(), false, $sqlStatement);
     }
 }
Esempio n. 8
0
 function __construct($dbInfos)
 {
     $dbtables = array('sp_credentials' => array(array('name' => 'electionId', 'digits' => '100', 'json' => false), array('name' => 'sp_credentials', 'digits' => '100', 'json' => false)));
     parent::__construct($dbInfos, $dbtables, true);
 }
Esempio n. 9
0
 function __construct($dbInfos)
 {
     $dbtables = array('oa_elections' => array(array('name' => 'electionId', 'digits' => '100', 'json' => false), array('name' => 'serverId', 'digits' => '100', 'json' => false), array('name' => 'eligibilityCriteria', 'digits' => '500', 'json' => true)), 'oa_voters' => array(array('name' => 'serverId', 'digits' => '100', 'json' => false), array('name' => 'configHash', 'digits' => '100', 'json' => false), array('name' => 'transactionId', 'digits' => '100', 'json' => false), array('name' => 'username', 'digits' => '100', 'json' => false), array('name' => 'displayname', 'digits' => '100', 'json' => false), array('name' => 'auid', 'digits' => '100', 'json' => false), array('name' => 'authInfos', 'digits' => '1000', 'json' => true), array('name' => 'startTime', 'digits' => '100', 'json' => false), array('name' => 'firstUse', 'digits' => '1', 'json' => false)));
     parent::__construct($dbInfos, $dbtables, true);
 }
Esempio n. 10
0
 function __construct($dbInfos)
 {
     $dbtables = array('blindedHashes' => array(array('name' => 'electionID', 'digits' => '100', 'json' => false), array('name' => 'voterId', 'digits' => '100', 'json' => false), array('name' => 'blindedHashes', 'digits' => '10000', 'json' => true)), 'pickedBallots' => array(array('name' => 'electionID', 'digits' => '100', 'json' => false), array('name' => 'voterId', 'digits' => '100', 'json' => false), array('name' => 'pickedBallots', 'digits' => '10000', 'json' => true)), 'signedBallots' => array(array('name' => 'electionID', 'digits' => '100', 'json' => false), array('name' => 'voterId', 'digits' => '100', 'json' => false), array('name' => 'signedBallots', 'digits' => '10000', 'json' => true)), 'VotingNos' => array(array('name' => 'electionID', 'digits' => '100', 'json' => false), array('name' => 'voterId', 'digits' => '100', 'json' => false), array('name' => 'VotingNos', 'digits' => '5000', 'json' => true)));
     parent::__construct($dbInfos, $dbtables, true);
 }
Esempio n. 11
0
 public function setColumnRules($columnRules)
 {
     self::$columnRules = $columnRules;
 }