深圳全飞鸿

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 991|回复: 2
打印 上一主题 下一主题

adodb函数列表

[复制链接]

800

主题

1379

帖子

7706

积分

版主

Rank: 7Rank: 7Rank: 7

积分
7706
跳转到指定楼层
楼主
发表于 2019-9-5 22:37:05 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
Reference Manual

Variables  变量
In database drivers that do not support native recordset counting, controls whether to emulate the functionality
Determines whether to right trim CHAR fields
If using recordset caching, determines the directory holding the cached data
If using recordset caching, specifies a class for cached recordset handling
Sets a default date and time format for the ADOdb date/time library
Changes the behavior of empty and null field handling when updating or creating records
Sets the global array type (numeric or associative) for returned recordsets
Sets the returned value if a valid SQL statement does not match any record when the method getOne() is executed.
Sets the language for error messages
Quotes, and optionally controls the casing of field name in constructed SQL statements




Constants 常量
ADODB_ASSOC_CASEControls the case-specifity of recordset keys returned as associative arrays
ADODB_DEFAULT_METATYPEControls the default value returned if an unknown data type is tested
The Database Connection Object 数据库连接对象

Establishing Connections 建立连接
Create a new connection object
Establishes a non-persistent connection with a database
Indicates if a connection has been established
Is a pseudonym for adoNewConnection()
Forces the establishment of  a new connection with a database
Establishes a persistent connection with a database
Select which database to connect to
Sets an optional connection parameter
Closes a database connection




Working With Cached RecordsetsADOdb supports the ability to work with cached query results, either through storing the results on local disks, or via the use of a Memcached Server. The functions below work the same as their non-caching equivalents, but also check for the availabiltiy of cached results first. This can help reduce database load.
Configuring local parameters for caching
Configuring a memcached server connection
Executes a provided SQL statement and returns a handle to the result, or a cached handle if available
Executes a provided SQL statement and returns the entire recordset into an array
Executes a provided SQL statement and returns the entire recordset into an associatitive array with the value of the first column as a key
Executes a provided SQL statement and returns the first column of each row in the  recordset into an array
Retrieves the first column of the first matching row of an executed SQL statement
Retrieves the first matching row of an executed SQL statement
Executes a provided SQL statement and returns a handle to the result, with the ability to supply a starting offset and record count
Flushes a cached result set




Executing SQL 执行语句
Automatically prepares and executes Insert and Update statements based on supplied parameters
Executes a provided SQL statement and returns a handle to the result
Executes a provided SQL statement and returns the entire recordset into an array
Executes a provided SQL statement and returns the entire recordset into an associatitive array with the value of the first column as a key
Executes a provided SQL statement and returns the first column of each row of he entire recordset into an array
Returns the median value of a column in a table
Retrieves the first column of the first matching row of an executed SQL statement
Retrieves the first matching row of an executed SQL statement
Provides a simple single record replacement function
Executes a provided SQL statement and returns a handle to the result, with the ability to supply a starting offset and record count
Sets the character set for database connections (limited databases)




Prepared Statements
Sets an input parameter to a stored procedure
Receives an output parameter from a stored procedure
Returns a database specific parameter placeholder
Prepares an SQL statement and returns a handle to use
Access a stored procedure and returns a handle to the procedure




Generating Database Independent SQL strings
Quotes a string, without prefixing nor appending quotes
Returns the largest length of data that can be inserted into a character field
Returns a database-specific concatenation of strings
Creates a database-specific SQL UPDATE statement based on supplied parameters
Creates a database-specific SQL INSERT statement based on supplied parameters
Replaces a null value with a specified replacement
Is a pseudonym for the function qstr
Appropriately quotes strings with ' characters for insertion into the database
Returns the largest length of data that can be inserted into a text field




Handling Blobs
Decodes an encoded blob
Encodes a blob field in preparation for database insertion
Updates a blob field in a table using a syntax similar to autoexecute
Updates a blob field in a table directly from a disk file using a syntax similar to autoexecute
Updates a clob field in a table using a syntax similar to autoexecute




Paging/Scrolling  分页
absolutePage()
gets or sets the current page number in a paged recordset
gets or sets whether at the first page in a paged recordset
gets or sets whether at the last page in a paged recordset
cachePageExecute()
Return a requested page from a (possibly) cached recordset
Returns the page number of the last page in a paged recordset
Returns the maximum number of records that can be returned when paging
Returns a requested page from a recordset




Transaction Scoping 事务
Begins a granular transaction
Commits a granular transaction
Completes a smart transaction
Forces a smart transaction to fail
Reports if a granular transaction has failed
Rollback a smart transaction
Sets the isolation level of a transaction.
Starts a smart transaction
transCnt Returns the nesting level of smart transactions
transOffTemporarily disables transactions




Fetching Data
getFetchMode()Get the array type for return data
setFetchMode()Set the array type for return data




