variables - 我想在打字稿选择查询中获取一个变量
问题描述
标题说明了一切; 我需要一个带有动态 WHERE 子句的 Typoscript SQL SELECT 查询。
我通过以下方式获取当前登录用户的 UID:
data = TSFE:fe_user|user|uid
但是我如何在数据库查询中使用它呢?
我将 UID 存储在一个名为{userID}
.
到目前为止,这是我的代码。问题是 Typoscript 只是合并这两个值:
// User One has value: 50
// User Two has value: 32
// With this code the output is : 5032 ????
lib.coins = CONTENT
lib.coins {
table = fe_users
select {
pidInList = 18
where = uid
andWhere.insertData = TSFE:fe_user|user|uid
selectFields = coins
}
renderObj = COA
renderObj {
1 = TEXT
1.field = coins
}
}
解决方案
您应该使用以下select
选项markers
:
lib.coins = CONTENT
lib.coins {
table = fe_users
select {
selectFields = coins
pidInList = 18
where = uid = ###UID###
markers {
UID.data = TSFE:fe_user|user|uid
}
}
renderObj = COA
renderObj {
1 = TEXT
1.field = coins
}
}
推荐阅读
- javascript - 使用具有大量数据集的 Plotly 图时出现堆内存溢出问题
- javascript - `any extends` 是分布式条件类型,当泛型类型设置为从不时,泛型条件类型解析为从不
- javascript - 如何将点击事件添加到 svelte-simple-datatables
- solr - 无法使用 Solr API 在 Solr 8.9.0 中创建 solr 核心
- react-native - 垂直内的水平滚动视图
- java - 向外部 API 发送 post 请求时出现 403 错误
- postgresql - 为什么我在 macos 上安装 brew 后 postgresql@11 服务立即失败?
- r - mco vs GPareto(多目标优化)
- python - tortoise.exceptions.ConfigurationError:未知数据库方案:postgresql 错误
- css - 字体定义的 W3 CSS 验证错误