PHP – PDO函數簡介

來源:互聯網
上載者:User

標籤:metadata   rom   添加   tin   const   ack   數組   結果   ado   

PDO(PHP Data Objects)是一個“資料庫訪問抽象層”,作用是統一各種資料庫的提供者,與mysql和mysqli的函數庫相比,PDO讓跨資料庫的使用更具有親和力;與ADODB和MDB2相比,PDO更高效。目前而言,實現“資料庫抽象層”任重而道遠,使用PDO這樣的“資料庫訪問抽象層”是一個不錯的選擇。

PHP 6將預設使用PDO來處理資料庫,把所有的資料庫擴充移到了PECL



PDO->beginTransaction() — 標明復原起始點 
PDO->commit() — 標明復原結束點,並執行SQL 
PDO->__construct() — 建立一個PDO連結資料庫的執行個體 
PDO->errorCode() — 擷取錯誤碼 
PDO->errorInfo() — 擷取錯誤的資訊 
PDO->exec() — 處理一條SQL語句,並返回所影響的條目數 
PDO->getAttribute() — 擷取一個“資料庫連接對象”的屬性 
PDO->getAvailableDrivers() — 擷取有效PDO磁碟機名稱 
PDO->lastInsertId() — 擷取寫入的最後一條資料的主索引值 
PDO->prepare() — 產生一個“查詢對象” 
PDO->query() — 處理一條SQL語句,並返回一個“PDOStatement” 
PDO->quote() — 為某個SQL中的字串添加引號 
PDO->rollBack() — 執行復原 
PDO->setAttribute() — 為一個“資料庫連接對象”設定屬性 
PDOStatement->bindColumn() — 將PHP的變數綁定到資料庫中的列
PDOStatement->bindParam() — 綁定一個指定參數的變數名稱
PDOStatement->bindValue() — 將一個參數值綁定 
PDOStatement->closeCursor() — 關閉遊標,使聲明再次被運行。 
PDOStatement->columnCount() — 返回列數的結果集
PDOStatement->errorCode() — Fetch the SQLSTATE associated with the last operation on the statement handle 
PDOStatement->errorInfo() — Fetch extended error information associated with the last operation on the statement handle 
PDOStatement->execute() — 執行一個準備好的查詢對象
PDOStatement->fetch() — 擷取下一行的結果集 
PDOStatement->fetchAll() — 返回一個數組包含所有的結果集列
PDOStatement->fetchColumn() — Returns a single column from the next row of a result set 
PDOStatement->fetchObject() — Fetches the next row and returns it as an object. 
PDOStatement->getAttribute() — Retrieve a statement attribute 
PDOStatement->getColumnMeta() — Returns metadata for a column in a result set 
PDOStatement->nextRowset() — Advances to the next rowset in a multi-rowset statement handle 
PDOStatement->rowCount() — 由過去的SQL語句返回行數
PDOStatement->setAttribute() — 聲明屬性集 
PDOStatement->setFetchMode() — Set the default fetch mode for this statement

PHP – PDO函數簡介

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.