Book/ibase-Phpdoc专题
Firebird/InterBase
目录
- 简介
- 安装/配置
- 预定义常量
- Firebird/InterBase
函数
- fbird_add_user — 别名 ibase_add_user
- fbird_affected_rows — 别名 ibase_affected_rows
- fbird_backup — 别名 ibase_backup
- fbird_blob_add — 别名 ibase_blob_add
- fbird_blob_cancel — Cancel creating blob
- fbird_blob_close — 别名 ibase_blob_close
- fbird_blob_create — 别名 ibase_blob_create
- fbird_blob_echo — 别名 ibase_blob_echo
- fbird_blob_get — 别名 ibase_blob_get
- fbird_blob_import — 别名 ibase_blob_import
- fbird_blob_info — 别名 ibase_blob_info
- fbird_blob_open — 别名 ibase_blob_open
- fbird_close — 别名 ibase_close
- fbird_commit_ret — 别名 ibase_commit_ret
- fbird_commit — 别名 ibase_commit
- fbird_connect — 别名 ibase_connect
- fbird_db_info — 别名 ibase_db_info
- fbird_delete_user — 别名 ibase_delete_user
- fbird_drop_db — 别名 ibase_drop_db
- fbird_errcode — 别名 ibase_errcode
- fbird_errmsg — 别名 ibase_errmsg
- fbird_execute — 别名 ibase_execute
- fbird_fetch_assoc — 别名 ibase_fetch_assoc
- fbird_fetch_object — 别名 ibase_fetch_object
- fbird_fetch_row — 别名 ibase_fetch_row
- fbird_field_info — 别名 ibase_field_info
- fbird_free_event_handler — 别名 ibase_free_event_handler
- fbird_free_query — 别名 ibase_free_query
- fbird_free_result — 别名 ibase_free_result
- fbird_gen_id — 别名 ibase_gen_id
- fbird_maintain_db — 别名 ibase_maintain_db
- fbird_modify_user — 别名 ibase_modify_user
- fbird_name_result — 别名 ibase_name_result
- fbird_num_fields — 别名 ibase_num_fields
- fbird_num_params — 别名 ibase_num_params
- fbird_param_info — 别名 ibase_param_info
- fbird_pconnect — 别名 ibase_pconnect
- fbird_prepare — 别名 ibase_prepare
- fbird_query — 别名 ibase_query
- fbird_restore — 别名 ibase_restore
- fbird_rollback_ret — 别名 ibase_rollback_ret
- fbird_rollback — 别名 ibase_rollback
- fbird_server_info — 别名 ibase_server_info
- fbird_service_attach — 别名 ibase_service_attach
- fbird_service_detach — 别名 ibase_service_detach
- fbird_set_event_handler — 别名 ibase_set_event_handler
- fbird_trans — 别名 ibase_trans
- fbird_wait_event — 别名 ibase_wait_event
- ibase_add_user — Add a user to a security database
- ibase_affected_rows — Return the number of rows that were affected by the previous query
- ibase_backup — Initiates a backup task in the service manager and returns immediately
- ibase_blob_add — Add data into a newly created blob
- ibase_blob_cancel — Cancel creating blob
- ibase_blob_close — Close blob
- ibase_blob_create — Create a new blob for adding data
- ibase_blob_echo — Output blob contents to browser
- ibase_blob_get — Get len bytes data from open blob
- ibase_blob_import — Create blob, copy file in it, and close it
- ibase_blob_info — Return blob length and other useful info
- ibase_blob_open — Open blob for retrieving data parts
- ibase_close — Close a connection to an InterBase database
- ibase_commit_ret — Commit a transaction without closing it
- ibase_commit — Commit a transaction
- ibase_connect — Open a connection to a database
- ibase_db_info — Request statistics about a database
- ibase_delete_user — Delete a user from a security database
- ibase_drop_db — Drops a database
- ibase_errcode — Return an error code
- ibase_errmsg — Return error messages
- ibase_execute — Execute a previously prepared query
- ibase_fetch_assoc — Fetch a result row from a query as an associative array
- ibase_fetch_object — Get an object from a InterBase database
- ibase_fetch_row — Fetch a row from an InterBase database
- ibase_field_info — Get information about a field
- ibase_free_event_handler — Cancels a registered event handler
- ibase_free_query — Free memory allocated by a prepared query
- ibase_free_result — Free a result set
- ibase_gen_id — Increments the named generator and returns its new value
- ibase_maintain_db — Execute a maintenance command on the database server
- ibase_modify_user — Modify a user to a security database
- ibase_name_result — Assigns a name to a result set
- ibase_num_fields — Get the number of fields in a result set
- ibase_num_params — Return the number of parameters in a prepared query
- ibase_param_info — Return information about a parameter in a prepared query
- ibase_pconnect — Open a persistent connection to an InterBase database
- ibase_prepare — Prepare a query for later binding of parameter placeholders and execution
- ibase_query — Execute a query on an InterBase database
- ibase_restore — Initiates a restore task in the service manager and returns immediately
- ibase_rollback_ret — Roll back a transaction without closing it
- ibase_rollback — Roll back a transaction
- ibase_server_info — Request information about a database server
- ibase_service_attach — Connect to the service manager
- ibase_service_detach — Disconnect from the service manager
- ibase_set_event_handler — Register a callback function to be called when events are posted
- ibase_trans — Begin a transaction
- ibase_wait_event — Wait for an event to be posted by the database
Firebird is a relational database offering many ISO SQL-2003 features that runs on Linux, Windows, and a variety of Unix platforms. Firebird offers excellent concurrency, high performance, and powerful language support for stored procedures and triggers. It has been used in production systems, under a variety of names since 1981.
InterBase is the name of the closed-source variant of this RDBMS that was developed by Embarcadero/Inprise. More information about InterBase is available at » http://www.embarcadero.com/products/interbase.
Firebird is a commercially independent project (fundation) of C++ programmers, technical advisors and supporters developing and enhancing a multi-platform relational database management system based on the source code released by Inprise Corp (now known as Embarcadero) under the InterBase Public License v.1.0 on 25 July, 2000. More information about Firebird is available at » http://www.firebirdsql.org/.
Note:
此扩展已被移至 » PECL 资源库且不再与 PHP 捆绑。7.4.0
This extension supports InterBase versions 6 and up and Firebird version 2.0 and up.
安装/配置
目录
需求
构建此扩展不需要其他扩展。
安装
此扩展已被移至 » PECL 资源库且不再与 PHP 捆绑。7.4.0
安装此 PECL 扩展相关的信息可在手册中标题为 PECL 扩展的安装章节中找到。更多信息如新的发行版本、下载、源文件、 维护人员信息及变更日志等,都在此处: » https://pecl.php.net/package/ibase.
To enable Firebird/InterBase support configure PHP
--with-interbase[=DIR], where DIR is the Firebird/InterBase base
install directory, which defaults to /usr
.
Note: Note to Win32/Win64 Users
为了使此扩展生效, DLL 文件必须能在 Windows 系统的
PATH
指示的路径下找到。如何操作的信息,请参见题为“如何在 Windows 中将 PHP 目录加到 PATH 中”的FAQ。虽然将 DLL 文件从 PHP 文件夹复制到 Windows 系统目录也行,但不建议这样做。 此扩展需要下列文件在PATH
路径中:fbclient.dll,gds32.dll
If you installed the Firebird/InterBase database server on the same machine PHP is running on, you will have this DLL already and
fbclient.dll,gds32.dll
(gds32.dll is generated from the installer for legacy applications) will already be in thePATH
.
运行时配置
这些函数的行为受 php.ini
中的设置影响。
名字 | 默认 | 可修改范围 | 更新日志 |
---|---|---|---|
ibase.allow_persistent | "1" | PHP_INI_SYSTEM | |
ibase.max_persistent | "-1" | PHP_INI_SYSTEM | |
ibase.max_links | "-1" | PHP_INI_SYSTEM | |
ibase.default_db | NULL | PHP_INI_SYSTEM | |
ibase.default_user | NULL | PHP_INI_ALL | |
ibase.default_password | NULL | PHP_INI_ALL | |
ibase.default_charset | NULL | PHP_INI_ALL | |
ibase.timestampformat | "%Y-%m-%d %H:%M:%S" | PHP_INI_ALL | |
ibase.dateformat | "%Y-%m-%d" | PHP_INI_ALL | |
ibase.timeformat | "%H:%M:%S" | PHP_INI_ALL |
有关 PHP_INI_* 样式的更多详情与定义,见 配置可被设定范围。
这是配置指令的简短说明。
ibase.allow_persistent
bool
Whether to allow
persistent connections
to Firebird/InterBase.
ibase.max_persistent
int
The maximum number of persistent Firebird/InterBase connections per
process. New connections created with ibase_pconnect() will be
non-persistent if this number would be exceeded.
ibase.max_links
int
The maximum number of Firebird/InterBase connections per process,
including persistent connections.
ibase.default_db
string
The default database to connect to when ibase_[p]connect() is called
without specifying a database name. If this value is set and SQL safe
mode is enabled, no other connections than to this database will be
allowed.
ibase.default_user
string
The user name to use when connecting to a database if no user name is
specified.
ibase.default_password
string
The password to use when connecting to a database if no password is
specified.
ibase.default_charset
string
The character set to use when connecting to a database if no character
set is specified.
ibase.timestampformat
string
ibase.dateformat
string
ibase.timeformat
string
These directives are used to set the date and time formats that are used
when returning dates and times from a result set, or when binding
arguments to date and time parameters.
资源类型
此扩展没有定义资源类型。
预定义常量
下列常量由此扩展定义,且仅在此扩展编译入 PHP 或在运行时动态载入时可用。
The following constants can be passed to <span class="function">ibase_trans to specify transaction behaviour.
Constant | Description |
---|---|
IBASE_DEFAULT | The default transaction settings are to be used. This default is determined by the client library, which defines it as IBASE_WRITE|IBASE_CONCURRENCY|IBASE_WAIT in most cases. |
IBASE_READ | Starts a read-only transaction. |
IBASE_WRITE | Starts a read-write transaction. |
IBASE_CONSISTENCY | Starts a transaction with the isolation level set to 'consistency', which means the transaction cannot read from tables that are being modified by other concurrent transactions. |
IBASE_CONCURRENCY | Starts a transaction with the isolation level set to 'concurrency' (or 'snapshot'), which means the transaction has access to all tables, but cannot see changes that were committed by other transactions after the transaction was started. |
IBASE_COMMITTED | Starts a transaction with the isolation level set to 'read committed'. This flag should be combined with either IBASE_REC_VERSION or IBASE_REC_NO_VERSION . This isolation level allows access to changes that were committed after the transaction was started. If IBASE_REC_NO_VERSION was specified, only the latest version of a row can be read. If IBASE_REC_VERSION was specified, a row can even be read when a modification to it is pending in a concurrent transaction. |
IBASE_WAIT | Indicated that a transaction should wait and retry when a conflict occurs. |
IBASE_NOWAIT | Indicated that a transaction should fail immediately when a conflict occurs. |
The following constants can be passed to <span class="function">ibase_fetch_row, <span class="function">ibase_fetch_assoc or <span class="function">ibase_fetch_object to specify fetch behaviour.
Constant | Description |
---|---|
IBASE_FETCH_BLOBS | Also available as IBASE_TEXT for backward compatibility. Causes BLOB contents to be fetched inline, instead of being fetched as BLOB identifiers. |
IBASE_FETCH_ARRAYS | Causes arrays to be fetched inline. Otherwise, array identifiers are returned. Array identifiers can only be used as arguments to INSERT operations, as no functions to handle array identifiers are currently available. |
IBASE_UNIXTIME | Causes date and time fields not to be returned as strings, but as UNIX timestamps (the number of seconds since the epoch, which is 1-Jan-1970 0:00 UTC). Might be problematic if used with dates before 1970 on some systems. |
The following constants are used to pass requests and options to the service API functions (<span class="function">ibase_server_info, <span class="function">ibase_db_info, <span class="function">ibase_backup, <span class="function">ibase_restore and <span class="function">ibase_maintain_db). Please refer to the Firebird/InterBase manuals for the meaning of these options.
IBASE_BKP_IGNORE_CHECKSUMS
Options to <span
class="function">ibase_backup
IBASE_BKP_IGNORE_LIMBO
Options to <span
class="function">ibase_backup
IBASE_BKP_METADATA_ONLY
Options to <span
class="function">ibase_backup
IBASE_BKP_NO_GARBAGE_COLLECT
Options to <span
class="function">ibase_backup
IBASE_BKP_OLD_DESCRIPTIONS
Options to <span
class="function">ibase_backup
IBASE_BKP_NON_TRANSPORTABLE
Options to <span
class="function">ibase_backup
IBASE_BKP_CONVERT
Options to <span
class="function">ibase_backup
IBASE_RES_DEACTIVATE_IDX
Options to <span
class="function">ibase_restore
IBASE_RES_NO_SHADOW
Options to <span
class="function">ibase_restore
IBASE_RES_NO_VALIDITY
Options to <span
class="function">ibase_restore
IBASE_RES_ONE_AT_A_TIME
Options to <span
class="function">ibase_restore
IBASE_RES_REPLACE
IBASE_RES_CREATE
Options to <span
class="function">ibase_restore
IBASE_RES_USE_ALL_SPACE
Options to <span
class="function">ibase_restore
IBASE_PRP_PAGE_BUFFERS
IBASE_PRP_SWEEP_INTERVAL
IBASE_PRP_SHUTDOWN_DB
IBASE_PRP_DENY_NEW_TRANSACTIONS
IBASE_PRP_DENY_NEW_ATTACHMENTS
IBASE_PRP_RESERVE_SPACE
IBASE_PRP_RES_USE_FULL
IBASE_PRP_RES
IBASE_PRP_WRITE_MODE
IBASE_PRP_WM_ASYNC
IBASE_PRP_WM_SYNC
IBASE_PRP_ACCESS_MODE
IBASE_PRP_AM_READONLY
IBASE_PRP_AM_READWRITE
IBASE_PRP_SET_SQL_DIALECT
IBASE_PRP_ACTIVATE
IBASE_PRP_DB_ONLINE
IBASE_RPR_CHECK_DB
IBASE_RPR_IGNORE_CHECKSUM
IBASE_RPR_KILL_SHADOWS
IBASE_RPR_MEND_DB
IBASE_RPR_VALIDATE_DB
IBASE_RPR_FULL
IBASE_RPR_SWEEP_DB
Options to <span
class="function">ibase_maintain_db
IBASE_STS_DATA_PAGES
IBASE_STS_DB_LOG
IBASE_STS_HDR_PAGES
IBASE_STS_IDX_PAGES
IBASE_STS_SYS_RELATIONS
Options to <span
class="function">ibase_db_info
IBASE_SVC_SERVER_VERSION
Options to <span
class="function">ibase_server_info
IBASE_SVC_IMPLEMENTATION
Options to <span
class="function">ibase_server_info
IBASE_SVC_GET_ENV
Options to <span
class="function">ibase_server_info
IBASE_SVC_GET_ENV_LOCK
IBASE_SVC_GET_ENV_MSG
IBASE_SVC_USER_DBPATH
IBASE_SVC_SVR_DB_INFO
IBASE_SVC_GET_USERS
Options to <span
class="function">ibase_server_info
fbird_add_user
别名 ibase_add_user
说明
此函数是该函数的别名: ibase_add_user.
参见
- fbird_modify_user
- fbird_delete_user
fbird_affected_rows
别名 ibase_affected_rows
说明
此函数是该函数的别名: <span class="function">ibase_affected_rows.
参见
- fbird_query
- fbird_execute
fbird_backup
别名 ibase_backup
说明
此函数是该函数的别名: ibase_backup.
fbird_blob_add
别名 ibase_blob_add
说明
此函数是该函数的别名: ibase_blob_add.
参见
- fbird_blob_cancel
- fbird_blob_close
- fbird_blob_create
- fbird_blob_import
fbird_blob_cancel
Cancel creating blob
说明
bool <span
class="methodname">fbird_blob_cancel ( <span
class="methodparam">resource
$blob_handle
)
This function will discard a BLOB if it has not yet been closed by <span class="function">fbird_blob_close.
参数
blob_handle
A BLOB handle opened with <span
class="function">fbird_blob_create.
返回值
成功时返回 true
, 或者在失败时返回 false
。
参见
- fbird_blob_close
- fbird_blob_create
- fbird_blob_import
fbird_blob_close
别名 ibase_blob_close
说明
此函数是该函数的别名: ibase_blob_close.
参见
- fbird_blob_create
- fbird_blob_cancel
- fbird_blob_open
- fbird_blob_import
fbird_blob_create
别名 ibase_blob_create
说明
此函数是该函数的别名: <span class="function">ibase_blob_create.
参见
- fbird_blob_add
- fbird_blob_cancel
- fbird_blob_close
- fbird_blob_import
fbird_blob_echo
别名 ibase_blob_echo
说明
此函数是该函数的别名: ibase_blob_echo.
参见
- fbird_blob_open
- fbird_blob_close
- fbird_blob_get
fbird_blob_get
别名 ibase_blob_get
说明
此函数是该函数的别名: ibase_blob_get.
参见
- fbird_blob_open
- fbird_blob_close
- fbird_blob_echo
fbird_blob_import
别名 ibase_blob_import
说明
此函数是该函数的别名: <span class="function">ibase_blob_import.
参见
- fbird_blob_add
- fbird_blob_cancel
- fbird_blob_close
- fbird_blob_create
fbird_blob_info
别名 ibase_blob_info
说明
此函数是该函数的别名: ibase_blob_info.
fbird_blob_open
别名 ibase_blob_open
说明
此函数是该函数的别名: ibase_blob_open.
参见
- fbird_blob_close
- fbird_blob_echo
- fbird_blob_get
fbird_close
别名 ibase_close
说明
此函数是该函数的别名: ibase_close.
参见
- fbird_connect
- fbird_pconnect
fbird_commit_ret
别名 ibase_commit_ret
说明
此函数是该函数的别名: ibase_commit_ret.
fbird_commit
别名 ibase_commit
说明
此函数是该函数的别名: ibase_commit.
fbird_connect
别名 ibase_connect
说明
此函数是该函数的别名: ibase_connect.
参见
- fbird_pconnect
- fbird_close
fbird_db_info
别名 ibase_db_info
说明
此函数是该函数的别名: ibase_db_info.
fbird_delete_user
别名 ibase_delete_user
说明
此函数是该函数的别名: <span class="function">ibase_delete_user.
参见
- fbird_add_user
- fbird_modify_user
fbird_drop_db
别名 ibase_drop_db
说明
此函数是该函数的别名: ibase_drop_db.
参见
- fbird_connect
- fbird_pconnect
fbird_errcode
别名 ibase_errcode
说明
此函数是该函数的别名: ibase_errcode.
参见
- fbird_errmsg
fbird_errmsg
别名 ibase_errmsg
说明
此函数是该函数的别名: ibase_errmsg.
参见
- fbird_errcode
fbird_execute
别名 ibase_execute
说明
此函数是该函数的别名: ibase_execute.
参见
- fbird_query
fbird_fetch_assoc
别名 ibase_fetch_assoc
说明
此函数是该函数的别名: <span class="function">ibase_fetch_assoc.
参见
- fbird_fetch_row
- fbird_fetch_object
fbird_fetch_object
别名 ibase_fetch_object
说明
此函数是该函数的别名: <span class="function">ibase_fetch_object.
参见
- fbird_fetch_row
- fbird_fetch_assoc
fbird_fetch_row
别名 ibase_fetch_row
说明
此函数是该函数的别名: ibase_fetch_row.
参见
- fbird_fetch_assoc
- fbird_fetch_object
fbird_field_info
别名 ibase_field_info
说明
此函数是该函数的别名: ibase_field_info.
参见
- fbird_num_fields
fbird_free_event_handler
别名 ibase_free_event_handler
说明
此函数是该函数的别名: <span class="function">ibase_free_event_handler.
参见
- fbird_set_event_handler
fbird_free_query
别名 ibase_free_query
说明
此函数是该函数的别名: ibase_free_query.
fbird_free_result
别名 ibase_free_result
说明
此函数是该函数的别名: <span class="function">ibase_free_result.
fbird_gen_id
别名 ibase_gen_id
说明
此函数是该函数的别名: ibase_gen_id.
fbird_maintain_db
别名 ibase_maintain_db
说明
此函数是该函数的别名: <span class="function">ibase_maintain_db.
fbird_modify_user
别名 ibase_modify_user
说明
此函数是该函数的别名: <span class="function">ibase_modify_user.
参见
- fbird_add_user
- fbird_delete_user
fbird_name_result
别名 ibase_name_result
说明
此函数是该函数的别名: <span class="function">ibase_name_result.
参见
- fbird_prepare
- fbird_execute
fbird_num_fields
别名 ibase_num_fields
说明
此函数是该函数的别名: ibase_num_fields.
参见
- fbird_field_info
fbird_num_params
别名 ibase_num_params
说明
此函数是该函数的别名: ibase_num_params.
参见
- fbird_prepare
- fbird_param_info
fbird_param_info
别名 ibase_param_info
说明
此函数是该函数的别名: ibase_param_info.
参见
- fbird_field_info
- fbird_num_params
fbird_pconnect
别名 ibase_pconnect
说明
此函数是该函数的别名: ibase_pconnect.
参见
- fbird_close
- fbird_connect
fbird_prepare
别名 ibase_prepare
说明
此函数是该函数的别名: ibase_prepare.
fbird_query
别名 ibase_query
说明
此函数是该函数的别名: ibase_query.
参见
- fbird_errmsg
- fbird_fetch_row
- fbird_fetch_object
- fbird_free_result
fbird_restore
别名 ibase_restore
说明
此函数是该函数的别名: ibase_restore.
fbird_rollback_ret
别名 ibase_rollback_ret
说明
此函数是该函数的别名: <span class="function">ibase_rollback_ret.
fbird_rollback
别名 ibase_rollback
说明
此函数是该函数的别名: ibase_rollback.
fbird_server_info
别名 ibase_server_info
说明
此函数是该函数的别名: <span class="function">ibase_server_info.
fbird_service_attach
别名 ibase_service_attach
说明
此函数是该函数的别名: <span class="function">ibase_service_attach.
fbird_service_detach
别名 ibase_service_detach
说明
此函数是该函数的别名: <span class="function">ibase_service_detach.
fbird_set_event_handler
别名 ibase_set_event_handler
说明
此函数是该函数的别名: <span class="function">ibase_set_event_handler.
参见
- fbird_free_event_handler
- fbird_wait_event
fbird_trans
别名 ibase_trans
说明
此函数是该函数的别名: ibase_trans.
fbird_wait_event
别名 ibase_wait_event
说明
此函数是该函数的别名: ibase_wait_event.
参见
- fbird_set_event_handler
- fbird_free_event_handler
ibase_add_user
Add a user to a security database
说明
bool <span
class="methodname">ibase_add_user ( <span
class="methodparam">resource
$service_handle
, <span
class="type">string $user_name
, <span
class="methodparam">string $password
[, string
$first_name
[, <span
class="type">string $middle_name
[, <span
class="methodparam">string $last_name
]]] )
参数
service_handle
The handle on the database server service.
user_name
The login name of the new database user.
password
The password of the new user.
first_name
The first name of the new database user.
middle_name
The middle name of the new database user.
last_name
The last name of the new database user.
返回值
成功时返回 true
, 或者在失败时返回 false
。
参见
- ibase_modify_user
- ibase_delete_user
ibase_affected_rows
Return the number of rows that were affected by the previous query
说明
int <span
class="methodname">ibase_affected_rows ([ <span
class="methodparam">resource
$link_identifier
] )
This function returns the number of rows that were affected by the previous query (INSERT, UPDATE or DELETE) that was executed from within the specified transaction context.
参数
link_identifier
A transaction context. If link_identifier
is a connection resource,
its default transaction is used.
返回值
Returns the number of rows as an integer.
参见
- ibase_query
- ibase_execute
ibase_backup
Initiates a backup task in the service manager and returns immediately
说明
mixed <span
class="methodname">ibase_backup ( <span
class="methodparam">resource
$service_handle
, <span
class="type">string $source_db
, <span
class="methodparam">string $dest_file
[, int
$options
= 0 [, <span
class="methodparam">bool $verbose
<span
class="initializer"> = false
]] )
This function passes the arguments to the (remote) database server. There it starts a new backup process. Therefore you won't get any responses.
参数
service_handle
A previously opened connection to the database server.
source_db
The absolute file path to the database on the database server. You can
also use a database alias.
dest_file
The path to the backup file on the database server.
options
Additional options to pass to the database server for backup. The
options
parameter can be a combination of the following constants:
IBASE_BKP_IGNORE_CHECKSUMS
, IBASE_BKP_IGNORE_LIMBO
,
IBASE_BKP_METADATA_ONLY
, IBASE_BKP_NO_GARBAGE_COLLECT
,
IBASE_BKP_OLD_DESCRIPTIONS
, IBASE_BKP_NON_TRANSPORTABLE
or
IBASE_BKP_CONVERT
. Read the section about
for further
information.
verbose
Since the backup process is done on the database server, you don't have
any chance to get its output. This argument is useless.
返回值
成功时返回 true
, 或者在失败时返回 false
。
Since the backup process is done on the (remote) server, this function
just passes the arguments to it. While the arguments are legal, you
won't get false
.
范例
示例 #1 ibase_backup example
<?php
// Attach to database server by ip address and port
$service = ibase_service_attach ('10.1.11.200/3050', 'sysdba', 'masterkey');
// Start the backup process on database server
// Backup employee database using full path to /srv/backup/employees.fbk
// Don't use any special arguments
ibase_backup($service, '/srv/firebird/employees.fdb', '/srv/backup/employees.fbk');
// Free the attached connection
ibase_service_detach ($service);
?>
示例 #2 ibase_backup example with arguments
<?php
// Attach to database server by name and default port
$service = ibase_service_attach ('fb-server.contoso.local', 'sysdba', 'masterkey');
// Start the backup process on database server
// Backup employee database using alias to /srv/backup/employees.fbk.
// Backup only the metadata. Don't create a transportable backup.
ibase_backup($service, 'employees.fdb', '/srv/backup/employees.fbk', IBASE_BKP_METADATA_ONLY | IBASE_BKP_NON_TRANSPORTABLE);
// Free the attached connection
ibase_service_detach ($service);
?>
参见
- ibase_restore
ibase_blob_add
Add data into a newly created blob
说明
void <span
class="methodname">ibase_blob_add ( <span
class="methodparam">resource
$blob_handle
, <span
class="type">string $data
)
ibase_blob_add adds data into a blob created with ibase_blob_create.
参数
blob_handle
A blob handle opened with <span
class="function">ibase_blob_create.
data
The data to be added.
返回值
没有返回值。
参见
- ibase_blob_cancel
- ibase_blob_close
- ibase_blob_create
- ibase_blob_import
ibase_blob_cancel
Cancel creating blob
说明
bool <span
class="methodname">ibase_blob_cancel ( <span
class="methodparam">resource
$blob_handle
)
This function will discard a BLOB if it has not yet been closed by <span class="function">ibase_blob_close.
参数
blob_handle
A BLOB handle opened with <span
class="function">ibase_blob_create.
返回值
成功时返回 true
, 或者在失败时返回 false
。
参见
- ibase_blob_close
- ibase_blob_create
- ibase_blob_import
ibase_blob_close
Close blob
说明
mixed <span
class="methodname">ibase_blob_close ( <span
class="methodparam">resource
$blob_handle
)
This function closes a BLOB that has either been opened for reading by ibase_blob_open or has been opened for writing by ibase_blob_create.
参数
blob_handle
A BLOB handle opened with <span
class="function">ibase_blob_create or <span
class="function">ibase_blob_open.
返回值
If the BLOB was being read, this function returns true
on success,
if the BLOB was being written to, this function returns a string
containing the BLOB id that has been assigned to it by the database. On
failure, this function returns false
.
参见
- ibase_blob_cancel
- ibase_blob_open
ibase_blob_create
Create a new blob for adding data
说明
resource<span
class="type">false <span
class="methodname">ibase_blob_create ([ <span
class="methodparam">resource
$link_identifier
= null
] )
ibase_blob_create creates a new BLOB for filling with data.
参数
link_identifier
An InterBase link identifier. If omitted, the last opened link is
assumed.
返回值
Returns a BLOB handle for later use with <span
class="function">ibase_blob_add 或者在失败时返回 false
.
参见
- ibase_blob_add
- ibase_blob_cancel
- ibase_blob_close
- ibase_blob_import
ibase_blob_echo
Output blob contents to browser
说明
bool <span
class="methodname">ibase_blob_echo ( <span
class="methodparam">string $blob_id
)
bool <span
class="methodname">ibase_blob_echo ( <span
class="methodparam">resource
$link_identifier
, <span
class="type">string $blob_id
)
This function opens a BLOB for reading and sends its contents directly to standard output (the browser, in most cases).
参数
link_identifier
An InterBase link identifier. If omitted, the last opened link is
assumed.
blob_id
返回值
成功时返回 true
, 或者在失败时返回 false
。
参见
- ibase_blob_open
- ibase_blob_close
- ibase_blob_get
ibase_blob_get
Get len bytes data from open blob
说明
string <span
class="methodname">ibase_blob_get ( <span
class="methodparam">resource
$blob_handle
, <span
class="type">int $len
)
This function returns at most len
bytes from a BLOB that has been
opened for reading by ibase_blob_open.
Note:
It is not possible to read from a BLOB that has been opened for writing by ibase_blob_create.
参数
blob_handle
A BLOB handle opened with <span
class="function">ibase_blob_open.
len
Size of returned data.
返回值
Returns at most len
bytes from the BLOB, or false
on failure.
范例
示例 #1 ibase_blob_get example
<?php
$result = ibase_query("SELECT blob_value FROM table");
$data = ibase_fetch_object($result);
$blob_data = ibase_blob_info($data->BLOB_VALUE);
$blob_hndl = ibase_blob_open($data->BLOB_VALUE);
echo ibase_blob_get($blob_hndl, $blob_data[0]);
?>
Whilst this example doesn't do much more than a 'ibase_blob_echo($data->BLOB_VALUE)' would do, it does show you how to get information into a $variable to manipulate as you please.
参见
- ibase_blob_open
- ibase_blob_close
- ibase_blob_echo
ibase_blob_import
Create blob, copy file in it, and close it
说明
string <span
class="methodname">ibase_blob_import ( <span
class="methodparam">resource
$link_identifier
, <span
class="type">resource $file_handle
)
string <span
class="methodname">ibase_blob_import ( <span
class="methodparam">resource
$file_handle
)
This function creates a BLOB, reads an entire file into it, closes it and returns the assigned BLOB id.
参数
link_identifier
An InterBase link identifier. If omitted, the last opened link is
assumed.
file_handle
The file handle is a handle returned by <span
class="function">fopen.
返回值
Returns the BLOB id on success, or false
on error.
范例
示例 #1 ibase_blob_import example
<?php
$dbh = ibase_connect($host, $username, $password);
$filename = '/tmp/bar';
$fd = fopen($filename, 'r');
if ($fd) {
$blob = ibase_blob_import($dbh, $fd);
fclose($fd);
if (!is_string($blob)) {
// import failed
} else {
$query = "INSERT INTO foo (name, data) VALUES ('$filename', ?)";
$prepared = ibase_prepare($dbh, $query);
if (!ibase_execute($prepared, $blob)) {
// record insertion failed
}
}
} else {
// unable to open the data file
}
?>
参见
- ibase_blob_add
- ibase_blob_cancel
- ibase_blob_close
- ibase_blob_create
ibase_blob_info
Return blob length and other useful info
说明
array <span
class="methodname">ibase_blob_info ( <span
class="methodparam">resource
$link_identifier
, <span
class="type">string $blob_id
)
array <span
class="methodname">ibase_blob_info ( <span
class="methodparam">string $blob_id
)
Returns the BLOB length and other useful information.
参数
link_identifier
An InterBase link identifier. If omitted, the last opened link is
assumed.
blob_id
A BLOB id.
返回值
Returns an array containing information about a BLOB. The information returned consists of the length of the BLOB, the number of segments it contains, the size of the largest segment, and whether it is a stream BLOB or a segmented BLOB.
ibase_blob_open
Open blob for retrieving data parts
说明
resource<span
class="type">false <span
class="methodname">ibase_blob_open ( <span
class="methodparam">resource
$link_identifier
, <span
class="type">string $blob_id
)
resource<span
class="type">false <span
class="methodname">ibase_blob_open ( <span
class="methodparam">string $blob_id
)
Opens an existing BLOB for reading.
参数
link_identifier
An InterBase link identifier. If omitted, the last opened link is
assumed.
blob_id
A BLOB id.
返回值
Returns a BLOB handle for later use with <span
class="function">ibase_blob_get 或者在失败时返回 false
.
参见
- ibase_blob_close
- ibase_blob_echo
- ibase_blob_get
ibase_close
Close a connection to an InterBase database
说明
bool <span
class="methodname">ibase_close ([ <span
class="methodparam">resource
$connection_id
= null
]
)
Closes the link to an InterBase database that's associated with a connection id returned from <span class="function">ibase_connect. Default transaction on link is committed, other transactions are rolled back.
参数
connection_id
An InterBase link identifier returned from <span
class="function">ibase_connect. If omitted, the last opened link
is assumed.
返回值
成功时返回 true
, 或者在失败时返回 false
。
参见
- ibase_connect
- ibase_pconnect
ibase_commit_ret
Commit a transaction without closing it
说明
bool <span
class="methodname">ibase_commit_ret ([ <span
class="methodparam">resource
$link_or_trans_identifier
=
null
] )
Commits a transaction without closing it.
参数
link_or_trans_identifier
If called without an argument, this function commits the default
transaction of the default link. If the argument is a connection
identifier, the default transaction of the corresponding connection will
be committed. If the argument is a transaction identifier, the
corresponding transaction will be committed. The transaction context
will be retained, so statements executed from within this transaction
will not be invalidated.
返回值
成功时返回 true
, 或者在失败时返回 false
。
ibase_commit
Commit a transaction
说明
bool <span
class="methodname">ibase_commit ([ <span
class="methodparam">resource
$link_or_trans_identifier
=
null
] )
Commits a transaction.
参数
link_or_trans_identifier
If called without an argument, this function commits the default
transaction of the default link. If the argument is a connection
identifier, the default transaction of the corresponding connection will
be committed. If the argument is a transaction identifier, the
corresponding transaction will be committed.
返回值
成功时返回 true
, 或者在失败时返回 false
。
ibase_connect
Open a connection to a database
说明
resource <span
class="methodname">ibase_connect ([ <span
class="methodparam">string $database
[, string
$username
[, <span
class="type">string $password
[, <span
class="methodparam">string $charset
[, int
$buffers
[, <span
class="type">int $dialect
[, <span
class="methodparam">string $role
[,
int $sync
]]]]]]]] )
Establishes a connection to an Firebird/InterBase server.
In case a second call is made to <span class="function">ibase_connect with the same arguments, no new link will be established, but instead, the link identifier of the already opened link will be returned. The link to the server will be closed as soon as the execution of the script ends, unless it's closed earlier by explicitly calling <span class="function">ibase_close.
参数
database
The database
argument has to be a valid path to database file on the
server it resides on. If the server is not local, it must be prefixed
with either 'hostname:' (TCP/IP), 'hostname/port:' (TCP/IP with
interbase server on custom TCP port), '//hostname/' (NetBEUI), depending
on the connection protocol used.
username
The user name. Can be set with the ibase.default_user php.ini
directive.
password
The password for username
. Can be set with the
ibase.default_password php.ini
directive.
charset
charset
is the default character set for a database.
buffers
buffers
is the number of database buffers to allocate for the
server-side cache. If 0 or omitted, server chooses its own default.
dialect
dialect
selects the default SQL dialect for any statement executed
within a connection, and it defaults to the highest one supported by
client libraries.
role
Functional only with InterBase 5 and up.
sync
返回值
Returns an Firebird/InterBase link identifier on success, or false
on error.
错误/异常
If you get some error like "arithmetic exception, numeric overflow, or string truncation. Cannot transliterate character between character sets" (this occurs when you try use some character with accents) when using this and after ibase_query you must set the character set (i.e. ISO8859_1 or your current character set).
范例
示例 #1 ibase_connect example
<?php
$host = 'localhost:/path/to/your.gdb';
$dbh = ibase_connect($host, $username, $password);
$stmt = 'SELECT * FROM tblname';
$sth = ibase_query($dbh, $stmt);
while ($row = ibase_fetch_object($sth)) {
echo $row->email, "\n";
}
ibase_free_result($sth);
ibase_close($dbh);
?>
参见
- ibase_pconnect
- ibase_close
ibase_db_info
Request statistics about a database
说明
string <span
class="methodname">ibase_db_info ( <span
class="methodparam">resource
$service_handle
, <span
class="type">string $db
, <span
class="methodparam">int $action
[,
int $argument
<span
class="initializer"> = 0 ] )
Warning
本函数还未编写文档,仅有参数列表。
ibase_delete_user
Delete a user from a security database
说明
bool <span
class="methodname">ibase_delete_user ( <span
class="methodparam">resource
$service_handle
, <span
class="type">string $user_name
)
参数
service_handle
The handle on the database server service.
user_name
The login name of the user you want to delete from the database.
返回值
成功时返回 true
, 或者在失败时返回 false
。
参见
- ibase_add_user
- ibase_modify_user
ibase_drop_db
Drops a database
说明
bool <span
class="methodname">ibase_drop_db ([ <span
class="methodparam">resource
$connection
= null
] )
This functions drops a database that was opened by either <span class="function">ibase_connect or <span class="function">ibase_pconnect. The database is closed and deleted from the server.
参数
connection
An InterBase link identifier. If omitted, the last opened link is
assumed.
返回值
成功时返回 true
, 或者在失败时返回 false
。
参见
- ibase_connect
- ibase_pconnect
ibase_errcode
Return an error code
说明
int <span class="methodname">ibase_errcode ( <span class="methodparam">void )
Returns the error code that resulted from the most recent InterBase function call.
返回值
Returns the error code as an integer, or false
if no error
occurred.
参见
- ibase_errmsg
ibase_errmsg
Return error messages
说明
string <span class="methodname">ibase_errmsg ( <span class="methodparam">void )
Returns the error message that resulted from the most recent InterBase function call.
返回值
Returns the error message as a string, or false
if no error
occurred.
参见
- ibase_errcode
ibase_execute
Execute a previously prepared query
说明
resource <span
class="methodname">ibase_execute ( <span
class="methodparam">resource $query
,
mixed
$values
)
Execute a query prepared by <span class="function">ibase_prepare.
This is a lot more effective than using <span class="function">ibase_query if you are repeating a same kind of query several times with only some parameters changing.
参数
query
An InterBase query prepared by <span
class="function">ibase_prepare.
values
返回值
If the query raises an error, returns false
. If it is successful
and there is a (possibly empty) result set (such as with a SELECT
query), returns a result identifier. If the query was successful and
there were no results, returns true
.
Note:
This function returns the number of rows affected by the query (if > 0 and applicable to the statement type). A query that succeeded, but did not affect any rows (e.g. an UPDATE of a non-existent record) will return
true
.
范例
示例 #1 ibase_execute example
<?php
$dbh = ibase_connect($host, $username, $password);
$updates = array(
1 => 'Eric',
5 => 'Filip',
7 => 'Larry'
);
$query = ibase_prepare($dbh, "UPDATE FOO SET BAR = ? WHERE BAZ = ?");
foreach ($updates as $baz => $bar) {
ibase_execute($query, $bar, $baz);
}
?>
参见
- ibase_query
ibase_fetch_assoc
Fetch a result row from a query as an associative array
说明
array <span
class="methodname">ibase_fetch_assoc ( <span
class="methodparam">resource $result
[, int
$fetch_flag
= 0 ] )
Fetch a result row from a query as an associative array.
ibase_fetch_assoc fetches one row of
data from the result
. If two or more columns of the result have the
same field names, the last column will take precedence. To access the
other column(s) of the same name, you either need to access the result
with numeric indices by using <span
class="function">ibase_fetch_row or use alias names in your
query.
参数
result
The result handle.
fetch_flag
fetch_flag
is a combination of the constants IBASE_TEXT
and
IBASE_UNIXTIME
ORed together. Passing IBASE_TEXT
will cause
this function to return BLOB contents instead of BLOB ids. Passing
IBASE_UNIXTIME
will cause this function to return date/time values
as Unix timestamps instead of as formatted strings.
返回值
Returns an associative array that corresponds to the fetched row.
Subsequent calls will return the next row in the result set, or
false
if there are no more rows.
参见
- ibase_fetch_row
- ibase_fetch_object
ibase_fetch_object
Get an object from a InterBase database
说明
object <span
class="methodname">ibase_fetch_object ( <span
class="methodparam">resource
$result_id
[, <span
class="type">int $fetch_flag
=
0 ] )
Fetches a row as a pseudo-object from a given result identifier.
Subsequent calls to ibase_fetch_object return the next row in the result set.
参数
result_id
An InterBase result identifier obtained either by <span
class="function">ibase_query or <span
class="function">ibase_execute.
fetch_flag
fetch_flag
is a combination of the constants IBASE_TEXT
and
IBASE_UNIXTIME
ORed together. Passing IBASE_TEXT
will cause
this function to return BLOB contents instead of BLOB ids. Passing
IBASE_UNIXTIME
will cause this function to return date/time values
as Unix timestamps instead of as formatted strings.
返回值
Returns an object with the next row information, or false
if there
are no more rows.
范例
示例 #1 ibase_fetch_object example
<?php
$dbh = ibase_connect($host, $username, $password);
$stmt = 'SELECT * FROM tblname';
$sth = ibase_query($dbh, $stmt);
while ($row = ibase_fetch_object($sth)) {
echo $row->email . "\n";
}
ibase_close($dbh);
?>
参见
- ibase_fetch_row
- ibase_fetch_assoc
ibase_fetch_row
Fetch a row from an InterBase database
说明
array <span
class="methodname">ibase_fetch_row ( <span
class="methodparam">resource
$result_identifier
[, <span
class="type">int $fetch_flag
=
0 ] )
ibase_fetch_row fetches one row of data from the given result set.
Subsequent calls to ibase_fetch_row
return the next row in the result set, or false
if there are no
more rows.
参数
result_identifier
An InterBase result identifier.
fetch_flag
fetch_flag
is a combination of the constants IBASE_TEXT
and
IBASE_UNIXTIME
ORed together. Passing IBASE_TEXT
will cause
this function to return BLOB contents instead of BLOB ids. Passing
IBASE_UNIXTIME
will cause this function to return date/time values
as Unix timestamps instead of as formatted strings.
返回值
Returns an array that corresponds to the fetched row, or false
if
there are no more rows. Each result column is stored in an array offset,
starting at offset 0.
参见
- ibase_fetch_assoc
- ibase_fetch_object
ibase_field_info
Get information about a field
说明
array <span
class="methodname">ibase_field_info ( <span
class="methodparam">resource $result
, int
$field_number
)
Returns an array with information about a field after a select query has been run.
参数
result
An InterBase result identifier.
field_number
Field offset.
返回值
Returns an array with the following keys: name, alias, relation, length and type.
范例
示例 #1 ibase_field_info example
<?php
$rs = ibase_query("SELECT * FROM tablename");
$coln = ibase_num_fields($rs);
for ($i = 0; $i < $coln; $i++) {
$col_info = ibase_field_info($rs, $i);
echo "name: ". $col_info['name']. "\n";
echo "alias: ". $col_info['alias']. "\n";
echo "relation: ". $col_info['relation']. "\n";
echo "length: ". $col_info['length']. "\n";
echo "type: ". $col_info['type']. "\n";
}
?>
参见
- ibase_num_fields
ibase_free_event_handler
Cancels a registered event handler
说明
bool <span
class="methodname">ibase_free_event_handler ( <span
class="methodparam">resource $event
)
This function causes the registered event handler specified by event
to be cancelled. The callback function will no longer be called for the
events it was registered to handle.
参数
event
An event resource, created by <span
class="function">ibase_set_event_handler.
返回值
成功时返回 true
, 或者在失败时返回 false
。
参见
- ibase_set_event_handler
ibase_free_query
Free memory allocated by a prepared query
说明
bool <span
class="methodname">ibase_free_query ( <span
class="methodparam">resource $query
)
Frees a prepared query.
参数
query
A query prepared with ibase_prepare.
返回值
成功时返回 true
, 或者在失败时返回 false
。
ibase_free_result
Free a result set
说明
bool <span
class="methodname">ibase_free_result ( <span
class="methodparam">resource
$result_identifier
)
Frees a result set.
参数
result_identifier
A result set created by ibase_query or
ibase_execute.
返回值
成功时返回 true
, 或者在失败时返回 false
。
ibase_gen_id
Increments the named generator and returns its new value
说明
mixed <span
class="methodname">ibase_gen_id ( <span
class="methodparam">string $generator
[, int
$increment
= 1 [, <span
class="methodparam">resource
$link_identifier
= null
]] )
Warning
本函数还未编写文档,仅有参数列表。
返回值
Returns new generator value as integer, or as string if the value is too big.
ibase_maintain_db
Execute a maintenance command on the database server
说明
bool <span
class="methodname">ibase_maintain_db ( <span
class="methodparam">resource
$service_handle
, <span
class="type">string $db
, <span
class="methodparam">int $action
[,
int $argument
<span
class="initializer"> = 0 ] )
Warning
本函数还未编写文档,仅有参数列表。
返回值
成功时返回 true
, 或者在失败时返回 false
。
ibase_modify_user
Modify a user to a security database
说明
bool <span
class="methodname">ibase_modify_user ( <span
class="methodparam">resource
$service_handle
, <span
class="type">string $user_name
, <span
class="methodparam">string $password
[, string
$first_name
[, <span
class="type">string $middle_name
[, <span
class="methodparam">string $last_name
]]] )
参数
service_handle
The handle on the database server service.
user_name
The login name of the database user to modify.
password
The user's new password.
first_name
The user's new first name.
middle_name
The user's new middle name.
last_name
The user's new last name.
返回值
成功时返回 true
, 或者在失败时返回 false
。
参见
- ibase_add_user
- ibase_delete_user
ibase_name_result
Assigns a name to a result set
说明
bool <span
class="methodname">ibase_name_result ( <span
class="methodparam">resource $result
, string
$name
)
This function assigns a name to a result set. This name can be used
later in UPDATE|DELETE ... WHERE CURRENT OF name
statements.
参数
result
An InterBase result set.
name
The name to be assigned.
返回值
成功时返回 true
, 或者在失败时返回 false
。
范例
示例 #1 ibase_name_result example
<?php
$result = ibase_query("SELECT field1,field2 FROM table FOR UPDATE");
ibase_name_result($result, "my_cursor");
$updateqry = ibase_prepare("UPDATE table SET field2 = ? WHERE CURRENT OF my_cursor");
for ($i = 0; ibase_fetch_row($result); ++$i) {
ibase_execute($updateqry, $i);
}
?>
参见
- ibase_prepare
- ibase_execute
ibase_num_fields
Get the number of fields in a result set
说明
int <span
class="methodname">ibase_num_fields ( <span
class="methodparam">resource
$result_id
)
Get the number of fields in a result set.
参数
result_id
An InterBase result identifier.
返回值
Returns the number of fields as an integer.
范例
示例 #1 ibase_num_fields example
<?php
$rs = ibase_query("SELECT * FROM tablename");
$coln = ibase_num_fields($rs);
for ($i = 0; $i < $coln; $i++) {
$col_info = ibase_field_info($rs, $i);
echo "name: " . $col_info['name'] . "\n";
echo "alias: " . $col_info['alias'] . "\n";
echo "relation: " . $col_info['relation'] . "\n";
echo "length: " . $col_info['length'] . "\n";
echo "type: " . $col_info['type'] . "\n";
}
?>
参见
- ibase_field_info
ibase_num_params
Return the number of parameters in a prepared query
说明
int <span
class="methodname">ibase_num_params ( <span
class="methodparam">resource $query
)
This function returns the number of parameters in the prepared query
specified by query
. This is the number of binding arguments that must
be present when calling ibase_execute.
参数
query
The prepared query handle.
返回值
Returns the number of parameters as an integer.
参见
- ibase_prepare
- ibase_param_info
ibase_param_info
Return information about a parameter in a prepared query
说明
array <span
class="methodname">ibase_param_info ( <span
class="methodparam">resource $query
,
int
$param_number
)
Returns an array with information about a parameter after a query has been prepared.
参数
query
An InterBase prepared query handle.
param_number
Parameter offset.
返回值
Returns an array with the following keys: name, alias, relation, length and type.
参见
- ibase_field_info
- ibase_num_params
ibase_pconnect
Open a persistent connection to an InterBase database
说明
resource <span
class="methodname">ibase_pconnect ([ <span
class="methodparam">string $database
[, string
$username
[, <span
class="type">string $password
[, <span
class="methodparam">string $charset
[, int
$buffers
[, <span
class="type">int $dialect
[, <span
class="methodparam">string $role
[,
int $sync
]]]]]]]] )
Opens a persistent connection to an InterBase database.
ibase_pconnect acts very much like <span class="function">ibase_connect with two major differences.
First, when connecting, the function will first try to find a (persistent) link that's already opened with the same parameters. If one is found, an identifier for it will be returned instead of opening a new connection.
Second, the connection to the InterBase server will not be closed when the execution of the script ends. Instead, the link will remain open for future use (ibase_close will not close links established by ibase_pconnect). This type of link is therefore called 'persistent'.
参数
database
The database
argument has to be a valid path to database file on the
server it resides on. If the server is not local, it must be prefixed
with either 'hostname:' (TCP/IP), '//hostname/' (NetBEUI) or 'hostname@'
(IPX/SPX), depending on the connection protocol used.
username
The user name. Can be set with the ibase.default_user php.ini
directive.
password
The password for username
. Can be set with the
ibase.default_password php.ini
directive.
charset
charset
is the default character set for a database.
buffers
buffers
is the number of database buffers to allocate for the
server-side cache. If 0 or omitted, server chooses its own default.
dialect
dialect
selects the default SQL dialect for any statement executed
within a connection, and it defaults to the highest one supported by
client libraries. Functional only with InterBase 6 and up.
role
Functional only with InterBase 5 and up.
sync
返回值
Returns an InterBase link identifier on success, or false
on
error.
参见
- ibase_close
- ibase_connect
ibase_prepare
Prepare a query for later binding of parameter placeholders and execution
说明
resource <span
class="methodname">ibase_prepare ( <span
class="methodparam">string $query
)
resource <span
class="methodname">ibase_prepare ( <span
class="methodparam">resource
$link_identifier
, <span
class="type">string $query
)
resource <span
class="methodname">ibase_prepare ( <span
class="methodparam">resource
$link_identifier
, <span
class="type">string $trans
, <span
class="methodparam">string $query
)
Prepare a query for later binding of parameter placeholders and execution (via ibase_execute).
参数
query
An InterBase query.
link_identifier
An InterBase link identifier returned from <span
class="function">ibase_connect. If omitted, the last opened link
is assumed.
trans
An InterBase transaction handle the query should be associated with. If
omitted, the default transaction of the connection is assumed.
返回值
Returns a prepared query handle, or false
on error.
ibase_query
Execute a query on an InterBase database
说明
resource <span
class="methodname">ibase_query ([ <span
class="methodparam">resource
$link_identifier
], <span
class="type">string $query
[, <span
class="methodparam">int $bind_args
]
)
Performs a query on an InterBase database.
参数
link_identifier
An InterBase link identifier. If omitted, the last opened link is
assumed.
query
An InterBase query.
bind_args
返回值
If the query raises an error, returns false
. If it is successful
and there is a (possibly empty) result set (such as with a SELECT
query), returns a result identifier. If the query was successful and
there were no results, returns true
.
Note:
In PHP 5.0.0 and up, this function will return the number of rows affected by the query for INSERT, UPDATE and DELETE statements. In order to retain backward compatibility, it will return
true
for these statements if the query succeeded without affecting any rows.
错误/异常
If you get some error like "arithmetic exception, numeric overflow, or string truncation. Cannot transliterate character between character sets" (this occurs when you try use some character with accents) when using this and after ibase_query you must set the character set (i.e. ISO8859_1 or your current character set).
范例
示例 #1 ibase_query example
<?php
$host = 'localhost:/path/to/your.gdb';
$dbh = ibase_connect($host, $username, $password);
$stmt = 'SELECT * FROM tblname';
$sth = ibase_query($dbh, $stmt) or die(ibase_errmsg());
?>
参见
- ibase_errmsg
- ibase_fetch_row
- ibase_fetch_object
- ibase_free_result
ibase_restore
Initiates a restore task in the service manager and returns immediately
说明
mixed <span
class="methodname">ibase_restore ( <span
class="methodparam">resource
$service_handle
, <span
class="type">string $source_file
, <span
class="methodparam">string $dest_db
[, int
$options
= 0 [, <span
class="methodparam">bool $verbose
<span
class="initializer"> = false
]] )
This function passes the arguments to the (remote) database server. There it starts a new restore process. Therefore you won't get any responses.
参数
service_handle
A previously opened connection to the database server.
source_file
The absolute path on the server where the backup file is located.
dest_db
The path to create the new database on the server. You can also use
database alias.
options
Additional options to pass to the database server for restore. The
options
parameter can be a combination of the following constants:
IBASE_RES_DEACTIVATE_IDX
, IBASE_RES_NO_SHADOW
,
IBASE_RES_NO_VALIDITY
, IBASE_RES_ONE_AT_A_TIME
,
IBASE_RES_REPLACE
, IBASE_RES_CREATE
,
IBASE_RES_USE_ALL_SPACE
, IBASE_PRP_PAGE_BUFFERS
,
IBASE_PRP_SWEEP_INTERVAL
, IBASE_RES_CREATE
. Read the section
about for
further information.
verbose
Since the restore process is done on the database server, you don't have
any chance to get its output. This argument is useless.
返回值
成功时返回 true
, 或者在失败时返回 false
。
Since the restore process is done on the (remote) server, this function
just passes the arguments to it. While the arguments are legal, you
won't get false
.
范例
示例 #1 ibase_restore example
<?php
// Attach to database server by ip address and port
$service = ibase_service_attach ('10.1.11.200/3050', 'sysdba', 'masterkey');
// Start the restore process on database server
// Restore employee backup to the new emps.fdb database
// Don't use any special arguments
ibase_restore($service, '/srv/backup/employees.fbk', '/srv/firebird/emps.fdb');
// Free the attached connection
ibase_service_detach ($service);
?>
示例 #2 ibase_restore example with arguments
<?php
// Attach to database server by name and default port
$service = ibase_service_attach ('fb-server.contoso.local', 'sysdba', 'masterkey');
// Start the restore process on database server
// Restore to employee database using alias.
// Restore without indixes. Replace existing database.
ibase_restore($service, '/srv/backup/employees.fbk', 'employees.fdb', IBASE_RES_DEACTIVATE_IDX | IBASE_RES_REPLACE);
// Free the attached connection
ibase_service_detach ($service);
?>
参见
- ibase_backup
ibase_rollback_ret
Roll back a transaction without closing it
说明
bool <span
class="methodname">ibase_rollback_ret ([ <span
class="methodparam">resource
$link_or_trans_identifier
=
null
] )
Rolls back a transaction without closing it.
参数
link_or_trans_identifier
If called without an argument, this function rolls back the default
transaction of the default link. If the argument is a connection
identifier, the default transaction of the corresponding connection will
be rolled back. If the argument is a transaction identifier, the
corresponding transaction will be rolled back. The transaction context
will be retained, so statements executed from within this transaction
will not be invalidated.
返回值
成功时返回 true
, 或者在失败时返回 false
。
ibase_rollback
Roll back a transaction
说明
bool <span
class="methodname">ibase_rollback ([ <span
class="methodparam">resource
$link_or_trans_identifier
=
null
] )
Rolls back a transaction.
参数
link_or_trans_identifier
If called without an argument, this function rolls back the default
transaction of the default link. If the argument is a connection
identifier, the default transaction of the corresponding connection will
be rolled back. If the argument is a transaction identifier, the
corresponding transaction will be rolled back.
返回值
成功时返回 true
, 或者在失败时返回 false
。
ibase_server_info
Request information about a database server
说明
string <span
class="methodname">ibase_server_info ( <span
class="methodparam">resource
$service_handle
, <span
class="type">int $action
)
参数
service_handle
A previously created connection to the database server.
action
A valid constant.
返回值
Returns mixed types depending on context.
范例
示例 #1 ibase_service_attach example
<?php
// Attach to the remote Firebird server
if (($service = ibase_service_attach('10.1.1.254/3050', 'sysdba', 'masterkey')) != FALSE) {
// Successfully attached.
// Output the info
echo "Server version: " . ibase_server_info($service, IBASE_SVC_SERVER_VERSION) . "\n";
echo "Server implementation: " . ibase_server_info($service, IBASE_SVC_IMPLEMENTATION) . "\n";
echo "Server users: " . print_r(ibase_server_info($service, IBASE_SVC_GET_USERS), true) . "\n";
echo "Server directory: " . ibase_server_info($service, IBASE_SVC_GET_ENV) . "\n";
echo "Server lock path: " . ibase_server_info($service, IBASE_SVC_GET_ENV_LOCK) . "\n";
echo "Server lib path: " . ibase_server_info($service, IBASE_SVC_GET_ENV_MSG) . "\n";
echo "Path of user db: " . ibase_server_info($service, IBASE_SVC_USER_DBPATH) . "\n";
echo "Established connections: " . print_r(ibase_server_info($service, IBASE_SVC_SVR_DB_INFO),true) . "\n";
// Detach from server (disconnect)
ibase_service_detach($service);
}
else {
// Output message on error
$conn_error = ibase_errmsg();
die($conn_error);
}
?>
以上例程会输出:
Server version: LI-V3.0.4.33054 Firebird 3.0
Server implementation: Firebird/Linux/AMD/Intel/x64
Server users: Array
(
[0] => Array
(
[user_name] => SYSDBA
[first_name] => Sql
[middle_name] => Server
[last_name] => Administrator
[user_id] => 0
[group_id] => 0
)
)
Server directory: /etc/firebird/
Server lock path: /tmp/firebird/
Server lib path: /usr/lib64/firebird/lib/
Path of user db: /var/lib/firebird/secdb/security3.fdb
Established connections: Array
(
[attachments] => 3
[databases] => 2
[0] => /srv/firebird/poss.fdb
[1] => /srv/firebird/employees.fdb
)
ibase_service_attach
Connect to the service manager
说明
resource<span
class="type">false <span
class="methodname">ibase_service_attach ( <span
class="methodparam">string $host
,
string
$dba_username
, <span
class="type">string $dba_password
)
参数
host
The name or ip address of the database host. You can define the port by
adding '/' and port number. If no port is specified, port 3050 will be
used.
dba_username
The name of any valid user.
dba_password
The user's password.
返回值
Returns a Interbase / Firebird link identifier on success
或者在失败时返回 false
.
范例
示例 #1 ibase_service_attach example
<?php
// Attach to the remote Firebird server by ip address
if (($service = ibase_service_attach('10.1.1.199', 'sysdba', 'masterkey')) != FALSE) {
// Successfully attached.
// Fetch server version (something like 'LI-V3.0.4.33054 Firebird 3.0')
$server_version = ibase_server_info($service, IBASE_SVC_SERVER_VERSION);
// Fetch server implementation (something like 'Firebird/Linux/AMD/Intel/x64')
$server_implementation = ibase_server_info($service, IBASE_SVC_IMPLEMENTATION);
// Detach from server (disconnect)
ibase_service_detach($service);
// Output the info
echo "Server version: " . $server_version . "<br/>";
echo "Server implementation: " . $server_implementation;
}
else {
// Output message on error
$conn_error = ibase_errmsg();
die($conn_error);
}
?>
示例 #2 ibase_service_attach example using hostname/port syntax
<?php
// Attach to the remote Firebird server by name. Use Port 3050.
if (($service = ibase_service_attach('FB-SRV-01.contoso.local/3050', 'sysdba', 'masterkey')) != FALSE) {
// Successfully attached.
// Fetch server version (something like 'LI-V3.0.4.33054 Firebird 3.0')
$server_version = ibase_server_info($service, IBASE_SVC_SERVER_VERSION);
// Fetch server implementation (something like 'Firebird/Linux/AMD/Intel/x64')
$server_implementation = ibase_server_info($service, IBASE_SVC_IMPLEMENTATION);
// Detach from server (disconnect)
ibase_service_detach($service);
// Output the info
echo "Server version: " . $server_version . "<br/>";
echo "Server implementation: " . $server_implementation;
}
else {
// Output message on error
$conn_error = ibase_errmsg();
die($conn_error);
}
?>
参见
- ibase_service_detach
ibase_service_detach
Disconnect from the service manager
说明
bool <span
class="methodname">ibase_service_detach ( <span
class="methodparam">resource
$service_handle
)
参数
service_handle
A previously created connection to the database server.
返回值
成功时返回 true
, 或者在失败时返回 false
。
范例
示例 #1 ibase_service_detach example
<?php
// Attach to the remote Firebird server by ip address
if (($service = ibase_service_attach('10.1.1.199', 'sysdba', 'masterkey')) != FALSE) {
// Successfully attached.
// Fetch server version (something like 'LI-V3.0.4.33054 Firebird 3.0')
$server_version = ibase_server_info($service, IBASE_SVC_SERVER_VERSION);
// Fetch server implementation (something like 'Firebird/Linux/AMD/Intel/x64')
$server_implementation = ibase_server_info($service, IBASE_SVC_IMPLEMENTATION);
// Detach from server (disconnect)
if(ibase_service_detach($service) == FALSE) {
echo "Error on service detach.";
}
else {
echo "Successfully detached from service.";
}
}
else {
// Output message on error
$conn_error = ibase_errmsg();
die($conn_error);
}
?>
ibase_set_event_handler
Register a callback function to be called when events are posted
说明
resource <span
class="methodname">ibase_set_event_handler ( <span
class="methodparam">callable
$event_handler
, <span
class="type">string $event_name
, <span
class="methodparam">string
$even_names
)
resource <span
class="methodname">ibase_set_event_handler ( <span
class="methodparam">resource
$connection
, <span
class="type">callable $event_handler
, <span
class="methodparam">string
$event_name
, <span
class="type">string $event_names
)
This function registers a PHP user function as event handler for the specified events.
参数
event_handler
The callback is called with the event name and the link resource as
arguments whenever one of the specified events is posted by the
database.
The callback must return false
if the event handler should be
canceled. Any other return value is ignored. This function accepts up to
15 event arguments.
event_name
An event name.
event_names
At most 15 events allowed.
返回值
The return value is an event resource. This resource can be used to free the event handler using <span class="function">ibase_free_event_handler.
范例
示例 #1 ibase_set_event_handler example
<?php
function event_handler($event_name, $link)
{
if ($event_name == "NEW ORDER") {
// process new order
ibase_query($link, "UPDATE orders SET status='handled'");
} else if ($event_name == "DB_SHUTDOWN") {
// free event handler
return false;
}
}
ibase_set_event_handler($link, "event_handler", "NEW_ORDER", "DB_SHUTDOWN");
?>
参见
- ibase_free_event_handler
- ibase_wait_event
ibase_trans
Begin a transaction
说明
resource <span
class="methodname">ibase_trans ([ <span
class="methodparam">int $trans_args
[, resource
$link_identifier
]] )
resource <span
class="methodname">ibase_trans ([ <span
class="methodparam">resource
$link_identifier
[, <span
class="type">int $trans_args
]] )
Begins a transaction.
Note:
The first call to ibase_trans will not return the default transaction of a connection. All transactions started by ibase_trans will be rolled back at the end of the script if they were not committed or rolled back by either ibase_commit or <span class="function">ibase_rollback.
Note:
This function will accept multiple
trans_args
andlink_identifier
arguments. This allows transactions over multiple database connections, which are committed using a 2-phase commit algorithm. This means you can rely on the updates to either succeed in every database, or fail in every database. It does NOT mean you can use tables from different databases in the same query!If you use transactions over multiple databases, you will have to specify both the
link_id
andtransaction_id
in calls to <span class="function">ibase_query and <span class="function">ibase_prepare.
参数
trans_args
trans_args
can be a combination of IBASE_READ
,
IBASE_WRITE
, IBASE_COMMITTED
, IBASE_CONSISTENCY
,
IBASE_CONCURRENCY
, IBASE_REC_VERSION
,
IBASE_REC_NO_VERSION
, IBASE_WAIT
and IBASE_NOWAIT
.
link_identifier
An InterBase link identifier. If omitted, the last opened link is
assumed.
返回值
Returns a transaction handle, or false
on error.
ibase_wait_event
Wait for an event to be posted by the database
说明
string <span
class="methodname">ibase_wait_event ( <span
class="methodparam">string
$event_name
, <span
class="type">string $event_names
)
string <span
class="methodname">ibase_wait_event ( <span
class="methodparam">resource
$connection
, <span
class="type">string $event_name
, <span
class="methodparam">string
$event_names
)
This function suspends execution of the script until one of the specified events is posted by the database. The name of the event that was posted is returned. This function accepts up to 15 event arguments.
参数
event_name
The event name.
event_names
返回值
Returns the name of the event that was posted.
参见
- ibase_set_event_handler
- ibase_free_event_handler
目录
- fbird_add_user — 别名 ibase_add_user
- fbird_affected_rows — 别名 ibase_affected_rows
- fbird_backup — 别名 ibase_backup
- fbird_blob_add — 别名 ibase_blob_add
- fbird_blob_cancel — Cancel creating blob
- fbird_blob_close — 别名 ibase_blob_close
- fbird_blob_create — 别名 ibase_blob_create
- fbird_blob_echo — 别名 ibase_blob_echo
- fbird_blob_get — 别名 ibase_blob_get
- fbird_blob_import — 别名 ibase_blob_import
- fbird_blob_info — 别名 ibase_blob_info
- fbird_blob_open — 别名 ibase_blob_open
- fbird_close — 别名 ibase_close
- fbird_commit_ret — 别名 ibase_commit_ret
- fbird_commit — 别名 ibase_commit
- fbird_connect — 别名 ibase_connect
- fbird_db_info — 别名 ibase_db_info
- fbird_delete_user — 别名 ibase_delete_user
- fbird_drop_db — 别名 ibase_drop_db
- fbird_errcode — 别名 ibase_errcode
- fbird_errmsg — 别名 ibase_errmsg
- fbird_execute — 别名 ibase_execute
- fbird_fetch_assoc — 别名 ibase_fetch_assoc
- fbird_fetch_object — 别名 ibase_fetch_object
- fbird_fetch_row — 别名 ibase_fetch_row
- fbird_field_info — 别名 ibase_field_info
- fbird_free_event_handler — 别名 ibase_free_event_handler
- fbird_free_query — 别名 ibase_free_query
- fbird_free_result — 别名 ibase_free_result
- fbird_gen_id — 别名 ibase_gen_id
- fbird_maintain_db — 别名 ibase_maintain_db
- fbird_modify_user — 别名 ibase_modify_user
- fbird_name_result — 别名 ibase_name_result
- fbird_num_fields — 别名 ibase_num_fields
- fbird_num_params — 别名 ibase_num_params
- fbird_param_info — 别名 ibase_param_info
- fbird_pconnect — 别名 ibase_pconnect
- fbird_prepare — 别名 ibase_prepare
- fbird_query — 别名 ibase_query
- fbird_restore — 别名 ibase_restore
- fbird_rollback_ret — 别名 ibase_rollback_ret
- fbird_rollback — 别名 ibase_rollback
- fbird_server_info — 别名 ibase_server_info
- fbird_service_attach — 别名 ibase_service_attach
- fbird_service_detach — 别名 ibase_service_detach
- fbird_set_event_handler — 别名 ibase_set_event_handler
- fbird_trans — 别名 ibase_trans
- fbird_wait_event — 别名 ibase_wait_event
- ibase_add_user — Add a user to a security database
- ibase_affected_rows — Return the number of rows that were affected by the previous query
- ibase_backup — Initiates a backup task in the service manager and returns immediately
- ibase_blob_add — Add data into a newly created blob
- ibase_blob_cancel — Cancel creating blob
- ibase_blob_close — Close blob
- ibase_blob_create — Create a new blob for adding data
- ibase_blob_echo — Output blob contents to browser
- ibase_blob_get — Get len bytes data from open blob
- ibase_blob_import — Create blob, copy file in it, and close it
- ibase_blob_info — Return blob length and other useful info
- ibase_blob_open — Open blob for retrieving data parts
- ibase_close — Close a connection to an InterBase database
- ibase_commit_ret — Commit a transaction without closing it
- ibase_commit — Commit a transaction
- ibase_connect — Open a connection to a database
- ibase_db_info — Request statistics about a database
- ibase_delete_user — Delete a user from a security database
- ibase_drop_db — Drops a database
- ibase_errcode — Return an error code
- ibase_errmsg — Return error messages
- ibase_execute — Execute a previously prepared query
- ibase_fetch_assoc — Fetch a result row from a query as an associative array
- ibase_fetch_object — Get an object from a InterBase database
- ibase_fetch_row — Fetch a row from an InterBase database
- ibase_field_info — Get information about a field
- ibase_free_event_handler — Cancels a registered event handler
- ibase_free_query — Free memory allocated by a prepared query
- ibase_free_result — Free a result set
- ibase_gen_id — Increments the named generator and returns its new value
- ibase_maintain_db — Execute a maintenance command on the database server
- ibase_modify_user — Modify a user to a security database
- ibase_name_result — Assigns a name to a result set
- ibase_num_fields — Get the number of fields in a result set
- ibase_num_params — Return the number of parameters in a prepared query
- ibase_param_info — Return information about a parameter in a prepared query
- ibase_pconnect — Open a persistent connection to an InterBase database
- ibase_prepare — Prepare a query for later binding of parameter placeholders and execution
- ibase_query — Execute a query on an InterBase database
- ibase_restore — Initiates a restore task in the service manager and returns immediately
- ibase_rollback_ret — Roll back a transaction without closing it
- ibase_rollback — Roll back a transaction
- ibase_server_info — Request information about a database server
- ibase_service_attach — Connect to the service manager
- ibase_service_detach — Disconnect from the service manager
- ibase_set_event_handler — Register a callback function to be called when events are posted
- ibase_trans — Begin a transaction
- ibase_wait_event — Wait for an event to be posted by the database