try {
- $this->conn = new PDO($this->pdo,$this->username,$this->password,$options);
+ $this->conn = new PDO($this->pdo,$this->username,$this->password,$this->options);
if (isset($this->pdo_error)) $this->conn->setAttribute(PDO::ATTR_ERRMODE, $this->pdo_error);
} catch (PDOException $e) {
function sql_name($value) {
if (preg_match('/^\w+$/',$value)) return $value;
- if ($this->db->type == 'mysql') return '`'.$value.'`';
+ if ($this->type == 'mysql') return '`'.$value.'`';
return '"'.$value.'"';
}
function quote($value,$force_quote=false) {
+ if ($value === null) return 'NULL';
if ($force_quote or !$this->numeric()) {
if (($db = $this->db()) === null) return "'".preg_replace("/'/","\\'",$value)."'";
return $db->quote($value);
+
} else {
if (strcmp($value,'') == 0) $value = 'NULL';
+ #if ($value === null) $value = 'NULL';
}
return $value;
function pdo_type() {
if (func_get_args()>0 and func_get_arg(0) === null) return PDO::PARAM_NULL;
- if ($this->numeric) return PDO::PARAM_INT;
+ if ($this->numeric()) return PDO::PARAM_INT;
if (strpos($this->type,'bool') !== false ) return PDO::PARAM_BOOL;
if (strpos($this->type,'blob') !== false ) return PDO::PARAM_LOB; # not a bug LOB
return PDO::PARAM_STR;
if (empty($keys)) $keys = $others;
foreach ($keys as $name => $field) {
- if (isset($values[$name]) and strcmp($values[$name],'')!=0)
+ #if (isset($values[$name]) and strcmp($values[$name],'')!=0)
+ if (isset($values[$name]))
$url[] = $name . '=' .urlencode($values[$name])
;
}
.'</div>'.PHP_EOL
.'</form>'.PHP_EOL;
- $this->row = $row;
- return $this;
}
function debug($msg,$level=0) { return debug($msg,$level); }
// Select
//
$sql = "SELECT *" . $this->select_extras();
- $sql .= " FROM $this->name".$this->where_criterias($this->db->p(),$this->db->p('op'));
+ $sql .= " FROM ".$this->sql_name().$this->where_criterias($this->db->p(),$this->db->p('op'));
$this->sql = $sql;
$this->debug($sql,1);
function rows_end_table($opt=array()) {
#$html = '</tbody>'.PHP_EOL;
+ $html = '';
if (!empty($opt['count'])) $html .= ''#'<tfoot>'.PHP_EOL
.'<tr class="nav bottom">'
}
$sql = 'DELETE FROM ' . $this->sql_name() . $where;
+ bye($sql);
return $this->db->exec($sql);
}