From 235d23f498e46e3415bf12a81b2056b792ea1808 Mon Sep 17 00:00:00 2001
From: 严智鑫 <test>
Date: 星期五, 09 五月 2025 14:52:41 +0800
Subject: [PATCH] 朝阳仓储BUG修改 1.传递中文字符 2.仓储车接口调整

---
 nglib/src/ng/db/DBHelper.java |  779 ++++++++++++++++++++++++++++++-----------------------------
 1 files changed, 390 insertions(+), 389 deletions(-)

diff --git a/nglib/src/ng/db/DBHelper.java b/nglib/src/ng/db/DBHelper.java
index fb645ad..80c3f9a 100644
--- a/nglib/src/ng/db/DBHelper.java
+++ b/nglib/src/ng/db/DBHelper.java
@@ -12,68 +12,69 @@
 import java.util.Properties;
 
 import org.json.*;
+import org.json.JSONArray;
 
 
 public class DBHelper{
-	
-	private String sqlurl="jdbc:mysql://10.153.19.150/gmms";
+
+	private String sqlurl="jdbc:mysql://localhost/haier";
 	private String user="root";
 	private String password="beibo.123/";
 	static java.util.Hashtable<String, DBHelper> helper=new java.util.Hashtable<String, DBHelper>();
-			
-	
+
+
 	public static DBSession createDBSession(String sqlurl,String user,String password,boolean manulcomit) throws SQLException{
 		return DBSession.createSession(sqlurl, user, password,manulcomit);
 	}
-	
+
 	public class ProcResult{
 		public int code;
 		public String Message;
-		public JSONArray Datas;
+		public org.json.JSONArray Datas;
 	}
-	
+
 	public static DBSession createDBSession(String name,boolean manulcomit) throws Exception{
 		if(helper.size()==0){
 			InitHelper();
 		}
- 	   DBHelper ret= helper.get(name);
- 	   if(ret!=null)
- 		   return ret.createSession(manulcomit);
- 	  throw new Exception("閿熸枻鎷烽敓鏂ゆ嫹閿熸枻鎷烽敓鏂ゆ嫹閿熸枻鎷烽敓鏂ゆ嫹閿熸枻鎷烽敓鏂ゆ嫹閿熸枻鎷�");
+		DBHelper ret= helper.get(name);
+		if(ret!=null)
+			return ret.createSession(manulcomit);
+		throw new Exception("閿熸枻鎷烽敓鏂ゆ嫹閿熸枻鎷烽敓鏂ゆ嫹閿熸枻鎷烽敓鏂ゆ嫹閿熸枻鎷烽敓鏂ゆ嫹閿熸枻鎷�");
 	}
-	
-	
-	
+
+
+
 
 	public int update(String sql,Object...params) throws SQLException{
 		DBSession sn=null;
 		try{
-		    sn= createSession(false);
-		    sn.createSql(sql);		    
-		    return sn._update(params);
+			sn= createSession(false);
+			sn.createSql(sql);
+			return sn._update(params);
 		}
 		finally{
 			sn.close();
 		}
 	}
-	
-	
-	public  JSONArray query(boolean asObject,String sql,Object...params) throws SQLException, JSONException{
+
+
+	public org.json.JSONArray query(boolean asObject, String sql, Object...params) throws SQLException, JSONException{
 		DBSession sn=null;
 		try{
-		    sn= createSession(false);
-		    sn.createSql(sql);		    
-		    return sn._query(params).resultToJson(asObject);
+			sn= createSession(false);
+			sn.createSql(sql);
+			return sn._query(params).resultToJson(asObject);
 		}
 		finally{
 			sn.close();
 		}
 	}
-	
 
-	
-	
-	
+
+
+
+
 
 	public static DBHelper getDBHelper(String name){
 		return helper.get(name);
@@ -82,454 +83,454 @@
 
 	public static void addHelper(String name,String url,String user,String pass){
 
-		 DBHelper help=new DBHelper(url,user,pass);
-		 helper.put("mes",help);
+		DBHelper help=new DBHelper(url,user,pass);
+		helper.put("mes",help);
 	}
 
 
 
-    public static void InitHelper() throws Exception{
+	public static void InitHelper() throws Exception{
 
 
-    	Properties properties = NGFunction.getProperties();
-    	Class.forName(properties.getProperty("driver"));
-     	String data= properties.getProperty("connection");
-     	if(data==null)
-     	{
-     		throw new Exception("鏈敓鎻鎷烽敓鏂ゆ嫹閿熸枻鎷�");
-     	}
-     	System.out.println(data);
-     	String[] names=data.split(",");
-     	for(int i=0;i<names.length;i++){
-     	    DBHelper help=new DBHelper(properties.getProperty(names[i]+".url"),
-     	    		properties.getProperty(names[i]+".user"),
-     	    		properties.getProperty(names[i]+".password")
-     	    		);
-     	    helper.put(names[i],help);
-     	    System.out.println("create "+names[i]);
-     	}
-     	
-    }
-    
-    
-    
-    
-    public static  void updateConnection(String name) throws Exception{
-    	   Properties properties = NGFunction.getProperties();
-    	   DBHelper ret= helper.get(name);
-    	   if(ret==null){
-    		   throw new Exception("閿熸枻鎷烽敓鏂ゆ嫹閿熸枻鎷烽敓鏂ゆ嫹閿熸枻鎷烽敓鏂ゆ嫹閿熸枻鎷烽敓鏂ゆ嫹閿熸枻鎷�");
-    	   }
-    	   ret.sqlurl=properties.getProperty(name+".url");
-    	   ret.user=properties.getProperty(name+".user");
-    	   ret.password=properties.getProperty(name+".password");
-    }
-	
-	
-	
-	
-	
-	
-	public JSONArray query(String sql,Boolean RowAsObject,Object...params) throws SQLException, JSONException{
-	    DBSession sn=null;
-	    try{
-	    	sn=this.createSession(false);
-	    	sn.createSql(sql);
-	        return sn.query(params).resultToJson(RowAsObject);
-	    
-	    }
-	    finally{
-	    	if(sn!=null)
-	    		sn.close();
-	    }
+		Properties properties = NGFunction.getProperties();
+		Class.forName(properties.getProperty("driver"));
+		String data= properties.getProperty("connection");
+		if(data==null)
+		{
+			throw new Exception("鏈敓鎻鎷烽敓鏂ゆ嫹閿熸枻鎷�");
+		}
+		System.out.println(data);
+		String[] names=data.split(",");
+		for(int i=0;i<names.length;i++){
+			DBHelper help=new DBHelper(properties.getProperty(names[i]+".url"),
+					properties.getProperty(names[i]+".user"),
+					properties.getProperty(names[i]+".password")
+			);
+			helper.put(names[i],help);
+			System.out.println("create "+names[i]);
+		}
+
 	}
-	
+
+
+
+
+	public static  void updateConnection(String name) throws Exception{
+		Properties properties = NGFunction.getProperties();
+		DBHelper ret= helper.get(name);
+		if(ret==null){
+			throw new Exception("閿熸枻鎷烽敓鏂ゆ嫹閿熸枻鎷烽敓鏂ゆ嫹閿熸枻鎷烽敓鏂ゆ嫹閿熸枻鎷烽敓鏂ゆ嫹閿熸枻鎷�");
+		}
+		ret.sqlurl=properties.getProperty(name+".url");
+		ret.user=properties.getProperty(name+".user");
+		ret.password=properties.getProperty(name+".password");
+	}
+
+
+
+
+
+
+	public org.json.JSONArray query(String sql, Boolean RowAsObject, Object...params) throws SQLException, JSONException{
+		DBSession sn=null;
+		try{
+			sn=this.createSession(false);
+			sn.createSql(sql);
+			return sn.query(params).resultToJson(RowAsObject);
+
+		}
+		finally{
+			if(sn!=null)
+				sn.close();
+		}
+	}
+
 	public int update(String sql,Boolean RowAsObject,Object...params) throws SQLException{
-	    DBSession sn=null;
-	    try{
-	    	sn=this.createSession(false);
-	    	sn.createSql(sql);
-	        return sn.update(params);
-	    
-	    
-	    }
-	    finally{
-	    	if(sn!=null)
-	    		sn.close();
-	    }
+		DBSession sn=null;
+		try{
+			sn=this.createSession(false);
+			sn.createSql(sql);
+			return sn.update(params);
+
+
+		}
+		finally{
+			if(sn!=null)
+				sn.close();
+		}
 	}
-	
-	
-	
+
+
+
 	public void init(String sqlurl,String user,String password){
 		this.sqlurl=sqlurl;
 		this.user=user;
 		this.password=password;
 	}
-	
-	
+
+
 	private static boolean odbc_regist=false;
-	
 
-	
 
-	
-	//閿熸枻鎷烽敓鏂ゆ嫹涓�閿熸枻鎷烽敓鏂ゆ嫹in閿熸枻鎷烽敓鏂ゆ嫹  閿熸枻鎷烽敓鏂ゆ嫹out閿熸枻鎷烽敓鏂ゆ嫹閿熶茎瀛樺偍閿熸枻鎷烽敓鏁欙綇鎷蜂竴閿熸枻鎷烽敓琛楄鎷烽敓鏂ゆ嫹int 1閿熸枻鎷烽敓鏂ゆ嫹鏅掗敓锟� 涓�閿熸枻鎷烽敓鏂ゆ嫹String閿熸枻鎷蜂负涓�閿熸枻鎷烽敓鎴潻鎷烽敓鏂ゆ嫹閿熸枻鎷烽敓缁炑嶆嫹閿熺粸鎲嬫嫹閿熻娇顏庢嫹閿熺粸鎾呮嫹閿熻緝顫嫹閿燂拷
+
+
+
+	//閿熸枻鎷烽敓鏂ゆ嫹涓�閿熸枻鎷烽敓鏂ゆ嫹in閿熸枻鎷烽敓鏂ゆ嫹  閿熸枻鎷烽敓鏂ゆ嫹out閿熸枻鎷烽敓鏂ゆ嫹閿熶茎瀛樺偍閿熸枻鎷烽敓鏁欙綇鎷蜂竴閿熸枻鎷烽敓琛楄鎷烽敓鏂ゆ嫹int 1閿熸枻鎷烽敓鏂ゆ嫹鏅掗敓? 涓�閿熸枻鎷烽敓鏂ゆ嫹String閿熸枻鎷蜂负涓�閿熸枻鎷烽敓鎴潻鎷烽敓鏂ゆ嫹閿熸枻鎷烽敓缁炑嶆嫹閿熺粸鎲嬫嫹閿熻娇顏庢嫹閿熺粸鎾呮嫹閿熻緝顫嫹閿�?
 	public QueryResult SelectByProc(String name,String[] Params){
-		 Connection con=null;
-		  try{
-			    int length=Params.length;
-			    
-			    String s=String.format("{call %s(",name);
-			    for(int i=0;i<=length;i++){
-			    	if(i==0)
-			    	s+="?";
-			    	else
-			    		s+=",?";
-			    }
-			    s+=")}";
-			    
-			  	con=DriverManager.getConnection(sqlurl,user,password);
-			    CallableStatement c=con.prepareCall(s);
-			    for(int i=0;i<length;i++){
-			    	c.setString(i+1,Params[i]);
-			    }
-				c.registerOutParameter(length+1, java.sql.Types.VARCHAR);
-				ResultSet result= c.executeQuery();
-			   String rest=c.getString(length+1);
-				QueryResult r=new QueryResult(con,c,result);
-				if(rest!=null){
-					if(rest.equals("success")){
-						return r;		 
-					}
+		Connection con=null;
+		try{
+			int length=Params.length;
+
+			String s=String.format("{call %s(",name);
+			for(int i=0;i<=length;i++){
+				if(i==0)
+					s+="?";
+				else
+					s+=",?";
+			}
+			s+=")}";
+
+			con=DriverManager.getConnection(sqlurl,user,password);
+			CallableStatement c=con.prepareCall(s);
+			for(int i=0;i<length;i++){
+				c.setString(i+1,Params[i]);
+			}
+			c.registerOutParameter(length+1, java.sql.Types.VARCHAR);
+			ResultSet result= c.executeQuery();
+			String rest=c.getString(length+1);
+			QueryResult r=new QueryResult(con,c,result);
+			if(rest!=null){
+				if(rest.equals("success")){
+					return r;
 				}
-				r.Close();
-				return null;
-			
-		  }
-		  catch(Exception e){
-				e.printStackTrace();
-			  if(con!=null)
+			}
+			r.Close();
+			return null;
+
+		}
+		catch(Exception e){
+			e.printStackTrace();
+			if(con!=null)
 				try {
 					con.close();
 				} catch (SQLException e1) {
 					// TODO Auto-generated catch block
 					e1.printStackTrace();
 				}
-			  return null;
-		  }
+			return null;
+		}
 	}
-	
+
 	//閿熸枻鎷烽敓鏂ゆ嫹涓�閿熸枻鎷烽敓鏂ゆ嫹in閿熸枻鎷烽敓鏂ゆ嫹   涓�閿熸枻鎷穙ut閿熸枻鎷烽敓鏂ゆ嫹閿熶茎瀛樺偍閿熸枻鎷烽敓鏂ゆ嫹
 	public  String InvokeSqlProc(String name,String[] Params){
-		 Connection con=null;
-		  try{
-			    int length=Params.length;
-			    
-			    String s=String.format("{call %s(",name);
-			    for(int i=0;i<=length;i++){
-			    	if(i==0)
-			    	s+="?";
-			    	else
-			    		s+=",?";
-			    }
-			    s+=")}";
-			    
-			  	con=DriverManager.getConnection(sqlurl,user,password);
-			    CallableStatement c=con.prepareCall(s);
-			    for(int i=0;i<length;i++){
-			    	c.setString(i+1,Params[i]);
-			    }
-				c.registerOutParameter(length+1, java.sql.Types.VARCHAR);
-				c.execute(); 
-				String message=c.getString(length+1);
-				c.close();
-				con.close();
-				return message;
-		  }
-		  catch(Exception e){
-				e.printStackTrace();
-			  if(con!=null)
+		Connection con=null;
+		try{
+			int length=Params.length;
+
+			String s=String.format("{call %s(",name);
+			for(int i=0;i<=length;i++){
+				if(i==0)
+					s+="?";
+				else
+					s+=",?";
+			}
+			s+=")}";
+
+			con=DriverManager.getConnection(sqlurl,user,password);
+			CallableStatement c=con.prepareCall(s);
+			for(int i=0;i<length;i++){
+				c.setString(i+1,Params[i]);
+			}
+			c.registerOutParameter(length+1, java.sql.Types.VARCHAR);
+			c.execute();
+			String message=c.getString(length+1);
+			c.close();
+			con.close();
+			return message;
+		}
+		catch(Exception e){
+			e.printStackTrace();
+			if(con!=null)
 				try {
 					con.close();
 				} catch (SQLException e1) {
 					// TODO Auto-generated catch block
 					e1.printStackTrace();
 				}
-			  return "fail";
-		  }
+			return "fail";
+		}
 	}
-	
-	
+
+
 	//閿熸枻鎷烽敓鏂ゆ嫹涓�閿熸枻鎷烽敓鏂ゆ嫹in閿熸枻鎷烽敓鏂ゆ嫹 涓�閿熸枻鎷穙ut閿熸枻鎷烽敓鏂ゆ嫹閿熶茎瀛樺偍閿熸枻鎷烽敓鏂ゆ嫹
 	public  String InvokeSqlProc(String name,String param1,String param2){
-		  Connection con=null;
-		  try{
-			  	con=DriverManager.getConnection(sqlurl,user,password);
-			    CallableStatement c=con.prepareCall(String.format("{call %s(?,?,?)}",name));
-				c.setString(1,param1);
-				c.setString(2,param2);
-	
-				c.registerOutParameter(3, java.sql.Types.VARCHAR);
-				System.out.println("ok");
-				c.execute(); 
-				System.out.println("ok1");
-				String message=c.getString(3);
-				c.close();
-				con.close();
-				return message;
-		  }
-		  catch(Exception e){
-				e.printStackTrace();
-			  if(con!=null)
+		Connection con=null;
+		try{
+			con=DriverManager.getConnection(sqlurl,user,password);
+			CallableStatement c=con.prepareCall(String.format("{call %s(?,?,?)}",name));
+			c.setString(1,param1);
+			c.setString(2,param2);
+
+			c.registerOutParameter(3, java.sql.Types.VARCHAR);
+			System.out.println("ok");
+			c.execute();
+			System.out.println("ok1");
+			String message=c.getString(3);
+			c.close();
+			con.close();
+			return message;
+		}
+		catch(Exception e){
+			e.printStackTrace();
+			if(con!=null)
 				try {
 					con.close();
 				} catch (SQLException e1) {
 					// TODO Auto-generated catch block
 					e1.printStackTrace();
 				}
-			  return "fail";
-		  }
-		
+			return "fail";
+		}
+
 	}
-	
+
 	//閿熸枻鎷烽敓鏂ゆ嫹涓�閿熸枻鎷烽敓鏂ゆ嫹閿熸枻鎷烽敓鏂ゆ嫹
 	public Connection getConnection() throws SQLException{
-		
-		return  DriverManager.getConnection(sqlurl,user,password); 
-	  	 //return DriverManager.getConnection(sqlurl,user,password);
+
+		return  DriverManager.getConnection(sqlurl,user,password);
+		//return DriverManager.getConnection(sqlurl,user,password);
 	}
-   
-	
+
+
 
 	//閿熸枻鎷烽敓鏂ゆ嫹閿熸嵎鍖℃嫹閿熸枻鎷烽敓鏂ゆ嫹閿熸枻鎷烽敓鎻紮鎷烽敓鏂ゆ嫹渚勯敓鏂ゆ嫹閿熻娇顎︾枻鈺痚lect 閿熸枻鎷烽�夐敓鏂ゆ嫹
 	public  String MakeSelectOptionBySql(String sql,String field){
-	    QueryResult query=null;
-		   try{ 
-			  query=new QueryResult(sqlurl,user,password,sql);
-			  ResultSet result=query.Result;
+		QueryResult query=null;
+		try{
+			query=new QueryResult(sqlurl,user,password,sql);
+			ResultSet result=query.Result;
 			StringBuilder sb=new StringBuilder();
 			while(result.next()){
 				Object o=result.getObject(field);
-				if(o!=null)					
-			   sb.append(String.format("<option value=\"%s\">%s</option>\r\n",o.toString(),o.toString()));
+				if(o!=null)
+					sb.append(String.format("<option value=\"%s\">%s</option>\r\n",o.toString(),o.toString()));
 			}
 			query.Close();
 			return sb.toString();
-		   }
-		   catch(Exception e){
-			   if(query!=null)
-				   query.Close();
-			   return null;
-		   }
-	}
-	
-	//閫氶敓鏂ゆ嫹涓�閿熸枻鎷烽敓鏂ゆ嫹閿熸枻鎷峰彇閿熸枻鎷烽敓鎹风》鎷烽敓鏂ゆ嫹閿燂拷
-	public QueryResult getQueryResult(String sql){
-		QueryResult query=null;
-		try{
-		 query=new QueryResult(sqlurl,user,password,sql);
-		return query;
 		}
 		catch(Exception e){
 			if(query!=null)
 				query.Close();
-		    e.printStackTrace();
-		    return null;
+			return null;
 		}
 	}
-	
-	
+
+	//閫氶敓鏂ゆ嫹涓�閿熸枻鎷烽敓鏂ゆ嫹閿熸枻鎷峰彇閿熸枻鎷烽敓鎹风》鎷烽敓鏂ゆ嫹閿�?
+	public QueryResult getQueryResult(String sql){
+		QueryResult query=null;
+		try{
+			query=new QueryResult(sqlurl,user,password,sql);
+			return query;
+		}
+		catch(Exception e){
+			if(query!=null)
+				query.Close();
+			e.printStackTrace();
+			return null;
+		}
+	}
+
+
 	//閿熸枻鎷烽敓鏂ゆ嫹閿熸嵎鍖℃嫹閿熸枻鎷烽敓鏂ゆ嫹閿熸彮浼欐嫹閿熻鐤ゎ煉鎷疯皨閿熸枻鎷穞body閿熸枻鎷烽敓鏂ゆ嫹閿熸枻鎷烽敓鎹凤綇鎷稰KName閿熸枻鎷烽敓鏂ゆ嫹閿熸枻鎷烽敓琛楁锝忔嫹ShowField閿熸枻鎷疯閿熸枻鎷风ず閿熸枻鎷烽敓鏂ゆ嫹 閿熸枻鎷烽敓鏂ゆ嫹#閿熸枻鎷峰ご閿熸枻鎷烽敓琛楀嚖鎷烽敓鏂ゆ嫹鐩撮敓鏂ゆ嫹閿熸枻鎷蜂负t閿熸枻鎷烽敓鏂ゆ嫹閿熸枻鎷烽敓鏂ゆ嫹
 	public  String MakeHTMLTableRowsBySql(String sql,String PKName,String[] ShowField) throws SQLException{
-	    QueryResult query=null;
-	   try{ 
-		  query=new QueryResult(sqlurl,user,password,sql);
-		  ResultSet result=query.Result;
-		StringBuilder sb=new StringBuilder();
-		int[] fieldIndex=new int[ShowField.length];
-		for(int i=0;i<ShowField.length;i++){
-		 	if(ShowField[i].charAt(0)=='#'){
-		 		fieldIndex[i]=-100;
-		 		ShowField[i]=ShowField[i].substring(1);
-		 	}
-		 	else
-		 		fieldIndex[i]=result.findColumn(ShowField[i]);
-		}
-		//sb.append("<tbody>\r\n");
-		while(result.next()){
-			if(PKName!=null){
-			sb.append(String.format("<tr data-id=\"%s\">\r\n",result.getObject(PKName).toString().trim()));
-			}
-			else
-				sb.append("<tr>\r\n");
-			for(int i=0;i<fieldIndex.length;i++){
-				sb.append("<td>");
-				int idx=fieldIndex[i];
-				if(idx==-100){
-					sb.append(ShowField[i]);
+		QueryResult query=null;
+		try{
+			query=new QueryResult(sqlurl,user,password,sql);
+			ResultSet result=query.Result;
+			StringBuilder sb=new StringBuilder();
+			int[] fieldIndex=new int[ShowField.length];
+			for(int i=0;i<ShowField.length;i++){
+				if(ShowField[i].charAt(0)=='#'){
+					fieldIndex[i]=-100;
+					ShowField[i]=ShowField[i].substring(1);
 				}
-				else{
-				
-					Object o=result.getObject(idx);
-					if(o!=null)
-						sb.append(o);	
-				}
-				sb.append("</td>");
+				else
+					fieldIndex[i]=result.findColumn(ShowField[i]);
 			}
-			sb.append("</tr>\r\n");
+			//sb.append("<tbody>\r\n");
+			while(result.next()){
+				if(PKName!=null){
+					sb.append(String.format("<tr data-id=\"%s\">\r\n",result.getObject(PKName).toString().trim()));
+				}
+				else
+					sb.append("<tr>\r\n");
+				for(int i=0;i<fieldIndex.length;i++){
+					sb.append("<td>");
+					int idx=fieldIndex[i];
+					if(idx==-100){
+						sb.append(ShowField[i]);
+					}
+					else{
+
+						Object o=result.getObject(idx);
+						if(o!=null)
+							sb.append(o);
+					}
+					sb.append("</td>");
+				}
+				sb.append("</tr>\r\n");
+			}
+			//sb.append("</tbody>\r\n");
+			query.Close();
+			return sb.toString();
 		}
-		//sb.append("</tbody>\r\n");
-		query.Close();
-		return sb.toString();
-	   }
-	   catch(Exception e){
-		   if(query!=null)
-			   query.Close();
-		   e.printStackTrace();
-		   return null;
-	   }
+		catch(Exception e){
+			if(query!=null)
+				query.Close();
+			e.printStackTrace();
+			return null;
+		}
 	}
-	
+
 	public DBHelper(String sqlurl,String user,String password){
 		this.sqlurl=sqlurl;
 		this.user=user;
 		this.password=password;
 	}
-	
+
 	//涓�閿熸枻鎷烽敓娲ュ崟鐨勮鎷疯閿熸枻鎷烽敓鏂ゆ嫹閿熸枻鎷峰獟閿熸枻鎷烽敓鏂ゆ嫹閿熸枻鎷烽敓鏂ゆ嫹涓�浜涢敓鏂ゆ嫹璇㈤敓鏂ゆ嫹婧愰敓鏂ゆ嫹閿熸枻鎷烽敓鏂ゆ嫹close缁熶竴閿熼叺鏀撅綇鎷烽敓鏂ゆ嫹閿熼叺鏀剧櫢鎷烽敓鏂ゆ嫹
 	public  class QueryResult{
-		 private java.sql.Connection con;
-		 private java.sql.Statement statement;
-		 public java.sql.ResultSet Result;
-		   
-		 public  QueryResult(String conString,String user,String password,String Sql) throws SQLException{
-			 this.con= java.sql.DriverManager.getConnection(conString,user,password);
-			 this.statement=con.createStatement();
-			 this.Result=this.statement.executeQuery(Sql);
-		 }
-		 
+		private java.sql.Connection con;
+		private java.sql.Statement statement;
+		public java.sql.ResultSet Result;
 
-		 public QueryResult(Connection con,java.sql.Statement statement,ResultSet result){
-			 this.con=con;
-			 this.statement=statement;
-			 this.Result=result;
-		 }
-		 
-		 
-		 public void Close(){
-			 try{
-			 if(Result!=null){
-				 Result.close();
-				 Result=null;
-			 }
-			 }catch(Exception e){
-				 
-			 }
-			 try{
-				 if(statement!=null){
-					 statement.close();
-					 statement=null;
-				 }
-				 }catch(Exception e){
-					 
-				 }
-			 try{
-				 if(con!=null){
-					 con.close();
-					 con=null;
-				 }
-				 }catch(Exception e){
-					 
-				 }
-		 }
+		public  QueryResult(String conString,String user,String password,String Sql) throws SQLException{
+			this.con= java.sql.DriverManager.getConnection(conString,user,password);
+			this.statement=con.createStatement();
+			this.Result=this.statement.executeQuery(Sql);
 		}
-	
+
+
+		public QueryResult(Connection con,java.sql.Statement statement,ResultSet result){
+			this.con=con;
+			this.statement=statement;
+			this.Result=result;
+		}
+
+
+		public void Close(){
+			try{
+				if(Result!=null){
+					Result.close();
+					Result=null;
+				}
+			}catch(Exception e){
+
+			}
+			try{
+				if(statement!=null){
+					statement.close();
+					statement=null;
+				}
+			}catch(Exception e){
+
+			}
+			try{
+				if(con!=null){
+					con.close();
+					con=null;
+				}
+			}catch(Exception e){
+
+			}
+		}
+	}
+
 	public DBSession createSession(boolean ManulCommit) throws SQLException{
 		Connection con=this.getConnection();
 		return new DBSession(con,ManulCommit);
 	}
-	
-	
-    public static org.json.JSONArray resultToJson(String[] fields,ResultSet result,boolean RowAsObject) throws SQLException, JSONException{
-   	 JSONArray arr=new JSONArray();
-  
-   	  String[] cols=fields;
 
-   	  if(RowAsObject){
-		    	 while(result.next()){
-		    		 	JSONObject obj=new JSONObject();
-		    		 	for(int i=0;i<cols.length;i++){
-		    		 		Object o=result.getObject(i+1);
-		    		 		if(o==null)
-		    		 			o=JSONObject.NULL;
-		    		 		obj.put(cols[i],o);	 
-		    		 		
-		    		 	}
-		    		 	arr.put(obj);
-		    	 }
-   	  }
-   	  else{
-   		  while(result.next()){
-   			JSONArray obj=new JSONArray();
-   		 	for(int i=0;i<cols.length;i++){
-   		 		Object o=result.getObject(i+1);
-   		 	if(o==null)
-	 			o=JSONObject.NULL;
-   		 		obj.put(o);
-   		 	}
-   		 	arr.put(obj);
-   		  }
-   	  }
-   	 return arr;   	 
-    }
-	
-	
-	
-	
 
-	 //閿熸枻鎷烽敓鏂ゆ嫹閿熸嵎鍖℃嫹閿熺獤顖ゆ嫹閿熸枻鎷烽敓鏂ゆ嫹鑿侀敓琛楁唻鎷烽敓闃额亷鎷烽敓杞跨嫬sonArray, 閿熸枻鎷烽敓绲塷wAsObject=true 姣忛敓鏂ゆ嫹閿熸枻鎷风洰閿熸枻鎷烽敓鏂ゆ嫹閿熸枻鎷蜂负閿熸枻鎷烽敓鏂ゆ嫹閿熻璁规嫹閿熸枻鎷烽敓鏂ゆ嫹jsonobject 閿熸枻鎷烽敓鏂ゆ嫹姣忛敓鏂ゆ嫹閿熸枻鎷风洰閿熸枻鎷烽敓鏂ゆ嫹涓�閿熸枻鎷烽敓鏂ゆ嫹閿熻璁规嫹閿熸枻鎷烽敓鏂ゆ嫹 jsonarray閿熸枻鎷烽敓鏂ゆ嫹
-     public static org.json.JSONArray resultToJson(ResultSet result,boolean RowAsObject) throws SQLException, JSONException{
-    	 JSONArray arr=new JSONArray();
-    	 ResultSetMetaData r= result.getMetaData();
-    	  String[] cols=new String[r.getColumnCount()];
+	public static org.json.JSONArray resultToJson(String[] fields,ResultSet result,boolean RowAsObject) throws SQLException, JSONException{
+		org.json.JSONArray arr=new org.json.JSONArray();
 
-    	  for(int i=0;i<cols.length;i++){
-    		  cols[i]=r.getColumnLabel(i+1);
-    	
-    	  }
-    	  if(RowAsObject){
-		    	 while(result.next()){
-		    		 	JSONObject obj=new JSONObject();
-		    		 	for(int i=0;i<cols.length;i++){
-		    		 		Object o=result.getObject(i+1);
-		    		 	if(o==null)
-		    		 			o=JSONObject.NULL;
-		    		 		obj.put(cols[i],o);	    		 		 
-		    		 	}
-		    		 	arr.put(obj);
-		    	 }
-    	  }
-    	  else{
-    		  while(result.next()){
-    			JSONArray obj=new JSONArray();
-    		 	for(int i=0;i<cols.length;i++){
-    		 		Object o=result.getObject(i+1);
-    		 		if(o==null)
-    		 			o=JSONObject.NULL;
-    		 		obj.put(o);
-    		 	}
-    		 	arr.put(obj);
-    		  }
-    	  }
-    	 return arr;   	 
-     }
-   
-     
-     public static void main(String[] ss) throws Exception{
+		String[] cols=fields;
+
+		if(RowAsObject){
+			while(result.next()){
+				JSONObject obj=new JSONObject();
+				for(int i=0;i<cols.length;i++){
+					Object o=result.getObject(i+1);
+					if(o==null)
+						o=JSONObject.NULL;
+					obj.put(cols[i],o);
+
+				}
+				arr.put(obj);
+			}
+		}
+		else{
+			while(result.next()){
+				org.json.JSONArray obj=new org.json.JSONArray();
+				for(int i=0;i<cols.length;i++){
+					Object o=result.getObject(i+1);
+					if(o==null)
+						o=JSONObject.NULL;
+					obj.put(o);
+				}
+				arr.put(obj);
+			}
+		}
+		return arr;
+	}
+
+
+
+
+
+	//閿熸枻鎷烽敓鏂ゆ嫹閿熸嵎鍖℃嫹閿熺獤顖ゆ嫹閿熸枻鎷烽敓鏂ゆ嫹鑿侀敓琛楁唻鎷烽敓闃额亷鎷烽敓杞跨嫬sonArray, 閿熸枻鎷烽敓绲塷wAsObject=true 姣忛敓鏂ゆ嫹閿熸枻鎷风洰閿熸枻鎷烽敓鏂ゆ嫹閿熸枻鎷蜂负閿熸枻鎷烽敓鏂ゆ嫹閿熻璁规嫹閿熸枻鎷烽敓鏂ゆ嫹jsonobject 閿熸枻鎷烽敓鏂ゆ嫹姣忛敓鏂ゆ嫹閿熸枻鎷风洰閿熸枻鎷烽敓鏂ゆ嫹涓�閿熸枻鎷烽敓鏂ゆ嫹閿熻璁规嫹閿熸枻鎷烽敓鏂ゆ嫹 jsonarray閿熸枻鎷烽敓鏂ゆ嫹
+	public static org.json.JSONArray resultToJson(ResultSet result,boolean RowAsObject) throws SQLException, JSONException{
+		org.json.JSONArray arr=new org.json.JSONArray();
+		ResultSetMetaData r= result.getMetaData();
+		String[] cols=new String[r.getColumnCount()];
+
+		for(int i=0;i<cols.length;i++){
+			cols[i]=r.getColumnLabel(i+1);
+
+		}
+		if(RowAsObject){
+			while(result.next()){
+				JSONObject obj=new JSONObject();
+				for(int i=0;i<cols.length;i++){
+					Object o=result.getObject(i+1);
+					if(o==null)
+						o=JSONObject.NULL;
+					obj.put(cols[i],o);
+				}
+				arr.put(obj);
+			}
+		}
+		else{
+			while(result.next()){
+				org.json.JSONArray obj=new JSONArray();
+				for(int i=0;i<cols.length;i++){
+					Object o=result.getObject(i+1);
+					if(o==null)
+						o=JSONObject.NULL;
+					obj.put(o);
+				}
+				arr.put(obj);
+			}
+		}
+		return arr;
+	}
+
+
+	public static void main(String[] ss) throws Exception{
 //    	 DBHelper.InitHelper();
 //    	 System.out.println(DBHelper.getDBHelper("mes").query(true,"select * from gmms_galss_task where width>? limit 1",100));
 //    	 System.out.println(DBHelper.getDBHelper("mes").query(true,"select * from gmms_galss_task where width>? limit 1",false));
 //    	 System.out.println(DBHelper.getDBHelper("mes").update("insert into abc (a,b,c) values (?,?,?)", 1,"2","3"));
-     }
+	}
 }
\ No newline at end of file

--
Gitblit v1.8.0