除了C# 、C++,C++ cli 、还有一个Java版的 db

DB_.java

java 复制代码
/*****************************************************************************
 创建时间           :2019年10月28日

 文件名             :Ldb.cs

 功能               :基本数据库的访问

 作者               :李锋

 Email              :runzhilf@139.com

 联系电话           :13828778863,25722732




 -------------------最后一次修改时间:2019年10月28日


 (1)加入jtds-1.3.1.jar




 *******************************************************************************/



package JavaPlatform.Database;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;

import JavaPlatform.jp;
import JavaPlatform.System.StringList_;


/**
 * The type Db.
 */
/*
1、用abstract关键字来表达的类,其表达形式为:(public)abstract class 类名{}

2、抽象类不能被实例化,也就是说我们没法直接new 一个抽象类。抽象类本身就代表了一个类型,无法
确定为一个具体的对象,所以不能实例化就合乎情理了,只能有它的继承类实例化。

3、抽象类虽然不能被实例化,但有自己的构造方法(这个后面再讨论)

4、抽象类与接口(interface)有很大的不同之处,接口中不能有实例方法去实现业务逻辑,而抽象类
中可以有实例方法,并实现业务逻辑,比如我们可以在抽象类中创建和销毁一个线程池。

5、抽象类不能使用final关键字修饰,因为final修饰的类是无法被继承,而对于抽象类来说就是
需要通过继承去实现抽象方法,这又会产生矛盾。(后面将写一篇关于finally的文章详细讨论)
------------------------------------------------
如果一个类中至少有一个抽象方法,那么这个类一定是抽象类,但反之则不然。也就是说一个抽象类中可
以没有抽象方法。这样做的目的是为了此类不能被实例化。

如果一个类继承了一个抽象类,那么它必须全部覆写抽象类中的抽象方法,当然也可以不全部覆写,如果
不覆写全部抽象方法则这个子类也必须是抽象类(这样做就无意义了)
------------------------------------------------
 */
public abstract class DB_ {

    /**
     * The enum Data access driver.
     */
/// <summary>
    /// 数据访问驱动
    /// </summary>
    public enum  DataAccessDriver_
    {
        /**
         * Da jtds data access driver.
         */
//"net.sourceforge.jtds.jdbc.Driver"
        daJTDS,
        /**
         * Da oracle data access driver.
         */
//oracle.jdbc.driver.OracleDriver
        daOracle,
        /**
         * Da my sql data access driver.
         */
//com.mysql.jdbc.Driver
        daMySQL,
        /**
         * Da db 2 data access driver.
         */
//com.ibm.db2.jcc.DB2Driver
        daDB2,
        /**
         * Da sy base data access driver.
         */
//com.sybase.jdbc.SybDriver
        daSyBase,
        /**
         * Da postgre sql data access driver.
         */
//org.postgresql.Driver
        daPostgreSQL,
        /**
         * Da sql server 2000 data access driver.
         */
//com.microsoft.jdbc.sqlserver.SQLServerDriver
        daSQLServer2000,
        /**
         * Da sql server 2005 data access driver.
         */
//com.microsoft.sqlserver.jdbc.SQLServerDriver
        daSQLServer2005,        
    }


    /**
     * The enum Data format.
     */
/// <summary>
    /// 访问格式
    /// </summary>
    public enum DataFormat_
    {
        /**
         * Df mdb data format.
         */
        dfMDB,                      //Access2000,2003数据库
        /**
         * Df accdb data format.
         */
        dfAccdb,                    //2007数据库
        /**
         * Df dbf data format.
         */
        dfDBF,
        /**
         * Df db data format.
         */
        dfDB,
        /**
         * Df inter base data format.
         */
        dfInterBase,
        /**
         * Df sql server data format.
         */
        dfSQLServer,                //SQL数据库
        /**
         * Df oracle data format.
         */
        dfOracle,                   //Oracle数据库
        /**
         * Df sybase data format.
         */
        dfSybase,
        /**
         * Df informix data format.
         */
        dfInformix,
        /**
         * Df db 2 data format.
         */
        dfDB2,
        /**
         * Df sq lite data format.
         */
        dfSQLite,                   //Android数据库
        /**
         * Df my sql data format.
         */
        dfMySQL
    };

    /**
     * The enum Editor status.
     */
/// <summary>
    /// 数据编缉状态
    /// </summary>
    public enum EditorStatus_
    {
        /**
         * Es view editor status.
         */
        esView,       //查看状态
        /**
         * Es update editor status.
         */
        esUpdate,     //更新状态
        /**
         * Es delete editor status.
         */
        esDelete,     //删除状态
        /**
         * Es insert editor status.
         */
        esInsert      //添加状态
    }


    /**
     * The enum Data change.
     */
/// <summary>
    /// 记录改变状态
    /// </summary>
    public enum DataChange_
    {
        /**
         * Dc not data change.
         */
        dcNot,                              //没有改变
        /**
         * Dc update data change.
         */
        dcUpdate,                           //记录已更新
        /**
         * Dc delete data change.
         */
        dcDelete,                           //记录已删除
        /**
         * Dc insert data change.
         */
        dcInsert,                           //记录已添加
        /**
         * Dc select data change.
         */
        dcSelect,                           //记录已选择

        /**
         * Dc changed data change.
         */
/// <summary>
        /// 记录已改变,可能是删除,可以是添加,可能是修改
        /// </summary>
        dcChanged
    }


    /**
     * The enum Data type.
     */
/// <summary>
    /// 数据类型
    /// </summary>
    public enum DataType_
    {
        /**
         * Dt int data type.
         */
/// <summary>
        /// 整数
        /// </summary>
        dtInt,

        /**
         * Dt uint data type.
         */
/// <summary>
        /// 正整数或0
        /// </summary>
        dtUint,

        /**
         * Dt float data type.
         */
/// <summary>
        /// 小数
        /// </summary>
        dtFloat,

        /**
         * Dt double data type.
         */
/// <summary>
        /// 双精度小数
        /// </summary>
        dtDouble,

        /**
         * Dt date time data type.
         */
/// <summary>
        /// 时间日期
        /// </summary>
        dtDateTime,

        /**
         * Dt string data type.
         */
/// <summary>
        /// 字符串
        /// </summary>
        dtString,

        /**
         * Dt plus number or zero data type.
         */
/// <summary>
        /// 正数或0
        /// </summary>
        dtPlusNumberOrZero,

        /**
         * Dt negative or zero data type.
         */
/// <summary>
        /// 负数或0
        /// </summary>
        dtNegativeOrZero,


        /**
         * Dt positive integer data type.
         */
/// <summary>
        /// 正整数
        /// </summary>
        dtPositiveInteger,

        /**
         * Dt positive integer or zero data type.
         */
/// <summary>
        /// 正整数或0
        /// </summary>
        dtPositiveIntegerOrZero,


        /**
         * Dt plus number data type.
         */
/// <summary>
        /// 正数
        /// </summary>
        dtPlusNumber,

        /**
         * Dt binary stream data type.
         */
/// <summary>
        /// 图片,二进制数据
        /// </summary>
        dtBinaryStream,


        /**
         * The Dt boolean.
         */
/// <summary>
        /// tinyint TINYINT 1字节 (-128,127) (0,255) 小整数值
        /// </summary>
        dtBoolean,

        /**
         * Dt byte array data type.
         */
/// <summary>
        /// byte[]
        /// </summary>
        dtByteArray,

        /**
         * Dt null data type.
         */
/// <summary>
        /// 无数据类型
        /// </summary>
        dtNULL,
    }


    /**
     * The enum Sq lite data type.
     */
    public enum SQLiteDataType_{
        /**
         * NULL,值是一个 NULL 值。
         */
        dtNULL,

        /**
         * INTEGER,有符号整数,依据数值大小存储在1-8字节的存储空间中。
         */
        dtINTEGER,


        /**
         * REAL,浮点数,8字节的浮点数。
         */
        dtREAL,


        /**
         * TEXT 数值型数据在被插入之前,需要先被转换为文本格式,之后再插入到目标字段中。
         */
        dtText,

        /**
         * BLOB,二进制数据,依照输入来定。
         */
        dtBLOB
    }



    private static  boolean m_checkConnectionEnvironment = false;

    private DataAccessDriver_ m_DataAccessDriver;
    private DataFormat_ m_DataFormat;



    //-------------------------------------------------------------构造

    /**
     * Instantiates a new Db.
     *
     * @param da the da
     * @param df the df
     */
    DB_(DataAccessDriver_ da, DataFormat_ df){

        initData();

        m_DataAccessDriver = da;
        m_DataFormat = df;

    }


    private static void loadJtdsDriver(){
        try {
            Class.forName("net.sourceforge.jtds.jdbc.Driver");
            jp.d("JTDS_SQLConnection类提示:加载jtds驱动成功!");
        } catch (ClassNotFoundException e) {
            jp.d("JTDS_SQLConnection类提示:加载jtds驱动失败!" + e.toString());
        }
    }

    private  String getDriverName(){
        String sResult = "";

        switch (m_DataAccessDriver){

            case daJTDS: {
                sResult = "net.sourceforge.jtds.jdbc.Driver";
                break;
            }

            case daDB2:{
                sResult = "com.ibm.db2.jcc.DB2Driver";
                break;
            }

            case daMySQL:{
                sResult = "com.mysql.jdbc.Driver";
                break;
            }

            case daOracle:{
                sResult = "oracle.jdbc.driver.OracleDriver";
                break;
            }

            case daSyBase:{
                sResult = "com.sybase.jdbc.SybDriver";
                break;
            }

            case daPostgreSQL:{
                sResult = "org.postgresql.Driver";
                break;
            }

            case daSQLServer2000:{
                sResult = "com.microsoft.jdbc.sqlserver.SQLServerDriver";
                break;
            }

            case daSQLServer2005:{
                sResult = "com.microsoft.sqlserver.jdbc.SQLServerDriver";

                break;
            }

            default:
                break;
        }

        return sResult;
    }


    /**
     * Get jtdssql server connection connection.
     *
     * @param sIP       the s ip
     * @param sDBName   the s db name
     * @param sUserName the s user name
     * @param sPassword the s password
     * @return the connection
     */
//基于jtds的SQL Server连接
    static  Connection getJTDSSQLServerConnection(String sIP, String sDBName,
                                                  String sUserName, String sPassword){

       loadJtdsDriver();  //加载驱动

        Connection con = null;

        String sInfo = "";

        try {//100.64.133.241
            DriverManager.setLoginTimeout(5);


            con = DriverManager.getConnection( "jdbc:jtds:sqlserver://" + sIP + ":1433/" + sDBName +
                    ";charset=utf8",sUserName, sPassword);

            sInfo = "getJTDSSQLServerConnection提示:连接" + sIP + "上的数据库" + sDBName + "成功!";

            jp.d(sInfo);
        } catch (SQLException e) {
            sInfo = "getJTDSSQLServerConnection提示:连接" + sIP + "上的数据库" + sDBName + "失败!";
            jp.d(sInfo);
            jp.d(e.toString());
            e.printStackTrace();
        }
        return  con;
    }


    private  void initData()
    {
        if(m_DataAccessDriver == DataAccessDriver_.daJTDS)
        {
            try{
                Class.forName("net.sourceforge.jtds.jdbc.Driver");
                jp.d("JTDS_SQLConnection类提示:加载jtds驱动成功!");
            }
            catch (ClassNotFoundException e){

                jp.d("JTDS_SQLConnection类提示:加载jtds驱动失败!" +
                        e.toString());
            }
        }
        else{

        }
    }


    //-----------------------------------------------------------------------属性重写

    /**
     * Database name string.
     *
     * @return the string
     */
/// <summary>
    /// 数据库名子
    /// </summary>
    public  String database_name()
    {
        return  "";
    }


    /**
     * User name string.
     *
     * @return the string
     */
/// <summary>
    /// 数据库用户
    /// </summary>
    public  String user_name()
    {
        return  "";
    }


    /**
     * User password string.
     *
     * @return the string
     */
/// <summary>
    ///  数据库密码
    /// </summary>
    public  String user_password()
    {
        return  "";
    }






    //-------------------------------------------------------------方法重写


    /**
     * Exec dict sql content boolean.
     *
     * @param sCaptionName    the s caption name
     * @param sCheckTableName the s check table name
     * @return the boolean
     */
/// <summary>
    /// 执行特定的SQL内容
    /// </summary>
    /// <param name="sCaptionName">标题名</param>
    /// <param name="sCheckTableName">需要检查的表名</param>
    /// <returns></returns>
    public  boolean exec_dict_sql_content(String sCaptionName, String sCheckTableName)
    {
        return false;
    }


    /**
     * Exec sql text boolean.
     *
     * @param sText the s text
     * @return the boolean
     */
    public  boolean execSQLText(String sText)
    {
        return false;
    }

    /**
     * Exec sql file boolean.
     *
     * @param sFileName the s file name
     * @return the boolean
     */
    public  boolean execSQLFile(String sFileName)
    {
        return false;
    }


    /**
     * Exec non sql int.
     *
     * @param sSQL the s sql
     * @return the int
     */
/// <summary>
    /// 执行SQL Insert 或者SQL Update
    /// 创建时间:2019年11月01日 最后一次修改时间:2019年11月11日
    /// </summary>
    /// <param name="sSQL">SQL内容</param>
    /// <returns>返回影响记录个数</returns>
    public  int execNonSQL(String sSQL){
        int  iResult = -1;
        Connection conn = getConnection();

        try {
            PreparedStatement ps = conn.prepareStatement(sSQL);
            iResult =  ps.executeUpdate();
            ps.close();
        } catch (SQLException e) {
            String sError = "Ldb.execNonSQL:" + "执行SQL语句:\n\n\t" + sSQL + "\n\n出现问题!";
            jp.d(sError);
            jp.d(e.toString());
            e.printStackTrace();
        }
        return iResult;
    }


    /**
     * Gets table names.
     *
     * @return the table names
     */
    public StringList_ getTableNames()
    {
        StringList_ ls = new StringList_();
        String ssql = "";
        
        if (m_DataFormat == DataFormat_.dfAccdb || m_DataFormat == DataFormat_.dfMDB)
        {
        	/* 
            ADOX.Catalog catalog = new Catalog();
            ADODB.Connection cn = new ADODB.Connection();
            cn.Open(getConnection().ConnectionString, null, null, -1);
            catalog.ActiveConnection = cn;

            for (int i = 0; i < catalog.Tables.Count; ++i)
            {
                ls.Add(catalog.Tables[i].Name);
            }

            cn.Close();
            catalog.ActiveConnection = null;
            */
        }
        else if (m_DataFormat == DataFormat_.dfSQLServer){
        
        	ssql = "SELECT [name] FROM sysobjects WHERE type = \'U\' ORDER BY [name]";


        }
        else if(m_DataFormat == DataFormat_.dfSQLite){
        	ssql = "SELECT [name] FROM sqlite_master WHERE type = \'table\' ORDER BY [name]";
        }
      
        DataTable_ dt = execSQLQuery(ssql);
        
        for (int i = 0; i < dt.getRowsCount(); ++i){
         
        	ls.add(dt.getString(i, "name"));        	 
        }
        	
            //ls.Add(dt.Rows[i]["NAME"].ToString());
        
        
        return ls;
    }


