Esempio n. 1
0
 public function __construct($con = null, $sql = null)
 {
     parent::__construct();
     $this->pdo = $con;
     if ($sql != null) {
         $this->setQuery($sql);
     }
 }
Esempio n. 2
0
 public function __construct($pdo, $table, $column = null, $cond = '', $order = '', $limit = '')
 {
     $this->pdo = $pdo;
     $this->statement = null;
     parent::__construct();
     if ($column != null) {
         $campos = '';
         $campos = implode(', ', $column);
     } else {
         $campos = '*';
     }
     $this->sql = "SELECT " . $campos . " FROM " . $table . " ";
     if ($cond != '') {
         $this->sql .= " WHERE " . trim($cond);
     }
     if ($order != '') {
         $this->sql .= " ORDER BY " . trim($order);
     }
     if ($limit != '') {
         $this->sql .= " LIMIT " . trim($limit);
     }
     $this->statement = $this->pdo->prepare($this->sql);
     try {
         $this->statement->execute();
         $this->rows_affected = $this->statement->rowCount();
         if ($this->rows_affected > 0) {
             return true;
         } else {
             $this->error = $this->getMensagemErro('NULLSELECT', 'selecionar');
             $this->rows_affected = 0;
             return false;
         }
     } catch (PDOException $e) {
         $this->error = $this->getMensagemErro($e, 'selecionar');
         $this->rows_affected = 0;
         return false;
     }
 }
Esempio n. 3
0
 public function __construct($pdo, $table, $value, $cond = '')
 {
     parent::__construct();
     $this->pdo = $pdo;
     $this->update($table, $value, $cond);
 }
Esempio n. 4
0
 public function __construct($pdo, $table, $value)
 {
     parent::__construct();
     $this->pdo = $pdo;
     $this->insert($table, $value);
 }