本文整理汇总了PHP中resource::lastErrorMsg方法的典型用法代码示例。如果您正苦于以下问题:PHP resource::lastErrorMsg方法的具体用法?PHP resource::lastErrorMsg怎么用?PHP resource::lastErrorMsg使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类resource
的用法示例。
在下文中一共展示了resource::lastErrorMsg方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: copyCellCollection
/**
* Clone the cell collection
*
* @param PHPExcel_Worksheet $parent The new worksheet
*
* @return void
*/
public function copyCellCollection(PHPExcel_Worksheet $parent)
{
$this->_currentCellIsDirty;
$this->_storeData();
// Get a new id for the new table name
$tableName = str_replace('.', '_', $this->_getUniqueID());
if (!$this->_DBHandle->exec('CREATE TABLE kvp_' . $tableName . ' (id VARCHAR(12) PRIMARY KEY, value BLOB)
AS SELECT * FROM kvp_' . $this->_TableName)) {
throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg());
}
// Copy the existing cell cache file
$this->_TableName = $tableName;
}
示例2: __construct
/**
* Initialise this new cell collection
*
* @param PHPExcel_Worksheet $parent The worksheet for this cell collection
*/
public function __construct(PHPExcel_Worksheet $parent)
{
parent::__construct($parent);
if (is_null($this->_DBHandle)) {
$this->_TableName = str_replace('.', '_', $this->_getUniqueID());
$_DBName = ':memory:';
$this->_DBHandle = new SQLite3($_DBName);
if ($this->_DBHandle === false) {
throw new Exception($this->_DBHandle->lastErrorMsg());
}
if (!$this->_DBHandle->exec('CREATE TABLE kvp_' . $this->_TableName . ' (id VARCHAR(12) PRIMARY KEY, value BLOB)')) {
throw new Exception($this->_DBHandle->lastErrorMsg());
}
}
}
示例3: moveCell
/**
* Move a cell object from one address to another
*
* @param string $fromAddress Current address of the cell to move
* @param string $toAddress Destination address of the cell to move
* @return boolean
*/
public function moveCell($fromAddress, $toAddress)
{
if ($fromAddress === $this->_currentObjectID) {
$this->_currentObjectID = $toAddress;
}
$query = "DELETE FROM kvp_" . $this->_TableName . " WHERE id = '" . $toAddress . "'";
$result = $this->_DBHandle->exec($query);
if ($result === false) {
throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg());
}
$query = "UPDATE kvp_" . $this->_TableName . " SET id = '" . $toAddress . "' WHERE id = '" . $fromAddress . "'";
$result = $this->_DBHandle->exec($query);
if ($result === false) {
throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg());
}
return true;
}
示例4: __construct
/**
* Initialise this new cell collection
*
* @param PHPExcel_Worksheet $parent The worksheet for this cell collection
*/
public function __construct(PHPExcel_Worksheet $parent)
{
parent::__construct($parent);
if (is_null($this->_DBHandle)) {
$this->_TableName = str_replace('.', '_', $this->_getUniqueID());
$_DBName = ':memory:';
$this->_DBHandle = new SQLite3($_DBName);
if ($this->_DBHandle === false) {
throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg());
}
if (!$this->_DBHandle->exec('CREATE TABLE kvp_' . $this->_TableName . ' (id VARCHAR(12) PRIMARY KEY, value BLOB)')) {
throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg());
}
}
$this->_selectQuery = $this->_DBHandle->prepare("SELECT value FROM kvp_" . $this->_TableName . " WHERE id = :id");
$this->_insertQuery = $this->_DBHandle->prepare("INSERT OR REPLACE INTO kvp_" . $this->_TableName . " VALUES(:id,:data)");
$this->_updateQuery = $this->_DBHandle->prepare("UPDATE kvp_" . $this->_TableName . " SET id=:toId WHERE id=:fromId");
$this->_deleteQuery = $this->_DBHandle->prepare("DELETE FROM kvp_" . $this->_TableName . " WHERE id = :id");
}
示例5: query
/**
* 直接查询Sql
*
* @param String $SQL
* @return Mix
*/
function query($sql)
{
if (!$this->conn) {
$this->connect();
}
if (strtolower(substr(ltrim($sql), 0, 5)) == 'alter') {
$queryparts = preg_split("/[\\s]+/", $sql, 4, PREG_SPLIT_NO_EMPTY);
$tablename = $queryparts[2];
$alterdefs = $queryparts[3];
$result = $this->alterTable($tablename, $alterdefs);
} else {
if ($this->type == "SQLite2") {
$result = sqlite_query($sql, $this->conn);
} else {
$result = $this->conn->query($sql);
}
}
if (!$result) {
if ($this->type == "SQLite2") {
$this->lasterr = sqlite_last_error($this->conn);
$this->lasterrcode = sqlite_error_string($this->lasterr);
} elseif ($this->type == "SQLite3") {
$this->lasterr = $this->conn->lastErrorCode();
$this->lasterrcode = $this->conn->lastErrorMsg();
} elseif ($this->type == 'PDO') {
$this->lasterr = $this->conn->errorCode();
$this->lasterrcode = implode(',', $this->conn->errorInfo());
}
if ($this->_transflag) {
$this->_transErrors[]['sql'] = $sql;
$this->_transErrors[]['errcode'] = $this->lasterrcode;
$this->_transErrors[]['err'] = $this->lasterr;
} else {
exit('SQL:' . $sql . ' ERROR_INFO:' . $this->lasterrcode . ',' . $this->lasterr);
return false;
}
} else {
$this->query_num++;
$this->lastResult = $result;
return $result;
}
}
示例6: errorInfo
public function errorInfo()
{
return $this->dbh->lastErrorMsg();
}