    /**
     * Gets record count.
     *
     * @param sTableName the s table name
     * @return the record count
     */
/// <summary>
    /// 返回记录条数
    /// </summary>
    /// <param name="sTableName">表句</param>
    /// <returns></returns>
    public int getRecordCount(String sTableName)
    {

        //DataTable_l dt = execSQLQuery("SELECT COUNT(*) fd_sum FROM " + sTableName, false);
        //return (int)dt.Rows[0]["fd_sum"];

        return  0;
    }


    /**
     * Gets connection.
     *
     * @return the connection
     */
//子类应该覆盖重写这个函数
    public abstract Connection getConnection();


    /**
     * Database source change.
     *
     * @param sNewDataSource the s new data source
     */
//数据源发生改变
    public abstract void databaseSourceChange(String sNewDataSource);


    /**
     * Exec sql query data table.
     *
     * @param sSQL the s sql
     * @return the data table
     */
    public DataTable_ execSQLQuery(String sSQL)
    {
       return SQLQuery_.execQuery(sSQL,getConnection());
    }


    /**
     * Find data table.
     *
     * @param sSelectFieldNameList the s select field name list
     * @param sTableName           the s table name
     * @param sCondition           the s condition
     * @return the data table
     * @throws Exception the exception
     */
    public DataTable_ find(String  sSelectFieldNameList, String sTableName, String sCondition) throws Exception {
        if(sSelectFieldNameList.trim().length() == 0 || sTableName.trim().length() == 0)
        {
            String sError = "sSelectFieldNameList.trim().length() == 0";


            throw new Exception(sError);
        }

        String sSql = "SELECT " + sSelectFieldNameList + "  FROM " + sTableName;

        if(sCondition.trim().length() != 0)
            sSql = sSql + "  WHERE  " +  sCondition;

        return execSQLQuery(sSql);
    }

    /**
     * Find exist s boolean.
     *
     * @param sFieldName  the s field name
     * @param sFieldValue the s field value
     * @param sTableName  the s table name
     * @param sCondition  the s condition
     * @return the boolean
     * @throws Exception the exception
     */
    public  boolean findExist_s(String  sFieldName,String sFieldValue,String sTableName, String sCondition) throws Exception {
        return  find(sFieldName,sTableName,sFieldName + "=\'" + sFieldValue + "\'  AND " + sCondition).getRowsCount() != 0;
    }


    /**
     * Exec sql query statement data table.
     *
     * @param sSQL the s sql
     * @return the data table
     */
    public DataTable_ execSQLQueryStatement(String sSQL)
    {
        Connection conn = getConnection();

        DataTable_ dt =  SQLQuery_.execQueryStatement(sSQL,conn);


        try {
            conn.close();
        } catch (SQLException e) {
            jp.d("LDataTable execSQLQueryStatement关闭数据库连接失败!\n" );
            jp.d(e.toString() );
            e.printStackTrace();
        }

        return  dt;
    }


    /**
     * Get max id int.
     *
     * @param sTableName the s table name
     * @param sCondition the s condition
     * @return the int
     */
/// <summary>
    /// 返回最大的索引号,如果表中没有记录,则返回0
    /// </summary>
    /// <param name="sTableName"></param>
    /// <param name="sCondition"></param>
    /// <returns></returns>
    public int get_max_id(String sTableName, String sCondition){
        String ssql;

        if (sCondition.length() == 0)
            ssql = "SELECT Max(fd_id) AS max_id FROM " + sTableName;
        else
            ssql = "SELECT Max(fd_id) AS max_id FROM " + sTableName + " WHERE " + sCondition;


        DataTable_ dt = execSQLQuery(ssql);

        //if (dt.Rows[0]["max_id"] != DBNull.Value)
        //    return (int)dt.Rows[0]["max_id"];



        //如果sTableName表中没有记录,Max(fd_id)返回null,dt.getRowsCount() = 1,不管
        //怎样,dt.getRowsCount()都返回1

        String sResult =  dt.getString(0,0);

        if(sResult == null)
        {
            return 0;
        }
        else
        {
            return  Integer.parseInt(sResult);
        }
    }

    /**
     * Gets id from value.
     *
     * @param sFieldName the s field name
     * @param sValue     the s value
     * @param sTableName the s table name
     * @return the id from value
     */
/// <summary>
    /// 从某个字段的值得到索引号,这个值必须是唯一的,字段的值必须是字符串,找到返回ID,否则返回-1
    /// </summary>
    /// <param name="sFieldName">字段名</param>
    /// <param name="sValue">字段值</param>
    /// <param name="sTableName">表名</param>
    /// <returns>如找到,返回索引号,否则返回-1</returns>
    public int getIDFromValue(String sFieldName, String sValue, String sTableName)
    {
        /*
        DataTable dt = execSQLQuery("SELECT fd_id  FROM " + sTableName +
                " WHERE " + sFieldName + " = \'" + ap.checkSQLString(sValue.Trim()) + "\'", false);

        if (dt.Rows.Count > 0)
        {
            return (int)dt.Rows[0]["fd_id"];
        }
        else
        {
            return -1;
        }
        */

        return -1;
    }


    /**
     * Add name int [ ].
     *
     * @param sFieldName the s field name
     * @param sValue     the s value
     * @param sTableName the s table name
     * @return the int [ ]
     * @throws Exception the exception
     */
/// <summary>
    /// 如创建了一个字典值,数组第一个无素是1,第二无素是ID,如果没有创建字典值,第一个元素是0,第二个元素还是ID,不充许字符串都是空格。
    /// </summary>
    /// <param name="sFieldName">字段名</param>
    /// <param name="sValue">字段值,必须是符串</param>
    /// <param name="sTableName">表名</param>
    /// <returns>返回字典ID</returns>
    public int[] addName(String sFieldName, String sValue, String sTableName) throws Exception
    {

        if (sValue.trim().length() == 0)
        {
            jp.d("ldb.addName: 字段值不能为空值!");
            throw new Exception("字段值不能为空值!");
        }

        int[] il = new int[2];
        int iid = get_max_id(sTableName, "") + 1;
        if (sValue.trim().length() != 0)
        {
            il[1] = getIDFromValue(sFieldName, sValue, sTableName);
            if (il[1] == -1)
            {
                String ssql = "INSERT INTO " + sTableName + "(fd_id," + sFieldName + ") VALUES(" +
                        Integer.toString(iid) + ",\'" + jp.checkSQLString(sValue) + "\')";
                if (execNonSQL(ssql) != 0)
                {
                    il[0] = 1; il[1] = iid;
                }
                else { throw new Exception("无法创建字典值"" + sValue + """); }
            }
            else
            {
                il[0] = 0;
            }
        }
        else
        {
            throw new Exception("字段值不能为空!");
        }
        return il;
    }


    /**
     * Create database boolean.
     *
     * @param sDatabaseName the s database name
     * @param sPath         the s path
     * @return the boolean
     */
    public  boolean createDatabase(String sDatabaseName, String sPath)
    {


        return  false;
    }


    /**
     * 函数名:create_crm_natural_person
     * 作用: 在数据库sDBName中创建表crm_natural_person
     * 参数:[sDBName]数据库名
     * 返回值:boolean
     * 作者:李锋
     * 创建时间:2020/1/26 22:21
     * 最后一次修改日期:2020/1/26 22:21
     *
     * @param sDBName the s db name
     * @return the boolean
     */
    public  boolean create_crm_natural_person(String sDBName) {
        if (sDBName.trim().length() == 0)
            return false;


        String ssql = "SELECT [fd_content] FROM [dict_sql] WHERE [fd_caption] = \'crm_natural_person.sql\'";

        //[MobileFamily]

        String sCreate = "";


        DataTable_ dt = execSQLQuery(ssql);

        if (dt.getRows().Count() > 0)
            sCreate = dt.getString(0, 0);
        else
            return false;

        sCreate = sCreate.replaceAll("MobileFamily", sDBName) ;

        return execNonSQL(sCreate) != 0;
    }
}

SQLDB_.java

java 复制代码
package JavaPlatform.Database;

import java.sql.Connection;
import java.sql.SQLException;

import JavaPlatform.jp;


/**
 * The type Sqldb.
 */
public class SQLDB_ extends DB_ {
    private String m_ip;
    private String m_DatabaseName;
    private String m_UserName;
    private String m_Password;
    private Connection m_connection;


    /**
     * Instantiates a new Sqldb.
     *
     * @param sDBName   the s db name
     * @param sUserName the s user name
     * @param sPassword the s password
     * @param sIP       the s ip
     */
    public SQLDB_(String sDBName,
                  String sUserName, String sPassword, String sIP)
    {
        super(DataAccessDriver_.daJTDS, DataFormat_.dfSQLServer);


        m_DatabaseName = sDBName;
        m_UserName = sUserName;
        m_Password = sPassword;
        m_ip = sIP;
        m_connection = null;
    }


    /**
     * Gets connection.
     *
     * @return the connection
     */
    @Override
    public Connection  getConnection()
    {
        if(m_connection == null)
            m_connection = getJTDSSQLServerConnection(m_ip,m_DatabaseName,m_UserName,m_Password);

        return  m_connection;
    }


    /**
     * Database source change.
     *
     * @param sNewDataSource the s new data source
     */
    @Override
    public void databaseSourceChange(String sNewDataSource)
    {
        m_ip = sNewDataSource;

        //如果已经连接,则断开重新连接
        if(m_connection != null) {
            try {
                m_connection.close();
            } catch (SQLException e) {
                jp.d(e.toString());
                e.printStackTrace();
            }

            //重新连接
            m_connection = getConnection();
            jp.d("重定向新的数据源:" + sNewDataSource);
        }
    }


    /**
     * Create database boolean.
     *
     * @param sDatabaseName the s database name
     * @param sPath         the s path
     * @return the boolean
     */
/// <summary>
    /// 在路径sPath下创建一个数据库。
    /// </summary>
    /// <param name="sDatabaseName">数据库名</param>
    /// <param name="sPath">路径名</param>
    /// <returns></returns>
    @Override
    public  boolean createDatabase(String sDatabaseName, String sPath)
    {
        String sTruePath;

        if(sPath.length() == 0)
            sTruePath = DB_Global_.sqlserver_db_path;
        else
            sTruePath = sPath;

        SQLDB_ db = new SQLDB_("master", "sa", m_Password, m_ip);


        String sql = "SELECT * FROM master..sysdatabases WHERE [name]=\'" + sDatabaseName + "\'";


        DataTable_ dt = db.execSQLQuery(sql);

        if (dt.getRows().Count() > 0)
        {
            String sError = "SQLDB_.createDatabase:数据库" + sDatabaseName + "已存在!";
            jp.d(sError);
            return false; //数据库已存在
        }


        sql = "use  master " + "\n";
        sql += "IF NOT EXISTS(SELECT * FROM master..sysdatabases WHERE [name] = \'" +
                sDatabaseName + "\')" + " \n";
        sql += "BEGIN	 " + " \n";
        sql += "CREATE DATABASE [" + sDatabaseName + "] \n";
        sql += "ON " + " \n";
        sql += "(NAME = [" + sDatabaseName + "_data], " + " \n";
        sql += " FILENAME = \'" + sTruePath + sDatabaseName + "_Data.mdf')" + " \n";
        sql += "LOG ON " + " \n";
        sql += "(NAME = [" + sDatabaseName + "_log], " + " \n";
        sql += "FILENAME = \'" + sTruePath + sDatabaseName + "_Log.ldf') " + "\n";
        sql += "END " + "\n";

        db.execNonSQL(sql);

        sql = "SELECT * FROM master..sysdatabases WHERE name=\'" + sDatabaseName + "\'";


        dt = db.execSQLQuery(sql);

        return dt.getRows().Count()  > 0;
    }

}

SQLQuery_

java 复制代码
/*****************************************************************************
 创建时间                 :  2012年11月22日

 文件名                   :   lSQLQuery.cs

 作者                     :  李锋

 Email                    :  runzhilf@139.com

 联系电话                 :  13828778863

 作用                     :  客户,供应商,合作伙伴


 ----------------------最后一次修改时间: 2019年10月28日

 *******************************************************************************/


package JavaPlatform.Database;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

import JavaPlatform.jp;


/**
 * The type Sql query.
 */
public class SQLQuery_{

    /**
     * Instantiates a new Sql query.
     */
    public SQLQuery_()
    {

    }

    /**
     * Exec query statement data table.
     *
     * @param sSQL the s sql
     * @param conn the conn
     * @return the data table
     */
    static DataTable_ execQueryStatement(String sSQL, Connection conn) {
        String sq = jp.checkSQLString(sSQL);

        DataTable_ dt = new DataTable_();

        try {

            Statement stmt = conn.createStatement();

            ResultSet rs = stmt.executeQuery(sq);

            dt.Fill(rs);

            rs.close();

            stmt.close();


        } catch (SQLException e) {
            jp.d("LDataTable.execQueryStatement(sSql)失败\n" + sSQL +"\n");
            jp.d(e.toString());
            e.printStackTrace();
        }

        return dt;
    }

    /************************************************************
     * ssql  =  "SELECT * FROM crm_natural_person WHERE fd_name_cn = \'张三\'";
     * 用 Statement 会出错  java.sql.SQLException: "张三"附近有语法错误。
     * 但用PreparedStatement不会,不知道为什么?
     * @param sSQL the s sql
     * @param conn the conn
     * @return data table
     */
    static DataTable_ execQuery(String sSQL, Connection conn){

        String sq = jp.checkSQLString(sSQL);

        DataTable_ dt = new DataTable_();

        try {
            PreparedStatement ps =  conn.prepareStatement(sSQL);
            ResultSet rs = ps.executeQuery();
            dt.Fill(rs);
            rs.close();
            ps.close();
            //lg.LogD("stmt.executeQuery(sSql)成功");
        } catch (SQLException e) {
            jp.d("LDataTable.execQuery(sSql)失败\n" + sSQL +"\n");
            jp.d(e.toString());
            e.printStackTrace();

        }

        return dt;
    }

}

DataRow_.java

java 复制代码
 /*****************************************************************************
 创建时间                 :  2012年11月22日

 文件名                   :   lDataRow.cs

 作者                     :  李锋

 Email                    :  runzhilf@139.com

 联系电话                 :  13828778863

 作用                     :  模仿C# public class DataRow


 ----------------------最后一次修改时间: 2019年10月28日

 *******************************************************************************/




