码迷,mamicode.com
首页 > 其他好文 > 详细

tp5总结(四)

时间:2017-12-30 20:04:36      阅读:239      评论:0      收藏:0      [点我收藏+]

标签:事务   last   div   dex   nio   where   重复   tla   2-2   

数据库

1.数据库配置

1-1.配置文件配置【http://ww:7070/tp5-3/public/】

1-2.Db::connect配置【数组和字符串方式】【http://ww:7070/tp5-3/public/index/index/db1和http://ww:7070/tp5-3/public/index/index/db2】

1-3.model配置【数组和字符串方式】【http://ww:7070/tp5-3/public/admin】

2数据库普通链接

2-1.普通查询两种【http://ww:7070/tp5-3/public/index/test/test1和http://ww:7070/tp5-3/public/index/test/test2】【返回查询结果】

2-2.普通插入三种【http://ww:7070/tp5-3/public/index/test/test3和4和5】【返回影响的条数】

注意:Db::getLastSql()可以获取sql语句

2-3.普通删除三种【http://ww:7070/tp5-3/public/index/test/test6】【返回影响条数】

2-4.普通更新三种【http://ww:7070/tp5-3/public/index/test/test7】【返回影响条数】

3.常用方法

3-1.where限制条件【http://localhost:7070/tp/public/admin/sql/awhere1或awhere2和awhere3】

3-2.order升降序【http://localhost:7070/tp/public/admin/sql/aorder】

3-3.limit限制上限和分页【http://localhost:7070/tp/public/admin/sql/alimit1和http://localhost:7070/tp/public/admin/sql/alimit2】

3-4.group分组以及获取最大最小总量平均值 字段重命名【http://localhost:7070/tp/public/admin/sql/agroup】

3-5.having对于分组查询的结果进行筛选【http://localhost:7070/tp/public/admin/sql/ahaving】

3-6.join联动查询【http://localhost:7070/tp/public/admin/sql/ajoin】

3-7.union查询多个表,返回一个包含所有结果的数组【http://localhost:7070/tp/public/admin/sql/aunion】

3-8.distinct只会返回不重复的值【http://localhost:7070/tp/public/admin/sql/adistinct】

3-9.聚合查询【avg,count,max,min,sum】

4.事务机制

4-1.主动控制【http://localhost:7070/tp/public/admin/sql/event1】

4-2.手动控制【http://localhost:7070/tp/public/admin/sql/event2】

tp5总结(四)

标签:事务   last   div   dex   nio   where   重复   tla   2-2   

原文地址:https://www.cnblogs.com/douyaer/p/8109916.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!