OSChina底层数据库操作的类(QueryHelper)源代码
而 QueryHelper 则是在 dbutils 的基础上进行一级简单的封装,提供一些经常使用的数据库操作方法和对数据缓存的支持。
数据库连接的释放方法请看这里。
[1].[代码] QueryHelper.java 跳至 [1]
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
|
packageimportimportimportimportimportimportimportimportimport/** * *@SuppressWarnings("unchecked")public private new private new @Override protectedthrows Objectsuper.handleRow(rs); if(objinstanceof return return } }; private new @Override publicthrows Objectsuper.handle(rs); if(objinstanceof return return } }; private new add(Long.class); add(Integer.class); add(String.class); add(java.util.Date.class); add(java.sql.Date.class); add(java.sql.Timestamp.class); }}; private return } /** * * */ public try{ return }catch(SQLException throw } } /** * * * * */ @SuppressWarnings("rawtypes") public try{ returnnew }catch(SQLException throw } } public T if(objnull){ obj CacheManager.set(cache, } return } /** * * * * * * */ @SuppressWarnings("rawtypes") public try{ returnnew }catch(SQLException throw } } /** * * * * * * * * */ public List<T> if(objsnull){ objs CacheManager.set(cache_region, } return } /** * * * * * * * * */ public intint if(page00) throw "Illegal); int1) count0) return",new } /** * * * * * * * * * * * */ public intintint List<T> if(objsnull) objs1, CacheManager.set(cache, } if(objsnull0) return int1) if(from0) return; if((from+count)//超出缓存的范围 return int if(from return; return } /** * * * * */ public try{ Number returnnull)?num.longValue():-1; }catch(SQLException throw } } /** * * * * * * */ public Number if(valuenull){ value CacheManager.set(cache_region, } return } /** * * * * */ public try{ return }catch(SQLException throw } } /** * * * * */ public [] try{ return }catch(SQLException throw } }} |
OSChina底层数据库操作的类(QueryHelper)源代码的更多相关文章
- 【转载】微软官方提供的Sqlserver数据库操作帮助类SQLHelper类
在.NET平台中,C#语言一般使用ADO.NET组件来操作Sqlserver数据库,通过ADO.NET组件可以实现连接数据库.查询数据集.执行SQL语句以及关闭数据库连接等操作,为此网上有很多开发者自 ...
- 第三百零七节,Django框架,models.py模块,数据库操作——表类容的增删改查
Django框架,models.py模块,数据库操作——表类容的增删改查 增加数据 create()方法,增加数据 save()方法,写入数据 第一种方式 表类名称(字段=值) 需要save()方法, ...
- 五 Django框架,models.py模块,数据库操作——表类容的增删改查
Django框架,models.py模块,数据库操作——表类容的增删改查 增加数据 create()方法,增加数据 save()方法,写入数据 第一种方式 表类名称(字段=值) 需要save()方法, ...
- ADO.NET数据库操作助手类
SQL语句操作增删查改助手类 using System; using System.Collections.Generic; using System.Configuration; using Sys ...
- SQLserver数据库操作帮助类SqlHelper
1 SqlHelper源码 using System; using System.Data; using System.Xml; using System.Data.SqlClient; using ...
- tp5数据库操作 Db类
一.链接数据库 1.配置文件定义 application\database.php 注意:数据表前缀更改,在文件的prefix选项 2.类定义 二.数据库的基本使用 namespace app\de ...
- Discuz!数据库操作DB类和C::t类介绍
类定义文件 DB类: 文件\source\class\class_core.php class DB extends discuz_database {} discuz_database类定义 文件\ ...
- matlab提取wind底层数据库操作
首先需要安装navicat for SQL server 软件, 为了实现Matlab 通过JDBC方式连接Sqlserver数据库, 需要安装Sqlserver JDBC驱动. 地址: https: ...
- C# ACCESS数据库操作类
这个是针对ACCESS数据库操作的类,同样也是从SQLHELPER提取而来,分页程序的调用可以参考MSSQL那个类的调用,差不多的,只是提取所有记录的数量的时候有多一个参数,这个需要注意一下! usi ...
随机推荐
- Suse 创建NFS共享目录
Suse 创建NFS共享目录 服务端的配置: 1.编辑nfs服务的配置文件 /software/suse11 *(rw,sync,no_root_squash,no_all_squash) 凝视: / ...
- callback用法简介
源地址:https://argcv.com/articles/2669.c callback,函数的回调,从ANSI C开始,一直被广为使用.无论是windows API的所谓消息机制,动态链接库的调 ...
- thinkphp模版调用函数方法
原文:thinkphp模版调用函数方法 {变量|函数1|函数2|函数3=参数1,参数2,参数3,###} ###为第4个参数,代表变量替换为第4个参数 举例: {$username|substr=0, ...
- COCOS2D中对精灵的操作、对图片的各种操作
内容简要: 1.初始化 2.创建无图的精灵 3.设置精灵贴图大小 4.添加入层中 5.对精灵进行缩放 6.对精灵宽或高进行缩放 7.旋转精灵 8.设置精灵透明度 9.精灵的镜像反转 10.设 ...
- 初窥Linux 之 区分硬连接和软连接
一.Linux下的两种连接文件及创建方式 在Linux下面的连接文件有两种——软连接和硬连接,虽然都是连接文件,但两者却有很大的区别.一种是类似于Windows的快捷方式功能的文件(或目录),这种连接 ...
- win7下怎样设置putty免用户名密码登陆
putty是一款好用的远程登录linux服务器软件,但每次输入用户名密码毕竟有些烦人,这里教你免用户名密码登陆. 工具/原料 putty 方法/步骤 去百度下载putty,小巧易用,仅有0.5 ...
- MySQL错误:You are using safe update mode and you tried to update a table without a WHERE that uses a K
转载自:http://blog.csdn.net/dragonpeng2008/article/details/7279590 Error: 1175 SQLSTATE: HY000 (ER_UPDA ...
- 解压tar.gz文件报错gzip: stdin: not in gzip format解决方法
解压tar.gz文件报错gzip: stdin: not in gzip format解决方法 在解压tar.gz文件的时候报错 1 2 3 4 5 [Sun@localhost Downloads] ...
- JavaScript 中的事件类型3(读书笔记思维导图)
Web 浏览器中可能发生的事件有很多类型.如前所述,不同的事件类型具有不同的信息,而“ DOM3级事件”规定了以下几类事件. UI(User Interface,用户界面)事件:当用户与页面上的元素交 ...
- VSTO学习笔记(七)基于WPF的Excel分析、转换小程序
原文:VSTO学习笔记(七)基于WPF的Excel分析.转换小程序 近期因为工作的需要,要批量处理Excel文件,于是写了一个小程序,来提升工作效率. 小程序的功能是对Excel进行一些分析.验证,然 ...