• R/O
  • SSH
  • HTTPS

webserver: Commit


Commit MetaInfo

Revision49 (tree)
Time2010-10-03 22:02:54
Authorhoritaku

Log Message

修正

Change Summary

Incremental Difference

--- branch/Basic 0.2x/import_lib/lib/DAO/Query/CommonQuery.java (revision 48)
+++ branch/Basic 0.2x/import_lib/lib/DAO/Query/CommonQuery.java (revision 49)
@@ -16,8 +16,6 @@
1616
1717 public long selectCount = 0;
1818
19- /** DBコネクションオブジェクト */
20- private Connection con;
2119
2220 public CommonQuery(String[] schemeAry) {
2321 this.schemeAry = schemeAry;
@@ -36,7 +34,7 @@
3634
3735 selectCount = 0;
3836 try {
39- stmt = con.prepareStatement(sql);
37+ stmt = conn.prepareStatement(sql);
4038
4139 rs = stmt.executeQuery();
4240
@@ -71,7 +69,7 @@
7169 PreparedStatement preparedStatement = null;
7270
7371 try {
74- preparedStatement = con.prepareStatement(sql);
72+ preparedStatement = conn.prepareStatement(sql);
7573
7674 //更新用SQLを実行する
7775 preparedStatement.executeUpdate();
--- branch/Basic 0.2x/reflectAction/refrect_action/ContentsList.java (revision 48)
+++ branch/Basic 0.2x/reflectAction/refrect_action/ContentsList.java (revision 49)
@@ -1,5 +1,9 @@
11 package refrect_action;
22
3+import java.sql.SQLException;
4+import java.util.HashMap;
5+import java.util.List;
6+
37 import servercore.http.HttpRequest;
48 import servercore.http.HttpResponse;
59 import servercore.servelet.reflect.Action;
@@ -8,12 +12,17 @@
812
913 public class ContentsList extends Action{
1014
11- public HttpResponse execute(HttpRequest request) {
15+ public HttpResponse execute(HttpRequest request) throws Exception {
1216 HttpResponse res = new HttpResponse();
1317 String type = request.getGetParams().get("type");
1418 res.addHeader("Cache-Control", "no-cache");
1519 ContentsBiz biz = new ContentsBiz();
1620 if("getall".equals(type)) {
21+ try {
22+ List<HashMap<String,String>> list = biz.getTitle();
23+ } catch (Exception e) {
24+ throw e;
25+ }
1726
1827 }
1928 return res;
--- branch/Basic 0.2x/models/models/ContentsBiz.java (revision 48)
+++ branch/Basic 0.2x/models/models/ContentsBiz.java (revision 49)
@@ -1,10 +1,26 @@
11 package models;
22
3+import java.sql.SQLException;
34 import java.util.HashMap;
5+import java.util.List;
46
7+import lib.DAO.ConstUtil;
8+import lib.DAO.Query.TableDataQuery;
9+
510 public class ContentsBiz {
6- public HashMap<String, String> getTitle() {
7- return null;
11+ public List<HashMap<String,String>> getTitle() throws Exception{
12+ TableDataQuery query = new TableDataQuery(ConstUtil.Test01);
13+ String[] culmname = {"text_index", "title", "created_at"};
14+ String sql = "select text_index, title, created_at from textfeeds limit 10";
15+ List<HashMap<String,String>> list = null;
16+ query.setColumnName(culmname);
17+ try {
18+ query.getConnection();
19+ list = query.executeQuery(sql);
20+ } finally {
21+ query.closeConnection();
22+ }
23+ return list;
824 }
925
1026 }
--- branch/Basic 0.2x/src/servercore/servelet/reflect/Action.java (revision 48)
+++ branch/Basic 0.2x/src/servercore/servelet/reflect/Action.java (revision 49)
@@ -4,6 +4,6 @@
44 import servercore.http.HttpResponse;
55
66 public abstract class Action {
7- public abstract HttpResponse execute(HttpRequest request) ;
7+ public abstract HttpResponse execute(HttpRequest request) throws Exception;
88
99 }
Show on old repository browser