public function insertRowInDb($info, $insertId, $nextRowNum = '', $inPlace = false)
 {
     $preparedSets = array();
     $queryParams = array();
     $afterAddArray = array();
     $fileColumns = array('name', 'size', 'type');
     if (!stristr($this->permissions, 'A')) {
         $this->handleHacking();
     }
     foreach ($info as $col => $val) {
         if (isset($this->tableColumns[$col])) {
             // Check to make sure the column has add permissions
             if (!stristr($this->tableColumns[$col]['perms'], 'A')) {
                 $this->handleHacking();
             }
             $val = $this->validateInputValue($col, $val, $info, 'add', $inPlace);
             $val = $this->getSqlValue($col, $val);
             if ($val === false && !isset($this->tableColumns[$col]['mysql_add_fun'])) {
                 continue;
             }
             $preparedSets[] = $this->getAddEditPreparedSet($col, $val, 'add');
             if ($val !== null && !isset($this->tableColumns[$col]['mysql_add_fun'])) {
                 $queryParams[$col] = $val;
             }
             $afterAddArray[$col] = $val;
         }
     }
     if (!$this->valError) {
         if (!empty($this->userInsertFun) && is_callable($this->userInsertFun)) {
             return call_user_func($this->userInsertFun, $this->primaryKeyCol, '', $afterAddArray, $this->instanceName, $nextRowNum);
         }
         if (count($preparedSets) == 0) {
             $preparedSets[] = $this->primaryKeyCol . " = ''";
         }
         $query = "insert into {$this->tableName} set " . implode(', ', $preparedSets);
         //$this->information[] = $query;
         $result = $this->doQuery($query, $queryParams);
         if ($result) {
             $insertId = strlen($insertId) > 0 ? $insertId : DBC::get()->lastInsertId();
             if (!empty($this->afterAddFun) && is_callable($this->afterAddFun)) {
                 call_user_func($this->afterAddFun, $this->primaryKeyCol, $insertId, $afterAddArray, $this->instanceName, $nextRowNum);
             }
         }
     }
     return $insertId;
 }
Ejemplo n.º 2
0
 protected function setMysqlLocale()
 {
     $query = "SET lc_time_names = 'cs_CZ'";
     $result = DBC::get()->query($query);
 }
Ejemplo n.º 3
0
 public function __construct($table, $alias = '', $connexion = null)
 {
     $this->table = $table;
     $this->aliasTable = $table . ' ' . $alias;
     $this->con = $connexion === null ? DBC::get() : $connexion;
 }