package com.zzsn.tmpurl.oracledb;

import java.sql.SQLException;
import java.sql.Types;

/**
 * 测试Demo
 * @author Administrator
 */
public class TestBusIness{
    
    static String searchSql = "select * from CIS_sys_Proxy where ID = 1";

    static String insertSql = "insert into score(name, age, score)values(?,?,?)";
    static String deleteSql = "delete from score where id = ?";
    static String updateSql = "update score set name = ? where id = ?";
    static String searchSql2="select count(*) form from cis_ans_processitem where sid='202202150000' and ";
    
    public static void main(String[] args) {
//        intsertData();
        searchData();
    }
    
    private static void intsertData()
    {    
        OracleDBManager dm = new OracleDBManager();
        String[] coulmn = new String[]{"wyf2",  "23", "89.5"};
        int[] type = new int[]{Types.CHAR, Types.INTEGER, Types.DOUBLE};
        
        try {
            boolean flag = dm.updateOrAdd(coulmn, type, insertSql);
            if(flag)
                System.out.println("插入成功");
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
    private static void searchData()
    {    
        OracleDBManager dm = new OracleDBManager();
        String[] coulmn = null;
        int[] type = null;
        
        try {
            OracleDataTable dt = dm.getResultData(coulmn, type, searchSql);
            if(dt != null && dt.getRowCount()> 0){            
                for(int i = 0; i<dt.getRowCount(); i++)
                {
                    for(int j = 0; j<dt.getColCoun(); j++)
                    System.out.printf(dt.getRow()[i][j]+"\t");
                    System.out.println();
                }
            }
            else
                System.out.println("查询失败");
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
}