package JavaPlatform.Database;


 import JavaPlatform.jp;

 /**
  * The type Data row.
  */
 public class DataRow_ {

     /**
      * The enum L data row state.
      */
//
     // 摘要:
     //     获取状态 System.Data.DataRow 对象。
     public enum LDataRowState
     {
         /**
          * Drs detached l data row state.
          */
//
         // 摘要:
         //     行已创建,但不属于任何 System.Data.DataRowCollection。 一个 System.Data.DataRow 处于此状态,已创建后和之前添加到一个集合,或者如果已从集合中删除它。
         drsDetached ,
         /**
          * Drs unchanged l data row state.
          */
//
         // 摘要:
         //     以来未更改行 System.Data.DataRow.AcceptChanges 上一次调用。
         drsUnchanged,
         /**
          * Drs added l data row state.
          */
//
         // 摘要:
         //     行已添加到 System.Data.DataRowCollection, ,和 System.Data.DataRow.AcceptChanges 尚未调用。
         drsAdded ,
         /**
          * Drs deleted l data row state.
          */
//
         // 摘要:
         //     使用已删除该行 System.Data.DataRow.Delete 方法 System.Data.DataRow。
         drsDeleted,
         /**
          * Drs modified l data row state.
          */
//
         // 摘要:
         //     被修改的行和 System.Data.DataRow.AcceptChanges 尚未调用。
         drsModified
     }


     /**
      * The enum L data row version.
      */
//
     // 摘要:
     //     介绍 System.Data.DataRow 的版本。
     public enum LDataRowVersion
     {
         /**
          * Drw original l data row version.
          */
//
         // 摘要:
         //     包含其原始值的行。
         drwOriginal,
         /**
          * Drw current l data row version.
          */
//
         // 摘要:
         //     包含其当前值的行。
         drwCurrent,
         /**
          * Drw proposed l data row version.
          */
//
         // 摘要:
         //     包含建议值的行。
         drwProposed,
         /**
          * Drw default l data row version.
          */
//
         // 摘要:
         //     System.Data.DataRowState 的默认版本。 对于 Added、Modified 或 Deleted 的 DataRowState 值,默认的版本是
         //     Current。 对于 Detached 的 System.Data.DataRowState 值,版本是 Proposed。
         drwDefault
     }



    /*
    //
    // 摘要:
    //     初始化 DataRow 的新实例。 从生成器中构造行。 仅限内部使用。
    //
    // 参数:
    //   builder:
    //     生成器
    protected internal DataRow(DataRowBuilder builder);

    //
    // 摘要:
    //     获取或设置存储在指定的数据 System.Data.DataColumn。
    //
    // 参数:
    //   column:
    //     一个 System.Data.DataColumn 包含数据。
    //
    // 返回结果:
    //     包该数据的 System.Object。
    //
    // 异常:
    //   T:System.ArgumentException:
    //     列不属于此表。
    //
    //   T:System.ArgumentNullException:
    //     column 为 null。
    //
    //   T:System.Data.DeletedRowInaccessibleException:
    //     尝试对已删除的行设置值。
    //
    //   T:System.InvalidCastException:
    //     值与列的数据类型不匹配。
    public object this[DataColumn column] { get; set; }
    //
    // 摘要:
    //     获取或设置指定名称的列中存储的数据。
    //
    // 参数:
    //   columnName:
    //     列的名称。
    //
    // 返回结果:
    //     包该数据的 System.Object。
    //
    // 异常:
    //   T:System.ArgumentException:
    //     指定的列 columnName 找不到。
    //
    //   T:System.Data.DeletedRowInaccessibleException:
    //     当您尝试在已删除的行上设置一个值时出现。
    //
    //   T:System.InvalidCastException:
    //     当您设置一个值并将其 System.Type 不符 System.Data.DataColumn.DataType。
    //
    //   T:System.Data.NoNullAllowedException:
    //     当尝试将 null 值插入列时会发生其中 System.Data.DataColumn.AllowDBNull 设置为 false。
    public object this[string columnName] { get; set; }
    //
    // 摘要:
    //     获取或设置指定索引的列中存储的数据。
    //
    // 参数:
    //   columnIndex:
    //     列的从零开始的索引。
    //
    // 返回结果:
    //     包该数据的 System.Object。
    //
    // 异常:
    //   T:System.Data.DeletedRowInaccessibleException:
    //     当您尝试在已删除的行上设置一个值时出现。
    //
    //   T:System.IndexOutOfRangeException:
    //     columnIndex 参数不在范围。
    //
    //   T:System.InvalidCastException:
    //     当您设置的值和新值时发生 System.Type 不符 System.Data.DataColumn.DataType。
    public object this[int columnIndex] { get; set; }
    //
    // 摘要:
    //     获取存储在指定的数据的指定的版本 System.Data.DataColumn。
    //
    // 参数:
    //   column:
    //     System.Data.DataColumn,包含有关该列的信息。
    //
    //   version:
    //     其中一个 System.Data.DataRowVersion 值,该值指定所需的行版本。 可能值为 Default、Original、Current 和
    //     Proposed。
    //
    // 返回结果:
    //     包该数据的 System.Object。
    //
    // 异常:
    //   T:System.ArgumentException:
    //     列不属于表。
    //
    //   T:System.ArgumentNullException:
    //     column 参数包含 null 值。
    //
    //   T:System.Data.VersionNotFoundException:
    //     行不具有此版本的数据。
    public object this[DataColumn column, DataRowVersion version] { get; }
    //
    // 摘要:
    //     获取指定列中存储的数据的指定的版本。
    //
    // 参数:
    //   columnName:
    //     列的名称。
    //
    //   version:
    //     其中一个 System.Data.DataRowVersion 值,该值指定所需的行版本。 可能值为 Default、Original、Current 和
    //     Proposed。
    //
    // 返回结果:
    //     包该数据的 System.Object。
    //
    // 异常:
    //   T:System.ArgumentException:
    //     指定的列 columnName 找不到。
    //
    //   T:System.InvalidCastException:
    //     值与列的数据类型不匹配。
    //
    //   T:System.Data.VersionNotFoundException:
    //     行不具有此版本的数据。
    //
    //   T:System.Data.DeletedRowInaccessibleException:
    //     行已被删除。
    public object this[string columnName, DataRowVersion version] { get; }
    //
    // 摘要:
    //     获取指定索引和版本要检索的数据的列中存储的数据。
    //
    // 参数:
    //   columnIndex:
    //     列的从零开始的索引。
    //
    //   version:
    //     其中一个 System.Data.DataRowVersion 值,该值指定所需的行版本。 可能值为 Default、Original、Current 和
    //     Proposed。
    //
    // 返回结果:
    //     包该数据的 System.Object。
    //
    // 异常:
    //   T:System.IndexOutOfRangeException:
    //     columnIndex 参数不在范围。
    //
    //   T:System.InvalidCastException:
    //     值与列的数据类型不匹配。
    //
    //   T:System.Data.VersionNotFoundException:
    //     行不具有此版本的数据。
    //
    //   T:System.Data.DeletedRowInaccessibleException:
    //     尝试对已删除的行设置值。
    public object this[int columnIndex, DataRowVersion version] { get; }

    //
    // 摘要:
    //     获取 System.Data.DataTable 为其该行有一个架构。
    //
    // 返回结果:
    //     System.Data.DataTable 此行所属。
    public DataTable Table { get; }
    //
    // 摘要:
    //     获取有关及其与关系行的当前状态 System.Data.DataRowCollection。
    //
    // 返回结果:
    //     System.Data.DataRowState 值之一。
    public DataRowState RowState { get; }
    //
    // 摘要:
    //     获取或设置某一行的自定义错误说明。
    //
    // 返回结果:
    //     描述错误的文本。
    public string RowError { get; set; }
    //
    // 摘要:
    //     获取或设置通过数组此行的所有值。
    //
    // 返回结果:
    //     System.Object 类型的数组。
    //
    // 异常:
    //   T:System.ArgumentException:
    //     该数组将大于表中的列数。
    //
    //   T:System.InvalidCastException:
    //     数组中的值不匹配其 System.Data.DataColumn.DataType 在其各个供应商 System.Data.DataColumn。
    //
    //   T:System.Data.ConstraintException:
    //     编辑破坏了约束。
    //
    //   T:System.Data.ReadOnlyException:
    //     编辑尝试更改只读列的值。
    //
    //   T:System.Data.NoNullAllowedException:
    //     编辑尝试放入列中的 null 值其中 System.Data.DataColumn.AllowDBNull 的 System.Data.DataColumn
    //     对象是 false。
    //
    //   T:System.Data.DeletedRowInaccessibleException:
    //     行已被删除。
    public object[] ItemArray { get; set; }
    //
    // 摘要:
    //     获取一个值,该值指示行是否存在错误。
    //
    // 返回结果:
    //     true 如果行中包含错误。否则为 false。
    public bool HasErrors { get; }

    //
    // 摘要:
    //     提交自上次对该行进行的所有更改 System.Data.DataRow.AcceptChanges 调用。
    //
    // 异常:
    //   T:System.Data.RowNotInTableException:
    //     该行不属于表。
    public void AcceptChanges();
    //
    // 摘要:
    //     在开始编辑操作 System.Data.DataRow 对象。
    //
    // 异常:
    //   T:System.Data.InRowChangingEventException:
    //     该方法调用内 System.Data.DataTable.RowChanging 事件。
    //
    //   T:System.Data.DeletedRowInaccessibleException:
    //     该方法是在已删除的行时调用。
        [EditorBrowsable(EditorBrowsableState.Advanced)]
    public void BeginEdit();
    //
    // 摘要:
    //     取消当前编辑的行上。
    //
    // 异常:
    //   T:System.Data.InRowChangingEventException:
    //     该方法调用内 System.Data.DataTable.RowChanging 事件。
        [EditorBrowsable(EditorBrowsableState.Advanced)]
    public void CancelEdit();
    //
    // 摘要:
    //     清除的行的错误。 这包括 System.Data.DataRow.RowError 并且错误设置有 System.Data.DataRow.SetColumnError(System.Int32,System.String)。
    public void ClearErrors();
    //
    // 摘要:
    //     删除 System.Data.DataRow。
    //
    // 异常:
    //   T:System.Data.DeletedRowInaccessibleException:
    //     System.Data.DataRow 被删除。
    public void Delete();
    //
    // 摘要:
    //     结束对行进行编辑。
    //
    // 异常:
    //   T:System.Data.InRowChangingEventException:
    //     该方法调用内 System.Data.DataTable.RowChanging 事件。
    //
    //   T:System.Data.ConstraintException:
    //     编辑破坏了约束。
    //
    //   T:System.Data.ReadOnlyException:
    //     行所属的表和编辑尝试更改只读列的值。
    //
    //   T:System.Data.NoNullAllowedException:
    //     编辑尝试将 null 值放入某一列其中 System.Data.DataColumn.AllowDBNull 为 false。
        [EditorBrowsable(EditorBrowsableState.Advanced)]
    public void EndEdit();
    //
    // 摘要:
    //     获取子项的行 System.Data.DataRow 使用指定 System.Data.DataRelation.RelationName 的 System.Data.DataRelation。
    //
    // 参数:
    //   relationName:
    //     System.Data.DataRelation.RelationName 的 System.Data.DataRelation 使用。
    //
    // 返回结果:
    //     一个数组 System.Data.DataRow 对象或长度为零的数组。
    //
    // 异常:
    //   T:System.ArgumentException:
    //     关系和行不属于同一个表。
    //
    //   T:System.Data.RowNotInTableException:
    //     该行不属于表。
    public DataRow[] GetChildRows(string relationName);
    //
    // 摘要:
    //     获取子项的行 System.Data.DataRow 使用指定 System.Data.DataRelation.RelationName 的 System.Data.DataRelation,
    //     ,和 System.Data.DataRowVersion。
    //
    // 参数:
    //   relationName:
    //     System.Data.DataRelation.RelationName 的 System.Data.DataRelation 使用。
    //
    //   version:
    //     其中一个 System.Data.DataRowVersion 指定要获取的数据的版本值。 可能值为 Default、Original、Current 和
    //     Proposed。
    //
    // 返回结果:
    //     一个数组 System.Data.DataRow 对象或长度为零的数组。
    //
    // 异常:
    //   T:System.ArgumentException:
    //     关系和行不属于同一个表。
    //
    //   T:System.ArgumentNullException:
    //     relation 为 null。
    //
    //   T:System.Data.RowNotInTableException:
    //     该行不属于表。
    //
    //   T:System.Data.VersionNotFoundException:
    //     行不具有所请求 System.Data.DataRowVersion。
    public DataRow[] GetChildRows(string relationName, DataRowVersion version);
    //
    // 摘要:
    //     获取子项的这行 System.Data.DataRow 使用指定 System.Data.DataRelation。
    //
    // 参数:
    //   relation:
    //     要使用的 System.Data.DataRelation。
    //
    // 返回结果:
    //     一个数组 System.Data.DataRow 对象或长度为零的数组。
    //
    // 异常:
    //   T:System.ArgumentException:
    //     关系和行不属于同一个表。
    //
    //   T:System.ArgumentNullException:
    //     该关系是 null。
    //
    //   T:System.Data.RowNotInTableException:
    //     该行不属于表。
    //
    //   T:System.Data.VersionNotFoundException:
    //     行不具有此版本的数据。
    public DataRow[] GetChildRows(DataRelation relation);
    //
    // 摘要:
    //     获取子项的行 System.Data.DataRow 使用指定 System.Data.DataRelation, ,和 System.Data.DataRowVersion。
    //
    // 参数:
    //   relation:
    //     要使用的 System.Data.DataRelation。
    //
    //   version:
    //     其中一个 System.Data.DataRowVersion 指定要获取的数据的版本值。 可能值为 Default、Original、Current 和
    //     Proposed。
    //
    // 返回结果:
    //     一个 System.Data.DataRow 对象数组。
    //
    // 异常:
    //   T:System.ArgumentException:
    //     关系和行不属于同一个表。
    //
    //   T:System.ArgumentNullException:
    //     relation 为 null。
    //
    //   T:System.Data.RowNotInTableException:
    //     该行不属于表。
    //
    //   T:System.Data.VersionNotFoundException:
    //     行不具有所请求 System.Data.DataRowVersion。
    public DataRow[] GetChildRows(DataRelation relation, DataRowVersion version);
    //
    // 摘要:
    //     获取按名称指定的列中的错误说明。
    //
    // 参数:
    //   columnName:
    //     列的名称。
    //
    // 返回结果:
    //     错误说明的文本。
    public string GetColumnError(string columnName);
    //
    // 摘要:
    //     获取指定的错误说明 System.Data.DataColumn。
    //
    // 参数:
    //   column:
    //     System.Data.DataColumn。
    //
    // 返回结果:
    //     错误说明的文本。
    public string GetColumnError(DataColumn column);
    //
    // 摘要:
    //     获取指定索引的列的错误说明。
    //
    // 参数:
    //   columnIndex:
    //     列的从零开始的索引。
    //
    // 返回结果:
    //     错误说明的文本。
    //
    // 异常:
    //   T:System.IndexOutOfRangeException:
    //     columnIndex 参数不在范围。
    public string GetColumnError(int columnIndex);
    //
    // 摘要:
    //     获取具有错误的列的数组。
    //
    // 返回结果:
    //     一个数组 System.Data.DataColumn 包含错误的对象。
    public DataColumn[] GetColumnsInError();
    //
    // 摘要:
    //     获取的父行 System.Data.DataRow 使用指定 System.Data.DataRelation.RelationName 的 System.Data.DataRelation,
    //     ,和 System.Data.DataRowVersion。
    //
    // 参数:
    //   relationName:
    //     System.Data.DataRelation.RelationName 的 System.Data.DataRelation。
    //
    //   version:
    //     System.Data.DataRowVersion 值之一。
    //
    // 返回结果:
    //     父 System.Data.DataRow 当前行的行。
    //
    // 异常:
    //   T:System.ArgumentException:
    //     关系和行不属于同一个表。
    //
    //   T:System.ArgumentNullException:
    //     relation 为 null。
    //
    //   T:System.Data.DataException:
    //     子行有多个父级。
    //
    //   T:System.Data.RowNotInTableException:
    //     该行不属于表。
    //
    //   T:System.Data.VersionNotFoundException:
    //     行不具有所请求 System.Data.DataRowVersion。
    public DataRow GetParentRow(string relationName, DataRowVersion version);
    //
    // 摘要:
    //     获取的父行 System.Data.DataRow 使用指定 System.Data.DataRelation.RelationName 的 System.Data.DataRelation。
    //
    // 参数:
    //   relationName:
    //     System.Data.DataRelation.RelationName 的 System.Data.DataRelation。
    //
    // 返回结果:
    //     父 System.Data.DataRow 当前行的行。
    //
    // 异常:
    //   T:System.ArgumentException:
    //     关系和行不属于同一个表。
    //
    //   T:System.Data.DataException:
    //     子行有多个父级。
    //
    //   T:System.Data.RowNotInTableException:
    //     该行不属于表。
    public DataRow GetParentRow(string relationName);
    //
    // 摘要:
    //     获取的父行 System.Data.DataRow 使用指定 System.Data.DataRelation, ,和 System.Data.DataRowVersion。
    //
    // 参数:
    //   relation:
    //     要使用的 System.Data.DataRelation。
    //
    //   version:
    //     其中一个 System.Data.DataRowVersion 指定要获取的数据的版本值。
    //
    // 返回结果:
    //     父 System.Data.DataRow 当前行的行。
    //
    // 异常:
    //   T:System.ArgumentNullException:
    //     该行是 null。 relation 不属于此表的父关系。
    //
    //   T:System.Data.DataException:
    //     子行有多个父级。
    //
    //   T:System.Data.InvalidConstraintException:
    //     关系的子表不是行所属的表。
    //
    //   T:System.Data.RowNotInTableException:
    //     该行不属于表。
    //
    //   T:System.Data.VersionNotFoundException:
    //     行不具有此版本的数据。
    public DataRow GetParentRow(DataRelation relation, DataRowVersion version);
    //
    // 摘要:
    //     获取的父行 System.Data.DataRow 使用指定 System.Data.DataRelation。
    //
    // 参数:
    //   relation:
    //     要使用的 System.Data.DataRelation。
    //
    // 返回结果:
    //     父 System.Data.DataRow 当前行的行。
    //
    // 异常:
    //   T:System.ArgumentNullException:
    //     relation 不属于 System.Data.DataTable。 该行是 null。
    //
    //   T:System.Data.DataException:
    //     子行有多个父级。
    //
    //   T:System.Data.InvalidConstraintException:
    //     该行不属于的子表的 System.Data.DataRelation 对象。
    //
    //   T:System.Data.RowNotInTableException:
    //     该行不属于表。
    public DataRow GetParentRow(DataRelation relation);
    //
    // 摘要:
    //     获取父行的 System.Data.DataRow 使用指定 System.Data.DataRelation.RelationName 的 System.Data.DataRelation,
    //     ,和 System.Data.DataRowVersion。
    //
    // 参数:
    //   relationName:
    //     System.Data.DataRelation.RelationName 的 System.Data.DataRelation。
    //
    //   version:
    //     其中一个 System.Data.DataRowVersion 指定要获取的数据的版本值。 可能值为 Default、Original、Current 和
    //     Proposed。
    //
    // 返回结果:
    //     一个数组 System.Data.DataRow 对象或长度为零的数组。
    //
    // 异常:
    //   T:System.ArgumentException:
    //     关系和行不属于同一个表。
    //
    //   T:System.ArgumentNullException:
    //     relation 为 null。
    //
    //   T:System.Data.RowNotInTableException:
    //     该行不属于表。
    //
    //   T:System.Data.VersionNotFoundException:
    //     行不具有所请求 System.Data.DataRowVersion。
    public DataRow[] GetParentRows(string relationName, DataRowVersion version);
    //
    // 摘要:
    //     获取父行的 System.Data.DataRow 使用指定 System.Data.DataRelation.RelationName 的 System.Data.DataRelation。
    //
    // 参数:
    //   relationName:
    //     System.Data.DataRelation.RelationName 的 System.Data.DataRelation。
    //
    // 返回结果:
    //     一个数组 System.Data.DataRow 对象或长度为零的数组。
    //
    // 异常:
    //   T:System.ArgumentException:
    //     关系和行不属于同一个表。
    //
    //   T:System.Data.RowNotInTableException:
    //     该行不属于表。
    public DataRow[] GetParentRows(string relationName);
    //
    // 摘要:
    //     获取父行的 System.Data.DataRow 使用指定 System.Data.DataRelation。
    //
    // 参数:
    //   relation:
    //     要使用的 System.Data.DataRelation。
    //
    // 返回结果:
    //     一个数组 System.Data.DataRow 对象或长度为零的数组。
    //
    // 异常:
    //   T:System.ArgumentException:
    //     System.Data.DataRelation 不属于此行 System.Data.DataSet。
    //
    //   T:System.ArgumentNullException:
    //     该行是 null。
    //
    //   T:System.Data.InvalidConstraintException:
    //     关系的子表不是行所属的表。
    //
    //   T:System.Data.RowNotInTableException:
    //     该行不属于 System.Data.DataTable。
    public DataRow[] GetParentRows(DataRelation relation);
    //
    // 摘要:
    //     获取父行的 System.Data.DataRow 使用指定 System.Data.DataRelation, ,和 System.Data.DataRowVersion。
    //
    // 参数:
    //   relation:
    //     要使用的 System.Data.DataRelation。
    //
    //   version:
    //     其中一个 System.Data.DataRowVersion 指定要获取的数据的版本值。
    //
    // 返回结果:
    //     一个数组 System.Data.DataRow 对象或长度为零的数组。
    //
    // 异常:
    //   T:System.ArgumentException:
    //     System.Data.DataRelation 不属于此行 System.Data.DataSet。
    //
    //   T:System.ArgumentNullException:
    //     该行是 null。
    //
    //   T:System.Data.InvalidConstraintException:
    //     关系的子表不是行所属的表。
    //
    //   T:System.Data.RowNotInTableException:
    //     该行不属于 System.Data.DataTable。
    //
    //   T:System.Data.VersionNotFoundException:
    //     行不具有所请求 System.Data.DataRowVersion。
    public DataRow[] GetParentRows(DataRelation relation, DataRowVersion version);
    //
    // 摘要:
    //     获取一个值,该值指示是否存在指定的版本。
    //
    // 参数:
    //   version:
    //     其中一个 System.Data.DataRowVersion 值,该值指定行的行版本。
    //
    // 返回结果:
    //     true 如果存在版本;否则为 false。
    public bool HasVersion(DataRowVersion version);
    //
    // 摘要:
    //     获取一个值,该值指示是否指定 System.Data.DataColumn 包含一个 null 值。
    //
    // 参数:
    //   column:
    //     System.Data.DataColumn。
    //
    // 返回结果:
    //     true 如果该列包含 null 值;否则为 false。
    public bool IsNull(DataColumn column);
    //
    // 摘要:
    //     获取一个值,该值指示是否指定索引处的列包含 null 值。
    //
    // 参数:
    //   columnIndex:
    //     列的从零开始的索引。
    //
    // 返回结果:
    //     true 如果该列包含 null 值;否则为 false。
    public bool IsNull(int columnIndex);
    //
    // 摘要:
    //     获取一个值,该值指示指定的列是否包含 null 值。
    //
    // 参数:
    //   columnName:
    //     列的名称。
    //
    // 返回结果:
    //     true 如果该列包含 null 值;否则为 false。
    public bool IsNull(string columnName);
    //
    // 摘要:
    //     获取一个值,该值指示是否指定 System.Data.DataColumn 和 System.Data.DataRowVersion 包含一个 null
    //     值。
    //
    // 参数:
    //   column:
    //     System.Data.DataColumn。
    //
    //   version:
    //     其中一个 System.Data.DataRowVersion 值,该值指定行的行版本。 可能值为 Default、Original、Current 和
    //     Proposed。
    //
    // 返回结果:
    //     true 如果该列包含 null 值;否则为 false。
    public bool IsNull(DataColumn column, DataRowVersion version);
    //
    // 摘要:
    //     拒绝以来对该行进行的所有更改 System.Data.DataRow.AcceptChanges 上一次调用。
    //
    // 异常:
    //   T:System.Data.RowNotInTableException:
    //     该行不属于表。
    public void RejectChanges();
    //
    // 摘要:
    //     更改 System.Data.DataRow.Rowstate 的 System.Data.DataRow 到 Added。
    public void SetAdded();
    //
    // 摘要:
    //     设置由索引指定的列的错误说明。
    //
    // 参数:
    //   columnIndex:
    //     列的从零开始的索引。
    //
    //   error:
    //     错误说明。
    //
    // 异常:
    //   T:System.IndexOutOfRangeException:
    //     columnIndex 参数不在范围内
    public void SetColumnError(int columnIndex, string error);
    //
    // 摘要:
    //     设置为指定的列的错误说明 System.Data.DataColumn。
    //
    // 参数:
    //   column:
    //     System.Data.DataColumn 若要设置的错误说明。
    //
    //   error:
    //     错误说明。
    public void SetColumnError(DataColumn column, string error);
    //
    // 摘要:
    //     设置由名称指定的列的错误说明。
    //
    // 参数:
    //   columnName:
    //     列的名称。
    //
    //   error:
    //     错误说明。
    public void SetColumnError(string columnName, string error);
    //
    // 摘要:
    //     更改 System.Data.DataRow.Rowstate 的 System.Data.DataRow 到 Modified。
    public void SetModified();
    //
    // 摘要:
    //     设置的父行 System.Data.DataRow 用新指定 System.Data.DataRow 和 System.Data.DataRelation。
    //
    // 参数:
    //   parentRow:
    //     新的父级 System.Data.DataRow。
    //
    //   relation:
    //     该关系 System.Data.DataRelation 使用。
    //
    // 异常:
    //   T:System.Data.RowNotInTableException:
    //     这些行之一不属于表
    //
    //   T:System.ArgumentNullException:
    //     这些行之一是 null。
    //
    //   T:System.ArgumentException:
    //     该关系不属于 System.Data.DataRelationCollection 的 System.Data.DataSet 对象。
    //
    //   T:System.Data.InvalidConstraintException:
    //     该关系的子级 System.Data.DataTable 不是该行所属的表。
    public void SetParentRow(DataRow parentRow, DataRelation relation);
    //
    // 摘要:
    //     设置的父行 System.Data.DataRow 用新指定 System.Data.DataRow。
    //
    // 参数:
    //   parentRow:
    //     新的父级 System.Data.DataRow。
    public void SetParentRow(DataRow parentRow);
    //
    // 摘要:
    //     设置指定的值 System.Data.DataColumn 为空值。
    //
    // 参数:
    //   column:
    //     System.Data.DataColumn。
    protected void SetNull(DataColumn column);
************************************************************************************************/


     /**
      * Instantiates a new Data row.
      *
      * @param nRowIndex the n row index
      * @param dt        the dt
      */
     public DataRow_(int nRowIndex, DataTable_ dt){

        if( nRowIndex >= dt.getRowsCount() || nRowIndex < 0)
        {
            jp.d("函数LDataRow(int nRowIndex,LDataTable dt):dt.getRowsCount() < nRowIndex || nRowIndex < 0");
            throw  new IndexOutOfBoundsException();
        }


        m_RowIndex = nRowIndex;
        m_DataTable = dt;
    }


    private int m_RowIndex = -1;

     /**
      * Get row index int.
      *
      * @return the int
      */
     public  int getRowIndex(){return m_RowIndex;}







/*******************************************************************模仿C# public class DataRow*/



    private DataTable_ m_DataTable;

     /**
      * Get data table data table.
      *
      * @return the data table
      */
     public DataTable_ getDataTable(){return m_DataTable;}


    private  LDataRowState m_DataRowState;




    //
    // 摘要:
    //     初始化 DataRow 的新实例。 从生成器中构造行。 仅限内部使用。
    //
    // 参数:
    //   builder:
    //     生成器
    //protected internal DataRow(DataRowBuilder builder);


     /**
      * Get data string.
      *
      * @param column the column
      * @return the string
      */
//
    // 摘要:
    //     获取或设置存储在指定的数据 System.Data.DataColumn。
    //
    // 参数:
    //   column:
    //     一个 System.Data.DataColumn 包含数据。
    //
    // 返回结果:
    //     包该数据的 System.Object。
    //
    // 异常:
    //   T:System.ArgumentException:
    //     列不属于此表。
    //
    //   T:System.ArgumentNullException:
    //     column 为 null。
    //
    //   T:System.Data.DeletedRowInaccessibleException:
    //     尝试对已删除的行设置值。
    //
    //   T:System.InvalidCastException:
    //     值与列的数据类型不匹配。
    public String getData(DataColumn_ column){ return m_DataTable.getString(m_RowIndex,column.getColumnName());}


     /**
      * Get data string.
      *
      * @param columnName the column name
      * @return the string
      */
//
    // 摘要:
    //     获取或设置指定名称的列中存储的数据。
    //
    // 参数:
    //   columnName:
    //     列的名称。
    //
    // 返回结果:
    //     包该数据的 System.Object。
    //
    // 异常:
    //   T:System.ArgumentException:
    //     指定的列 columnName 找不到。
    //
    //   T:System.Data.DeletedRowInaccessibleException:
    //     当您尝试在已删除的行上设置一个值时出现。
    //
    //   T:System.InvalidCastException:
    //     当您设置一个值并将其 System.Type 不符 System.Data.DataColumn.DataType。
    //
    //   T:System.Data.NoNullAllowedException:
    //     当尝试将 null 值插入列时会发生其中 System.Data.DataColumn.AllowDBNull 设置为 false。
    public String getData(String columnName){ return m_DataTable.getString(m_RowIndex,columnName); }


     /**
      * Gets data.
      *
      * @param columnIndex the column index
      * @return the data
      */
//
     // 摘要:
     //     获取或设置指定索引的列中存储的数据。
     //
     // 参数:
     //   columnIndex:
     //     列的从零开始的索引。
     //
     // 返回结果:
     //     包该数据的 System.Object。
     //
     // 异常:
     //   T:System.Data.DeletedRowInaccessibleException:
     //     当您尝试在已删除的行上设置一个值时出现。
     //
     //   T:System.IndexOutOfRangeException:
     //     columnIndex 参数不在范围。
     //
     //   T:System.InvalidCastException:
     //     当您设置的值和新值时发生 System.Type 不符 System.Data.DataColumn.DataType。
     public String getData(int columnIndex) {return m_DataTable.getString(m_RowIndex,columnIndex); }



     //
     // 摘要:
     //     获取存储在指定的数据的指定的版本 System.Data.DataColumn。
     //
     // 参数:
     //   column:
     //     System.Data.DataColumn,包含有关该列的信息。
     //
     //   version:
     //     其中一个 System.Data.DataRowVersion 值,该值指定所需的行版本。 可能值为 Default、Original、Current 和
     //     Proposed。
     //
     // 返回结果:
     //     包该数据的 System.Object。
     //
     // 异常:
     //   T:System.ArgumentException:
     //     列不属于表。
     //
     //   T:System.ArgumentNullException:
     //     column 参数包含 null 值。
     //
     //   T:System.Data.VersionNotFoundException:
     //     行不具有此版本的数据。
    // public object this[DataColumn column, DataRowVersion version] { get; }



     //
     // 摘要:
     //     获取指定列中存储的数据的指定的版本。
     //
     // 参数:
     //   columnName:
     //     列的名称。
     //
     //   version:
     //     其中一个 System.Data.DataRowVersion 值,该值指定所需的行版本。 可能值为 Default、Original、Current 和
     //     Proposed。
     //
     // 返回结果:
     //     包该数据的 System.Object。
     //
     // 异常:
     //   T:System.ArgumentException:
     //     指定的列 columnName 找不到。
     //
     //   T:System.InvalidCastException:
     //     值与列的数据类型不匹配。
     //
     //   T:System.Data.VersionNotFoundException:
     //     行不具有此版本的数据。
     //
     //   T:System.Data.DeletedRowInaccessibleException:
     //     行已被删除。
     //public object this[string columnName, DataRowVersion version] { get; }
     //
     // 摘要:
     //     获取指定索引和版本要检索的数据的列中存储的数据。
     //
     // 参数:
     //   columnIndex:
     //     列的从零开始的索引。
     //
     //   version:
     //     其中一个 System.Data.DataRowVersion 值,该值指定所需的行版本。 可能值为 Default、Original、Current 和
     //     Proposed。
     //
     // 返回结果:
     //     包该数据的 System.Object。
     //
     // 异常:
     //   T:System.IndexOutOfRangeException:
     //     columnIndex 参数不在范围。
     //
     //   T:System.InvalidCastException:
     //     值与列的数据类型不匹配。
     //
     //   T:System.Data.VersionNotFoundException:
     //     行不具有此版本的数据。
     //
     //   T:System.Data.DeletedRowInaccessibleException:
     //     尝试对已删除的行设置值。
     //public object this[int columnIndex, DataRowVersion version] { get; }


     /**
      * Data table data table.
      *
      * @return the data table
      */
//
    // 摘要:
    //     获取 System.Data.DataTable 为其该行有一个架构。
    //
    // 返回结果:
    //     System.Data.DataTable 此行所属。
    public DataTable_ DataTable(){return  m_DataTable;}


     /**
      * Row state l data row state.
      *
      * @return the l data row state
      */
//
     // 摘要:
     //     获取有关及其与关系行的当前状态 System.Data.DataRowCollection。
     //
     // 返回结果:
     //     System.Data.DataRowState 值之一。
     public LDataRowState RowState(){   return  m_DataRowState;  }


     /**
      * Row error string.
      *
      * @return the string
      */
//
     // 摘要:
     //     获取或设置某一行的自定义错误说明。
     //
     // 返回结果:
     //     描述错误的文本。
     public String RowError() { return  ""; }


     /**
      * Item array string [ ].
      *
      * @return the string [ ]
      */
//
     // 摘要:
     //     获取或设置通过数组此行的所有值。
     //
     // 返回结果:
     //     System.Object 类型的数组。
     //
     // 异常:
     //   T:System.ArgumentException:
     //     该数组将大于表中的列数。
     //
     //   T:System.InvalidCastException:
     //     数组中的值不匹配其 System.Data.DataColumn.DataType 在其各个供应商 System.Data.DataColumn。
     //
     //   T:System.Data.ConstraintException:
     //     编辑破坏了约束。
     //
     //   T:System.Data.ReadOnlyException:
     //     编辑尝试更改只读列的值。
     //
     //   T:System.Data.NoNullAllowedException:
     //     编辑尝试放入列中的 null 值其中 System.Data.DataColumn.AllowDBNull 的 System.Data.DataColumn
     //     对象是 false。
     //
     //   T:System.Data.DeletedRowInaccessibleException:
     //     行已被删除。
     public String[] ItemArray(){
        String[] sArray = new String[m_DataTable.getColumns().size()];

        for(int n = 0;  n < m_DataTable.getColumns().size(); ++n){
            sArray[n] =  getData(n);
        }
        return  sArray;
     }


     /**
      * Has errors boolean.
      *
      * @return the boolean
      */
//
     // 摘要:
     //     获取一个值,该值指示行是否存在错误。
     //
     // 返回结果:
     //     true 如果行中包含错误。否则为 false。
     public boolean HasErrors(){ return true;}


     /**
      * Accept changes.
      */
//
     // 摘要:
     //     提交自上次对该行进行的所有更改 System.Data.DataRow.AcceptChanges 调用。
     //
     // 异常:
     //   T:System.Data.RowNotInTableException:
     //     该行不属于表。
     public void AcceptChanges(){}


     /**
      * Begin edit.
      */
//
     // 摘要:
     //     在开始编辑操作 System.Data.DataRow 对象。
     //
     // 异常:
     //   T:System.Data.InRowChangingEventException:
     //     该方法调用内 System.Data.DataTable.RowChanging 事件。
     //
     //   T:System.Data.DeletedRowInaccessibleException:
     //     该方法是在已删除的行时调用。
     //
     public void BeginEdit(){}


     /**
      * Cancel edit.
      */
//
     // 摘要:
     //     取消当前编辑的行上。
     //
     // 异常:
     //   T:System.Data.InRowChangingEventException:
     //     该方法调用内 System.Data.DataTable.RowChanging 事件。
     //[EditorBrowsable(EditorBrowsableState.Advanced)]
     public void CancelEdit(){}

     /**
      * Clear errors.
      */
//
     // 摘要:
     //     清除的行的错误。 这包括 System.Data.DataRow.RowError 并且错误设置有 System.Data.DataRow.SetColumnError(System.Int32,System.String)。
     public void ClearErrors(){}


     /**
      * Delete.
      */
//
     // 摘要:
     //     删除 System.Data.DataRow。
     //
     // 异常:
     //   T:System.Data.DeletedRowInaccessibleException:
     //     System.Data.DataRow 被删除。
     public void Delete(){}


     /**
      * End edit.
      */
//
     // 摘要:
     //     结束对行进行编辑。
     //
     // 异常:
     //   T:System.Data.InRowChangingEventException:
     //     该方法调用内 System.Data.DataTable.RowChanging 事件。
     //
     //   T:System.Data.ConstraintException:
     //     编辑破坏了约束。
     //
     //   T:System.Data.ReadOnlyException:
     //     行所属的表和编辑尝试更改只读列的值。
     //
     //   T:System.Data.NoNullAllowedException:
     //     编辑尝试将 null 值放入某一列其中 System.Data.DataColumn.AllowDBNull 为 false。
     //   [EditorBrowsable(EditorBrowsableState.Advanced)]
     public void EndEdit(){}


     /**
      * Get child rows data row [ ].
      *
      * @param relationName the relation name
      * @return the data row [ ]
      */
//
     // 摘要:
     //     获取子项的行 System.Data.DataRow 使用指定 System.Data.DataRelation.RelationName 的 System.Data.DataRelation。
     //
     // 参数:
     //   relationName:
     //     System.Data.DataRelation.RelationName 的 System.Data.DataRelation 使用。
     //
     // 返回结果:
     //     一个数组 System.Data.DataRow 对象或长度为零的数组。
     //
     // 异常:
     //   T:System.ArgumentException:
     //     关系和行不属于同一个表。
     //
     //   T:System.Data.RowNotInTableException:
     //     该行不属于表。
     public DataRow_[] GetChildRows(String relationName){ return  null;}


     /**
      * Get child rows data row [ ].
      *
      * @param relationName the relation name
      * @param version      the version
      * @return the data row [ ]
      */
//
     // 摘要:
     //     获取子项的行 System.Data.DataRow 使用指定 System.Data.DataRelation.RelationName 的 System.Data.DataRelation,
     //     ,和 System.Data.DataRowVersion。
     //
     // 参数:
     //   relationName:
     //     System.Data.DataRelation.RelationName 的 System.Data.DataRelation 使用。
     //
     //   version:
     //     其中一个 System.Data.DataRowVersion 指定要获取的数据的版本值。 可能值为 Default、Original、Current 和
     //     Proposed。
     //
     // 返回结果:
     //     一个数组 System.Data.DataRow 对象或长度为零的数组。
     //
     // 异常:
     //   T:System.ArgumentException:
     //     关系和行不属于同一个表。
     //
     //   T:System.ArgumentNullException:
     //     relation 为 null。
     //
     //   T:System.Data.RowNotInTableException:
     //     该行不属于表。
     //
     //   T:System.Data.VersionNotFoundException:
     //     行不具有所请求 System.Data.DataRowVersion。
     public DataRow_[] GetChildRows(String relationName, LDataRowVersion version){return  null;}


     /**
      * Get child rows data row [ ].
      *
      * @param relation the relation
      * @return the data row [ ]
      */
//
     // 摘要:
     //     获取子项的这行 System.Data.DataRow 使用指定 System.Data.DataRelation。
     //
     // 参数:
     //   relation:
     //     要使用的 System.Data.DataRelation。
     //
     // 返回结果:
     //     一个数组 System.Data.DataRow 对象或长度为零的数组。
     //
     // 异常:
     //   T:System.ArgumentException:
     //     关系和行不属于同一个表。
     //
     //   T:System.ArgumentNullException:
     //     该关系是 null。
     //
     //   T:System.Data.RowNotInTableException:
     //     该行不属于表。
     //
     //   T:System.Data.VersionNotFoundException:
     //     行不具有此版本的数据。
     public DataRow_[] GetChildRows(DataRelation_ relation){return  null;}


     /**
      * Get child rows data row [ ].
      *
      * @param relation the relation
      * @param version  the version
      * @return the data row [ ]
      */
//
     // 摘要:
     //     获取子项的行 System.Data.DataRow 使用指定 System.Data.DataRelation, ,和 System.Data.DataRowVersion。
     //
     // 参数:
     //   relation:
     //     要使用的 System.Data.DataRelation。
     //
     //   version:
     //     其中一个 System.Data.DataRowVersion 指定要获取的数据的版本值。 可能值为 Default、Original、Current 和
     //     Proposed。
     //
     // 返回结果:
     //     一个 System.Data.DataRow 对象数组。
     //
     // 异常:
     //   T:System.ArgumentException:
     //     关系和行不属于同一个表。
     //
     //   T:System.ArgumentNullException:
     //     relation 为 null。
     //
     //   T:System.Data.RowNotInTableException:
     //     该行不属于表。
     //
     //   T:System.Data.VersionNotFoundException:
     //     行不具有所请求 System.Data.DataRowVersion。
     public DataRow_[] GetChildRows(DataRelation_ relation, LDataRowVersion version){return  null;}


     /**
      * Get column error string.
      *
      * @param columnName the column name
      * @return the string
      */
//
     // 摘要:
     //     获取按名称指定的列中的错误说明。
     //
     // 参数:
     //   columnName:
     //     列的名称。
     //
     // 返回结果:
     //     错误说明的文本。
     public String GetColumnError(String columnName){return  null;}


     /**
      * Get column error string.
      *
      * @param column the column
      * @return the string
      */
//
     // 摘要:
     //     获取指定的错误说明 System.Data.DataColumn。
     //
     // 参数:
     //   column:
     //     System.Data.DataColumn。
     //
     // 返回结果:
     //     错误说明的文本。
     public String GetColumnError(DataColumn_ column){return  "";}


     /**
      * Get column error string.
      *
      * @param columnIndex the column index
      * @return the string
      */
//
     // 摘要:
     //     获取指定索引的列的错误说明。
     //
     // 参数:
     //   columnIndex:
     //     列的从零开始的索引。
     //
     // 返回结果:
     //     错误说明的文本。
     //
     // 异常:
     //   T:System.IndexOutOfRangeException:
     //     columnIndex 参数不在范围。
     public String GetColumnError(int columnIndex){return "";}


     /**
      * Get columns in error data column [ ].
      *
      * @return the data column [ ]
      */
//
     // 摘要:
     //     获取具有错误的列的数组。
     //
     // 返回结果:
     //     一个数组 System.Data.DataColumn 包含错误的对象。
     public DataColumn_[] GetColumnsInError(){return null;}

     /**
      * Get parent row data row.
      *
      * @param relationName the relation name
      * @param version      the version
      * @return the data row
      */
//
     // 摘要:
     //     获取的父行 System.Data.DataRow 使用指定 System.Data.DataRelation.RelationName 的 System.Data.DataRelation,
     //     ,和 System.Data.DataRowVersion。
     //
     // 参数:
     //   relationName:
     //     System.Data.DataRelation.RelationName 的 System.Data.DataRelation。
     //
     //   version:
     //     System.Data.DataRowVersion 值之一。
     //
     // 返回结果:
     //     父 System.Data.DataRow 当前行的行。
     //
     // 异常:
     //   T:System.ArgumentException:
     //     关系和行不属于同一个表。
     //
     //   T:System.ArgumentNullException:
     //     relation 为 null。
     //
     //   T:System.Data.DataException:
     //     子行有多个父级。
     //
     //   T:System.Data.RowNotInTableException:
     //     该行不属于表。
     //
     //   T:System.Data.VersionNotFoundException:
     //     行不具有所请求 System.Data.DataRowVersion。
     public DataRow_ GetParentRow(String relationName, LDataRowVersion version){return  null;}


     /**
      * Get parent row data row.
      *
      * @param relationName the relation name
      * @return the data row
      */
//
     // 摘要:
     //     获取的父行 System.Data.DataRow 使用指定 System.Data.DataRelation.RelationName 的 System.Data.DataRelation。
     //
     // 参数:
     //   relationName:
     //     System.Data.DataRelation.RelationName 的 System.Data.DataRelation。
     //
     // 返回结果:
     //     父 System.Data.DataRow 当前行的行。
     //
     // 异常:
     //   T:System.ArgumentException:
     //     关系和行不属于同一个表。
     //
     //   T:System.Data.DataException:
     //     子行有多个父级。
     //
     //   T:System.Data.RowNotInTableException:
     //     该行不属于表。
     public DataRow_ GetParentRow(String relationName){return  null;}


     /**
      * Get parent row data row.
      *
      * @param relation the relation
      * @param version  the version
      * @return the data row
      */
//
     // 摘要:
     //     获取的父行 System.Data.DataRow 使用指定 System.Data.DataRelation, ,和 System.Data.DataRowVersion。
     //
     // 参数:
     //   relation:
     //     要使用的 System.Data.DataRelation。
     //
     //   version:
     //     其中一个 System.Data.DataRowVersion 指定要获取的数据的版本值。
     //
     // 返回结果:
     //     父 System.Data.DataRow 当前行的行。
     //
     // 异常:
     //   T:System.ArgumentNullException:
     //     该行是 null。 relation 不属于此表的父关系。
     //
     //   T:System.Data.DataException:
     //     子行有多个父级。
     //
     //   T:System.Data.InvalidConstraintException:
     //     关系的子表不是行所属的表。
     //
     //   T:System.Data.RowNotInTableException:
     //     该行不属于表。
     //
     //   T:System.Data.VersionNotFoundException:
     //     行不具有此版本的数据。
     public DataRow_ GetParentRow(DataRelation_ relation, LDataRowVersion version){return null;}


     /**
      * Get parent row data row.
      *
      * @param relation the relation
      * @return the data row
      */
//
     // 摘要:
     //     获取的父行 System.Data.DataRow 使用指定 System.Data.DataRelation。
     //
     // 参数:
     //   relation:
     //     要使用的 System.Data.DataRelation。
     //
     // 返回结果:
     //     父 System.Data.DataRow 当前行的行。
     //
     // 异常:
     //   T:System.ArgumentNullException:
     //     relation 不属于 System.Data.DataTable。 该行是 null。
     //
     //   T:System.Data.DataException:
     //     子行有多个父级。
     //
     //   T:System.Data.InvalidConstraintException:
     //     该行不属于的子表的 System.Data.DataRelation 对象。
     //
     //   T:System.Data.RowNotInTableException:
     //     该行不属于表。
     public DataRow_ GetParentRow(DataRelation_ relation){return null;}


     /**
      * Get parent rows data row [ ].
      *
      * @param relationName the relation name
      * @param version      the version
      * @return the data row [ ]
      */
//
     // 摘要:
     //     获取父行的 System.Data.DataRow 使用指定 System.Data.DataRelation.RelationName 的 System.Data.DataRelation,
     //     ,和 System.Data.DataRowVersion。
     //
     // 参数:
     //   relationName:
     //     System.Data.DataRelation.RelationName 的 System.Data.DataRelation。
     //
     //   version:
     //     其中一个 System.Data.DataRowVersion 指定要获取的数据的版本值。 可能值为 Default、Original、Current 和
     //     Proposed。
     //
     // 返回结果:
     //     一个数组 System.Data.DataRow 对象或长度为零的数组。
     //
     // 异常:
     //   T:System.ArgumentException:
     //     关系和行不属于同一个表。
     //
     //   T:System.ArgumentNullException:
     //     relation 为 null。
     //
     //   T:System.Data.RowNotInTableException:
     //     该行不属于表。
     //
     //   T:System.Data.VersionNotFoundException:
     //     行不具有所请求 System.Data.DataRowVersion。
     public DataRow_[] GetParentRows(String relationName, LDataRowVersion version){return null;}


     /**
      * Get parent rows data row [ ].
      *
      * @param relationName the relation name
      * @return the data row [ ]
      */
//
     // 摘要:
     //     获取父行的 System.Data.DataRow 使用指定 System.Data.DataRelation.RelationName 的 System.Data.DataRelation。
     //
     // 参数:
     //   relationName:
     //     System.Data.DataRelation.RelationName 的 System.Data.DataRelation。
     //
     // 返回结果:
     //     一个数组 System.Data.DataRow 对象或长度为零的数组。
     //
     // 异常:
     //   T:System.ArgumentException:
     //     关系和行不属于同一个表。
     //
     //   T:System.Data.RowNotInTableException:
     //     该行不属于表。
     public DataRow_[] GetParentRows(String relationName){return  null;}


     /**
      * Get parent rows data row [ ].
      *
      * @param relation the relation
      * @return the data row [ ]
      */
//
     // 摘要:
     //     获取父行的 System.Data.DataRow 使用指定 System.Data.DataRelation。
     //
     // 参数:
     //   relation:
     //     要使用的 System.Data.DataRelation。
     //
     // 返回结果:
     //     一个数组 System.Data.DataRow 对象或长度为零的数组。
     //
     // 异常:
     //   T:System.ArgumentException:
     //     System.Data.DataRelation 不属于此行 System.Data.DataSet。
     //
     //   T:System.ArgumentNullException:
     //     该行是 null。
     //
     //   T:System.Data.InvalidConstraintException:
     //     关系的子表不是行所属的表。
     //
     //   T:System.Data.RowNotInTableException:
     //     该行不属于 System.Data.DataTable。
     public DataRow_[] GetParentRows(DataRelation_ relation){return null;}


     /**
      * Get parent rows data row [ ].
      *
      * @param relation the relation
      * @param version  the version
      * @return the data row [ ]
      */
//
     // 摘要:
     //     获取父行的 System.Data.DataRow 使用指定 System.Data.DataRelation, ,和 System.Data.DataRowVersion。
     //
     // 参数:
     //   relation:
     //     要使用的 System.Data.DataRelation。
     //
     //   version:
     //     其中一个 System.Data.DataRowVersion 指定要获取的数据的版本值。
     //
     // 返回结果:
     //     一个数组 System.Data.DataRow 对象或长度为零的数组。
     //
     // 异常:
     //   T:System.ArgumentException:
     //     System.Data.DataRelation 不属于此行 System.Data.DataSet。
     //
     //   T:System.ArgumentNullException:
     //     该行是 null。
     //
     //   T:System.Data.InvalidConstraintException:
     //     关系的子表不是行所属的表。
     //
     //   T:System.Data.RowNotInTableException:
     //     该行不属于 System.Data.DataTable。
     //
     //   T:System.Data.VersionNotFoundException:
     //     行不具有所请求 System.Data.DataRowVersion。
     public DataRow_[] GetParentRows(DataRelation_ relation, LDataRowVersion version){return null;}


     /**
      * Has version boolean.
      *
      * @param version the version
      * @return the boolean
      */
//
     // 摘要:
     //     获取一个值,该值指示是否存在指定的版本。
     //
     // 参数:
     //   version:
     //     其中一个 System.Data.DataRowVersion 值,该值指定行的行版本。
     //
     // 返回结果:
     //     true 如果存在版本;否则为 false。
     public boolean HasVersion(LDataRowVersion version){return false;}


     /**
      * Is null boolean.
      *
      * @param column the column
      * @return the boolean
      */
//
     // 摘要:
     //     获取一个值,该值指示是否指定 System.Data.DataColumn 包含一个 null 值。
     //
     // 参数:
     //   column:
     //     System.Data.DataColumn。
     //
     // 返回结果:
     //     true 如果该列包含 null 值;否则为 false。
     public boolean IsNull(DataColumn_ column){return false;}


     /**
      * Is null boolean.
      *
      * @param columnIndex the column index
      * @return the boolean
      */
//
     // 摘要:
     //     获取一个值,该值指示是否指定索引处的列包含 null 值。
     //
     // 参数:
     //   columnIndex:
     //     列的从零开始的索引。
     //
     // 返回结果:
     //     true 如果该列包含 null 值;否则为 false。
     public boolean IsNull(int columnIndex){return false;}


     /**
      * Is null boolean.
      *
      * @param columnName the column name
      * @return the boolean
      */
//
     // 摘要:
     //     获取一个值,该值指示指定的列是否包含 null 值。
     //
     // 参数:
     //   columnName:
     //     列的名称。
     //
     // 返回结果:
     //     true 如果该列包含 null 值;否则为 false。
     public boolean IsNull(String columnName){return false;}


     /**
      * Is null boolean.
      *
      * @param column  the column
      * @param version the version
      * @return the boolean
      */
//
     // 摘要:
     //     获取一个值,该值指示是否指定 System.Data.DataColumn 和 System.Data.DataRowVersion 包含一个 null
     //     值。
     //
     // 参数:
     //   column:
     //     System.Data.DataColumn。
     //
     //   version:
     //     其中一个 System.Data.DataRowVersion 值,该值指定行的行版本。 可能值为 Default、Original、Current 和
     //     Proposed。
     //
     // 返回结果:
     //     true 如果该列包含 null 值;否则为 false。
     public boolean IsNull(DataColumn_ column, LDataRowVersion version){return false;}


     /**
      * Reject changes.
      */
//
     // 摘要:
     //     拒绝以来对该行进行的所有更改 System.Data.DataRow.AcceptChanges 上一次调用。
     //
     // 异常:
     //   T:System.Data.RowNotInTableException:
     //     该行不属于表。
     public void RejectChanges(){}


     /**
      * Set added.
      */
//
     // 摘要:
     //     更改 System.Data.DataRow.Rowstate 的 System.Data.DataRow 到 Added。
     public void SetAdded(){}


     /**
      * Set column error.
      *
      * @param columnIndex the column index
      * @param error       the error
      */
//
     // 摘要:
     //     设置由索引指定的列的错误说明。
     //
     // 参数:
     //   columnIndex:
     //     列的从零开始的索引。
     //
     //   error:
     //     错误说明。
     //
     // 异常:
     //   T:System.IndexOutOfRangeException:
     //     columnIndex 参数不在范围内
     public void SetColumnError(int columnIndex, String error){}


     /**
      * Set column error.
      *
      * @param column the column
      * @param error  the error
      */
//
     // 摘要:
     //     设置为指定的列的错误说明 System.Data.DataColumn。
     //
     // 参数:
     //   column:
     //     System.Data.DataColumn 若要设置的错误说明。
     //
     //   error:
     //     错误说明。
     public void SetColumnError(DataColumn_ column, String error){}


     /**
      * Set column error.
      *
      * @param columnName the column name
      * @param error      the error
      */
//
     // 摘要:
     //     设置由名称指定的列的错误说明。
     //
     // 参数:
     //   columnName:
     //     列的名称。
     //
     //   error:
     //     错误说明。
     public void SetColumnError(String columnName, String error){}


     /**
      * Set modified.
      */
//
     // 摘要:
     //     更改 System.Data.DataRow.Rowstate 的 System.Data.DataRow 到 Modified。
     public void SetModified(){}


     /**
      * Set parent row.
      *
      * @param parentRow the parent row
      * @param relation  the relation
      */
//
     // 摘要:
     //     设置的父行 System.Data.DataRow 用新指定 System.Data.DataRow 和 System.Data.DataRelation。
     //
     // 参数:
     //   parentRow:
     //     新的父级 System.Data.DataRow。
     //
     //   relation:
     //     该关系 System.Data.DataRelation 使用。
     //
     // 异常:
     //   T:System.Data.RowNotInTableException:
     //     这些行之一不属于表
     //
     //   T:System.ArgumentNullException:
     //     这些行之一是 null。
     //
     //   T:System.ArgumentException:
     //     该关系不属于 System.Data.DataRelationCollection 的 System.Data.DataSet 对象。
     //
     //   T:System.Data.InvalidConstraintException:
     //     该关系的子级 System.Data.DataTable 不是该行所属的表。
     public void SetParentRow(DataRow_ parentRow, DataRelation_ relation){}


     /**
      * Set parent row.
      *
      * @param parentRow the parent row
      */
//
     // 摘要:
     //     设置的父行 System.Data.DataRow 用新指定 System.Data.DataRow。
     //
     // 参数:
     //   parentRow:
     //     新的父级 System.Data.DataRow。
     public void SetParentRow(DataRow_ parentRow){}


     /**
      * Set null.
      *
      * @param column the column
      */
//
     // 摘要:
     //     设置指定的值 System.Data.DataColumn 为空值。
     //
     // 参数:
     //   column:
     //     System.Data.DataColumn。
     protected void SetNull(DataColumn_ column){}


}

