/** * Binds value to PDOStatement. * * @param int $pos * @param mixed $value * @param int $type * @return boolean */ public function bindValue($pos, $value, $type = null) { $typestr = isset($this->typeMap[$type]) ? $this->typeMap[$type] : '(default)'; if ($type == PDO::PARAM_LOB) { $this->pdo->log("Binding [LOB value] at position " . $pos . " w/ PDO type " . $typestr); } else { $this->pdo->log("Binding " . var_export($value, true) . " at position {$pos} w/ PDO type " . $typestr); } return parent::bindValue($pos, $value, $type); }
/** * Binds a value to a corresponding named or question mark placeholder in the SQL statement * that was use to prepare the statement. Returns a boolean value indicating success. * * @param int $pos Parameter identifier (for determining what to replace in the query). * @param mixed $value The value to bind to the parameter. * @param int $type Explicit data type for the parameter using the PDO::PARAM_* constants. Defaults to PDO::PARAM_STR. * @return boolean */ public function bindValue($pos, $value, $type = PDO::PARAM_STR) { $debug = $this->pdo->getDebugSnapshot(); $typestr = isset(self::$typeMap[$type]) ? self::$typeMap[$type] : '(default)'; $return = parent::bindValue($pos, $value, $type); $valuestr = $type == PDO::PARAM_LOB ? '[LOB value]' : var_export($value, true); $msg = "Binding {$valuestr} at position {$pos} w/ PDO type {$typestr}"; $this->boundValues[$pos] = $valuestr; $this->pdo->log($msg, null, __METHOD__, $debug); return $return; }
// Автозагрузка классов--------- function __autoload($class_name) { $file = D . '/classes/' . $class_name . '.php'; if (!is_file($file)) { return false; } include $file; } //--------------------------- //Подключение к БД include D . '/sys/config.php'; //Класс кэширования $registry['cache'] = Cache::me(); try { $db = new DebugPDO('mysql:host=' . DB_SERVER . ';dbname=' . DB_NAME, DB_USER, DB_PASSWORD); $db->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC); $db->log_on(); $db->cache =& $registry['cache']; $db->query("SET NAMES utf8;"); $registry['db'] = $db; } catch (Exception $e) { echo 'Ошибка соединения с базой данных'; exit; } //Считывание настроек из базы---------------------- $raw_config = array(); $config = array(); $raw_conf_array = array(); $conf_dirs = array(0); if ($row = $db->get("SELECT * FROM config ORDER BY mother;", 60)) {