SQLite3Stmt::bindValue() - sqlite3数据库类
SQLite3Stmt::bindValue()
(PHP 5 >= 5.3.0, PHP 7)
Binds the value of a parameter to a statement variable
说明
publicSQLite3Stmt::bindValue(mixed $sql_param, mixed $value[,int $type]): boolBinds the value of a parameter to a statement variable.
CautionBefore PHP 7.2.14 and 7.3.0, respectively, once the statement has been executed,SQLite3Stmt::reset() needs to be called to be able to change the value of bound parameters.
参数
$sql_paramEither a string(for named parameters)or an int(for positional parameters)identifying the statement variable to which the value should be bound. If a named parameter does not start with a colon(:)or an at sign(@), a colon(:)is automatically preprended. Positional parameters start with1.
$valueThe value to bind to a statement variable.
$typeThe data type of the value to bind.
SQLITE3_INTEGER
: The value is a signed integer, stored in 1, 2, 3, 4, 6, or 8 bytes depending on the magnitude of the value.SQLITE3_FLOAT
: The value is a floating point value, stored as an 8-byte IEEE floating point number.SQLITE3_TEXT
: The value is a text string, stored using the database encoding(UTF-8, UTF-16BE or UTF-16-LE).SQLITE3_BLOB
: The value is a blob of data, stored exactly as it was input.SQLITE3_NULL
: The value is a NULL value.
As of PHP 7.0.7, if$typeis omitted, it is automatically detected from the type of the$value:boolean and integer are treated as SQLITE3_INTEGER
,float as SQLITE3_FLOAT
,null as SQLITE3_NULL
and all others as SQLITE3_TEXT
. Formerly, if$typehas been omitted, it has defaulted to SQLITE3_TEXT
.
If$valueis NULL
, it is always treated as SQLITE3_NULL
, regardless of the given$type.
返回值
Returns TRUE
if the value is bound to the statement variable,或者在失败时返回FALSE
.
更新日志
版本 | 说明 |
---|---|
7.4.0 | $sql_paramnow also supports the@paramnotation. |
范例
SQLite3Stmt::bindValue() example
鹏仔微信 15129739599 鹏仔QQ344225443 鹏仔前端 pjxi.com 共享博客 sharedbk.com
图片声明:本站部分配图来自网络。本站只作为美观性配图使用,无任何非法侵犯第三方意图,一切解释权归图片著作权方,本站不承担任何责任。如有恶意碰瓷者,必当奉陪到底严惩不贷!