DataTable_.java

java 复制代码
package JavaPlatform.Database;


import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Date;

import JavaPlatform.jp;


/**
 * The type Data table.
 */
public class DataTable_ {

    //------------------------------------------------------------------列
    private  ArrayList<DataColumn_>  m_ColumnsList;

    /**
     * Get columns array list.
     *
     * @return the array list
     */
    public ArrayList<DataColumn_> getColumns(){        return m_ColumnsList;    }


    //------------------------------------------------------------------行数据
    private  ArrayList<String> m_DataList;

    /**
     * Get data list array list.
     *
     * @return the array list
     */
    public  ArrayList<String> getDataList(){return  m_DataList;}

    /**
     * Set data list.
     *
     * @param sDataList the s data list
     */
    public void setDataList(ArrayList<String> sDataList){ m_DataList = sDataList;}


    /**
     * Get rows count int.
     *
     * @return the int
     */
//行数,记录数
    public int getRowsCount(){
        if(m_DataList == null || m_ColumnsList == null)
        {
            jp.d("程序终止:错误信息:m_DataList == null || m_ColumnsList == null");
            throw  new NullPointerException();
        }
        return  m_DataList.size() / m_ColumnsList.size() ;
    }


    /**
     * Instantiates a new Data table.
     */
    public DataTable_() {

        m_ColumnsList = null;
        m_DataList = null;
    }

