Composable filtered/sorted/paged query shared by C++ and scripts. 更多...
#include <Database.h>
Public 成员函数 | |
| Query (Connection *connection, std::string table) | |
| Queries Query. | |
| Query * | select (const std::string &column) |
| Adds a quoted projection column (default remains SELECT *). @ownership Borrowed; returns this for chaining. @lifetime Valid until this Query is destroyed. | |
| Query * | selectAs (const std::string &column, const std::string &alias) |
| Adds a quoted projection column with AS alias. @ownership Borrowed; returns this for chaining. @lifetime Valid until this Query is destroyed. | |
| Query * | selectExpr (const std::string &expression, const std::string &alias={}) |
| Adds a validated aggregate/expression projection with optional alias. @ownership Borrowed; returns this for chaining. @lifetime Valid until this Query is destroyed. | |
| Query * | selectJson (const std::string &columnsJson) |
| Script helper: JSON array of names, {column,as}, or {expr,as}. @ownership Borrowed; returns this for chaining. @lifetime Valid until this Query is destroyed. | |
| Query * | distinct (bool enabled) |
| SELECT DISTINCT … @ownership Borrowed; returns this for chaining. @lifetime Valid until this Query is destroyed. | |
| Query * | innerJoin (const std::string &table, const std::string &leftColumn, const std::string &rightColumn) |
| INNER JOIN table ON leftColumn = rightColumn (dotted names allowed). @ownership Borrowed; returns this for chaining. @lifetime Valid until this Query is destroyed. | |
| Query * | leftJoin (const std::string &table, const std::string &leftColumn, const std::string &rightColumn) |
| LEFT JOIN table ON leftColumn = rightColumn (dotted names allowed). @ownership Borrowed; returns this for chaining. @lifetime Valid until this Query is destroyed. | |
| Query * | where (const std::string &column, const std::string &op, Value value) |
| AND-combined comparison predicate. @ownership Borrowed; returns this for chaining. @lifetime Valid until this Query is destroyed. | |
| Query * | whereJson (const std::string &column, const std::string &op, const std::string &valueJson) |
| Script AND where; valueJson is one JSON scalar. @ownership Borrowed; returns this for chaining. @lifetime Valid until this Query is destroyed. | |
| Query * | orWhere (const std::string &column, const std::string &op, Value value) |
| OR-combined comparison predicate. @ownership Borrowed; returns this for chaining. @lifetime Valid until this Query is destroyed. | |
| Query * | orWhereJson (const std::string &column, const std::string &op, const std::string &valueJson) |
| Script OR where; valueJson is one JSON scalar. @ownership Borrowed; returns this for chaining. @lifetime Valid until this Query is destroyed. | |
| Query * | whereIn (const std::string &column, const std::string &valuesJson) |
| AND column IN (…); valuesJson is a JSON array of scalars. @ownership Borrowed; returns this for chaining. @lifetime Valid until this Query is destroyed. | |
| Query * | whereNotIn (const std::string &column, const std::string &valuesJson) |
| AND column NOT IN (…). @ownership Borrowed; returns this for chaining. @lifetime Valid until this Query is destroyed. | |
| Query * | whereBetween (const std::string &column, Value low, Value high) |
| AND column BETWEEN lo AND hi. @ownership Borrowed; returns this for chaining. @lifetime Valid until this Query is destroyed. | |
| Query * | whereBetweenJson (const std::string &column, const std::string &lowJson, const std::string &highJson) |
| Script BETWEEN; lowJson/highJson are JSON scalars. @ownership Borrowed; returns this for chaining. @lifetime Valid until this Query is destroyed. | |
| Query * | whereNull (const std::string &column) |
| AND column IS NULL. @ownership Borrowed; returns this for chaining. @lifetime Valid until this Query is destroyed. | |
| Query * | whereNotNull (const std::string &column) |
| AND column IS NOT NULL. @ownership Borrowed; returns this for chaining. @lifetime Valid until this Query is destroyed. | |
| Query * | whereAnyJson (const std::string &predicatesJson) |
| AND (p0 OR p1 OR …); predicatesJson is [{column,op,value}, …]. @ownership Borrowed; returns this for chaining. @lifetime Valid until this Query is destroyed. | |
| Query * | orWhereAnyJson (const std::string &predicatesJson) |
| OR (p0 OR p1 OR …) against the previous predicate. @ownership Borrowed; returns this for chaining. @lifetime Valid until this Query is destroyed. | |
| Query * | groupBy (const std::string &column) |
| Adds a GROUP BY column (dotted names allowed). @ownership Borrowed; returns this for chaining. @lifetime Valid until this Query is destroyed. | |
| Query * | groupByJson (const std::string &columnsJson) |
| Script GROUP BY from a JSON array of column names. @ownership Borrowed; returns this for chaining. @lifetime Valid until this Query is destroyed. | |
| Query * | having (const std::string &columnOrExpr, const std::string &op, Value value) |
| AND-style HAVING comparison (after GROUP BY). @ownership Borrowed; returns this for chaining. @lifetime Valid until this Query is destroyed. | |
| Query * | havingJson (const std::string &columnOrExpr, const std::string &op, const std::string &valueJson) |
| Script HAVING; valueJson is one JSON scalar. @ownership Borrowed; returns this for chaining. @lifetime Valid until this Query is destroyed. | |
| Query * | orderBy (const std::string &column, bool ascending=true) |
| Order by. @ownership Borrowed; returns this for chaining. @lifetime Valid until this Query is destroyed. | |
| Query * | limit (int count) |
| Limit. @ownership Borrowed; returns this for chaining. @lifetime Valid until this Query is destroyed. | |
| Query * | offset (int count) |
| Offset. @ownership Borrowed; returns this for chaining. @lifetime Valid until this Query is destroyed. | |
| std::vector< Row > | all () |
| All. | |
| std::string | allJson () |
| All json. | |
| std::string | firstJson () |
| First json. | |
| int | count () |
| Returns matching row count (or number of groups when GROUP BY is set). | |
详细描述
Composable filtered/sorted/paged query shared by C++ and scripts.
在文件 Database.h 第 178 行定义.
构造及析构函数说明
◆ Query()
| eve::database::Query::Query | ( | Connection * | connection, |
| std::string | table | ||
| ) |
Queries Query.
在文件 Database.cpp 第 332 行定义.
成员函数说明
◆ all()
| std::vector< Row > eve::database::Query::all | ( | ) |
◆ allJson()
| std::string eve::database::Query::allJson | ( | ) |
◆ count()
| int eve::database::Query::count | ( | ) |
Returns matching row count (or number of groups when GROUP BY is set).
在文件 Database.cpp 第 603 行定义.
引用了 number, eve::database::Connection::query(), rows, text , 以及 value.
◆ distinct()
| Query * eve::database::Query::distinct | ( | bool | enabled | ) |
SELECT DISTINCT … @ownership Borrowed; returns this for chaining. @lifetime Valid until this Query is destroyed.
在文件 Database.cpp 第 385 行定义.
引用了 enabled.
◆ firstJson()
| std::string eve::database::Query::firstJson | ( | ) |
◆ groupBy()
| Query * eve::database::Query::groupBy | ( | const std::string & | column | ) |
Adds a GROUP BY column (dotted names allowed). @ownership Borrowed; returns this for chaining. @lifetime Valid until this Query is destroyed.
在文件 Database.cpp 第 489 行定义.
引用了 column.
被这些函数引用 groupByJson().
◆ groupByJson()
| Query * eve::database::Query::groupByJson | ( | const std::string & | columnsJson | ) |
Script GROUP BY from a JSON array of column names. @ownership Borrowed; returns this for chaining. @lifetime Valid until this Query is destroyed.
在文件 Database.cpp 第 494 行定义.
引用了 groupBy().
◆ having()
| Query * eve::database::Query::having | ( | const std::string & | columnOrExpr, |
| const std::string & | op, | ||
| Value | value | ||
| ) |
AND-style HAVING comparison (after GROUP BY). @ownership Borrowed; returns this for chaining. @lifetime Valid until this Query is destroyed.
在文件 Database.cpp 第 505 行定义.
被这些函数引用 havingJson().
◆ havingJson()
| Query * eve::database::Query::havingJson | ( | const std::string & | columnOrExpr, |
| const std::string & | op, | ||
| const std::string & | valueJson | ||
| ) |
Script HAVING; valueJson is one JSON scalar. @ownership Borrowed; returns this for chaining. @lifetime Valid until this Query is destroyed.
在文件 Database.cpp 第 510 行定义.
引用了 having().
◆ innerJoin()
| Query * eve::database::Query::innerJoin | ( | const std::string & | table, |
| const std::string & | leftColumn, | ||
| const std::string & | rightColumn | ||
| ) |
INNER JOIN table ON leftColumn = rightColumn (dotted names allowed). @ownership Borrowed; returns this for chaining. @lifetime Valid until this Query is destroyed.
在文件 Database.cpp 第 396 行定义.
◆ leftJoin()
| Query * eve::database::Query::leftJoin | ( | const std::string & | table, |
| const std::string & | leftColumn, | ||
| const std::string & | rightColumn | ||
| ) |
LEFT JOIN table ON leftColumn = rightColumn (dotted names allowed). @ownership Borrowed; returns this for chaining. @lifetime Valid until this Query is destroyed.
在文件 Database.cpp 第 400 行定义.
◆ limit()
| Query * eve::database::Query::limit | ( | int | count | ) |
Limit. @ownership Borrowed; returns this for chaining. @lifetime Valid until this Query is destroyed.
在文件 Database.cpp 第 521 行定义.
引用了 count().
◆ offset()
| Query * eve::database::Query::offset | ( | int | count | ) |
Offset. @ownership Borrowed; returns this for chaining. @lifetime Valid until this Query is destroyed.
在文件 Database.cpp 第 527 行定义.
引用了 count().
◆ orderBy()
| Query * eve::database::Query::orderBy | ( | const std::string & | column, |
| bool | ascending = true |
||
| ) |
Order by. @ownership Borrowed; returns this for chaining. @lifetime Valid until this Query is destroyed.
在文件 Database.cpp 第 514 行定义.
◆ orWhere()
| Query * eve::database::Query::orWhere | ( | const std::string & | column, |
| const std::string & | op, | ||
| Value | value | ||
| ) |
OR-combined comparison predicate. @ownership Borrowed; returns this for chaining. @lifetime Valid until this Query is destroyed.
在文件 Database.cpp 第 418 行定义.
被这些函数引用 orWhereJson().
◆ orWhereAnyJson()
| Query * eve::database::Query::orWhereAnyJson | ( | const std::string & | predicatesJson | ) |
OR (p0 OR p1 OR …) against the previous predicate. @ownership Borrowed; returns this for chaining. @lifetime Valid until this Query is destroyed.
在文件 Database.cpp 第 487 行定义.
◆ orWhereJson()
| Query * eve::database::Query::orWhereJson | ( | const std::string & | column, |
| const std::string & | op, | ||
| const std::string & | valueJson | ||
| ) |
Script OR where; valueJson is one JSON scalar. @ownership Borrowed; returns this for chaining. @lifetime Valid until this Query is destroyed.
在文件 Database.cpp 第 422 行定义.
◆ select()
| Query * eve::database::Query::select | ( | const std::string & | column | ) |
Adds a quoted projection column (default remains SELECT *). @ownership Borrowed; returns this for chaining. @lifetime Valid until this Query is destroyed.
在文件 Database.cpp 第 336 行定义.
引用了 column.
被这些函数引用 selectJson().
◆ selectAs()
| Query * eve::database::Query::selectAs | ( | const std::string & | column, |
| const std::string & | alias | ||
| ) |
Adds a quoted projection column with AS alias. @ownership Borrowed; returns this for chaining. @lifetime Valid until this Query is destroyed.
在文件 Database.cpp 第 341 行定义.
引用了 column.
被这些函数引用 selectJson().
◆ selectExpr()
| Query * eve::database::Query::selectExpr | ( | const std::string & | expression, |
| const std::string & | alias = {} |
||
| ) |
Adds a validated aggregate/expression projection with optional alias. @ownership Borrowed; returns this for chaining. @lifetime Valid until this Query is destroyed.
在文件 Database.cpp 第 347 行定义.
被这些函数引用 selectJson().
◆ selectJson()
| Query * eve::database::Query::selectJson | ( | const std::string & | columnsJson | ) |
Script helper: JSON array of names, {column,as}, or {expr,as}. @ownership Borrowed; returns this for chaining. @lifetime Valid until this Query is destroyed.
在文件 Database.cpp 第 357 行定义.
引用了 object, select(), selectAs() , 以及 selectExpr().
◆ where()
| Query * eve::database::Query::where | ( | const std::string & | column, |
| const std::string & | op, | ||
| Value | value | ||
| ) |
AND-combined comparison predicate. @ownership Borrowed; returns this for chaining. @lifetime Valid until this Query is destroyed.
在文件 Database.cpp 第 410 行定义.
被这些函数引用 whereJson().
◆ whereAnyJson()
| Query * eve::database::Query::whereAnyJson | ( | const std::string & | predicatesJson | ) |
AND (p0 OR p1 OR …); predicatesJson is [{column,op,value}, …]. @ownership Borrowed; returns this for chaining. @lifetime Valid until this Query is destroyed.
在文件 Database.cpp 第 485 行定义.
◆ whereBetween()
AND column BETWEEN lo AND hi. @ownership Borrowed; returns this for chaining. @lifetime Valid until this Query is destroyed.
在文件 Database.cpp 第 446 行定义.
被这些函数引用 whereBetweenJson().
◆ whereBetweenJson()
| Query * eve::database::Query::whereBetweenJson | ( | const std::string & | column, |
| const std::string & | lowJson, | ||
| const std::string & | highJson | ||
| ) |
Script BETWEEN; lowJson/highJson are JSON scalars. @ownership Borrowed; returns this for chaining. @lifetime Valid until this Query is destroyed.
在文件 Database.cpp 第 452 行定义.
引用了 column , 以及 whereBetween().
◆ whereIn()
| Query * eve::database::Query::whereIn | ( | const std::string & | column, |
| const std::string & | valuesJson | ||
| ) |
AND column IN (…); valuesJson is a JSON array of scalars. @ownership Borrowed; returns this for chaining. @lifetime Valid until this Query is destroyed.
在文件 Database.cpp 第 438 行定义.
引用了 column.
◆ whereJson()
| Query * eve::database::Query::whereJson | ( | const std::string & | column, |
| const std::string & | op, | ||
| const std::string & | valueJson | ||
| ) |
Script AND where; valueJson is one JSON scalar. @ownership Borrowed; returns this for chaining. @lifetime Valid until this Query is destroyed.
在文件 Database.cpp 第 414 行定义.
◆ whereNotIn()
| Query * eve::database::Query::whereNotIn | ( | const std::string & | column, |
| const std::string & | valuesJson | ||
| ) |
AND column NOT IN (…). @ownership Borrowed; returns this for chaining. @lifetime Valid until this Query is destroyed.
在文件 Database.cpp 第 442 行定义.
引用了 column.
◆ whereNotNull()
| Query * eve::database::Query::whereNotNull | ( | const std::string & | column | ) |
AND column IS NOT NULL. @ownership Borrowed; returns this for chaining. @lifetime Valid until this Query is destroyed.
在文件 Database.cpp 第 461 行定义.
引用了 column.
◆ whereNull()
| Query * eve::database::Query::whereNull | ( | const std::string & | column | ) |
AND column IS NULL. @ownership Borrowed; returns this for chaining. @lifetime Valid until this Query is destroyed.
在文件 Database.cpp 第 456 行定义.
引用了 column.
该类的文档由以下文件生成:
- src/modules/database/Database.h
- src/modules/database/Database.cpp