欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

PHP PDO函數(shù)庫(PDO Functions)第1/2頁

 更新時間:2009年07月20日 22:51:07   作者:  
PDO是一個“數(shù)據(jù)庫訪問抽象層”,作用是統(tǒng)一各種數(shù)據(jù)庫的訪問接口,與mysql和mysqli的函數(shù)庫相比,PDO讓跨數(shù)據(jù)庫的使用更具有親和力.
與ADODB和MDB2相比,PDO更高效。目前而言,實現(xiàn)“數(shù)據(jù)庫抽象層”任重而道遠,使用PDO這樣的“數(shù)據(jù)庫訪問抽象層”是一個不錯的選擇。
PDO->beginTransaction() — 標明回滾起始點
PDO->commit() — 標明回滾結(jié)束點,并執(zhí)行SQL
PDO->__construct() — 建立一個PDO鏈接數(shù)據(jù)庫的實例
PDO->errorCode() — 獲取錯誤碼
PDO->errorInfo() — 獲取錯誤的信息
PDO->exec() — 處理一條SQL語句,并返回所影響的條目數(shù)
PDO->getAttribute() — 獲取一個“數(shù)據(jù)庫連接對象”的屬性
PDO->getAvailableDrivers() — 獲取有效的PDO驅(qū)動器名稱
PDO->lastInsertId() — 獲取寫入的最后一條數(shù)據(jù)的主鍵值
PDO->prepare() — 生成一個“查詢對象”
PDO->query() — 處理一條SQL語句,并返回一個“PDOStatement”
PDO->quote() — 為某個SQL中的字符串添加引號
PDO->rollBack() — 執(zhí)行回滾
PDO->setAttribute() — 為一個“數(shù)據(jù)庫連接對象”設(shè)定屬性
PDOStatement->bindColumn() — Bind a column to a PHP variable
PDOStatement->bindParam() — Binds a parameter to the specified variable name
PDOStatement->bindValue() — Binds a value to a parameter
PDOStatement->closeCursor() — Closes the cursor, enabling the statement to be executed again.
PDOStatement->columnCount() — Returns the number of columns in the result set
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() — Executes a prepared statement
PDOStatement->fetch() — Fetches the next row from a result set
PDOStatement->fetchAll() — Returns an array containing all of the result set rows
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() — Returns the number of rows affected by the last SQL statement
PDOStatement->setAttribute() — Set a statement attribute
PDOStatement->setFetchMode() — Set the default fetch mode for this statement
從函數(shù)列表可以看出,操作基于不同的對象,“PDO”表示的是一個數(shù)據(jù)庫連接對象(new PDO產(chǎn)生),“PDOStatement”表示的是一個查詢對象(PDO->query()產(chǎn)生)或者是一個結(jié)果集對象(PDO->prepare()產(chǎn)生)。
一個“數(shù)據(jù)庫連接對象”的例子,返回“PDO”:
復制代碼 代碼如下:

<?php
$dbh = new PDO('mysql:host=localhost;dbname=test', 'root', '');
?>

一個“查詢對象”的例子,返回“PDOStatement”:
復制代碼 代碼如下:

<?php
$sql = "INSERT INTO `test`.`table` (`name` ,`age`)VALUES (?, ?);";
$stmt = $dbh->prepare($sql);
?>

一個“結(jié)果集對象”的例子,返回“PDOStatement”:
復制代碼 代碼如下:

<?php
$sql = "SELECT * FROM `table` WHERE `name` = 'samon'";
$stmt = $dbh->query($sql);
?>

相關(guān)文章

  • php獲取apk包信息的方法

    php獲取apk包信息的方法

    這篇文章主要介紹了php獲取apk包信息的方法,非常實用的功能,需要的朋友可以參考下
    2014-08-08
  • 使用apache模塊rewrite_module (轉(zhuǎn))

    使用apache模塊rewrite_module (轉(zhuǎn))

    使用apache模塊rewrite_module (轉(zhuǎn))...
    2007-02-02
  • PHP+ajax實現(xiàn)獲取新聞數(shù)據(jù)簡單示例

    PHP+ajax實現(xiàn)獲取新聞數(shù)據(jù)簡單示例

    這篇文章主要介紹了PHP+ajax實現(xiàn)獲取新聞數(shù)據(jù),涉及php ajax交互獲取信息及json格式處理的相關(guān)操作技巧,需要的朋友可以參考下
    2018-05-05
  • PHP原生函數(shù)一定好嗎?

    PHP原生函數(shù)一定好嗎?

    本文介紹了php的一個原生函數(shù)及其優(yōu)化后的函數(shù)執(zhí)行效率對比,得出結(jié)論,php原生函數(shù)不一定是最合適的。
    2014-12-12
  • php給圖片加文字水印

    php給圖片加文字水印

    本文給大家分享的是使用php實現(xiàn)的給圖片加水印的方法,十分的細致全面,有需要的小伙伴可以參考下。
    2015-07-07
  • PHP類相關(guān)知識點實例總結(jié)

    PHP類相關(guān)知識點實例總結(jié)

    這篇文章主要介紹了PHP類相關(guān)知識點,結(jié)合實例形式總結(jié)分析了php類相關(guān)的最終類、最終方法、抽象類、抽象方法、接口、重載、魔術(shù)方法等相關(guān)概念與操作技巧,需要的朋友可以參考下
    2016-09-09
  • PHP實現(xiàn)的迪科斯徹(Dijkstra)最短路徑算法實例

    PHP實現(xiàn)的迪科斯徹(Dijkstra)最短路徑算法實例

    這篇文章主要介紹了PHP實現(xiàn)的迪科斯徹(Dijkstra)最短路徑算法,簡單描述了迪科斯徹(Dijkstra)最短路徑算法的概念、功能并結(jié)合具體實例形式分析了php實現(xiàn)迪科斯徹(Dijkstra)最短路徑算法的相關(guān)步驟與操作技巧,需要的朋友可以參考下
    2017-09-09
  • php實現(xiàn)將數(shù)組轉(zhuǎn)換為XML的方法

    php實現(xiàn)將數(shù)組轉(zhuǎn)換為XML的方法

    這篇文章主要介紹了php實現(xiàn)將數(shù)組轉(zhuǎn)換為XML的方法,實例分析了php操作數(shù)組及XML格式文件的技巧,具有一定參考借鑒價值,需要的朋友可以參考下
    2015-03-03
  • PHP 計算代碼執(zhí)行耗時的代碼修正網(wǎng)上普遍錯誤

    PHP 計算代碼執(zhí)行耗時的代碼修正網(wǎng)上普遍錯誤

    前幾天測試 SQLite 插入大數(shù)據(jù)量的時候, 找了一些關(guān)于計算執(zhí)行時間的代碼, 發(fā)現(xiàn)網(wǎng)上普遍流傳著這樣一份代碼
    2011-05-05
  • php中count獲取多維數(shù)組長度的方法

    php中count獲取多維數(shù)組長度的方法

    這篇文章主要介紹了php中count獲取多維數(shù)組長度的方法,實例分析了數(shù)組的原理并總結(jié)了數(shù)組長度計算的方法,非常具有實用價值,需要的朋友可以參考下
    2014-11-11

最新評論