问题标签 [qsqlquery]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
mysql - 如何使用 Qt 连接到我的 Web 域的 mySQL 数据库?
我有一个网络域,并且其中已经有 mySql 数据库。我希望将数据库中的数据连接并检索到我的 Qt 应用程序。这是我的尝试和结果。(刚刚编辑了主机名、数据库名、用户名和密码)。
它表明它已连接但在执行查询时。它返回一个错误。此外,我尝试更改为无效的主机名和/或用户名,但它仍然可以连接。
c++ - 如何查询本地 QSqlQueryModel?
我在QSqlTableModel::OnManualSubmit
模式下显示 QSqlTableModel。
我想在我的本地副本上运行 SQL 样式查询,例如,我有一个getMax
在添加新行时会发生变化的函数。QSqlTableModel
如果我的用户在交互过程中本地更改了我希望getMax
生成不同的输入,但是该getMax
函数远程查询数据并且结果将始终相同,而与用户所做的任何更改无关。
如何在模型的本地副本上运行查询?
sql - Qt SQL Server 和变音符号
- 操作系统:Windows 8.1
- 微软 SQL Server 2008 R2
- Qt 5.2
- 数据库驱动程序“QODBC”
我对元音变音有点问题。
我用列 NVARCHAR(35) 创建表并用 N'1ö2' 填充表。当我从 SQL Management Studio 中选择某些内容时,我会看到变音符号 ö。
在Qt中我使用例如thisqDebug() << “name“ << aQuery->value(„name“).toString();
但我得到name "1?2"
即使我循环可用的编解码器 (QTextCodec::availableCodecs();) 我也没有得到有效的 1ö2 字符串。
输出:
31 是 1
32 是 2
efbfbd 是 unicode 吗?(替换字符)
所以我的问题很简单——我做错了什么?;-)
谢谢, 马蒂亚斯
sql - 奇怪的结果 NOT IN 与 SQL 中的 NULL 查询
谁能向我解释为什么我得到不同的结果:
Table2.Table1ID nullable
场地
没有结果
预期结果:Table1
不相关的项目Table2
SQL 服务器版本:10.50.3720.0 操作系统:Microsoft Windows NT 6.1 (7601)
sql-server - SQL Server 中选择查询中的多个案例
我的 SQL 查询中有一个场景是我必须找出具有给定日期但多年的婴儿记录假设我的选择日期是 = 01/Jan/2014 到 31/Jan/2014
我有另一个参数是年份,它要求我随机选择以前(1~3 岁)出生的婴儿的数据假设如果我当前选择的日期是 2014 年并且我的年份变量的值为 2,那么
我必须将婴儿的数据分别带到当年以及比当前日期少一年的时间等等以下是我的给定场景
下面是我的 SQl 查询,它不明确并且有错误。我尝试过单日期比较,它很好但是当我添加OR条件时,它给了我错误
sql - sql query search into two tables, performance issue
I have two tables (I'll list only fields that I want to search)
MySQL version: 5.0.96-community
The Details
table can have multiple rows from the same client.
I need to search into those two tables and retrive the ids of clients that match a search value.
If i have a search value "blue" it has to match CLientName
(ex the Blue
berries Corp), or the Details
in the second table (ex "it has a blue
logo)
The result should be a list of client id's that match the criteria.
If I make a query for one table, it takes a decent time
But if I try to join those two queries it takes ages.
My questions(s)
What's the best way of doing what I need here, to get a list of ID-s based on the search result from both tables
What to change to improve search performance in the Details table, I know that %..% is not fast, but I need partial matches too.
Edit (based on the answers)
It returns a list of IDs from both tables filtred by the search value.
Edit 2: final query
And with that list of ids I can filter the client table, to get only the clients that are in boths tables based on their id
c++ - 为什么 QSqlQuery query.next() 返回 false
为什么query.next()
返回false,何时query.isSelected()
返回query.isActive()
true。并且列号和索引的数据EventNote
是正确的。
这是代码:
c++ - SQLite 和 QSqlQuery - execBatch() 的多次调用失败
我有一个需要重复执行批量插入的类。QSqlQuery 实例是该类的成员。起初我尝试了这段代码:
那没有用。创建的 SQLite 文件有 65536 字节,但表 cache_storage 中只有 1 行(flushBuffer() 被多次调用)。看起来 execBatch() 的第一次调用成功执行,而下一次调用静默失败(它们一直返回 true)。我意识到以下代码有效:
我有一些问题:
每次调用execBatch()都需要创建和销毁QSqlQuery吗?
如果是这样,为什么 execBatch() 的后续调用假装成功执行?
第一种情况下的大文件怎么办?(只有2张桌子,另外一张是空的)
我应该提到,这是在 BlackBerry 10 OS 上运行的应用程序的一部分。为了避免每次都创建和销毁 QSqlQuery,我还尝试在 flushBuffer() 结束时调用 query.clear() 但这似乎也从 QSqlQuery 实例中删除了准备好的 SQL(下一次调用 execBatch() 失败) .
编辑:我试图避免每次都解析 SQL,所以我试图保持 m_setWithGeoQuery 不变,并在 flushBuffer() 中复制它:
令人惊讶的是,它不起作用。它的行为与第一个片段相同。
mysql - 无法删除带有 GROUP BY 和 HAVING 子句的语句
我正在尝试通过以下 SQL 语句删除一些记录,但出现错误#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'GROUP BY tsa_.task_attachment_id H' at line 12
:
有谁知道我该如何解决这个错误?
我还尝试了以下句子,出现此错误#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'GROUP BY tsa_.task_attachment_id HAVING COUNT( DISTINCT( tr_.task_id ' at line 12
:
上面的句子在将表链接到主表的表中查找task_attachments
未被任何人 ecxept 本身使用的行。many_to_many
tasks_attachments
slave
task_attachments
tasks_recursive
为了解决workaround
上述问题,我尝试wrap
了above query
但我收到了这个错误#1093 - You can't specify target table 'ta_' for update in FROM clause
:
最后尝试了双包装,但也没有用,这是错误#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AS sub )' at line 25
:
sql-server - 如何获取执行缓慢的任务列表?
方案数据库 示例报告:
任务_ __|_Percent_Executing |_Executing_0f_day_| 页眉|
任务_1 | 20 | 12 | Трудягин Т.Т. |
任务_2 | 90 | 7 | Исполнительный И.И。|
任务_3 | 50 | 7 | Трудягин Т.Т. |
** 为履行职责,负责监控必须找出其他运行速度相对较慢的任务。为此,应提供负责监督的报告,包括 10 个(或更少)用于运行缓慢的任务。**