![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数据库
CodingLife99
这个作者很懒,什么都没留下…
展开
-
存在问题的sql
create table test(name varchar(255) primary key,age int);insert into test(name, age) select "guanyu", 21;insert into test values("zhangfei", 20);insert into test (name) values("liubei");insert into test (age) values(22) where test.name = "liubei".原创 2023-01-10 18:28:47 · 139 阅读 · 0 评论 -
windows系统下MySQL中遇到1045问题
报错内容为"1045 Access denied for user ‘root’@‘localhost’ (using password:YES)",对应的原因是密码错误,如果忘记密码可以采用下面文章中介绍的方法试一下:https://blog.csdn.net/lzf_hlh/article/details/80885139我当时是在my.ini中添加了skip-grant-tables,不填写密码通过的注:Windows下运行mysql命令要在mysql.exe的目录下.linux版本看参原创 2021-09-22 22:38:48 · 142 阅读 · 0 评论 -
20210108关于数据库事务的讨论
Stephen:群友们,请教一个问题: 数据库事务中,如果批量插入数据,是否有一条错误,就应该提前跳出循环,提示事务失败进行回滚操作呢? 还是可以忽略这条错误,继续提交事务?风华神使:应该回滚既然是事务,就绝不能提交一部分jeff:一般场景下,批量提交时候,捕获到错误,就全部回滚正常的批量插入时候不是循环插入的,每个字段都是一个数组。除非你是自己循环一条一条插入。杨赛:不要 事务中套循环Stephen:现在遇到同事写的是事务里用的循环Stephen:还需要引入一个bool量,判断每原创 2021-01-08 18:36:56 · 65 阅读 · 0 评论 -
Qt中判断sqlite数据库表是否含有某列
在网上查到在sqlite数据库中,判断某列在表中是否存在的语句,如下.如果该列存在,则返回1;否则返回空.select 1 from PRAGMA_TABLE_INFO('table_name') WHERE name='column_name'这个在sqlite中直接运行是可以的,但在qt中运行就会报如下的错误:near \"(\": syntax error Unable to execute statement一开始以为是括号的问题,后来意识到是qt中不能够识别"PRAGMA_.原创 2020-12-26 22:29:24 · 2339 阅读 · 0 评论 -
QSqlDatabase::removeDatabase的用法
void QSqlDatabase::removeDatabase(const QString &connectionName)Removes the database connection connectionName from the list of database connections.Warning: There should be no open queries on the database connection when this function is called, oth原创 2020-12-26 22:08:44 · 633 阅读 · 2 评论 -
用解压包方式安装mysql
1.注意安装包要完整,如果解压过程中报错,一般表示压缩包有问题.2.如果出现和教程中不一致的现象时,尽量不要往下面走:比如初始化mysql成功后,会有临时密码出现,我当时没有产生,还往下走,最后发现不好使.3.感觉安装比较晕,命名改了密码发现新密码不好使,最后采用修改my.cnf,在[mysqld]下添加skip-grant-iptables的方式.4.在service mysqld start的时候,遇到问题,报错"Failed to start MariaDB 10.0 database s原创 2020-11-18 19:34:58 · 81 阅读 · 0 评论