Manipulating Dates & Times
Creates a portable date field, for use in bind statements
Creates a portable timestamp field, for use in bind statements
Creates a portable date field, for use in SQL statements
Creates a portable timestamp field, for use in SQL statements
Creates a portable date offset field, for use in SQL statements
Changes the SQL connection to a specified Locale
Returns a portably-formatted date string from a timestamp database column
Uses the database connection to create date strings
Uses the database connection to create date/time strings




Row Management
affected_rows()Returns the number of rows affected by the last operation
createSequence()Creates a sequence in the database
dropSequence()Drops a sequence in the database
genId()A portable method of creating sequence numbers
insert_id()Returns the last auto-increment number for an SQL statement
rowLock()Lock a table row for a duration of a transaction




Error Handling
errorMsg()Returns a database specific error message
ignoreErrors()Overrides the built-in transaction and error handling status
metaError()Returns a portable error number based on a database specific error
metaErrorMsg()Returns a portable error message based on a portable error number. The language of the message may be controlled by $ADODB_LANG




Query Rewriting
A reference to a function that overrides the execute function




The Recordset Object


Returns one field
fields()Returns a single field in a single row of the current recordset




PEAR CompatibilityThis series of  functions is designed to duplicate the commands and emulate the functionality provided by the now deprecated PEAR DB module. ADOdb also provides an unsupported PEAR Auth connection plugin in the /adodb/pear/auth directory.
Fetches  a recordset into an array
Returns the current row as an object for convenience and advances the record pointer
This is a pseudonym for fetchNextObj
Returns the current row as an object for convenience
This is a pseudonym for fetchObj
Reads  a row of a result set and advances the recordset pointer
Is a pseudonym for close()
Reads a row in associative mode if the recordset fetch mode is numeric
Returns the number of columns in a row of a returned recordset
Returns the number of rows in a returned recordset




Returns all rows
getArray()Returns a complete recordset as an array
getAssoc()Returns an associate key/value array, with other options
getRows()This function is a pseudonym for getArray(), for ADO compatibility
getRandRow()Returns a random record from a recordset




Scrolling
Move to the nth record of a recordset
Moves the cursor to the next record of the recordset from the current position
Moves the cursor to the first record of the recordset
Moves to the last record of a recordset
absolutePosition() is a pseudonym for currentRow()
Returns the current row number of a recordset




Menu generation
Creates a string containing a basic HTML select box
Creates a string containing a basic HTML select box with alternate comparison criteria to getMenu()
Creates a string containing a grouped HTML muilti-select box




Dates
Uses the DBMS to return a timestamp from a date string
Uses the DBMS to return a timestamp from a date/time string
Returns a formatted date string for a user supplied timestamp
Returns a formatted date/time string for a user supplied timestamp




Recordset Info
In databases that allow accessing of recordsets, retrieves the next set
po_recordCount() A Portable record count supported by all databases
recordCount() Interface to the native driver recordCount function
rowCount()Is a synonym for recordCount()



Field Info
Returns raw, database specific information about a field
Returns the the number of fields in a row of a recordset
Returns an array of all the ADOFieldObjects columns in a row




Recordset Cleanup
close()Closes both the recordset and database connection








回复

使用道具 举报

800

主题

1379

帖子

7706

积分

版主

Rank: 7Rank: 7Rank: 7

积分
7706
沙发
 楼主| 发表于 2020-3-21 21:14:25 | 只看该作者
define(‘ADODB_FETCH_DEFAULT’,0);
define(‘ADODB_FETCH_NUM’,1);
define(‘ADODB_FETCH_ASSOC’,2);
define(‘ADODB_FETCH_BOTH’,3);
回复 支持 反对

使用道具 举报

800

主题

1379

帖子

7706

积分

版主

Rank: 7Rank: 7Rank: 7

积分
7706
板凳
 楼主| 发表于 2020-3-22 19:29:54 | 只看该作者
  1.         include_once 'conn/conn.php';                                                        //载入数据库链接文件
  2.         $conn -> BeginTrans();                                                                //开始事务处理
  3.         $sql = 'delete from tb_object where id = 3';                                //sql删除语句
  4.         $rst = $conn -> execute($sql) or die('execute error:  '.$conn -> ErrorMsg());                 //执行删除语句
  5.         $num = $conn -> Affected_rows();                                                //查看被更新的记录数
  6.         if(false !== $rst){                                                                        //如果$rst不为假
  7.                 if($num != 0){                                                                        //如果$num不为0,说明删除成功
  8.                         $conn -> CommitTrans();                                                //执行提交
  9.                         echo '删除成功!';
  10.                         exit();
  11.                 }else{                                                                                //如果$num为0,说明没有删除记录
  12.                         echo '没有数据,或数据已删除';
  13.                         exit();
  14.                 }
  15.         }else{                                                                                        //如果发生意外
  16.                 $conn -> RollbackTrans();                                                //执行回滚操作
  17.                 echo '出现意外。';
复制代码
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|nagomes  

GMT+8, 2025-5-5 06:40 , Processed in 0.036184 second(s), 20 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表