元编程参考文档

应用数据库

14 个节点

本页内容 14

默认文件名

函数

The local database file when nothing names one.

签名
默认文件名() -> 文本
string DefaultFileName()

返回

结果文本
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
应用数据库
所属包
网络应用

路径变量

函数

The variable naming the local database file.

签名
路径变量() -> 文本
string PathVariable()

返回

结果文本
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
应用数据库
所属包
网络应用

网址变量

函数

The variable naming the platform database's address.

签名
网址变量() -> 文本
string UrlVariable()

返回

结果文本
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
应用数据库
所属包
网络应用

批量执行

函数

Runs several statements as one: either all of them take effect, or - when any is refused - none does.

签名
批量执行(语句: Database Statement 数组) -> Database Result 数组
DatabaseResult[] Batch(DatabaseStatement[] statements)

参数

名称类型默认值说明
语句Database Statement 数组—

返回

结果Database Result 数组
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
应用数据库
所属包
网络应用

描述

函数

Where this app's database is, in words.

签名
描述() -> 文本
string Describe()

返回

结果文本
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
应用数据库
所属包
网络应用

执行

函数

Runs a statement that changes something - CREATE, INSERT, UPDATE, DELETE - and says how many rows it changed.

签名
执行(SQL: 文本, 参数: 任意数组) -> 大整数
long Execute(string sql, object[] parameters)

参数

名称类型默认值说明
SQL文本—The statement, with ? where each value goes.
参数任意数组—The values for the placeholders, in order.

返回

受影响行数大整数
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
应用数据库
所属包
网络应用

按名称参数执行

函数

Runs a statement that changes something, with its values named as AppDatabase.QueryNamed names them, and says how many rows it changed.

签名
按名称参数执行(SQL: 文本, 值: 文本到文本的字典) -> 大整数
long ExecuteNamed(string sql, Dictionary<string, string> values)

参数

名称类型默认值说明
SQL文本—
值文本到文本的字典—

返回

受影响行数大整数
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
应用数据库
所属包
网络应用

插入

函数

Runs a statement that inserts one row and gives back the new row's id.

签名
插入(SQL: 文本, 参数: 任意数组) -> 大整数
long Insert(string sql, object[] parameters)

参数

名称类型默认值说明
SQL文本—
参数任意数组—

返回

行 ID大整数
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
应用数据库
所属包
网络应用

按名称参数插入

函数

Runs a statement that inserts one row, with its values named as AppDatabase.QueryNamed names them, and gives back the new row's id.

签名
按名称参数插入(SQL: 文本, 值: 文本到文本的字典) -> 大整数
long InsertNamed(string sql, Dictionary<string, string> values)

参数

名称类型默认值说明
SQL文本—
值文本到文本的字典—

返回

行 ID大整数
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
应用数据库
所属包
网络应用

查询

函数

Runs a statement that reads - a SELECT - and gives back its rows.

签名
查询(SQL: 文本, 参数: 任意数组) -> Database Result
DatabaseResult Query(string sql, object[] parameters)

参数

名称类型默认值说明
SQL文本—The statement, with ? where each value goes.
参数任意数组—The values for the placeholders, in order.

返回

结果Database Result
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
应用数据库
所属包
网络应用

按名称参数查询

函数

Runs a statement that reads, with its values named: :name in the SQL takes the value of name in Values - a web request's parameters, as an endpoint's handler receives them.

签名
按名称参数查询 -> Database Result
    SQL: 文本
    值: 文本到文本的字典
DatabaseResult QueryNamed(
    string sql,
    Dictionary<string, string> values)

参数

名称类型默认值说明
SQL文本—The statement, with :name (or @name, $name) where each value goes.
值文本到文本的字典—The values by name.

返回

结果Database Result
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
应用数据库
所属包
网络应用

语句

函数

A statement for AppDatabase.Batch.

签名
语句(SQL: 文本, 参数: 任意数组) -> Database Statement
DatabaseStatement Statement(string sql, object[] parameters)

参数

名称类型默认值说明
SQL文本—
参数任意数组—

返回

语句Database Statement
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
应用数据库
所属包
网络应用

使用数据库

函数

Uses Provider from now on, closing the one in use. For a host that decides where the database is itself, and for tests.

签名
使用数据库(提供者: I App Database Provider)
void Use(IAppDatabaseProvider provider)

参数

名称类型默认值说明
提供者I App Database Provider—
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
应用数据库
所属包
网络应用

设置值

函数

The values with one more - or one replaced - for a named statement: a request's parameters plus what the handler worked out, a password's hash or a time, without changing the request's own.

签名
设置值 -> 文本到文本的字典
    值: 文本到文本的字典
    名称: 文本
    值: 文本
Dictionary<string, string> WithValue(
    Dictionary<string, string> values,
    string name,
    string value)

参数

名称类型默认值说明
值文本到文本的字典—The values so far - a handler's Parameters.
名称文本—The name the statement uses for it, without the colon.
值文本—Its value.

返回

值文本到文本的字典

备注

A handler is a Function graph, which cannot add to a dictionary in place; this answers a new one, so a value the handler computed reaches :name as the request's fields do, rather than being spliced into the SQL text.

所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
应用数据库
所属包
网络应用