php - 的意思 ?在 SQLite 中标记

标签 php zend-framework sqlite

此 SQL 查询中的 ? 字符是什么意思?

$res = $dbConn->fetchPairs('SELECT name FROM tree where parent = ?',$key);

最佳答案

这是一个查询 parameter .该值在编译时未知 - 它在运行时通过使用变量 $key 的内容确定。

还存在其他用于指定参数的符号:

 ?NNN    A question mark followed by a number NNN holds a spot for the NNN-th
         parameter. NNN must be between 1 and SQLITE_MAX_VARIABLE_NUMBER.
    ?    A question mark that is not followed by a number holds a spot for the
         next unused parameter.
:AAAA    A colon followed by an identifier name holds a spot for a named
         parameter with the name AAAA. Named parameters are also numbered. The
         number assigned is the next unused number. To avoid confusion, it is
         best to avoid mixing named and numbered parameters.
@AAAA    An "at" sign works exactly like a colon.
$AAAA    A dollar-sign followed by an identifier name also holds a spot for a
         named parameter with the name AAAA. The identifier name in this case
         can include one or more occurances of "::" and a suffix enclosed in
         "(...)" containing any text at all. This syntax is the form of a
         variable name in the Tcl programming language. The presence of this
         syntax results from the fact that SQLite is really a Tcl extension
         that has escaped into the wild.

关于php - 的意思 ?在 SQLite 中标记,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2315003/

相关文章:

mysql - 执行此查询的更好方法

sql - 什么要添加到SELECT以快速输出10个RANDOM条目?

php - 在 Apigility 中使用 "DB Connect"生成新服务时出错

php - Symfony 4.3.1 和 FosUserBundle 2.1.2 的问题

php - 如何使用 Zend Compressor Filter 压缩多个文件?

php - Zend 框架 1.12 的简单路由

c# - PHP/Rails/Django/ASP 网站应该是用 C++ 写的吧?

php - 在 WooCommerce 循环中的子类别和产品之间添加分隔线

php - 使用 Sprockets 作为 PHP 应用程序的独立服务

sql - 收集一组合并的几个表,所有表都链接到同一个( super )表