    /**
     * Gets column name list.
     *
     * @return the column name list
     */
    public  ArrayList<String> getColumnNameList()
    {
        ArrayList<String> sRestul = new ArrayList<String>();

        for (DataColumn_ dc: m_ColumnsList
             ) {
            sRestul.add(dc.getColumnName());
        }

        return  sRestul;
    }


    /**
     * Sets column list from split string list.
     *
     * @param sColumnList the s column list
     */
    public void setColumnListFromSplitStringList(ArrayList<String> sColumnList)
    {
        m_ColumnsList = new ArrayList<DataColumn_>();
        for (String s:sColumnList
             ) {
            m_ColumnsList.add(DataColumn_.fromSplitString(s));
        }
    }


    /**
     * Gets from string list.
     *
     * @param sColumnList the s column list
     * @param sDataList   the s data list
     * @return the from string list
     */
    public  static DataTable_ getFromStringList(ArrayList<String> sColumnList, ArrayList<String> sDataList)
    {
        String sErrorString = "LDataTable getFromStringList: 行列数据错误!";

        if(sDataList.size() % sColumnList.size() != 0)
        {
            jp.d(sErrorString);
            throw new IndexOutOfBoundsException(sErrorString);
        }

        DataTable_ dt = new DataTable_();
        dt.setColumnListFromSplitStringList(sColumnList);
        dt.setDataList(sDataList);

        return  dt;
    }

