| Server IP : 50.21.180.56 / Your IP : 216.73.216.208 Web Server : Apache System : Linux info 3.0 #1337 SMP Tue Jan 01 00:00:00 CEST 2000 all GNU/Linux User : ws67922704 ( 67922704) PHP Version : 8.5.13 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /kunden/proc/thread-self/cwd/wp-content/plugins_old/dhtmlxspreadsheet/codebase/php/ |
Upload File : |
<?php
/**
(c) DHTMLX Ltd, 2011
Licensing: You allowed to use this component for free under GPL or you need to obtain Commercial/Enterprise license to use it in non-GPL project
Contact: sales@dhtmlx.com
**/
/*
@author dhtmlx.com
@license GPL, see license.txt
*/
require_once("db_common.php");
/*! Implementation of DataWrapper for PDO
if you plan to use it for Oracle - use Oracle connection type instead
**/
class PDODBDataWrapper extends DBDataWrapper{
private $last_result;//!< store result or last operation
public function query($sql){
LogMaster::log($sql);
$res=$this->connection->query($sql);
if ($res===false) {
$message = $this->connection->errorInfo();
throw new Exception("PDO - sql execution failed\n".$message[2]);
}
return new PDOResultSet($res);
}
protected function select_query($select,$from,$where,$sort,$start,$count){
if (!$from)
return $select;
$sql="SELECT ".$select." FROM ".$from;
if ($where) $sql.=" WHERE ".$where;
if ($sort) $sql.=" ORDER BY ".$sort;
if ($start || $count) {
if ($this->connection->getAttribute(PDO::ATTR_DRIVER_NAME)=="pgsql")
$sql.=" OFFSET ".$start." LIMIT ".$count;
else
$sql.=" LIMIT ".$start.",".$count;
}
return $sql;
}
public function get_next($res){
$data = $res->next();
return $data;
}
protected function get_new_id(){
return $this->connection->lastInsertId();
}
public function escape($str){
$res=$this->connection->quote($str);
if ($res===false) //not supported by pdo driver
return str_replace("'","''",$str);
return substr($res,1,-1);
}
}
class PDOResultSet{
private $res;
public function __construct($res){
$this->res = $res;
}
public function next(){
$data = $this->res->fetch(PDO::FETCH_ASSOC);
if (!$data){
$this->res->closeCursor();
return null;
}
return $data;
}
}
?>