sqlite_escape_string

(PHP 5 < 5.4.0, PECL sqlite >= 1.0.0)

sqlite_escape_stringEscapes a string for use as a query parameter

说明

sqlite_escape_string ( string $item ) : string

sqlite_escape_string() will correctly quote the string specified by item for use in an SQLite SQL statement. This includes doubling up single-quote characters (') and checking for binary-unsafe characters in the query string.

Although the encoding makes it safe to insert the data, it will render simple text comparisons and LIKE clauses in your queries unusable for the columns that contain the binary data. In practice, this shouldn't be a problem, as your schema should be such that you don't use such things on binary columns (in fact, it might be better to store binary data using other means, such as in files).

参数

item

The string being quoted.

If the item contains a NUL character, or if it begins with a character whose ordinal value is 0x01, PHP will apply a binary encoding scheme so that you can safely store and retrieve binary data.

返回值

Returns an escaped string for use in an SQLite SQL statement.

注释

Note: Do not use this function to encode the return values from UDF's created using sqlite_create_function() or sqlite_create_aggregate() - use sqlite_udf_encode_binary() instead.

Warning

addslashes() should NOT be used to quote your strings for SQLite queries; it will lead to strange results when retrieving your data.

参见

相关文章
php cubrid mysql 兼容性函数 escape special characters in a string for use in an sql statementphp firebird/interbase 函数 return information about a parameter in a prepared queryphp ingres 函数 escape special characters for use in a queryphp ldap 函数 escape a string for use in an ldap filter or dnphp maxdb 函数 escapes special characters in a string for use in an sql statement taking into account the current charset of the connectionphp pdf 函数 get string parameterphp pdf 函数 get pdi string parameter deprecated php pdf 函数 set string parameterphp sqlite 函数 execute a query against a given database and returns an arrayphp sqlite 函数 register an aggregating udf for use in sql statementsphp sqlite 函数 registers a regular user defined function for use in sql statementsphp sqlite 函数 escapes a string for use as a query parameterphp sqlite 函数 executes a result less query against a given databasephp sqlite 函数 fetches the first column of a result set as a stringphp sqlite 函数 executes a query against a given database and returns a result handlephp sqlite 函数 executes a query and returns either an array for one single column or the value of the first rowphp sqlite 函数 execute a query that does not prefetch and buffer all dataphp mysqlnduhconnection escapes special characters in a string for use in an sql statement taking into account the current charset of the connectionphp solrdismaxquery specifies the amount of slop permitted on phrase queries explicitly included in the user s query string qf parameter php solrutils escapes a lucene query string
关注编程学问公众号