    /*

    public  static DataTable_ getFromIntent(Activity act)
    {
        Intent intent = act.getIntent();

        ArrayList<String> table_column = intent.getStringArrayListExtra("table_column");
        ArrayList<String> table_data = intent.getStringArrayListExtra("table_data");


        return DataTable_.getFromStringList(table_column,table_data);
    }

    

    public  void writeToIntent(Intent intent)
    {

        intent.putStringArrayListExtra("table_column",getColumnListString());

        intent.putStringArrayListExtra("table_data",  m_DataList);

        //MainActivity.tt dt = (MainActivity.tt)intent.getSerializableExtra("data_table");
    }

 */


    /**
     * Gets column list string.
     *
     * @return the column list string
     */
    public  ArrayList<String> getColumnListString()
    {
        ArrayList<String> sArray = new ArrayList<String>();
        for (DataColumn_ dc: m_ColumnsList
             ) {
            sArray.add(dc.getSplitString());
        }

        return  sArray;
    }


    /**
     * Get string string.
     *
     * @param nRowIndex    the n row index
     * @param nColumnIndex the n column index
     * @return the string
     */
//为了兼容,从nRowIndex是从0开始的索引。
    public  String getString(int nRowIndex, int nColumnIndex){

        if(nRowIndex >= getRowsCount() || nRowIndex < 0 || nColumnIndex > m_ColumnsList.size() ||
                nColumnIndex < 0){
            jp.d("LDataTable.getString:" + "nRowIndex >= m_RowsCount || nRowIndex < 0 || nColumnIndex > m_Columns.size() ||  nColumnIndex < 0");
            throw  new IndexOutOfBoundsException();
        }


        int nIndex = nRowIndex  *  m_ColumnsList.size() + nColumnIndex ;



        if(nIndex >= m_DataList.size() || nIndex < 0){
            jp.d("LDataTable.getString:" + "(nIndex >= m_Data.size() || nIndex < 0)");
            throw  new IndexOutOfBoundsException();
        }

        return  m_DataList.get(nIndex);
    }


