wu
2025-03-19 1d0a4978574e2b67b4ed04783465710978dbdaba
nglib/src/ng/db/DBHelper.java
@@ -12,11 +12,12 @@
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>();
@@ -29,7 +30,7 @@
   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{
@@ -58,7 +59,7 @@
   }
   
   
   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);
@@ -130,7 +131,7 @@
   
   
   
   public JSONArray query(String sql,Boolean RowAsObject,Object...params) throws SQLException, JSONException{
   public org.json.JSONArray query(String sql, Boolean RowAsObject, Object...params) throws SQLException, JSONException{
       DBSession sn=null;
       try{
          sn=this.createSession(false);
@@ -174,7 +175,7 @@
   
   
   //锟斤拷锟斤拷一锟斤拷锟斤拷in锟斤拷锟斤拷  锟斤拷锟斤拷out锟斤拷锟斤拷锟侥存储锟斤拷锟教o拷一锟斤拷锟街讹拷锟斤拷int 1锟斤拷锟斤拷晒锟� 一锟斤拷锟斤拷String锟斤拷为一锟斤拷锟截革拷锟斤拷锟斤拷锟绞э拷锟绞憋拷锟轿拷锟绞撅拷锟较拷锟�
   //锟斤拷锟斤拷一锟斤拷锟斤拷in锟斤拷锟斤拷  锟斤拷锟斤拷out锟斤拷锟斤拷锟侥存储锟斤拷锟教o拷一锟斤拷锟街讹拷锟斤拷int 1锟斤拷锟斤拷晒锟? 一锟斤拷锟斤拷String锟斤拷为一锟斤拷锟截革拷锟斤拷锟斤拷锟绞э拷锟绞憋拷锟轿拷锟绞撅拷锟较拷锟?
   public QueryResult SelectByProc(String name,String[] Params){
       Connection con=null;
        try{
@@ -324,7 +325,7 @@
         }
   }
   
   //通锟斤拷一锟斤拷锟斤拷锟斤拷取锟斤拷锟捷硷拷锟斤拷锟�
   //通锟斤拷一锟斤拷锟斤拷锟斤拷取锟斤拷锟捷硷拷锟斤拷锟?
   public QueryResult getQueryResult(String sql){
      QueryResult query=null;
      try{
@@ -452,7 +453,7 @@
   
   
    public static org.json.JSONArray resultToJson(String[] fields,ResultSet result,boolean RowAsObject) throws SQLException, JSONException{
       JSONArray arr=new JSONArray();
      org.json.JSONArray arr=new org.json.JSONArray();
  
        String[] cols=fields;
@@ -471,7 +472,7 @@
        }
        else{
           while(result.next()){
            JSONArray obj=new JSONArray();
            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)
@@ -490,7 +491,7 @@
    //锟斤拷锟斤拷锟捷匡拷锟窖拷锟斤拷锟斤拷菁锟街憋拷锟阶拷锟轿狫sonArray, 锟斤拷锟絉owAsObject=true 每锟斤拷锟斤拷目锟斤拷锟斤拷锟斤拷为锟斤拷锟斤拷锟街讹拷锟斤拷锟斤拷jsonobject 锟斤拷锟斤拷每锟斤拷锟斤拷目锟斤拷锟斤拷一锟斤拷锟斤拷锟街讹拷锟斤拷锟斤拷 jsonarray锟斤拷锟斤拷
     public static org.json.JSONArray resultToJson(ResultSet result,boolean RowAsObject) throws SQLException, JSONException{
        JSONArray arr=new JSONArray();
      org.json.JSONArray arr=new org.json.JSONArray();
        ResultSetMetaData r= result.getMetaData();
         String[] cols=new String[r.getColumnCount()];
@@ -512,7 +513,7 @@
         }
         else{
            while(result.next()){
             JSONArray obj=new JSONArray();
            org.json.JSONArray obj=new JSONArray();
              for(int i=0;i<cols.length;i++){
                 Object o=result.getObject(i+1);
                 if(o==null)