PDO: Skillnad mellan sidversioner
Hoppa till navigering
Hoppa till sök
Admin (diskussion | bidrag) (Skapade sidan med '== PDO-klassen == '''(PHP 5 >= 5.1.0, PHP 7, PHP 8, PECL pdo >= 0.1.0)''' === Introduktion === Representerar en anslutning mellan PHP och en databasserver. === Klassöversikt === <pre> class PDO { →Konstanter: public const int PARAM_NULL; public const int PARAM_BOOL = 5; public const int PARAM_INT = 1; public const int PARAM_STR = 2; public const int PARAM_LOB = 3; public const int PARAM_STMT = 4; public const int PARAM_INPUT_OUTPUT; public const int PARAM_STR_NATL...') |
Admin (diskussion | bidrag) Ingen redigeringssammanfattning |
||
Rad 1: | Rad 1: | ||
= | = PHP Data Objects (PDO) = | ||
PDO är en lättviktig och konsekvent gränssnitt för att komma åt databaser i PHP. Det erbjuder en databasabstraktionslager som gör att samma funktioner kan användas för olika databaser. | |||
== | == Innehåll == | ||
* [[#Introduction|Introduction]] | |||
* [[#Installing_Configuring|Installing/Configuring]] | |||
** [[#Installation|Installation]] | |||
** [[#Runtime_Configuration|Runtime Configuration]] | |||
* [[#Predefined_Constants|Predefined Constants]] | |||
* [[#Connections_and_Connection_management|Connections and Connection management]] | |||
* [[#Transactions_and_auto_commit|Transactions and auto-commit]] | |||
* [[#Prepared_statements_and_stored_procedures|Prepared statements and stored procedures]] | |||
* [[#Errors_and_error_handling|Errors and error handling]] | |||
* [[#Large_Objects_LOBs|Large Objects (LOBs)]] | |||
* [[#PDO|PDO — The PDO class]] | |||
** [[PDO::beginTransaction()]] — Initiates a transaction | |||
** [[PDO::commit()]] — Commits a transaction | |||
** [[PDO::connect()]] — Connect to a database and return a PDO subclass for drivers that support it | |||
** [[PDO::__construct()]] — Creates a PDO instance representing a connection to a database | |||
** [[PDO::errorCode()]] — Fetch the SQLSTATE associated with the last operation on the database handle | |||
** [[PDO::errorInfo()]] — Fetch extended error information associated with the last operation on the database handle | |||
** [[PDO::exec()]] — Execute an SQL statement and return the number of affected rows | |||
** [[PDO::getAttribute()]] — Retrieve a database connection attribute | |||
** [[PDO::getAvailableDrivers()]] — Return an array of available PDO drivers | |||
** [[PDO::inTransaction()]] — Checks if inside a transaction | |||
** [[PDO::lastInsertId()]] — Returns the ID of the last inserted row or sequence value | |||
** [[PDO::prepare()]] — Prepares a statement for execution and returns a statement object | |||
** [[PDO::query()]] — Prepares and executes an SQL statement without placeholders | |||
** [[PDO::quote()]] — Quotes a string for use in a query | |||
** [[PDO::rollBack()]] — Rolls back a transaction | |||
** [[PDO::setAttribute()]] — Set an attribute | |||
* [[#PDOStatement|PDOStatement — The PDOStatement class]] | |||
** [[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::debugDumpParams()]] — Dump an SQL prepared command | |||
** [[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()]] — Fetches the remaining rows from a result set | |||
** [[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::getIterator()]] — Gets result set iterator | |||
** [[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 | |||
* [[#PDORow|PDORow — The PDORow class]] | |||
* [[#PDOException|PDOException — The PDOException class]] | |||
* [[#PDO_Drivers|PDO Drivers]] | |||
** [[#CUBRID_PDO|CUBRID (PDO) — CUBRID Functions (PDO_CUBRID)]] | |||
** [[#MS_SQL_Server_PDO|MS SQL Server (PDO) — Microsoft SQL Server and Sybase Functions (PDO_DBLIB)]] | |||
** [[#Pdo_Dblib|Pdo\Dblib — The Pdo\Dblib class]] | |||
** [[#Firebird_PDO|Firebird (PDO) — Firebird Functions (PDO_FIREBIRD)]] | |||
** [[#Pdo_Firebird|Pdo\Firebird — The Pdo\Firebird class]] | |||
** [[#IBM_PDO|IBM (PDO) — IBM Functions (PDO_IBM)]] | |||
** [[#Informix_PDO|Informix (PDO) — Informix Functions (PDO_INFORMIX)]] | |||
** [[#MySQL_PDO|MySQL (PDO) — MySQL Functions (PDO_MYSQL)]] | |||
** [[#Pdo_Mysql|Pdo\Mysql — The Pdo\Mysql class]] | |||
** [[#MS_SQL_Server_PDO_SQLSRV|MS SQL Server (PDO) — Microsoft SQL Server Functions (PDO_SQLSRV)]] | |||
** [[#Oracle_PDO|Oracle (PDO) — Oracle Functions (PDO_OCI)]] | |||
** [[#ODBC_DB2_PDO|ODBC and DB2 (PDO) — ODBC and DB2 Functions (PDO_ODBC)]] | |||
** [[#Pdo_Odbc|Pdo\Odbc — The Pdo\Odbc class]] | |||
** [[#PostgreSQL_PDO|PostgreSQL (PDO) — PostgreSQL Functions (PDO_PGSQL)]] | |||
** [[#Pdo_Pgsql|Pdo\Pgsql — The Pdo\Pgsql class]] | |||
** [[#SQLite_PDO|SQLite (PDO) — SQLite Functions (PDO_SQLITE)]] | |||
** [[#Pdo_Sqlite|Pdo\Sqlite — The Pdo\Sqlite class]] | |||
= Sidslut = | = Sidslut = | ||
Orginalhemsidan på Engelska :https://www.php.net/manual/en/ | Orginalhemsidan på Engelska :https://www.php.net/manual/en/book.pdo.php | ||
<BR>[[PHP]] | <BR>[[PHP]] | ||
[[Funktioner]] | [[Funktioner]] |
Versionen från 22 december 2024 kl. 07.46
PHP Data Objects (PDO)
PDO är en lättviktig och konsekvent gränssnitt för att komma åt databaser i PHP. Det erbjuder en databasabstraktionslager som gör att samma funktioner kan användas för olika databaser.
Innehåll
- Introduction
- Installing/Configuring
- Predefined Constants
- Connections and Connection management
- Transactions and auto-commit
- Prepared statements and stored procedures
- Errors and error handling
- Large Objects (LOBs)
- PDO — The PDO class
- PDO::beginTransaction() — Initiates a transaction
- PDO::commit() — Commits a transaction
- PDO::connect() — Connect to a database and return a PDO subclass for drivers that support it
- PDO::__construct() — Creates a PDO instance representing a connection to a database
- PDO::errorCode() — Fetch the SQLSTATE associated with the last operation on the database handle
- PDO::errorInfo() — Fetch extended error information associated with the last operation on the database handle
- PDO::exec() — Execute an SQL statement and return the number of affected rows
- PDO::getAttribute() — Retrieve a database connection attribute
- PDO::getAvailableDrivers() — Return an array of available PDO drivers
- PDO::inTransaction() — Checks if inside a transaction
- PDO::lastInsertId() — Returns the ID of the last inserted row or sequence value
- PDO::prepare() — Prepares a statement for execution and returns a statement object
- PDO::query() — Prepares and executes an SQL statement without placeholders
- PDO::quote() — Quotes a string for use in a query
- PDO::rollBack() — Rolls back a transaction
- PDO::setAttribute() — Set an attribute
- PDOStatement — The PDOStatement class
- 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::debugDumpParams() — Dump an SQL prepared command
- 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() — Fetches the remaining rows from a result set
- 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::getIterator() — Gets result set iterator
- 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
- PDORow — The PDORow class
- PDOException — The PDOException class
- PDO Drivers
- CUBRID (PDO) — CUBRID Functions (PDO_CUBRID)
- MS SQL Server (PDO) — Microsoft SQL Server and Sybase Functions (PDO_DBLIB)
- Pdo\Dblib — The Pdo\Dblib class
- Firebird (PDO) — Firebird Functions (PDO_FIREBIRD)
- Pdo\Firebird — The Pdo\Firebird class
- IBM (PDO) — IBM Functions (PDO_IBM)
- Informix (PDO) — Informix Functions (PDO_INFORMIX)
- MySQL (PDO) — MySQL Functions (PDO_MYSQL)
- Pdo\Mysql — The Pdo\Mysql class
- MS SQL Server (PDO) — Microsoft SQL Server Functions (PDO_SQLSRV)
- Oracle (PDO) — Oracle Functions (PDO_OCI)
- ODBC and DB2 (PDO) — ODBC and DB2 Functions (PDO_ODBC)
- Pdo\Odbc — The Pdo\Odbc class
- PostgreSQL (PDO) — PostgreSQL Functions (PDO_PGSQL)
- Pdo\Pgsql — The Pdo\Pgsql class
- SQLite (PDO) — SQLite Functions (PDO_SQLITE)
- Pdo\Sqlite — The Pdo\Sqlite class
Sidslut
Orginalhemsidan på Engelska :https://www.php.net/manual/en/book.pdo.php
PHP
Funktioner
Funktionsreferens
Databas-tillägg
Det här är en maskinöversättning av PHP-manualen till svenska. Om du hittar fel är vi tacksamma om du rapporterar dem via formuläret som finns på
https://www.linux.se/kontaka-linux-se/
Tack till Huddinge Datorhjälp som har sponsrat Linux.se med webbhotell.