    /**
     * Get string string.
     *
     * @param nRow        the n row
     * @param sColumnName the s column name
     * @return the string
     */
    public String getString(int nRow, String sColumnName){

        for(DataColumn_ dc : m_ColumnsList) {
            if(dc.getColumnName().equals(sColumnName)){
                return getString(nRow,dc.getColumnIndex());
            }
        }

        throw  new IndexOutOfBoundsException();
    }


    /**
     * Get int int.
     *
     * @param nRow        the n row
     * @param sColumnName the s column name
     * @return the int
     */
    public int getInt(int nRow, String sColumnName){
        String sResult =  getString(nRow,sColumnName);

        int  iResult = -1;

        try {
            iResult = Integer.parseInt(sResult);
        } catch (NumberFormatException e) {
            jp.d("LDataTable.getInt:转换字符\n" +  sResult  + "\n为整型时出现错误!字段名为: " +
                    sColumnName + "\n");
            jp.d(e.toString());
            e.printStackTrace();
        }

        return  iResult;
    }

    /**
     * Get float float.
     *
     * @param nRow        the n row
     * @param sColumnName the s column name
     * @return the float
     */
    public float getFloat(int nRow, String sColumnName){
        String sResult =  getString(nRow,sColumnName);
        return  Float.parseFloat(sResult);
    }


    /**
     * Get date date.
     *
     * @param nRow        the n row
     * @param sColumnName the s column name
     * @return the date
     */
    public Date getDate(int nRow, String sColumnName){
        String sResult =  getString(nRow,sColumnName);
        try{
            Date date = jp.sqlStringToDate(sResult);
            return date;
        }
        catch (Exception e){
            jp.d(e.toString(),"DataTable_.getDate");
        }
       return new Date();
    }


    /**
     * Fill int.
     *
     * @param rs the rs
     * @return the int
     */
    public int Fill(ResultSet rs){

        m_ColumnsList = DataTable_.getColumnList(rs);

        m_DataList = new ArrayList<String>();

        while (true)
        {
            try {
                if (!rs.next()) break;

            } catch (SQLException e) {
                jp.d("rs.next()失败");
                e.printStackTrace();
            }

            for(int i = 0; i <  m_ColumnsList.size(); ++i){
                String s = null;
                try {
                    s = rs.getString(m_ColumnsList.get(i).getColumnName());
                } catch (SQLException e) {
                    jp.d("LDataTable.Fill()函数中 语句rs.getString失败");
                    e.printStackTrace();
                }
                m_DataList.add(s);
             }
        }

        return  m_DataList.size();
    }


    /**
     * Get column list array list.
     *
     * @param rs the rs
     * @return the array list
     */
    public static ArrayList<DataColumn_> getColumnList(ResultSet rs){

        ArrayList<DataColumn_> dcList =  new ArrayList<DataColumn_>();

        ResultSetMetaData rsmd = null;
        try {
            rsmd = rs.getMetaData();

            for(int i = 1;  i <=  rsmd.getColumnCount(); ++i) {

                DataColumn_ dcTemp = new DataColumn_();

                dcTemp.setColumnName(rsmd.getColumnName(i));
                dcTemp.setCaptionName(rsmd.getColumnLabel(i));
                dcTemp.setDataType(rsmd.getColumnTypeName(i));
                dcTemp.setColumnIndex(i-1);

                dcList.add(dcTemp);
            }

        } catch (SQLException e) {
            e.printStackTrace();
            jp.d("LDataTable.getColumnList提示:" + e.toString());
        }

        return  dcList;
    }


    /**
     * Gets rows.
     *
     * @return the rows
     */
//
    // 摘要:
    //     获取属于此表的行的集合。
    //
    // 返回结果:
    //     一个 System.Data.DataRowCollection ,其中包含 System.Data.DataRow 对象; 否则为空值如果没有 System.Data.DataRow
    //     存在的对象。
    public DataRowCollection_ getRows() { return  new DataRowCollection_(this); }




}

DataColumn_.java

java 复制代码
/*
        //
        // 摘要:
        //     新实例初始化 System.Data.DataColumn 类作为字符串类型。
        public DataColumn();
        //
        // 摘要:
        //     新实例初始化 System.Data.DataColumn 类作为类型为字符串,使用指定的列名称。
        //
        // 参数:
        //   columnName:
        //     一个表示要创建的列的名称的字符串。 如果设置为 null 或空字符串 (""),添加到列集合时,将指定一个默认名称。
        public DataColumn(string columnName);
        //
        // 摘要:
        //     新实例初始化 System.Data.DataColumn 类使用指定的列名称和数据类型。
        //
        // 参数:
        //   columnName:
        //     一个表示要创建的列的名称的字符串。 如果设置为 null 或空字符串 (""),添加到列集合时,将指定一个默认名称。
        //
        //   dataType:
        //     支持 System.Data.DataColumn.DataType。
        //
        // 异常:
        //   T:System.ArgumentNullException:
        //     否 dataType 指定。
        public DataColumn(string columnName, Type dataType);
        //
        // 摘要:
        //     新实例初始化 System.Data.DataColumn 类使用指定的名称、 数据类型和表达式。
        //
        // 参数:
        //   columnName:
        //     一个表示要创建的列的名称的字符串。 如果设置为 null 或空字符串 (""),添加到列集合时,将指定一个默认名称。
        //
        //   dataType:
        //     支持 System.Data.DataColumn.DataType。
        //
        //   expr:
        //     用来创建此列的表达式。 有关更多信息,请参见 System.Data.DataColumn.Expression 属性。
        //
        // 异常:
        //   T:System.ArgumentNullException:
        //     否 dataType 指定。
        public DataColumn(string columnName, Type dataType, string expr);
        //
        // 摘要:
        //     新实例初始化 System.Data.DataColumn 类使用指定的名称、 数据类型、 表达式和值,该值确定列是否是一个属性。
        //
        // 参数:
        //   columnName:
        //     一个表示要创建的列的名称的字符串。 如果设置为 null 或空字符串 (""),添加到列集合时,将指定一个默认名称。
        //
        //   dataType:
        //     支持 System.Data.DataColumn.DataType。
        //
        //   expr:
        //     用来创建此列的表达式。 有关更多信息,请参见 System.Data.DataColumn.Expression 属性。
        //
        //   type:
        //     System.Data.MappingType 值之一。
        //
        // 异常:
        //   T:System.ArgumentNullException:
        //     否 dataType 指定。
        public DataColumn(string columnName, Type dataType, string expr, MappingType type);

        //
        // 摘要:
        //     获取 System.Data.DataTable 列属于对。
        //
        // 返回结果:
        //     System.Data.DataTable , System.Data.DataColumn 属于。
        [Browsable(false)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        [ResCategoryAttribute("DataCategory_Data")]
        [ResDescriptionAttribute("DataColumnDataTableDescr")]
        public DataTable Table { get; }
        //
        // 摘要:
        //     获取或设置一个值,指示行已添加到表时,就立即列是否允许的更改。
        //
        // 返回结果:
        //     true 如果列只读的;否则为 false。 默认值为 false。
        //
        // 异常:
        //   T:System.ArgumentException:
        //     该属性设置为 false 计算所得的列。
        [DefaultValue(false)]
        [ResCategoryAttribute("DataCategory_Data")]
        [ResDescriptionAttribute("DataColumnReadOnlyDescr")]
        public bool ReadOnly { get; set; }
        //
        // 摘要:
        //     获取 (从零开始) 中的列的位置 System.Data.DataColumnCollection 集合。
        //
        // 返回结果:
        //     列的位置。 如果列不是某个集合的成员,则获取-1。
        [Browsable(false)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        [ResCategoryAttribute("DataCategory_Data")]
        [ResDescriptionAttribute("DataColumnOrdinalDescr")]
        public int Ordinal { get; }
        //
        // 摘要:
        //     获取或设置的命名空间 System.Data.DataColumn。
        //
        // 返回结果:
        //     命名空间 System.Data.DataColumn。
        //
        // 异常:
        //   T:System.ArgumentException:
        //     命名空间已有数据。
        [ResCategoryAttribute("DataCategory_Data")]
        [ResDescriptionAttribute("DataColumnNamespaceDescr")]
        public string Namespace { get; set; }
        //
        // 摘要:
        //     获取或设置文本列的最大长度。
        //
        // 返回结果:
        //     以字符为单位的列的最大长度。 如果该列具有没有最大长度,值为-1 (默认值)。
        [DefaultValue(-1)]
        [ResCategoryAttribute("DataCategory_Data")]
        [ResDescriptionAttribute("DataColumnMaxLengthDescr")]
        public int MaxLength { get; set; }
        //
        // 摘要:
        //     获取与相关联的自定义用户信息的集合 System.Data.DataColumn。
        //
        // 返回结果:
        //     一个 System.Data.PropertyCollection 的自定义信息。
        [Browsable(false)]
        [ResCategoryAttribute("DataCategory_Data")]
        [ResDescriptionAttribute("ExtendedPropertiesDescr")]
        public PropertyCollection ExtendedProperties { get; }
        //
        // 摘要:
        //     获取或设置用来筛选行、 计算列中的值或创建聚合列的表达式。
        //
        // 返回结果:
        //     一个表达式来计算列的值或创建聚合列。 一个表达式,表达式的返回类型由 System.Data.DataColumn.DataType 的列。
        //
        // 异常:
        //   T:System.ArgumentException:
        //     System.Data.DataColumn.AutoIncrement 或 System.Data.DataColumn.Unique 属性设置为 true。
        //
        //   T:System.FormatException:
        //     当使用 CONVERT 函数时,表达式的计算结果为一个字符串,但该字符串不包含可以转换为类型参数中的表示形式。
        //
        //   T:System.InvalidCastException:
        //     当使用 CONVERT 函数时,所请求的转换不可能。 请参阅下列部分获取有关可能的强制转换详细信息中的转换函数。
        //
        //   T:System.ArgumentOutOfRangeException:
        //     当您使用 SUBSTRING 函数时,start 参数超出了范围。 - 或 - 当您使用 SUBSTRING 函数时,长度参数超出了范围。
        //
        //   T:System.Exception:
        //     当您使用 LEN 函数或 TRIM 函数时,该表达式计算结果不为字符串。 这包括表达式的计算结果为 System.Char。
        [DefaultValue("")]
        [RefreshProperties(RefreshProperties.All)]
        [ResCategoryAttribute("DataCategory_Data")]
        [ResDescriptionAttribute("DataColumnExpressionDescr")]
        public string Expression { get; set; }
        //
        // 摘要:
        //     获取或设置列的默认值,则在创建新行。
        //
        // 返回结果:
        //     适合于列的值 System.Data.DataColumn.DataType。
        //
        // 异常:
        //   T:System.InvalidCastException:
        //     当添加行时,默认值不是列的数据类型的实例。
        [ResCategoryAttribute("DataCategory_Data")]
        [ResDescriptionAttribute("DataColumnDefaultValueDescr")]
        [TypeConverter(typeof(DefaultValueTypeConverter))]
        public object DefaultValue { get; set; }
        //
        // 摘要:
        //     获取或设置 DateTimeMode 的列。
        //
        // 返回结果:
        //     System.Data.DataSetDateTime 为指定的列。
        [DefaultValue(DataSetDateTime.UnspecifiedLocal)]
        [RefreshProperties(RefreshProperties.All)]
        [ResCategoryAttribute("DataCategory_Data")]
        [ResDescriptionAttribute("DataColumnDateTimeModeDescr")]
        public DataSetDateTime DateTimeMode { get; set; }
        //
        // 摘要:
        //     获取或设置列中存储的数据类型。
        //
        // 返回结果:
        //     一个 System.Type 对象,表示列的数据类型。
        //
        // 异常:
        //   T:System.ArgumentException:
        //     已在列存储的数据。
        [DefaultValue(typeof(string))]
        [RefreshProperties(RefreshProperties.All)]
        [ResCategoryAttribute("DataCategory_Data")]
        [ResDescriptionAttribute("DataColumnDataTypeDescr")]
        [TypeConverter(typeof(ColumnTypeConverter))]
        public Type DataType { get; set; }
        //
        // 摘要:
        //     获取或设置 XML 前缀的命名空间别名 System.Data.DataTable。
        //
        // 返回结果:
        //     XML 前缀 System.Data.DataTable 命名空间。
        [DefaultValue("")]
        [ResCategoryAttribute("DataCategory_Data")]
        [ResDescriptionAttribute("DataColumnPrefixDescr")]
        public string Prefix { get; set; }
        //
        // 摘要:
        //     获取或设置某一列使用的增量其 System.Data.DataColumn.AutoIncrement 属性设置为 true。
        //
        // 返回结果:
        //     列的值自动递增的编号。 默认值为 1。
        //
        // 异常:
        //   T:System.ArgumentException:
        //     设置的值为零。
        [DefaultValue(1)]
        [ResCategoryAttribute("DataCategory_Data")]
        [ResDescriptionAttribute("DataColumnAutoIncrementStepDescr")]
        public long AutoIncrementStep { get; set; }
        //
        // 摘要:
        //     获取或设置列标题。
        //
        // 返回结果:
        //     列的标题。 如果未设置,则返回 System.Data.DataColumn.ColumnName 值。
        [ResCategoryAttribute("DataCategory_Data")]
        [ResDescriptionAttribute("DataColumnCaptionDescr")]
        public string Caption { get; set; }
        //
        // 摘要:
        //     获取或设置一个值,该值指示是否必须唯一列的每个行中的值。
        //
        // 返回结果:
        //     true 如果值必须是唯一的。否则为 false。 默认值为 false。
        //
        // 异常:
        //   T:System.ArgumentException:
        //     列是计算的列。
        [DefaultValue(false)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        [ResCategoryAttribute("DataCategory_Data")]
        [ResDescriptionAttribute("DataColumnUniqueDescr")]
        public bool Unique { get; set; }
        //
        // 摘要:
        //     获取或设置包含的列的起始值及其 System.Data.DataColumn.AutoIncrement 属性设置为 true。 默认值为 0。
        //
        // 返回结果:
        //     起始值为 System.Data.DataColumn.AutoIncrement 特征。
        [DefaultValue(0)]
        [ResCategoryAttribute("DataCategory_Data")]
        [ResDescriptionAttribute("DataColumnAutoIncrementSeedDescr")]
        public long AutoIncrementSeed { get; set; }
        //
        // 摘要:
        //     获取或设置一个值,指示该列是否自动递增的新行添加到表中列的值。
        //
        // 返回结果:
        //     true 如果列的值递增自动保存功能。,否则为 false。 默认值为 false。
        //
        // 异常:
        //   T:System.ArgumentException:
        //     列是计算所得的列。
        [DefaultValue(false)]
        [RefreshProperties(RefreshProperties.All)]
        [ResCategoryAttribute("DataCategory_Data")]
        [ResDescriptionAttribute("DataColumnAutoIncrementDescr")]
        public bool AutoIncrement { get; set; }
        //
        // 摘要:
        //     获取或设置一个值,该值指示是否允许空值在本专栏中属于表的行。
        //
        // 返回结果:
        //     true 如果允许 null 值的值;否则为 false。 默认值为 true。
        [DefaultValue(true)]
        [ResCategoryAttribute("DataCategory_Data")]
        [ResDescriptionAttribute("DataColumnAllowNullDescr")]
        public bool AllowDBNull { get; set; }
        //
        // 摘要:
        //     获取或设置中的列的名称 System.Data.DataColumnCollection。
        //
        // 返回结果:
        //     列的名称。
        //
        // 异常:
        //   T:System.ArgumentException:
        //     该属性设置为 null 或为空字符串和列属于一个集合。
        //
        //   T:System.Data.DuplicateNameException:
        //     集合中已存在具有相同名称的列。 名称比较不区分大小写。
        [DefaultValue("")]
        [RefreshProperties(RefreshProperties.All)]
        [ResCategoryAttribute("DataCategory_Data")]
        [ResDescriptionAttribute("DataColumnColumnNameDescr")]
        public string ColumnName { get; set; }
        //
        // 摘要:
        //     获取或设置 System.Data.MappingType 的列。
        //
        // 返回结果:
        //     System.Data.MappingType 值之一。
        [DefaultValue(MappingType.Element)]
        [ResDescriptionAttribute("DataColumnMappingDescr")]
        public virtual MappingType ColumnMapping { get; set; }

        //
        // 摘要:
        //     更改序号或位置 System.Data.DataColumn 到指定的序号或位置。
        //
        // 参数:
        //   ordinal:
        //     指定的序号。
        public void SetOrdinal(int ordinal);
        //
        // 摘要:
        //     获取 System.Data.DataColumn.Expression 列,如果存在。
        //
        // 返回结果:
        //     System.Data.DataColumn.Expression 值,此属性是否设置; 否则为 System.Data.DataColumn.ColumnName
        //     属性。
        public override string ToString();
        //
        // 摘要:
        //     此成员支持 .NET Framework 结构,不能在代码中直接使用。
        protected void CheckUnique();
        //
        // 摘要:
        //     此成员支持 .NET Framework 结构,不能在代码中直接使用。
        //
        // 参数:
        //   pcevent:
        //     参数的引用。
        protected virtual void OnPropertyChanging(PropertyChangedEventArgs pcevent);
        //
        // 摘要:
        //     此成员支持 .NET Framework 结构,不能在代码中直接使用。
        protected internal void CheckNotAllowNull();
        //
        // 摘要:
        //     此成员支持 .NET Framework 结构,不能在代码中直接使用。
        //
        // 参数:
        //   name:
        //     参数的引用。
        protected internal void RaisePropertyChanging(string name);
 */

package JavaPlatform.Database;


import JavaPlatform.jp;

/**
 * The type Data column.
 */
//列数据
public class DataColumn_ {

    /**
     * The constant split_string.
     */
    public static final  String split_string = ",";


    /**
     * The enum L mapping type.
     */
//
    // 摘要:
    //     指定如何 System.Data.DataColumn 映射。
    public enum LMappingType
    {
        /**
         * Mt element l mapping type.
         */
//
        // 摘要:
        //     将列映射到 XML 元素。
        mtElement,
        /**
         * Mt attribute l mapping type.
         */
//
        // 摘要:
        //     列映射到一个 XML 属性。
        mtAttribute,
        /**
         * Mt simple content l mapping type.
         */
//
        // 摘要:
        //     列映射到 System.Xml.XmlText 节点。
        mtSimpleContent,
        /**
         * Mt hidden l mapping type.
         */
//
        // 摘要:
        //     列映射到的内部结构。
        mtHidden
    }


    private String m_columnName = ""; //------------------------------------------------列名

    /**
     * Gets column name.
     *
     * @return the column name
     */
    public String getColumnName() {        return m_columnName;    }

    /**
     * Sets column name.
     *
     * @param sColumnName the s column name
     */
    public void setColumnName(String sColumnName) {      m_columnName = sColumnName;  }



    private String m_captionName= ""; //------------------------------------------------显示名称

    /**
     * Gets caption name.
     *
     * @return the caption name
     */
    public String getCaptionName() {
        return m_captionName;
    }

    /**
     * Sets caption name.
     *
     * @param sColumnName the s column name
     */
    public void setCaptionName(String sColumnName) {
        m_captionName = sColumnName;
    }


    private int m_columnIndex= 0;//-------------------------------------------------------列索引

    /**
     * Gets column index.
     *
     * @return the column index
     */
    public int getColumnIndex() {        return m_columnIndex;    }

    /**
     * Sets column index.
     *
     * @param iColumnIndex the column index
     */
    public void setColumnIndex(int iColumnIndex) {
        m_columnIndex = iColumnIndex;
    }


    private DB_.DataType_ m_DataType = DB_.DataType_.dtNULL;//----------------------------------------------列数据类型

    /**
     * Get data type db . data type.
     *
     * @return the db . data type
     */
    public DB_.DataType_ getDataType(){
        return  m_DataType;
    }

    /**
     * Set data type.
     *
     * @param dt the dt
     */
    public void  setDataType(DB_.DataType_ dt){ m_DataType =  dt;}


    /**
     * Gets split string.
     *
     * @return the split string
     */
    public  String getSplitString()
    {
        return  m_columnName + split_string +  m_captionName + split_string +
                Integer.toString(m_columnIndex) + split_string + m_DataType.toString();
    }


    /**
     * From split string data column.
     *
     * @param sSplitString the s split string
     * @return the data column
     */
//列名,显示名称,列索引,列数据类型
    public  static DataColumn_ fromSplitString(String sSplitString)
    {
        String sErrorString = "LDataColumn.fromSplitString(String sSplitString):" + "字符串 "" + sSplitString  + "" 格式错误!";

        DataColumn_ dc = new DataColumn_();

        String[]  sArray = sSplitString.split(DataColumn_.split_string);

        if(sArray.length == 4) {
            try {
                dc.setColumnName(sArray[0]);
                dc.setCaptionName(sArray[1]);
                dc.setColumnIndex(Integer.parseInt(sArray[2]));
                dc.setDataType(DB_.DataType_.valueOf(sArray[3]));
            }
            catch (Exception e) {
                jp.d(sErrorString);
            }
        }
        else {

            jp.d(sErrorString);
            throw new IndexOutOfBoundsException(sErrorString);
        }
        return  dc;
    }


    /**
     * Sets data type.
     *
     * @param sColumnTypeName_or_ColumnClassName the s column type name or column class name
     */
    public void setDataType(String sColumnTypeName_or_ColumnClassName)
    {
        //JDBC类型 = int  Java类型 = java.lang.Integer
        if(sColumnTypeName_or_ColumnClassName.equals("int") ||
                sColumnTypeName_or_ColumnClassName.equals("java.lang.Integer")){
            m_DataType = DB_.DataType_.dtInt;
        }
        //JDBC类型 = ntext  Java类型 = java.sql.Clob
        else if( sColumnTypeName_or_ColumnClassName.equals("ntext") || sColumnTypeName_or_ColumnClassName.equals("text") ||
                sColumnTypeName_or_ColumnClassName.equals("java.sql.Clob") ){
            m_DataType = DB_.DataType_.dtString;
        }
        //JDBC类型 = datetime  Java类型 = java.sql.Timestamp
        else if( sColumnTypeName_or_ColumnClassName.equals("datetime") ||
                sColumnTypeName_or_ColumnClassName.equals("java.sql.Timestamp") ){
            m_DataType = DB_.DataType_.dtDateTime;
        }
        //JDBC类型 = nchar  Java类型 = java.lang.String
        else if( sColumnTypeName_or_ColumnClassName.equals("nchar") ||
                sColumnTypeName_or_ColumnClassName.equals("java.lang.String") ){
            m_DataType = DB_.DataType_.dtString;
        }
        //JDBC类型 = float  Java类型 = java.lang.Double
        else if( sColumnTypeName_or_ColumnClassName.equals("float") ||
                sColumnTypeName_or_ColumnClassName.equals("java.lang.Double") ){
            m_DataType = DB_.DataType_.dtDouble;
        }
        //JDBC类型 = smallmoney  Java类型 = java.math.BigDecimal
        else if( sColumnTypeName_or_ColumnClassName.equals("smallmoney") ||
                sColumnTypeName_or_ColumnClassName.equals("java.math.BigDecimal") ){
            m_DataType = DB_.DataType_.dtFloat;
        }
        //JDBC类型 = image  Java类型 = java.sql.Blob
        else if( sColumnTypeName_or_ColumnClassName.equals("image") ||
                sColumnTypeName_or_ColumnClassName.equals("java.sql.Blob") ){
            m_DataType = DB_.DataType_.dtBinaryStream;
        }
        //JDBC类型 = tinyint  Java类型 = java.lang.Boolean
        else if( sColumnTypeName_or_ColumnClassName.equals("tinyint") ||
                sColumnTypeName_or_ColumnClassName.equals("java.lang.Boolean") ){
            m_DataType = DB_.DataType_.dtBoolean;
        }
        //JDBC类型 = smallint  Java类型 = java.lang.Integer
        else if( sColumnTypeName_or_ColumnClassName.equals("smallint") ||
                sColumnTypeName_or_ColumnClassName.equals("java.lang.Integer") ){
            m_DataType = DB_.DataType_.dtInt;
        }
        //JDBC类型 = varbinary  Java类型 =  byte[]
        else if( sColumnTypeName_or_ColumnClassName.equals("varbinary") ||
                sColumnTypeName_or_ColumnClassName.equals("byte[]") ){
            m_DataType = DB_.DataType_.dtByteArray;
        }
        //JDBC类型 = nvarchar  Java类型 =  java.lang.String
        else if( sColumnTypeName_or_ColumnClassName.equals("nvarchar") ||
                sColumnTypeName_or_ColumnClassName.equals("java.sql.String") ){
            m_DataType = DB_.DataType_.dtString;
        }
        //SQL Server 实例包括用户定义的名为 sysname 的数据类型。sysname 用于表列、
        // 变量以及用于存储对象名的存储过程参数。sysname 的精确定义与标识符规则相关;
        // 因此,SQL Server 的各个实例会有所不同。sysname 与 nvarchar(128) 作用相同。
        // SQL Server 6.5 或早期版本仅支持较小的标识符;因此,在早期版本中,sysname
        // 被定义为 varchar(30)。
        //JDBC类型 = sysname  Java类型 =  java.lang.String
        else if( sColumnTypeName_or_ColumnClassName.equals("sysname") ||
                sColumnTypeName_or_ColumnClassName.equals("java.lang.String") ){
            m_DataType = DB_.DataType_.dtString;
        }
        else
        {
            jp.d("类LDataColumn中的函数setDataType无法判断类型是:sColumnClassName=" +
                    sColumnTypeName_or_ColumnClassName);
            m_DataType = DB_.DataType_.dtNULL;
        }
    }


    /**
     * Instantiates a new Data column.
     */
//
    // 摘要:
    //     新实例初始化 System.Data.DataColumn 类作为字符串类型。
    public DataColumn_(){

    }


    /**
     * Instantiates a new Data column.
     *
     * @param columnName the column name
     */
//
    // 摘要:
    //     新实例初始化 System.Data.DataColumn 类作为类型为字符串,使用指定的列名称。
    //
    // 参数:
    //   columnName:
    //     一个表示要创建的列的名称的字符串。 如果设置为 null 或空字符串 (""),添加到列集合时,将指定一个默认名称。
    public DataColumn_(String columnName){


    }

    /**
     * Instantiates a new Data column.
     *
     * @param columnName the column name
     * @param dataType   the data type
     */
//
    // 摘要:
    //     新实例初始化 System.Data.DataColumn 类使用指定的列名称和数据类型。
    //
    // 参数:
    //   columnName:
    //     一个表示要创建的列的名称的字符串。 如果设置为 null 或空字符串 (""),添加到列集合时,将指定一个默认名称。
    //
    //   dataType:
    //     支持 System.Data.DataColumn.DataType。
    //
    // 异常:
    //   T:System.ArgumentNullException:
    //     否 dataType 指定。
    public DataColumn_(String columnName, DB_.DataType_  dataType){


    }


    /**
     * Instantiates a new Data column.
     *
     * @param columnName the column name
     * @param dataType   the data type
     * @param expr       the expr
     */
//
    // 摘要:
    //     新实例初始化 System.Data.DataColumn 类使用指定的名称、 数据类型和表达式。
    //
    // 参数:
    //   columnName:
    //     一个表示要创建的列的名称的字符串。 如果设置为 null 或空字符串 (""),添加到列集合时,将指定一个默认名称。
    //
    //   dataType:
    //     支持 System.Data.DataColumn.DataType。
    //
    //   expr:
    //     用来创建此列的表达式。 有关更多信息,请参见 System.Data.DataColumn.Expression 属性。
    //
    // 异常:
    //   T:System.ArgumentNullException:
    //     否 dataType 指定。
    public DataColumn_(String columnName, DB_.DataType_ dataType, String expr){


    }


    /**
     * Instantiates a new Data column.
     *
     * @param columnName the column name
     * @param dataType   the data type
     * @param expr       the expr
     * @param type       the type
     */
//
    // 摘要:
    //     新实例初始化 System.Data.DataColumn 类使用指定的名称、 数据类型、 表达式和值,该值确定列是否是一个属性。
    //
    // 参数:
    //   columnName:
    //     一个表示要创建的列的名称的字符串。 如果设置为 null 或空字符串 (""),添加到列集合时,将指定一个默认名称。
    //
    //   dataType:
    //     支持 System.Data.DataColumn.DataType。
    //
    //   expr:
    //     用来创建此列的表达式。 有关更多信息,请参见 System.Data.DataColumn.Expression 属性。
    //
    //   type:
    //     System.Data.MappingType 值之一。
    //
    // 异常:
    //   T:System.ArgumentNullException:
    //     否 dataType 指定。
    public DataColumn_(String columnName, DB_.DataType_ dataType, String expr, LMappingType type){

    }


}
相关推荐
阿华的代码王国1 分钟前
【JavaEE】多线程编程引入——认识Thread类
java·开发语言·数据结构·mysql·java-ee
黑蛋同志2 分钟前
array和linked list的区别
java
繁依Fanyi8 分钟前
828 华为云征文|华为 Flexus 云服务器部署 RustDesk Server,打造自己的远程桌面服务器
运维·服务器·开发语言·人工智能·pytorch·华为·华为云
andrew_12198 分钟前
腾讯 IEG 游戏前沿技术 一面复盘
java·redis·sql·面试
寻求出路的程序媛16 分钟前
JVM —— 类加载器的分类,双亲委派机制
java·jvm·面试
这孩子叫逆17 分钟前
35. MyBatis中的缓存失效机制是如何工作的?
java·spring·mybatis
骆晨学长18 分钟前
基于SpringBoot的校园失物招领系统
java·spring boot
汇匠源18 分钟前
零工市场小程序:保障灵活就业
java·小程序·零工市场
计算机编程-吉哥21 分钟前
计算机毕业设计 二手图书交易系统 Java+SpringBoot+Vue 前后端分离 文档报告 代码讲解 安装调试
java·spring boot·毕业设计·毕业论文·计算机毕业设计选题·计算机毕业设计开题报告·二手图书交易系统
qq_353233538922 分钟前
【原创】java+springboot+mysql高校社团网系统设计与实现
java·spring boot·mysql