diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..222ad31 --- /dev/null +++ b/.classpath @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/.project b/.project new file mode 100644 index 0000000..5633970 --- /dev/null +++ b/.project @@ -0,0 +1,17 @@ + + + DBQuery + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..3a21537 --- /dev/null +++ b/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/bin/com/dbquery/dal/DBConnection.class b/bin/com/dbquery/dal/DBConnection.class new file mode 100644 index 0000000..3d28596 Binary files /dev/null and b/bin/com/dbquery/dal/DBConnection.class differ diff --git a/bin/com/dbquery/dal/MSSQLDBInfo.class b/bin/com/dbquery/dal/MSSQLDBInfo.class new file mode 100644 index 0000000..65f008e Binary files /dev/null and b/bin/com/dbquery/dal/MSSQLDBInfo.class differ diff --git a/bin/com/dbquery/dal/MySQLDBInfo.class b/bin/com/dbquery/dal/MySQLDBInfo.class new file mode 100644 index 0000000..c3022b4 Binary files /dev/null and b/bin/com/dbquery/dal/MySQLDBInfo.class differ diff --git a/bin/com/dbquery/demo/QueryObject.class b/bin/com/dbquery/demo/QueryObject.class new file mode 100644 index 0000000..f9bfff0 Binary files /dev/null and b/bin/com/dbquery/demo/QueryObject.class differ diff --git a/bin/com/dbquery/factory/DatabaseFactory.class b/bin/com/dbquery/factory/DatabaseFactory.class new file mode 100644 index 0000000..4977b25 Binary files /dev/null and b/bin/com/dbquery/factory/DatabaseFactory.class differ diff --git a/bin/com/dbquery/factory/MSSQLFactory.class b/bin/com/dbquery/factory/MSSQLFactory.class new file mode 100644 index 0000000..be9ec26 Binary files /dev/null and b/bin/com/dbquery/factory/MSSQLFactory.class differ diff --git a/bin/com/dbquery/factory/MySQLFactory.class b/bin/com/dbquery/factory/MySQLFactory.class new file mode 100644 index 0000000..637c96f Binary files /dev/null and b/bin/com/dbquery/factory/MySQLFactory.class differ diff --git a/bin/com/dbquery/interfaces/AbstractQueryObject.class b/bin/com/dbquery/interfaces/AbstractQueryObject.class new file mode 100644 index 0000000..484b435 Binary files /dev/null and b/bin/com/dbquery/interfaces/AbstractQueryObject.class differ diff --git a/bin/com/dbquery/interfaces/DBBasicInfo.class b/bin/com/dbquery/interfaces/DBBasicInfo.class new file mode 100644 index 0000000..1f66d2d Binary files /dev/null and b/bin/com/dbquery/interfaces/DBBasicInfo.class differ diff --git a/bin/com/dbquery/interfaces/IConnection.class b/bin/com/dbquery/interfaces/IConnection.class new file mode 100644 index 0000000..1604d10 Binary files /dev/null and b/bin/com/dbquery/interfaces/IConnection.class differ diff --git a/bin/com/dbquery/modelgoon/classdiagram.mgc b/bin/com/dbquery/modelgoon/classdiagram.mgc new file mode 100644 index 0000000..cf75ea6 --- /dev/null +++ b/bin/com/dbquery/modelgoon/classdiagram.mgc @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bin/com/dbquery/test/TestUnit.class b/bin/com/dbquery/test/TestUnit.class new file mode 100644 index 0000000..404b60a Binary files /dev/null and b/bin/com/dbquery/test/TestUnit.class differ diff --git a/bin/com/dbquery/util/Model.class b/bin/com/dbquery/util/Model.class new file mode 100644 index 0000000..7f87e72 Binary files /dev/null and b/bin/com/dbquery/util/Model.class differ diff --git a/bin/mysql-connector-java.jar b/bin/mysql-connector-java.jar new file mode 100644 index 0000000..dac6e14 Binary files /dev/null and b/bin/mysql-connector-java.jar differ diff --git a/doc/allclasses-frame.html b/doc/allclasses-frame.html new file mode 100644 index 0000000..9fec23c --- /dev/null +++ b/doc/allclasses-frame.html @@ -0,0 +1,29 @@ + + + + + + +所有类 + + + + + +

所有类

+
+ +
+ + diff --git a/doc/allclasses-noframe.html b/doc/allclasses-noframe.html new file mode 100644 index 0000000..2708d9e --- /dev/null +++ b/doc/allclasses-noframe.html @@ -0,0 +1,29 @@ + + + + + + +所有类 + + + + + +

所有类

+
+ +
+ + diff --git a/doc/com/dbquery/dal/DBConnection.html b/doc/com/dbquery/dal/DBConnection.html new file mode 100644 index 0000000..86e2df4 --- /dev/null +++ b/doc/com/dbquery/dal/DBConnection.html @@ -0,0 +1,411 @@ + + + + + + +DBConnection + + + + + + + + +
+ + + + + + + +
+ + + +
+
com.dbquery.dal
+

类 DBConnection

+
+
+ +
+
    +
  • +
    +
    所有已实现的接口:
    +
    IConnection
    +
    +
    +
    +
    public class DBConnection
    +extends java.lang.Object
    +implements IConnection
    +
    数据库连接类,提供数据库的连接
    +
    +
    版本:
    +
    1.0
    +
    作者:
    +
    Frank
    +
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      构造器详细资料

      + + + +
        +
      • +

        DBConnection

        +
        public DBConnection()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      方法详细资料

      + + + +
        +
      • +

        connection

        +
        public java.sql.Connection connection()
        +
        从接口复制的说明: IConnection
        +
        获取数据库连接
        +
        +
        指定者:
        +
        connection 在接口中 IConnection
        +
        返回:
        +
        数据库连接
        +
        +
      • +
      + + + +
        +
      • +

        setDbinfo

        +
        public void setDbinfo(DBBasicInfo dbinfo)
        +
        设置数据库信息
        +
        +
        参数:
        +
        dbinfo - the dbinfo to set
        +
        +
      • +
      + + + +
        +
      • +

        openConnection

        +
        public boolean openConnection()
        +                       throws java.sql.SQLException,
        +                              java.lang.ClassNotFoundException
        +
        从接口复制的说明: IConnection
        +
        打开数据库连接
        +
        +
        指定者:
        +
        openConnection 在接口中 IConnection
        +
        返回:
        +
        返回是否连接成功
        +
        抛出:
        +
        java.sql.SQLException - 可能抛出数据库异常,包括用户名和密码的错误,主机的错误等
        +
        java.lang.ClassNotFoundException - 可能抛出驱动未找到的异常
        +
        +
      • +
      + + + +
        +
      • +

        closeConnection

        +
        public boolean closeConnection()
        +                        throws java.sql.SQLException
        +
        从接口复制的说明: IConnection
        +
        关闭连接
        +
        +
        指定者:
        +
        closeConnection 在接口中 IConnection
        +
        返回:
        +
        返回是否关闭的状态
        +
        抛出:
        +
        java.sql.SQLException - 可能抛出数据库异常,连接不能正常关闭
        +
        +
      • +
      + + + +
        +
      • +

        isOpened

        +
        public boolean isOpened()
        +                 throws java.sql.SQLException
        +
        从接口复制的说明: IConnection
        +
        数据库是否连接
        +
        +
        指定者:
        +
        isOpened 在接口中 IConnection
        +
        返回:
        +
        返回是否连接的状态
        +
        抛出:
        +
        java.sql.SQLException - 可能抛出连接异常
        +
        +
      • +
      + + + +
        +
      • +

        getDbinfo

        +
        public DBBasicInfo getDbinfo()
        +
        +
        返回:
        +
        数据库信息
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + +
+ + + + + + + +
+ + + + diff --git a/doc/com/dbquery/dal/MSSQLDBInfo.html b/doc/com/dbquery/dal/MSSQLDBInfo.html new file mode 100644 index 0000000..77f7051 --- /dev/null +++ b/doc/com/dbquery/dal/MSSQLDBInfo.html @@ -0,0 +1,326 @@ + + + + + + +MSSQLDBInfo + + + + + + + + +
+ + + + + + + +
+ + + +
+
com.dbquery.dal
+

类 MSSQLDBInfo

+
+
+ +
+
    +
  • +
    +
    +
    public class MSSQLDBInfo
    +extends DBBasicInfo
    +
    MSSQL数据库信息类,在此设置并获取数据库的信息
    +
    +
    版本:
    +
    1.0
    +
    作者:
    +
    Frank
    +
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      构造器详细资料

      + + + +
        +
      • +

        MSSQLDBInfo

        +
        public MSSQLDBInfo()
        +
        构造函数,使用默认端口和默认本机数据库
        +
      • +
      + + + +
        +
      • +

        MSSQLDBInfo

        +
        public MSSQLDBInfo(java.lang.String databaseName,
        +                   java.lang.String machineAddress)
        +
        根据数据库名和主机地址构造对象
        +
        +
        参数:
        +
        databaseName - 数据库名
        +
        machineAddress - 主机地址
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      方法详细资料

      + + + +
        +
      • +

        getUrl

        +
        public java.lang.String getUrl()
        +
        从类复制的说明: DBBasicInfo
        +
        获取数据库地址
        +
        +
        指定者:
        +
        getUrl 在类中 DBBasicInfo
        +
        返回:
        +
        数据库连接URL
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + +
+ + + + + + + +
+ + + + diff --git a/doc/com/dbquery/dal/MySQLDBInfo.html b/doc/com/dbquery/dal/MySQLDBInfo.html new file mode 100644 index 0000000..5ee61e0 --- /dev/null +++ b/doc/com/dbquery/dal/MySQLDBInfo.html @@ -0,0 +1,326 @@ + + + + + + +MySQLDBInfo + + + + + + + + +
+ + + + + + + +
+ + + +
+
com.dbquery.dal
+

类 MySQLDBInfo

+
+
+ +
+
    +
  • +
    +
    +
    public class MySQLDBInfo
    +extends DBBasicInfo
    +
    MySQL数据库信息
    +
    +
    版本:
    +
    1.0
    +
    作者:
    +
    Frank
    +
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      构造器详细资料

      + + + +
        +
      • +

        MySQLDBInfo

        +
        public MySQLDBInfo()
        +
        构造函数,默认使用本机数据库和默认端口
        +
      • +
      + + + +
        +
      • +

        MySQLDBInfo

        +
        public MySQLDBInfo(java.lang.String databaseName,
        +                   java.lang.String machineAddr)
        +
        创建数据库并指定数据库名和IP地址
        +
        +
        参数:
        +
        databaseName - 数据库名
        +
        machineAddr - IP地址
        +
        +
      • +
      +
    • +
    + +
      +
    • + + +

      方法详细资料

      + + + +
        +
      • +

        getUrl

        +
        public java.lang.String getUrl()
        +
        从类复制的说明: DBBasicInfo
        +
        获取数据库地址
        +
        +
        指定者:
        +
        getUrl 在类中 DBBasicInfo
        +
        返回:
        +
        数据库连接URL
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + +
+ + + + + + + +
+ + + + diff --git a/doc/com/dbquery/dal/class-use/DBConnection.html b/doc/com/dbquery/dal/class-use/DBConnection.html new file mode 100644 index 0000000..4462a83 --- /dev/null +++ b/doc/com/dbquery/dal/class-use/DBConnection.html @@ -0,0 +1,125 @@ + + + + + + +类 com.dbquery.dal.DBConnection的使用 + + + + + + + + +
+ + + + + + + +
+ + +
+

类的使用
com.dbquery.dal.DBConnection

+
+
没有com.dbquery.dal.DBConnection的用法
+ +
+ + + + + + + +
+ + + + diff --git a/doc/com/dbquery/dal/class-use/MSSQLDBInfo.html b/doc/com/dbquery/dal/class-use/MSSQLDBInfo.html new file mode 100644 index 0000000..65b994b --- /dev/null +++ b/doc/com/dbquery/dal/class-use/MSSQLDBInfo.html @@ -0,0 +1,125 @@ + + + + + + +类 com.dbquery.dal.MSSQLDBInfo的使用 + + + + + + + + +
+ + + + + + + +
+ + +
+

类的使用
com.dbquery.dal.MSSQLDBInfo

+
+
没有com.dbquery.dal.MSSQLDBInfo的用法
+ +
+ + + + + + + +
+ + + + diff --git a/doc/com/dbquery/dal/class-use/MySQLDBInfo.html b/doc/com/dbquery/dal/class-use/MySQLDBInfo.html new file mode 100644 index 0000000..0a1a998 --- /dev/null +++ b/doc/com/dbquery/dal/class-use/MySQLDBInfo.html @@ -0,0 +1,125 @@ + + + + + + +类 com.dbquery.dal.MySQLDBInfo的使用 + + + + + + + + +
+ + + + + + + +
+ + +
+

类的使用
com.dbquery.dal.MySQLDBInfo

+
+
没有com.dbquery.dal.MySQLDBInfo的用法
+ +
+ + + + + + + +
+ + + + diff --git a/doc/com/dbquery/dal/package-frame.html b/doc/com/dbquery/dal/package-frame.html new file mode 100644 index 0000000..26c24cb --- /dev/null +++ b/doc/com/dbquery/dal/package-frame.html @@ -0,0 +1,23 @@ + + + + + + +com.dbquery.dal + + + + + +

com.dbquery.dal

+
+

+ +
+ + diff --git a/doc/com/dbquery/dal/package-summary.html b/doc/com/dbquery/dal/package-summary.html new file mode 100644 index 0000000..fca489d --- /dev/null +++ b/doc/com/dbquery/dal/package-summary.html @@ -0,0 +1,157 @@ + + + + + + +com.dbquery.dal + + + + + + + + +
+ + + + + + + +
+ + +
+

程序包 com.dbquery.dal

+
+
+ +
+ +
+ + + + + + + +
+ + + + diff --git a/doc/com/dbquery/dal/package-tree.html b/doc/com/dbquery/dal/package-tree.html new file mode 100644 index 0000000..b3fe192 --- /dev/null +++ b/doc/com/dbquery/dal/package-tree.html @@ -0,0 +1,144 @@ + + + + + + +com.dbquery.dal 类分层结构 + + + + + + + + +
+ + + + + + + +
+ + +
+

程序包com.dbquery.dal的分层结构

+程序包分层结构: + +
+
+

类分层结构

+ +
+ +
+ + + + + + + +
+ + + + diff --git a/doc/com/dbquery/dal/package-use.html b/doc/com/dbquery/dal/package-use.html new file mode 100644 index 0000000..7b623cf --- /dev/null +++ b/doc/com/dbquery/dal/package-use.html @@ -0,0 +1,125 @@ + + + + + + +程序包 com.dbquery.dal的使用 + + + + + + + + +
+ + + + + + + +
+ + +
+

程序包的使用
com.dbquery.dal

+
+
没有com.dbquery.dal的用法
+ +
+ + + + + + + +
+ + + + diff --git a/doc/com/dbquery/factory/DatabaseFactory.html b/doc/com/dbquery/factory/DatabaseFactory.html new file mode 100644 index 0000000..0d13856 --- /dev/null +++ b/doc/com/dbquery/factory/DatabaseFactory.html @@ -0,0 +1,315 @@ + + + + + + +DatabaseFactory + + + + + + + + +
+ + + + + + + +
+ + + +
+
com.dbquery.factory
+

接口 DatabaseFactory

+
+
+
+
    +
  • +
    +
    所有已知实现类:
    +
    MSSQLFactory, MySQLFactory
    +
    +
    +
    +
    public interface DatabaseFactory
    +
    数据库工厂,用于创建不同的数据库
    +
    +
    版本:
    +
    1.0
    +
    作者:
    +
    Frank
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      方法概要

      + + + + + + + + + + + + + + + + + + + + + + +
      所有方法 实例方法 抽象方法 
      限定符和类型方法和说明
      DBBasicInfodatabaseInfo() +
      创建一个数据库信息
      +
      DBBasicInfodatabaseInfo(java.lang.String databaseName) +
      创建数据库信息,并指定数据库名,使用本地IP地址和默认端口
      +
      DBBasicInfodatabaseInfo(java.lang.String databaseName, + int port) +
      创建数据库信息,并指定数据库名和端口号,使用本地IP
      +
      DBBasicInfodatabaseInfo(java.lang.String url, + java.lang.String databaseName, + int port) +
      创建数据库信息,并指定IP地址,数据库名,端口号
      +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      方法详细资料

      + + + +
        +
      • +

        databaseInfo

        +
        DBBasicInfo databaseInfo()
        +
        创建一个数据库信息
        +
        +
        返回:
        +
        数据库信息
        +
        +
      • +
      + + + +
        +
      • +

        databaseInfo

        +
        DBBasicInfo databaseInfo(java.lang.String databaseName)
        +
        创建数据库信息,并指定数据库名,使用本地IP地址和默认端口
        +
        +
        参数:
        +
        databaseName - 数据库名
        +
        返回:
        +
        数据库信息
        +
        +
      • +
      + + + +
        +
      • +

        databaseInfo

        +
        DBBasicInfo databaseInfo(java.lang.String databaseName,
        +                         int port)
        +
        创建数据库信息,并指定数据库名和端口号,使用本地IP
        +
        +
        参数:
        +
        databaseName - 数据库名
        +
        port - 端口号
        +
        返回:
        +
        数据库信息
        +
        +
      • +
      + + + +
        +
      • +

        databaseInfo

        +
        DBBasicInfo databaseInfo(java.lang.String url,
        +                         java.lang.String databaseName,
        +                         int port)
        +
        创建数据库信息,并指定IP地址,数据库名,端口号
        +
        +
        参数:
        +
        url - 主机地址
        +
        databaseName - 数据库名
        +
        port - 端口号
        +
        返回:
        +
        数据库信息
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + +
+ + + + + + + +
+ + + + diff --git a/doc/com/dbquery/factory/MSSQLFactory.html b/doc/com/dbquery/factory/MSSQLFactory.html new file mode 100644 index 0000000..9599958 --- /dev/null +++ b/doc/com/dbquery/factory/MSSQLFactory.html @@ -0,0 +1,378 @@ + + + + + + +MSSQLFactory + + + + + + + + +
+ + + + + + + +
+ + + +
+
com.dbquery.factory
+

类 MSSQLFactory

+
+
+ +
+
    +
  • +
    +
    所有已实现的接口:
    +
    DatabaseFactory
    +
    +
    +
    +
    public final class MSSQLFactory
    +extends java.lang.Object
    +implements DatabaseFactory
    +
    Microsoft SQL Server 工厂,用于创建SQLServer的数据库信息
    +
    +
    版本:
    +
    1.0
    +
    作者:
    +
    Frank
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      构造器概要

      + + + + + + + + +
      构造器 
      构造器和说明
      MSSQLFactory() 
      +
    • +
    + +
      +
    • + + +

      方法概要

      + + + + + + + + + + + + + + + + + + + + + + +
      所有方法 实例方法 具体方法 
      限定符和类型方法和说明
      DBBasicInfodatabaseInfo() +
      创建一个数据库信息
      +
      DBBasicInfodatabaseInfo(java.lang.String databaseName) +
      创建数据库信息,并指定数据库名,使用本地IP地址和默认端口
      +
      DBBasicInfodatabaseInfo(java.lang.String databaseName, + int port) +
      创建数据库信息,并指定数据库名和端口号,使用本地IP
      +
      DBBasicInfodatabaseInfo(java.lang.String url, + java.lang.String databaseName, + int port) +
      创建数据库信息,并指定IP地址,数据库名,端口号
      +
      +
        +
      • + + +

        从类继承的方法 java.lang.Object

        +equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      构造器详细资料

      + + + +
        +
      • +

        MSSQLFactory

        +
        public MSSQLFactory()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      方法详细资料

      + + + + + + + +
        +
      • +

        databaseInfo

        +
        public DBBasicInfo databaseInfo(java.lang.String databaseName)
        +
        从接口复制的说明: DatabaseFactory
        +
        创建数据库信息,并指定数据库名,使用本地IP地址和默认端口
        +
        +
        指定者:
        +
        databaseInfo 在接口中 DatabaseFactory
        +
        参数:
        +
        databaseName - 数据库名
        +
        返回:
        +
        数据库信息
        +
        +
      • +
      + + + +
        +
      • +

        databaseInfo

        +
        public DBBasicInfo databaseInfo(java.lang.String databaseName,
        +                                int port)
        +
        从接口复制的说明: DatabaseFactory
        +
        创建数据库信息,并指定数据库名和端口号,使用本地IP
        +
        +
        指定者:
        +
        databaseInfo 在接口中 DatabaseFactory
        +
        参数:
        +
        databaseName - 数据库名
        +
        port - 端口号
        +
        返回:
        +
        数据库信息
        +
        +
      • +
      + + + +
        +
      • +

        databaseInfo

        +
        public DBBasicInfo databaseInfo(java.lang.String url,
        +                                java.lang.String databaseName,
        +                                int port)
        +
        从接口复制的说明: DatabaseFactory
        +
        创建数据库信息,并指定IP地址,数据库名,端口号
        +
        +
        指定者:
        +
        databaseInfo 在接口中 DatabaseFactory
        +
        参数:
        +
        url - 主机地址
        +
        databaseName - 数据库名
        +
        port - 端口号
        +
        返回:
        +
        数据库信息
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + +
+ + + + + + + +
+ + + + diff --git a/doc/com/dbquery/factory/MySQLFactory.html b/doc/com/dbquery/factory/MySQLFactory.html new file mode 100644 index 0000000..2741fc1 --- /dev/null +++ b/doc/com/dbquery/factory/MySQLFactory.html @@ -0,0 +1,378 @@ + + + + + + +MySQLFactory + + + + + + + + +
+ + + + + + + +
+ + + +
+
com.dbquery.factory
+

类 MySQLFactory

+
+
+ +
+
    +
  • +
    +
    所有已实现的接口:
    +
    DatabaseFactory
    +
    +
    +
    +
    public final class MySQLFactory
    +extends java.lang.Object
    +implements DatabaseFactory
    +
    MySQL数据库工厂,用于创建MySQL的数据库信息
    +
    +
    版本:
    +
    1.0
    +
    作者:
    +
    Frank
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      构造器概要

      + + + + + + + + +
      构造器 
      构造器和说明
      MySQLFactory() 
      +
    • +
    + +
      +
    • + + +

      方法概要

      + + + + + + + + + + + + + + + + + + + + + + +
      所有方法 实例方法 具体方法 
      限定符和类型方法和说明
      DBBasicInfodatabaseInfo() +
      创建一个数据库信息
      +
      DBBasicInfodatabaseInfo(java.lang.String databaseName) +
      创建数据库信息,并指定数据库名,使用本地IP地址和默认端口
      +
      DBBasicInfodatabaseInfo(java.lang.String databaseName, + int port) +
      创建数据库信息,并指定数据库名和端口号,使用本地IP
      +
      DBBasicInfodatabaseInfo(java.lang.String url, + java.lang.String databaseName, + int port) +
      创建数据库信息,并指定IP地址,数据库名,端口号
      +
      +
        +
      • + + +

        从类继承的方法 java.lang.Object

        +equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      构造器详细资料

      + + + +
        +
      • +

        MySQLFactory

        +
        public MySQLFactory()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      方法详细资料

      + + + + + + + +
        +
      • +

        databaseInfo

        +
        public DBBasicInfo databaseInfo(java.lang.String databaseName)
        +
        从接口复制的说明: DatabaseFactory
        +
        创建数据库信息,并指定数据库名,使用本地IP地址和默认端口
        +
        +
        指定者:
        +
        databaseInfo 在接口中 DatabaseFactory
        +
        参数:
        +
        databaseName - 数据库名
        +
        返回:
        +
        数据库信息
        +
        +
      • +
      + + + +
        +
      • +

        databaseInfo

        +
        public DBBasicInfo databaseInfo(java.lang.String databaseName,
        +                                int port)
        +
        从接口复制的说明: DatabaseFactory
        +
        创建数据库信息,并指定数据库名和端口号,使用本地IP
        +
        +
        指定者:
        +
        databaseInfo 在接口中 DatabaseFactory
        +
        参数:
        +
        databaseName - 数据库名
        +
        port - 端口号
        +
        返回:
        +
        数据库信息
        +
        +
      • +
      + + + +
        +
      • +

        databaseInfo

        +
        public DBBasicInfo databaseInfo(java.lang.String url,
        +                                java.lang.String databaseName,
        +                                int port)
        +
        从接口复制的说明: DatabaseFactory
        +
        创建数据库信息,并指定IP地址,数据库名,端口号
        +
        +
        指定者:
        +
        databaseInfo 在接口中 DatabaseFactory
        +
        参数:
        +
        url - 主机地址
        +
        databaseName - 数据库名
        +
        port - 端口号
        +
        返回:
        +
        数据库信息
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + +
+ + + + + + + +
+ + + + diff --git a/doc/com/dbquery/factory/class-use/DatabaseFactory.html b/doc/com/dbquery/factory/class-use/DatabaseFactory.html new file mode 100644 index 0000000..b721bff --- /dev/null +++ b/doc/com/dbquery/factory/class-use/DatabaseFactory.html @@ -0,0 +1,173 @@ + + + + + + +接口 com.dbquery.factory.DatabaseFactory的使用 + + + + + + + + +
+ + + + + + + +
+ + +
+

接口的使用
com.dbquery.factory.DatabaseFactory

+
+
+ +
+ +
+ + + + + + + +
+ + + + diff --git a/doc/com/dbquery/factory/class-use/MSSQLFactory.html b/doc/com/dbquery/factory/class-use/MSSQLFactory.html new file mode 100644 index 0000000..146c6a9 --- /dev/null +++ b/doc/com/dbquery/factory/class-use/MSSQLFactory.html @@ -0,0 +1,125 @@ + + + + + + +类 com.dbquery.factory.MSSQLFactory的使用 + + + + + + + + +
+ + + + + + + +
+ + +
+

类的使用
com.dbquery.factory.MSSQLFactory

+
+
没有com.dbquery.factory.MSSQLFactory的用法
+ +
+ + + + + + + +
+ + + + diff --git a/doc/com/dbquery/factory/class-use/MySQLFactory.html b/doc/com/dbquery/factory/class-use/MySQLFactory.html new file mode 100644 index 0000000..b673155 --- /dev/null +++ b/doc/com/dbquery/factory/class-use/MySQLFactory.html @@ -0,0 +1,125 @@ + + + + + + +类 com.dbquery.factory.MySQLFactory的使用 + + + + + + + + +
+ + + + + + + +
+ + +
+

类的使用
com.dbquery.factory.MySQLFactory

+
+
没有com.dbquery.factory.MySQLFactory的用法
+ +
+ + + + + + + +
+ + + + diff --git a/doc/com/dbquery/factory/package-frame.html b/doc/com/dbquery/factory/package-frame.html new file mode 100644 index 0000000..1e63253 --- /dev/null +++ b/doc/com/dbquery/factory/package-frame.html @@ -0,0 +1,26 @@ + + + + + + +com.dbquery.factory + + + + + +

com.dbquery.factory

+
+

接口

+ +

+ +
+ + diff --git a/doc/com/dbquery/factory/package-summary.html b/doc/com/dbquery/factory/package-summary.html new file mode 100644 index 0000000..2216295 --- /dev/null +++ b/doc/com/dbquery/factory/package-summary.html @@ -0,0 +1,168 @@ + + + + + + +com.dbquery.factory + + + + + + + + +
+ + + + + + + +
+ + +
+

程序包 com.dbquery.factory

+
+
+ +
+ +
+ + + + + + + +
+ + + + diff --git a/doc/com/dbquery/factory/package-tree.html b/doc/com/dbquery/factory/package-tree.html new file mode 100644 index 0000000..29ddcb0 --- /dev/null +++ b/doc/com/dbquery/factory/package-tree.html @@ -0,0 +1,143 @@ + + + + + + +com.dbquery.factory 类分层结构 + + + + + + + + +
+ + + + + + + +
+ + +
+

程序包com.dbquery.factory的分层结构

+程序包分层结构: + +
+
+

类分层结构

+ +

接口分层结构

+ +
+ +
+ + + + + + + +
+ + + + diff --git a/doc/com/dbquery/factory/package-use.html b/doc/com/dbquery/factory/package-use.html new file mode 100644 index 0000000..3d32109 --- /dev/null +++ b/doc/com/dbquery/factory/package-use.html @@ -0,0 +1,160 @@ + + + + + + +程序包 com.dbquery.factory的使用 + + + + + + + + +
+ + + + + + + +
+ + +
+

程序包的使用
com.dbquery.factory

+
+
+ +
+ +
+ + + + + + + +
+ + + + diff --git a/doc/com/dbquery/interfaces/AbstractQueryObject.html b/doc/com/dbquery/interfaces/AbstractQueryObject.html new file mode 100644 index 0000000..344c188 --- /dev/null +++ b/doc/com/dbquery/interfaces/AbstractQueryObject.html @@ -0,0 +1,289 @@ + + + + + + +AbstractQueryObject + + + + + + + + +
+ + + + + + + +
+ + + +
+
com.dbquery.interfaces
+

类 AbstractQueryObject

+
+
+ +
+
    +
  • +
    +
    +
    public abstract class AbstractQueryObject
    +extends java.lang.Object
    +
    抽象查询类,提供数据库访问
    +
    +
    版本:
    +
    1.2
    +
    作者:
    +
    Frank
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      构造器概要

      + + + + + + + + +
      构造器 
      构造器和说明
      AbstractQueryObject() +
      构造函数,在实例化时,调用子类的方法指定数据库
      +
      +
    • +
    + +
      +
    • + + +

      方法概要

      + + + + + + + + + + +
      所有方法 实例方法 具体方法 
      限定符和类型方法和说明
      IConnectiongetDbManager() +
      获取数据库管理类
      +
      +
        +
      • + + +

        从类继承的方法 java.lang.Object

        +equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      构造器详细资料

      + + + +
        +
      • +

        AbstractQueryObject

        +
        public AbstractQueryObject()
        +
        构造函数,在实例化时,调用子类的方法指定数据库
        +
      • +
      +
    • +
    + +
      +
    • + + +

      方法详细资料

      + + + +
        +
      • +

        getDbManager

        +
        public IConnection getDbManager()
        +
        获取数据库管理类
        +
        +
        返回:
        +
        the dbManager
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + +
+ + + + + + + +
+ + + + diff --git a/doc/com/dbquery/interfaces/DBBasicInfo.html b/doc/com/dbquery/interfaces/DBBasicInfo.html new file mode 100644 index 0000000..9b53ba2 --- /dev/null +++ b/doc/com/dbquery/interfaces/DBBasicInfo.html @@ -0,0 +1,510 @@ + + + + + + +DBBasicInfo + + + + + + + + +
+ + + + + + + +
+ + + +
+
com.dbquery.interfaces
+

类 DBBasicInfo

+
+
+ +
+
    +
  • +
    +
    直接已知子类:
    +
    MSSQLDBInfo, MySQLDBInfo
    +
    +
    +
    +
    public abstract class DBBasicInfo
    +extends java.lang.Object
    +
    抽象基类,表示所有可用数据库的基类
    +
    +
    版本:
    +
    1.0
    +
    作者:
    +
    Frank
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      构造器概要

      + + + + + + + + +
      构造器 
      构造器和说明
      DBBasicInfo() 
      +
    • +
    + +
      +
    • + + +

      方法概要

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      所有方法 实例方法 抽象方法 具体方法 
      限定符和类型方法和说明
      java.lang.StringgetDatabaseName() +
      获取数据库名
      +
      java.lang.StringgetDriver() +
      获取驱动路径
      +
      java.lang.StringgetMachineAddress() +
      获取数据库主机地址
      +
      java.lang.StringgetPassword() +
      获取登录用户密码
      +
      intgetPort() +
      获取端口号
      +
      abstract java.lang.StringgetUrl() +
      获取数据库地址
      +
      java.lang.StringgetUsername() +
      获取数据库登录用户名
      +
      voidsetDatabaseName(java.lang.String databaseName) +
      设置数据库名
      +
      voidsetMachineAddress(java.lang.String machineAddress) +
      设置数据库主机地址
      +
      voidsetPassword(java.lang.String password) +
      设置用户登录密码
      +
      voidsetPort(int port) +
      设置端口号
      +
      voidsetUsername(java.lang.String username) +
      设置数据库登录用户名
      +
      +
        +
      • + + +

        从类继承的方法 java.lang.Object

        +equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      构造器详细资料

      + + + +
        +
      • +

        DBBasicInfo

        +
        public DBBasicInfo()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      方法详细资料

      + + + +
        +
      • +

        getUrl

        +
        public abstract java.lang.String getUrl()
        +
        获取数据库地址
        +
        +
        返回:
        +
        数据库连接URL
        +
        +
      • +
      + + + +
        +
      • +

        getDriver

        +
        public java.lang.String getDriver()
        +
        获取驱动路径
        +
        +
        返回:
        +
        驱动名称
        +
        +
      • +
      + + + +
        +
      • +

        getUsername

        +
        public java.lang.String getUsername()
        +
        获取数据库登录用户名
        +
        +
        返回:
        +
        数据库用户名
        +
        +
      • +
      + + + +
        +
      • +

        setUsername

        +
        public void setUsername(java.lang.String username)
        +
        设置数据库登录用户名
        +
        +
        参数:
        +
        username - 用户名
        +
        +
      • +
      + + + +
        +
      • +

        getPassword

        +
        public java.lang.String getPassword()
        +
        获取登录用户密码
        +
        +
        返回:
        +
        数据库密码
        +
        +
      • +
      + + + +
        +
      • +

        setPassword

        +
        public void setPassword(java.lang.String password)
        +
        设置用户登录密码
        +
        +
        参数:
        +
        password - 密码
        +
        +
      • +
      + + + +
        +
      • +

        getDatabaseName

        +
        public java.lang.String getDatabaseName()
        +
        获取数据库名
        +
        +
        返回:
        +
        数据库名
        +
        +
      • +
      + + + +
        +
      • +

        setDatabaseName

        +
        public void setDatabaseName(java.lang.String databaseName)
        +
        设置数据库名
        +
        +
        参数:
        +
        databaseName - 数据库名
        +
        +
      • +
      + + + +
        +
      • +

        getMachineAddress

        +
        public java.lang.String getMachineAddress()
        +
        获取数据库主机地址
        +
        +
        返回:
        +
        数据库主机地址
        +
        +
      • +
      + + + +
        +
      • +

        setMachineAddress

        +
        public void setMachineAddress(java.lang.String machineAddress)
        +
        设置数据库主机地址
        +
        +
        参数:
        +
        machineAddress - 主机地址
        +
        +
      • +
      + + + +
        +
      • +

        getPort

        +
        public int getPort()
        +
        获取端口号
        +
        +
        返回:
        +
        the port
        +
        +
      • +
      + + + +
        +
      • +

        setPort

        +
        public void setPort(int port)
        +
        设置端口号
        +
        +
        参数:
        +
        port - 要设置的数据库端口
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + +
+ + + + + + + +
+ + + + diff --git a/doc/com/dbquery/interfaces/IConnection.html b/doc/com/dbquery/interfaces/IConnection.html new file mode 100644 index 0000000..c266d76 --- /dev/null +++ b/doc/com/dbquery/interfaces/IConnection.html @@ -0,0 +1,311 @@ + + + + + + +IConnection + + + + + + + + +
+ + + + + + + +
+ + + +
+
com.dbquery.interfaces
+

接口 IConnection

+
+
+
+
    +
  • +
    +
    所有已知实现类:
    +
    DBConnection
    +
    +
    +
    +
    public interface IConnection
    +
    数据库连接接口
    +
    +
    版本:
    +
    1.0
    +
    作者:
    +
    Frank
    +
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      方法详细资料

      + + + +
        +
      • +

        openConnection

        +
        boolean openConnection()
        +                throws java.sql.SQLException,
        +                       java.lang.ClassNotFoundException
        +
        打开数据库连接
        +
        +
        返回:
        +
        返回是否连接成功
        +
        抛出:
        +
        java.sql.SQLException - 可能抛出数据库异常,包括用户名和密码的错误,主机的错误等
        +
        java.lang.ClassNotFoundException - 可能抛出驱动未找到的异常
        +
        +
      • +
      + + + +
        +
      • +

        closeConnection

        +
        boolean closeConnection()
        +                 throws java.sql.SQLException
        +
        关闭连接
        +
        +
        返回:
        +
        返回是否关闭的状态
        +
        抛出:
        +
        java.sql.SQLException - 可能抛出数据库异常,连接不能正常关闭
        +
        +
      • +
      + + + +
        +
      • +

        isOpened

        +
        boolean isOpened()
        +          throws java.sql.SQLException
        +
        数据库是否连接
        +
        +
        返回:
        +
        返回是否连接的状态
        +
        抛出:
        +
        java.sql.SQLException - 可能抛出连接异常
        +
        +
      • +
      + + + +
        +
      • +

        connection

        +
        java.sql.Connection connection()
        +
        获取数据库连接
        +
        +
        返回:
        +
        数据库连接
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + +
+ + + + + + + +
+ + + + diff --git a/doc/com/dbquery/interfaces/class-use/AbstractQueryObject.html b/doc/com/dbquery/interfaces/class-use/AbstractQueryObject.html new file mode 100644 index 0000000..2206076 --- /dev/null +++ b/doc/com/dbquery/interfaces/class-use/AbstractQueryObject.html @@ -0,0 +1,125 @@ + + + + + + +类 com.dbquery.interfaces.AbstractQueryObject的使用 + + + + + + + + +
+ + + + + + + +
+ + +
+

类的使用
com.dbquery.interfaces.AbstractQueryObject

+
+
没有com.dbquery.interfaces.AbstractQueryObject的用法
+ +
+ + + + + + + +
+ + + + diff --git a/doc/com/dbquery/interfaces/class-use/DBBasicInfo.html b/doc/com/dbquery/interfaces/class-use/DBBasicInfo.html new file mode 100644 index 0000000..c050de5 --- /dev/null +++ b/doc/com/dbquery/interfaces/class-use/DBBasicInfo.html @@ -0,0 +1,284 @@ + + + + + + +类 com.dbquery.interfaces.DBBasicInfo的使用 + + + + + + + + +
+ + + + + + + +
+ + +
+

类的使用
com.dbquery.interfaces.DBBasicInfo

+
+
+ +
+ +
+ + + + + + + +
+ + + + diff --git a/doc/com/dbquery/interfaces/class-use/IConnection.html b/doc/com/dbquery/interfaces/class-use/IConnection.html new file mode 100644 index 0000000..2369a79 --- /dev/null +++ b/doc/com/dbquery/interfaces/class-use/IConnection.html @@ -0,0 +1,191 @@ + + + + + + +接口 com.dbquery.interfaces.IConnection的使用 + + + + + + + + +
+ + + + + + + +
+ + +
+

接口的使用
com.dbquery.interfaces.IConnection

+
+
+ +
+ +
+ + + + + + + +
+ + + + diff --git a/doc/com/dbquery/interfaces/package-frame.html b/doc/com/dbquery/interfaces/package-frame.html new file mode 100644 index 0000000..af8e72d --- /dev/null +++ b/doc/com/dbquery/interfaces/package-frame.html @@ -0,0 +1,26 @@ + + + + + + +com.dbquery.interfaces + + + + + +

com.dbquery.interfaces

+
+

接口

+ +

+ +
+ + diff --git a/doc/com/dbquery/interfaces/package-summary.html b/doc/com/dbquery/interfaces/package-summary.html new file mode 100644 index 0000000..012287a --- /dev/null +++ b/doc/com/dbquery/interfaces/package-summary.html @@ -0,0 +1,168 @@ + + + + + + +com.dbquery.interfaces + + + + + + + + +
+ + + + + + + +
+ + +
+

程序包 com.dbquery.interfaces

+
+
+ +
+ +
+ + + + + + + +
+ + + + diff --git a/doc/com/dbquery/interfaces/package-tree.html b/doc/com/dbquery/interfaces/package-tree.html new file mode 100644 index 0000000..c17dd7d --- /dev/null +++ b/doc/com/dbquery/interfaces/package-tree.html @@ -0,0 +1,143 @@ + + + + + + +com.dbquery.interfaces 类分层结构 + + + + + + + + +
+ + + + + + + +
+ + +
+

程序包com.dbquery.interfaces的分层结构

+程序包分层结构: + +
+
+

类分层结构

+ +

接口分层结构

+ +
+ +
+ + + + + + + +
+ + + + diff --git a/doc/com/dbquery/interfaces/package-use.html b/doc/com/dbquery/interfaces/package-use.html new file mode 100644 index 0000000..0155557 --- /dev/null +++ b/doc/com/dbquery/interfaces/package-use.html @@ -0,0 +1,207 @@ + + + + + + +程序包 com.dbquery.interfaces的使用 + + + + + + + + +
+ + + + + + + +
+ + +
+

程序包的使用
com.dbquery.interfaces

+
+
+ +
+ +
+ + + + + + + +
+ + + + diff --git a/doc/com/dbquery/util/Model.html b/doc/com/dbquery/util/Model.html new file mode 100644 index 0000000..103c1b7 --- /dev/null +++ b/doc/com/dbquery/util/Model.html @@ -0,0 +1,311 @@ + + + + + + +Model + + + + + + + + +
+ + + + + + + +
+ + + +
+
com.dbquery.util
+

类 Model

+
+
+ +
+
    +
  • +
    +
    +
    public class Model
    +extends java.lang.Object
    +
    +
    作者:
    +
    Frank + 用户对模型的快速生成和解析
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      构造器概要

      + + + + + + + + +
      构造器 
      构造器和说明
      Model() 
      +
    • +
    + +
      +
    • + + +

      方法概要

      + + + + + + + + + + + + + + +
      所有方法 静态方法 具体方法 
      限定符和类型方法和说明
      static java.lang.ObjectparseObject(java.util.Map<java.lang.String,java.lang.Object> mapPair, + java.lang.Class<?> className) +
      将Map键值对模型化
      +
      static java.util.Map<java.lang.String,java.lang.Object>serializeModel(java.lang.Object object) +
      将实体类序列化为键值对
      +
      +
        +
      • + + +

        从类继承的方法 java.lang.Object

        +equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      构造器详细资料

      + + + +
        +
      • +

        Model

        +
        public Model()
        +
      • +
      +
    • +
    + +
      +
    • + + +

      方法详细资料

      + + + +
        +
      • +

        parseObject

        +
        public static java.lang.Object parseObject(java.util.Map<java.lang.String,java.lang.Object> mapPair,
        +                                           java.lang.Class<?> className)
        +
        将Map键值对模型化
        +
        +
        参数:
        +
        mapPair - 键值对
        +
        className - 目标类型
        +
        返回:
        +
        返回创建的对象
        +
        +
      • +
      + + + +
        +
      • +

        serializeModel

        +
        public static java.util.Map<java.lang.String,java.lang.Object> serializeModel(java.lang.Object object)
        +
        将实体类序列化为键值对
        +
        +
        参数:
        +
        object - 要序列化的实体
        +
        返回:
        +
        返回序列化后的键值对
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + +
+ + + + + + + +
+ + + + diff --git a/doc/com/dbquery/util/class-use/Model.html b/doc/com/dbquery/util/class-use/Model.html new file mode 100644 index 0000000..185e541 --- /dev/null +++ b/doc/com/dbquery/util/class-use/Model.html @@ -0,0 +1,125 @@ + + + + + + +类 com.dbquery.util.Model的使用 + + + + + + + + +
+ + + + + + + +
+ + +
+

类的使用
com.dbquery.util.Model

+
+
没有com.dbquery.util.Model的用法
+ +
+ + + + + + + +
+ + + + diff --git a/doc/com/dbquery/util/package-frame.html b/doc/com/dbquery/util/package-frame.html new file mode 100644 index 0000000..81dea2c --- /dev/null +++ b/doc/com/dbquery/util/package-frame.html @@ -0,0 +1,21 @@ + + + + + + +com.dbquery.util + + + + + +

com.dbquery.util

+
+

+ +
+ + diff --git a/doc/com/dbquery/util/package-summary.html b/doc/com/dbquery/util/package-summary.html new file mode 100644 index 0000000..38de50f --- /dev/null +++ b/doc/com/dbquery/util/package-summary.html @@ -0,0 +1,143 @@ + + + + + + +com.dbquery.util + + + + + + + + +
+ + + + + + + +
+ + +
+

程序包 com.dbquery.util

+
+
+ +
+ +
+ + + + + + + +
+ + + + diff --git a/doc/com/dbquery/util/package-tree.html b/doc/com/dbquery/util/package-tree.html new file mode 100644 index 0000000..ad6b4e1 --- /dev/null +++ b/doc/com/dbquery/util/package-tree.html @@ -0,0 +1,138 @@ + + + + + + +com.dbquery.util 类分层结构 + + + + + + + + +
+ + + + + + + +
+ + +
+

程序包com.dbquery.util的分层结构

+程序包分层结构: + +
+
+

类分层结构

+ +
+ +
+ + + + + + + +
+ + + + diff --git a/doc/com/dbquery/util/package-use.html b/doc/com/dbquery/util/package-use.html new file mode 100644 index 0000000..64d41c2 --- /dev/null +++ b/doc/com/dbquery/util/package-use.html @@ -0,0 +1,125 @@ + + + + + + +程序包 com.dbquery.util的使用 + + + + + + + + +
+ + + + + + + +
+ + +
+

程序包的使用
com.dbquery.util

+
+
没有com.dbquery.util的用法
+ +
+ + + + + + + +
+ + + + diff --git a/doc/constant-values.html b/doc/constant-values.html new file mode 100644 index 0000000..299b66f --- /dev/null +++ b/doc/constant-values.html @@ -0,0 +1,125 @@ + + + + + + +常量字段值 + + + + + + + + +
+ + + + + + + +
+ + +
+

常量字段值

+

目录

+
+ +
+ + + + + + + +
+ + + + diff --git a/doc/deprecated-list.html b/doc/deprecated-list.html new file mode 100644 index 0000000..c25e583 --- /dev/null +++ b/doc/deprecated-list.html @@ -0,0 +1,125 @@ + + + + + + +已过时的列表 + + + + + + + + +
+ + + + + + + +
+ + +
+

已过时的 API

+

目录

+
+ +
+ + + + + + + +
+ + + + diff --git a/doc/help-doc.html b/doc/help-doc.html new file mode 100644 index 0000000..8fa3fbb --- /dev/null +++ b/doc/help-doc.html @@ -0,0 +1,230 @@ + + + + + + +API 帮助 + + + + + + + + +
+ + + + + + + +
+ + +
+

此 API 文档的组织方式

+
此 API (应用程序编程接口) 文档包含对应于导航栏中的项目的页面, 如下所述。
+
+
+ +此帮助文件适用于使用标准 doclet 生成的 API 文档。
+ +
+ + + + + + + +
+ + + + diff --git a/doc/index-files/index-1.html b/doc/index-files/index-1.html new file mode 100644 index 0000000..21f4798 --- /dev/null +++ b/doc/index-files/index-1.html @@ -0,0 +1,136 @@ + + + + + + +A - 索引 + + + + + + + + +
+ + + + + + + +
+ + +
A C D G I M O P S  + + +

A

+
+
AbstractQueryObject - com.dbquery.interfaces中的类
+
+
抽象查询类,提供数据库访问
+
+
AbstractQueryObject() - 类 的构造器com.dbquery.interfaces.AbstractQueryObject
+
+
构造函数,在实例化时,调用子类的方法指定数据库
+
+
+A C D G I M O P S 
+ +
+ + + + + + + +
+ + + + diff --git a/doc/index-files/index-2.html b/doc/index-files/index-2.html new file mode 100644 index 0000000..c7f3883 --- /dev/null +++ b/doc/index-files/index-2.html @@ -0,0 +1,148 @@ + + + + + + +C - 索引 + + + + + + + + +
+ + + + + + + +
+ + +
A C D G I M O P S  + + +

C

+
+
closeConnection() - 类 中的方法com.dbquery.dal.DBConnection
+
 
+
closeConnection() - 接口 中的方法com.dbquery.interfaces.IConnection
+
+
关闭连接
+
+
com.dbquery.dal - 程序包 com.dbquery.dal
+
 
+
com.dbquery.factory - 程序包 com.dbquery.factory
+
 
+
com.dbquery.interfaces - 程序包 com.dbquery.interfaces
+
 
+
com.dbquery.util - 程序包 com.dbquery.util
+
 
+
connection() - 类 中的方法com.dbquery.dal.DBConnection
+
 
+
connection() - 接口 中的方法com.dbquery.interfaces.IConnection
+
+
获取数据库连接
+
+
+A C D G I M O P S 
+ +
+ + + + + + + +
+ + + + diff --git a/doc/index-files/index-3.html b/doc/index-files/index-3.html new file mode 100644 index 0000000..10bc41a --- /dev/null +++ b/doc/index-files/index-3.html @@ -0,0 +1,176 @@ + + + + + + +D - 索引 + + + + + + + + +
+ + + + + + + +
+ + +
A C D G I M O P S  + + +

D

+
+
DatabaseFactory - com.dbquery.factory中的接口
+
+
数据库工厂,用于创建不同的数据库
+
+
databaseInfo() - 接口 中的方法com.dbquery.factory.DatabaseFactory
+
+
创建一个数据库信息
+
+
databaseInfo(String) - 接口 中的方法com.dbquery.factory.DatabaseFactory
+
+
创建数据库信息,并指定数据库名,使用本地IP地址和默认端口
+
+
databaseInfo(String, int) - 接口 中的方法com.dbquery.factory.DatabaseFactory
+
+
创建数据库信息,并指定数据库名和端口号,使用本地IP
+
+
databaseInfo(String, String, int) - 接口 中的方法com.dbquery.factory.DatabaseFactory
+
+
创建数据库信息,并指定IP地址,数据库名,端口号
+
+
databaseInfo() - 类 中的方法com.dbquery.factory.MSSQLFactory
+
 
+
databaseInfo(String) - 类 中的方法com.dbquery.factory.MSSQLFactory
+
 
+
databaseInfo(String, int) - 类 中的方法com.dbquery.factory.MSSQLFactory
+
 
+
databaseInfo(String, String, int) - 类 中的方法com.dbquery.factory.MSSQLFactory
+
 
+
databaseInfo() - 类 中的方法com.dbquery.factory.MySQLFactory
+
 
+
databaseInfo(String) - 类 中的方法com.dbquery.factory.MySQLFactory
+
 
+
databaseInfo(String, int) - 类 中的方法com.dbquery.factory.MySQLFactory
+
 
+
databaseInfo(String, String, int) - 类 中的方法com.dbquery.factory.MySQLFactory
+
 
+
DBBasicInfo - com.dbquery.interfaces中的类
+
+
抽象基类,表示所有可用数据库的基类
+
+
DBBasicInfo() - 类 的构造器com.dbquery.interfaces.DBBasicInfo
+
 
+
DBConnection - com.dbquery.dal中的类
+
+
数据库连接类,提供数据库的连接
+
+
DBConnection() - 类 的构造器com.dbquery.dal.DBConnection
+
 
+
+A C D G I M O P S 
+ +
+ + + + + + + +
+ + + + diff --git a/doc/index-files/index-4.html b/doc/index-files/index-4.html new file mode 100644 index 0000000..5df783c --- /dev/null +++ b/doc/index-files/index-4.html @@ -0,0 +1,166 @@ + + + + + + +G - 索引 + + + + + + + + +
+ + + + + + + +
+ + +
A C D G I M O P S  + + +

G

+
+
getDatabaseName() - 类 中的方法com.dbquery.interfaces.DBBasicInfo
+
+
获取数据库名
+
+
getDbinfo() - 类 中的方法com.dbquery.dal.DBConnection
+
 
+
getDbManager() - 类 中的方法com.dbquery.interfaces.AbstractQueryObject
+
+
获取数据库管理类
+
+
getDriver() - 类 中的方法com.dbquery.interfaces.DBBasicInfo
+
+
获取驱动路径
+
+
getMachineAddress() - 类 中的方法com.dbquery.interfaces.DBBasicInfo
+
+
获取数据库主机地址
+
+
getPassword() - 类 中的方法com.dbquery.interfaces.DBBasicInfo
+
+
获取登录用户密码
+
+
getPort() - 类 中的方法com.dbquery.interfaces.DBBasicInfo
+
+
获取端口号
+
+
getUrl() - 类 中的方法com.dbquery.dal.MSSQLDBInfo
+
 
+
getUrl() - 类 中的方法com.dbquery.dal.MySQLDBInfo
+
 
+
getUrl() - 类 中的方法com.dbquery.interfaces.DBBasicInfo
+
+
获取数据库地址
+
+
getUsername() - 类 中的方法com.dbquery.interfaces.DBBasicInfo
+
+
获取数据库登录用户名
+
+
+A C D G I M O P S 
+ +
+ + + + + + + +
+ + + + diff --git a/doc/index-files/index-5.html b/doc/index-files/index-5.html new file mode 100644 index 0000000..7f41102 --- /dev/null +++ b/doc/index-files/index-5.html @@ -0,0 +1,138 @@ + + + + + + +I - 索引 + + + + + + + + +
+ + + + + + + +
+ + +
A C D G I M O P S  + + +

I

+
+
IConnection - com.dbquery.interfaces中的接口
+
+
数据库连接接口
+
+
isOpened() - 类 中的方法com.dbquery.dal.DBConnection
+
 
+
isOpened() - 接口 中的方法com.dbquery.interfaces.IConnection
+
+
数据库是否连接
+
+
+A C D G I M O P S 
+ +
+ + + + + + + +
+ + + + diff --git a/doc/index-files/index-6.html b/doc/index-files/index-6.html new file mode 100644 index 0000000..e893370 --- /dev/null +++ b/doc/index-files/index-6.html @@ -0,0 +1,168 @@ + + + + + + +M - 索引 + + + + + + + + +
+ + + + + + + +
+ + +
A C D G I M O P S  + + +

M

+
+
Model - com.dbquery.util中的类
+
 
+
Model() - 类 的构造器com.dbquery.util.Model
+
 
+
MSSQLDBInfo - com.dbquery.dal中的类
+
+
MSSQL数据库信息类,在此设置并获取数据库的信息
+
+
MSSQLDBInfo() - 类 的构造器com.dbquery.dal.MSSQLDBInfo
+
+
构造函数,使用默认端口和默认本机数据库
+
+
MSSQLDBInfo(String, String) - 类 的构造器com.dbquery.dal.MSSQLDBInfo
+
+
根据数据库名和主机地址构造对象
+
+
MSSQLFactory - com.dbquery.factory中的类
+
+
Microsoft SQL Server 工厂,用于创建SQLServer的数据库信息
+
+
MSSQLFactory() - 类 的构造器com.dbquery.factory.MSSQLFactory
+
 
+
MySQLDBInfo - com.dbquery.dal中的类
+
+
MySQL数据库信息
+
+
MySQLDBInfo() - 类 的构造器com.dbquery.dal.MySQLDBInfo
+
+
构造函数,默认使用本机数据库和默认端口
+
+
MySQLDBInfo(String, String) - 类 的构造器com.dbquery.dal.MySQLDBInfo
+
+
创建数据库并指定数据库名和IP地址
+
+
MySQLFactory - com.dbquery.factory中的类
+
+
MySQL数据库工厂,用于创建MySQL的数据库信息
+
+
MySQLFactory() - 类 的构造器com.dbquery.factory.MySQLFactory
+
 
+
+A C D G I M O P S 
+ +
+ + + + + + + +
+ + + + diff --git a/doc/index-files/index-7.html b/doc/index-files/index-7.html new file mode 100644 index 0000000..4e27c55 --- /dev/null +++ b/doc/index-files/index-7.html @@ -0,0 +1,134 @@ + + + + + + +O - 索引 + + + + + + + + +
+ + + + + + + +
+ + +
A C D G I M O P S  + + +

O

+
+
openConnection() - 类 中的方法com.dbquery.dal.DBConnection
+
 
+
openConnection() - 接口 中的方法com.dbquery.interfaces.IConnection
+
+
打开数据库连接
+
+
+A C D G I M O P S 
+ +
+ + + + + + + +
+ + + + diff --git a/doc/index-files/index-8.html b/doc/index-files/index-8.html new file mode 100644 index 0000000..e2d03dc --- /dev/null +++ b/doc/index-files/index-8.html @@ -0,0 +1,132 @@ + + + + + + +P - 索引 + + + + + + + + +
+ + + + + + + +
+ + +
A C D G I M O P S  + + +

P

+
+
parseObject(Map<String, Object>, Class<?>) - 类 中的静态方法com.dbquery.util.Model
+
+
将Map键值对模型化
+
+
+A C D G I M O P S 
+ +
+ + + + + + + +
+ + + + diff --git a/doc/index-files/index-9.html b/doc/index-files/index-9.html new file mode 100644 index 0000000..dba96e5 --- /dev/null +++ b/doc/index-files/index-9.html @@ -0,0 +1,156 @@ + + + + + + +S - 索引 + + + + + + + + +
+ + + + + + + +
+ + +
A C D G I M O P S  + + +

S

+
+
serializeModel(Object) - 类 中的静态方法com.dbquery.util.Model
+
+
将实体类序列化为键值对
+
+
setDatabaseName(String) - 类 中的方法com.dbquery.interfaces.DBBasicInfo
+
+
设置数据库名
+
+
setDbinfo(DBBasicInfo) - 类 中的方法com.dbquery.dal.DBConnection
+
+
设置数据库信息
+
+
setMachineAddress(String) - 类 中的方法com.dbquery.interfaces.DBBasicInfo
+
+
设置数据库主机地址
+
+
setPassword(String) - 类 中的方法com.dbquery.interfaces.DBBasicInfo
+
+
设置用户登录密码
+
+
setPort(int) - 类 中的方法com.dbquery.interfaces.DBBasicInfo
+
+
设置端口号
+
+
setUsername(String) - 类 中的方法com.dbquery.interfaces.DBBasicInfo
+
+
设置数据库登录用户名
+
+
+A C D G I M O P S 
+ +
+ + + + + + + +
+ + + + diff --git a/doc/index.html b/doc/index.html new file mode 100644 index 0000000..dbeb1cc --- /dev/null +++ b/doc/index.html @@ -0,0 +1,75 @@ + + + + + + +生成的文档 (无标题) + + + + + + + + + +<noscript> +<div>您的浏览器已禁用 JavaScript。</div> +</noscript> +<h2>框架预警</h2> +<p>请使用框架功能查看此文档。如果看到此消息, 则表明您使用的是不支持框架的 Web 客户机。链接到<a href="overview-summary.html">非框架版本</a>。</p> + + + diff --git a/doc/overview-frame.html b/doc/overview-frame.html new file mode 100644 index 0000000..2e4bd6c --- /dev/null +++ b/doc/overview-frame.html @@ -0,0 +1,25 @@ + + + + + + +概览列表 + + + + + +
所有类
+
+

程序包

+ +
+

 

+ + diff --git a/doc/overview-summary.html b/doc/overview-summary.html new file mode 100644 index 0000000..6be8bb3 --- /dev/null +++ b/doc/overview-summary.html @@ -0,0 +1,151 @@ + + + + + + +概览 + + + + + + + + +
+ + + + + + + +
+ + +
+

dbquery-doc

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
程序包 
程序包说明
com.dbquery.dal 
com.dbquery.factory 
com.dbquery.interfaces 
com.dbquery.util 
+
+ +
+ + + + + + + +
+ + + + diff --git a/doc/overview-tree.html b/doc/overview-tree.html new file mode 100644 index 0000000..42aae09 --- /dev/null +++ b/doc/overview-tree.html @@ -0,0 +1,156 @@ + + + + + + +类分层结构 + + + + + + + + +
+ + + + + + + +
+ + +
+

所有程序包的分层结构

+程序包分层结构: + +
+
+

类分层结构

+ +

接口分层结构

+ +
+ +
+ + + + + + + +
+ + + + diff --git a/doc/package-list b/doc/package-list new file mode 100644 index 0000000..9ca34c1 --- /dev/null +++ b/doc/package-list @@ -0,0 +1,4 @@ +com.dbquery.dal +com.dbquery.factory +com.dbquery.interfaces +com.dbquery.util diff --git a/doc/script.js b/doc/script.js new file mode 100644 index 0000000..b346356 --- /dev/null +++ b/doc/script.js @@ -0,0 +1,30 @@ +function show(type) +{ + count = 0; + for (var key in methods) { + var row = document.getElementById(key); + if ((methods[key] & type) != 0) { + row.style.display = ''; + row.className = (count++ % 2) ? rowColor : altColor; + } + else + row.style.display = 'none'; + } + updateTabs(type); +} + +function updateTabs(type) +{ + for (var value in tabs) { + var sNode = document.getElementById(tabs[value][0]); + var spanNode = sNode.firstChild; + if (value == type) { + sNode.className = activeTableTab; + spanNode.innerHTML = tabs[value][1]; + } + else { + sNode.className = tableTab; + spanNode.innerHTML = "" + tabs[value][1] + ""; + } + } +} diff --git a/doc/stylesheet.css b/doc/stylesheet.css new file mode 100644 index 0000000..98055b2 --- /dev/null +++ b/doc/stylesheet.css @@ -0,0 +1,574 @@ +/* Javadoc style sheet */ +/* +Overall document style +*/ + +@import url('resources/fonts/dejavu.css'); + +body { + background-color:#ffffff; + color:#353833; + font-family:'DejaVu Sans', Arial, Helvetica, sans-serif; + font-size:14px; + margin:0; +} +a:link, a:visited { + text-decoration:none; + color:#4A6782; +} +a:hover, a:focus { + text-decoration:none; + color:#bb7a2a; +} +a:active { + text-decoration:none; + color:#4A6782; +} +a[name] { + color:#353833; +} +a[name]:hover { + text-decoration:none; + color:#353833; +} +pre { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; +} +h1 { + font-size:20px; +} +h2 { + font-size:18px; +} +h3 { + font-size:16px; + font-style:italic; +} +h4 { + font-size:13px; +} +h5 { + font-size:12px; +} +h6 { + font-size:11px; +} +ul { + list-style-type:disc; +} +code, tt { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; + margin-top:8px; + line-height:1.4em; +} +dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; +} +table tr td dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + vertical-align:top; + padding-top:4px; +} +sup { + font-size:8px; +} +/* +Document title and Copyright styles +*/ +.clear { + clear:both; + height:0px; + overflow:hidden; +} +.aboutLanguage { + float:right; + padding:0px 21px; + font-size:11px; + z-index:200; + margin-top:-9px; +} +.legalCopy { + margin-left:.5em; +} +.bar a, .bar a:link, .bar a:visited, .bar a:active { + color:#FFFFFF; + text-decoration:none; +} +.bar a:hover, .bar a:focus { + color:#bb7a2a; +} +.tab { + background-color:#0066FF; + color:#ffffff; + padding:8px; + width:5em; + font-weight:bold; +} +/* +Navigation bar styles +*/ +.bar { + background-color:#4D7A97; + color:#FFFFFF; + padding:.8em .5em .4em .8em; + height:auto;/*height:1.8em;*/ + font-size:11px; + margin:0; +} +.topNav { + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.bottomNav { + margin-top:10px; + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.subNav { + background-color:#dee3e9; + float:left; + width:100%; + overflow:hidden; + font-size:12px; +} +.subNav div { + clear:left; + float:left; + padding:0 0 5px 6px; + text-transform:uppercase; +} +ul.navList, ul.subNavList { + float:left; + margin:0 25px 0 0; + padding:0; +} +ul.navList li{ + list-style:none; + float:left; + padding: 5px 6px; + text-transform:uppercase; +} +ul.subNavList li{ + list-style:none; + float:left; +} +.topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited { + color:#FFFFFF; + text-decoration:none; + text-transform:uppercase; +} +.topNav a:hover, .bottomNav a:hover { + text-decoration:none; + color:#bb7a2a; + text-transform:uppercase; +} +.navBarCell1Rev { + background-color:#F8981D; + color:#253441; + margin: auto 5px; +} +.skipNav { + position:absolute; + top:auto; + left:-9999px; + overflow:hidden; +} +/* +Page header and footer styles +*/ +.header, .footer { + clear:both; + margin:0 20px; + padding:5px 0 0 0; +} +.indexHeader { + margin:10px; + position:relative; +} +.indexHeader span{ + margin-right:15px; +} +.indexHeader h1 { + font-size:13px; +} +.title { + color:#2c4557; + margin:10px 0; +} +.subTitle { + margin:5px 0 0 0; +} +.header ul { + margin:0 0 15px 0; + padding:0; +} +.footer ul { + margin:20px 0 5px 0; +} +.header ul li, .footer ul li { + list-style:none; + font-size:13px; +} +/* +Heading styles +*/ +div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList ul.blockList li.blockList h3 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +ul.blockList ul.blockList li.blockList h3 { + padding:0; + margin:15px 0; +} +ul.blockList li.blockList h2 { + padding:0px 0 20px 0; +} +/* +Page layout container styles +*/ +.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer { + clear:both; + padding:10px 20px; + position:relative; +} +.indexContainer { + margin:10px; + position:relative; + font-size:12px; +} +.indexContainer h2 { + font-size:13px; + padding:0 0 3px 0; +} +.indexContainer ul { + margin:0; + padding:0; +} +.indexContainer ul li { + list-style:none; + padding-top:2px; +} +.contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt { + font-size:12px; + font-weight:bold; + margin:10px 0 0 0; + color:#4E4E4E; +} +.contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd { + margin:5px 0 10px 0px; + font-size:14px; + font-family:'DejaVu Sans Mono',monospace; +} +.serializedFormContainer dl.nameValue dt { + margin-left:1px; + font-size:1.1em; + display:inline; + font-weight:bold; +} +.serializedFormContainer dl.nameValue dd { + margin:0 0 0 1px; + font-size:1.1em; + display:inline; +} +/* +List styles +*/ +ul.horizontal li { + display:inline; + font-size:0.9em; +} +ul.inheritance { + margin:0; + padding:0; +} +ul.inheritance li { + display:inline; + list-style:none; +} +ul.inheritance li ul.inheritance { + margin-left:15px; + padding-left:15px; + padding-top:1px; +} +ul.blockList, ul.blockListLast { + margin:10px 0 10px 0; + padding:0; +} +ul.blockList li.blockList, ul.blockListLast li.blockList { + list-style:none; + margin-bottom:15px; + line-height:1.4; +} +ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList { + padding:0px 20px 5px 10px; + border:1px solid #ededed; + background-color:#f8f8f8; +} +ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList { + padding:0 0 5px 8px; + background-color:#ffffff; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockList { + margin-left:0; + padding-left:0; + padding-bottom:15px; + border:none; +} +ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast { + list-style:none; + border-bottom:none; + padding-bottom:0; +} +table tr td dl, table tr td dl dt, table tr td dl dd { + margin-top:0; + margin-bottom:1px; +} +/* +Table styles +*/ +.overviewSummary, .memberSummary, .typeSummary, .useSummary, .constantsSummary, .deprecatedSummary { + width:100%; + border-left:1px solid #EEE; + border-right:1px solid #EEE; + border-bottom:1px solid #EEE; +} +.overviewSummary, .memberSummary { + padding:0px; +} +.overviewSummary caption, .memberSummary caption, .typeSummary caption, +.useSummary caption, .constantsSummary caption, .deprecatedSummary caption { + position:relative; + text-align:left; + background-repeat:no-repeat; + color:#253441; + font-weight:bold; + clear:none; + overflow:hidden; + padding:0px; + padding-top:10px; + padding-left:1px; + margin:0px; + white-space:pre; +} +.overviewSummary caption a:link, .memberSummary caption a:link, .typeSummary caption a:link, +.useSummary caption a:link, .constantsSummary caption a:link, .deprecatedSummary caption a:link, +.overviewSummary caption a:hover, .memberSummary caption a:hover, .typeSummary caption a:hover, +.useSummary caption a:hover, .constantsSummary caption a:hover, .deprecatedSummary caption a:hover, +.overviewSummary caption a:active, .memberSummary caption a:active, .typeSummary caption a:active, +.useSummary caption a:active, .constantsSummary caption a:active, .deprecatedSummary caption a:active, +.overviewSummary caption a:visited, .memberSummary caption a:visited, .typeSummary caption a:visited, +.useSummary caption a:visited, .constantsSummary caption a:visited, .deprecatedSummary caption a:visited { + color:#FFFFFF; +} +.overviewSummary caption span, .memberSummary caption span, .typeSummary caption span, +.useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + padding-bottom:7px; + display:inline-block; + float:left; + background-color:#F8981D; + border: none; + height:16px; +} +.memberSummary caption span.activeTableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#F8981D; + height:16px; +} +.memberSummary caption span.tableTab span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + margin-right:3px; + display:inline-block; + float:left; + background-color:#4D7A97; + height:16px; +} +.memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab { + padding-top:0px; + padding-left:0px; + padding-right:0px; + background-image:none; + float:none; + display:inline; +} +.overviewSummary .tabEnd, .memberSummary .tabEnd, .typeSummary .tabEnd, +.useSummary .tabEnd, .constantsSummary .tabEnd, .deprecatedSummary .tabEnd { + display:none; + width:5px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .activeTableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + float:left; + background-color:#F8981D; +} +.memberSummary .tableTab .tabEnd { + display:none; + width:5px; + margin-right:3px; + position:relative; + background-color:#4D7A97; + float:left; + +} +.overviewSummary td, .memberSummary td, .typeSummary td, +.useSummary td, .constantsSummary td, .deprecatedSummary td { + text-align:left; + padding:0px 0px 12px 10px; +} +th.colOne, th.colFirst, th.colLast, .useSummary th, .constantsSummary th, +td.colOne, td.colFirst, td.colLast, .useSummary td, .constantsSummary td{ + vertical-align:top; + padding-right:0px; + padding-top:8px; + padding-bottom:3px; +} +th.colFirst, th.colLast, th.colOne, .constantsSummary th { + background:#dee3e9; + text-align:left; + padding:8px 3px 3px 7px; +} +td.colFirst, th.colFirst { + white-space:nowrap; + font-size:13px; +} +td.colLast, th.colLast { + font-size:13px; +} +td.colOne, th.colOne { + font-size:13px; +} +.overviewSummary td.colFirst, .overviewSummary th.colFirst, +.useSummary td.colFirst, .useSummary th.colFirst, +.overviewSummary td.colOne, .overviewSummary th.colOne, +.memberSummary td.colFirst, .memberSummary th.colFirst, +.memberSummary td.colOne, .memberSummary th.colOne, +.typeSummary td.colFirst{ + width:25%; + vertical-align:top; +} +td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover { + font-weight:bold; +} +.tableSubHeadingColor { + background-color:#EEEEFF; +} +.altColor { + background-color:#FFFFFF; +} +.rowColor { + background-color:#EEEEEF; +} +/* +Content styles +*/ +.description pre { + margin-top:0; +} +.deprecatedContent { + margin:0; + padding:10px 0; +} +.docSummary { + padding:0; +} + +ul.blockList ul.blockList ul.blockList li.blockList h3 { + font-style:normal; +} + +div.block { + font-size:14px; + font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; +} + +td.colLast div { + padding-top:0px; +} + + +td.colLast a { + padding-bottom:3px; +} +/* +Formatting effect styles +*/ +.sourceLineNo { + color:green; + padding:0 30px 0 0; +} +h1.hidden { + visibility:hidden; + overflow:hidden; + font-size:10px; +} +.block { + display:block; + margin:3px 10px 2px 0px; + color:#474747; +} +.deprecatedLabel, .descfrmTypeLabel, .memberNameLabel, .memberNameLink, +.overrideSpecifyLabel, .packageHierarchyLabel, .paramLabel, .returnLabel, +.seeLabel, .simpleTagLabel, .throwsLabel, .typeNameLabel, .typeNameLink { + font-weight:bold; +} +.deprecationComment, .emphasizedPhrase, .interfaceName { + font-style:italic; +} + +div.block div.block span.deprecationComment, div.block div.block span.emphasizedPhrase, +div.block div.block span.interfaceName { + font-style:normal; +} + +div.contentContainer ul.blockList li.blockList h2{ + padding-bottom:0px; +} diff --git a/src/com/dbquery/dal/DBConnection.java b/src/com/dbquery/dal/DBConnection.java new file mode 100644 index 0000000..83cce4b --- /dev/null +++ b/src/com/dbquery/dal/DBConnection.java @@ -0,0 +1,91 @@ +package com.dbquery.dal; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; + +import com.dbquery.interfaces.DBBasicInfo; +import com.dbquery.interfaces.IConnection; + +/** + * 数据库连接类,提供数据库的连接 + * @author Frank + * @version 1.0 + */ +public class DBConnection implements IConnection { + + /** + * 数据库连接 + */ + protected Connection connection; // 数据库连接实例 + /** + * 数据库信息 + */ + protected DBBasicInfo dbinfo; // 数据库信息 + + /* (non-Javadoc) + * @see com.dbquery.interfaces.IConnection#connection() + */ + @Override + public Connection connection() { + return connection; + } + + /** + * 设置数据库信息 + * @param dbinfo the dbinfo to set + */ + public void setDbinfo(DBBasicInfo dbinfo) { + this.dbinfo = dbinfo; + } + /* (non-Javadoc) + * @see com.dbquery.interfaces.IConnection#openConnection() + */ + @Override + public boolean openConnection() throws SQLException, ClassNotFoundException { + if (this.dbinfo == null) { + return false; + } + if (this.dbinfo.getUsername() == null || this.dbinfo.getPassword() == null) { + return false; + } + + // 开始尝试连接 + // 反射获取驱动 + Class.forName(this.dbinfo.getDriver()); + // 根据用户名密码连接 + this.connection = DriverManager.getConnection(this.dbinfo.getUrl(), this.dbinfo.getUsername(), this.dbinfo.getPassword()); + if (this.connection == null) { + return false;// 失败 + } + return true; + } + + /* (non-Javadoc) + * @see com.dbquery.interfaces.IConnection#closeConnection() + */ + @Override + public boolean closeConnection() throws SQLException { + this.connection.close(); + return true; + } + + /* (non-Javadoc) + * @see com.dbquery.interfaces.IConnection#isOpened() + */ + @Override + public boolean isOpened() throws SQLException { + if (this.connection == null) { + return false; // 数据连接未实例化 + } + return !this.connection.isClosed(); + } + + /** + * @return 数据库信息 + */ + public DBBasicInfo getDbinfo() { + return dbinfo; + } + +} diff --git a/src/com/dbquery/dal/MSSQLDBInfo.java b/src/com/dbquery/dal/MSSQLDBInfo.java new file mode 100644 index 0000000..286f504 --- /dev/null +++ b/src/com/dbquery/dal/MSSQLDBInfo.java @@ -0,0 +1,53 @@ +package com.dbquery.dal; + +import com.dbquery.interfaces.DBBasicInfo; + +/** + * MSSQL数据库信息类,在此设置并获取数据库的信息 + * @author Frank + * @version 1.0 + * */ +public class MSSQLDBInfo extends DBBasicInfo { + + /** + * 构造函数,使用默认端口和默认本机数据库 + */ + public MSSQLDBInfo() { + this.driver = "com.microsoft.sqlserver.jdbc.SQLServerDriver"; + this.port = 1433; //默认端口为1433 + this.url = "jdbc:sqlserver://localhost";// 默认URL地址 + } + + + /* (non-Javadoc) + * @see com.databasegenerate.dal.DBBasicInfo#getUrl() + */ + @Override + public String getUrl() { + if (this.machineAddress == null) { + if (this.databaseName == null) { + + return this.url + ":" + this.port + ";";// 未指定数据库名 + } + + return this.url + ":" + this.port + ";DatabaseName=" + this.databaseName; // 未指定数据库地址则使用默认本机地址 + } + if (this.databaseName == null) { + + return "jdbc:sqlserver://" + this.machineAddress + ":" + this.port + ";"; // 未指定数据库名,则使用指定地址 + } + + return "jdbc:sqlserver://" + this.machineAddress + ":" + this.port + ";DatabaseName=" + this.databaseName; + + } + + /** + * 根据数据库名和主机地址构造对象 + * @param databaseName 数据库名 + * @param machineAddress 主机地址 + * */ + public MSSQLDBInfo(String databaseName, String machineAddress) { + this.databaseName = databaseName; + this.setMachineAddress(machineAddress); + } +} diff --git a/src/com/dbquery/dal/MySQLDBInfo.java b/src/com/dbquery/dal/MySQLDBInfo.java new file mode 100644 index 0000000..b7536df --- /dev/null +++ b/src/com/dbquery/dal/MySQLDBInfo.java @@ -0,0 +1,56 @@ +/** + * + */ +package com.dbquery.dal; + +import com.dbquery.interfaces.DBBasicInfo; + +/** + * MySQL数据库信息 + * @author Frank + * @version 1.0 + */ +public class MySQLDBInfo extends DBBasicInfo { + + /** + * 构造函数,默认使用本机数据库和默认端口 + */ + public MySQLDBInfo() { + this.driver = "com.mysql.jdbc.Driver"; + this.port = 3306; //默认端口为3306 + this.url = "jdbc:mysql://localhost" + "?useOldAliasMetadataBehavior=true";// 默认URL地址 + } + + /** + * 创建数据库并指定数据库名和IP地址 + * @param databaseName 数据库名 + * @param machineAddr IP地址 + */ + public MySQLDBInfo(String databaseName, String machineAddr) { + this(); + this.databaseName = databaseName; + this.machineAddress = machineAddr; + } + + /* (non-Javadoc) + * @see com.databasegenerate.dal.DBBasicInfo#getUrl() + */ + @Override + public String getUrl() { + if (this.machineAddress == null) { + if (this.databaseName == null) { + + return this.url + ":" + this.port + "?useOldAliasMetadataBehavior=true";// 未指定数据库名 + } + + return this.url + ":" + this.port + "/" + this.databaseName + "?useOldAliasMetadataBehavior=true"; // 未指定数据库地址则使用默认本机地址 + } + if (this.databaseName == null) { + + return "jdbc:mysql://" + this.machineAddress + ":" + this.port + "?useOldAliasMetadataBehavior=true"; // 未指定数据库名,则使用指定地址 + } + + return "jdbc:mysql://" + this.machineAddress + ":" + this.port + "/" + this.databaseName + "?useOldAliasMetadataBehavior=true"; + } + +} diff --git a/src/com/dbquery/demo/QueryObject.java b/src/com/dbquery/demo/QueryObject.java new file mode 100644 index 0000000..ac69abe --- /dev/null +++ b/src/com/dbquery/demo/QueryObject.java @@ -0,0 +1,42 @@ +/** + * + */ +package com.dbquery.demo; + +import com.dbquery.dal.DBConnection; +import com.dbquery.factory.DatabaseFactory; +import com.dbquery.factory.MySQLFactory; +import com.dbquery.interfaces.AbstractQueryObject; +import com.dbquery.interfaces.DBBasicInfo; + +/** + * 测试查询类 + * @author Frank + * + */ +public final class QueryObject extends AbstractQueryObject { + + /* (non-Javadoc) + * @see com.dbquery.interfaces.AbstractQueryObject#setupDatabase() + */ + @Override + public void setupDatabase() { + DatabaseFactory factory = new MySQLFactory(); + DBBasicInfo mysql = factory.databaseInfo("test"); + DBConnection connection = new DBConnection(); + mysql.setUsername("root"); + mysql.setPassword("123456"); + connection.setDbinfo(mysql); + dbManager = connection; + } + + private final static String SQL_CREATE_TABLE = "CREATE TABLE TB_QUERY(id int primary key, content char(120) not null);"; + /** + * 示例,创建一个表 + * @return + */ + public boolean createTable() { + avoidNotBindDatabase(); + return this.update(SQL_CREATE_TABLE, new Object[0]); + } +} diff --git a/src/com/dbquery/factory/DatabaseFactory.java b/src/com/dbquery/factory/DatabaseFactory.java new file mode 100644 index 0000000..6695c7a --- /dev/null +++ b/src/com/dbquery/factory/DatabaseFactory.java @@ -0,0 +1,44 @@ +/** + * + */ +package com.dbquery.factory; + +import com.dbquery.interfaces.DBBasicInfo; + +/** + * 数据库工厂,用于创建不同的数据库 + * @author Frank + * @version 1.0 + */ +public interface DatabaseFactory { + + /** + * 创建一个数据库信息 + * @return 数据库信息 + */ + public DBBasicInfo databaseInfo(); + + /** + * 创建数据库信息,并指定数据库名,使用本地IP地址和默认端口 + * @param databaseName 数据库名 + * @return 数据库信息 + */ + public DBBasicInfo databaseInfo(String databaseName); + + /** + * 创建数据库信息,并指定数据库名和端口号,使用本地IP + * @param databaseName 数据库名 + * @param port 端口号 + * @return 数据库信息 + */ + public DBBasicInfo databaseInfo(String databaseName, int port); + + /** + * 创建数据库信息,并指定IP地址,数据库名,端口号 + * @param url 主机地址 + * @param databaseName 数据库名 + * @param port 端口号 + * @return 数据库信息 + */ + public DBBasicInfo databaseInfo(String url, String databaseName, int port); +} diff --git a/src/com/dbquery/factory/MSSQLFactory.java b/src/com/dbquery/factory/MSSQLFactory.java new file mode 100644 index 0000000..e5aaf05 --- /dev/null +++ b/src/com/dbquery/factory/MSSQLFactory.java @@ -0,0 +1,52 @@ +/** + * + */ +package com.dbquery.factory; + +import com.dbquery.dal.MSSQLDBInfo; +import com.dbquery.interfaces.DBBasicInfo; + +/** + * Microsoft SQL Server 工厂,用于创建SQLServer的数据库信息 + * @author Frank + * @version 1.0 + */ +public final class MSSQLFactory implements DatabaseFactory { + + /* (non-Javadoc) + * @see com.dbquery.factory.DatabaseFactory#databaseInfo() + */ + @Override + public DBBasicInfo databaseInfo() { + return new MSSQLDBInfo(); + } + + /* (non-Javadoc) + * @see com.dbquery.factory.DatabaseFactory#databaseInfo(java.lang.String) + */ + @Override + public DBBasicInfo databaseInfo(String databaseName) { + return new MSSQLDBInfo(databaseName, "127.0.0.1"); + } + + /* (non-Javadoc) + * @see com.dbquery.factory.DatabaseFactory#databaseInfo(java.lang.String, int) + */ + @Override + public DBBasicInfo databaseInfo(String databaseName, int port) { + DBBasicInfo info = databaseInfo(databaseName); + info.setPort(port); + return info; + } + + /* (non-Javadoc) + * @see com.dbquery.factory.DatabaseFactory#databaseInfo(java.lang.String, java.lang.String, int) + */ + @Override + public DBBasicInfo databaseInfo(String url, String databaseName, int port) { + DBBasicInfo info = databaseInfo(databaseName, port); + info.setMachineAddress(url); + return info; + } + +} diff --git a/src/com/dbquery/factory/MySQLFactory.java b/src/com/dbquery/factory/MySQLFactory.java new file mode 100644 index 0000000..249339a --- /dev/null +++ b/src/com/dbquery/factory/MySQLFactory.java @@ -0,0 +1,52 @@ +/** + * + */ +package com.dbquery.factory; + +import com.dbquery.dal.MySQLDBInfo; +import com.dbquery.interfaces.DBBasicInfo; + +/** + * MySQL数据库工厂,用于创建MySQL的数据库信息 + * @author Frank + * @version 1.0 + */ +public final class MySQLFactory implements DatabaseFactory { + + /* (non-Javadoc) + * @see com.dbquery.factory.DatabaseFactory#databaseInfo() + */ + @Override + public DBBasicInfo databaseInfo() { + return new MySQLDBInfo(); + } + + /* (non-Javadoc) + * @see com.dbquery.factory.DatabaseFactory#databaseInfo(java.lang.String) + */ + @Override + public DBBasicInfo databaseInfo(String databaseName) { + return new MySQLDBInfo(databaseName, "127.0.0.1"); + } + + /* (non-Javadoc) + * @see com.dbquery.factory.DatabaseFactory#databaseInfo(java.lang.String, int) + */ + @Override + public DBBasicInfo databaseInfo(String databaseName, int port) { + DBBasicInfo info = databaseInfo(databaseName); + info.setPort(port); + return info; + } + + /* (non-Javadoc) + * @see com.dbquery.factory.DatabaseFactory#databaseInfo(java.lang.String, java.lang.String, int) + */ + @Override + public DBBasicInfo databaseInfo(String url, String databaseName, int port) { + DBBasicInfo info = databaseInfo(databaseName, port); + info.setMachineAddress(url); + return info; + } + +} diff --git a/src/com/dbquery/interfaces/AbstractQueryObject.java b/src/com/dbquery/interfaces/AbstractQueryObject.java new file mode 100644 index 0000000..499be79 --- /dev/null +++ b/src/com/dbquery/interfaces/AbstractQueryObject.java @@ -0,0 +1,305 @@ +package com.dbquery.interfaces; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.dbquery.interfaces.IConnection; + + +/** + * 抽象查询类,提供数据库访问 + * @author Frank + * @version 1.2 + */ +public abstract class AbstractQueryObject { + + + /** + * 数据库连接管理 + */ + protected IConnection dbManager; + + /** + * 构造函数,在实例化时,调用子类的方法指定数据库 + */ + public AbstractQueryObject() { + avoidNotBindDatabase(); + } + + /** + * 更新数据 + * @param sqlStatement SQL语句 + * @param params 参数 + * @return 返回是否更新成功, true表示更新成功, false表示更新失败 + * */ + protected boolean update(String sqlStatement, Object[]params){ + Connection dbConnection = null; + try { + dbConnection = this.connectToDatabase(); + } catch (ClassNotFoundException e1) { + e1.printStackTrace(); + } catch (SQLException e1) { + e1.printStackTrace(); + } //数据库连接 + + try (PreparedStatement updateStatement = dbConnection.prepareStatement(sqlStatement)){// 创建Statement防止注入 + this.formatStatement(updateStatement, params);// 格式化SQL语句 + boolean res = updateStatement.executeUpdate() >= 0;// 更新结果 + updateStatement.close(); + return res; + }catch(SQLException e) { + e.printStackTrace(); + return false;// 发生异常错误 + }finally { + //关闭连接 + try { + dbManager.closeConnection(); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } + /** + * 删除数据 + * @param sqlStatement SQL语句 + * @param params 参数 + * @return 已删除的记录数目 + * */ + protected int delete(String sqlStatement, Object[]params){ + Connection dbConnection = null; + try { + dbConnection = this.connectToDatabase(); + } catch (ClassNotFoundException e1) { + e1.printStackTrace(); + } catch (SQLException e1) { + e1.printStackTrace(); + } + try (PreparedStatement delStatement = dbConnection.prepareStatement(sqlStatement)){// 创建SQL声明语句,自动释放 + + // 填充语句 + this.formatStatement(delStatement, params); + + // 执行删除 + int rowCount = delStatement.executeUpdate(); + delStatement.close(); + return rowCount; + } catch (java.sql.SQLException e) { + e.printStackTrace(); + return 0; + } finally { + try { + dbManager.closeConnection(); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } + /** + * 插入数据 + * @param sqlStatement SQL语句 + * @param params 参数 + * @return 返回是否插入成功, true表示更新成功, false表示更新失败 + * */ + protected boolean insert(String sqlStatement, Object[]params){ + Connection insConnection = null; + try { + insConnection = this.connectToDatabase(); + } catch (ClassNotFoundException e1) { + e1.printStackTrace(); + } catch (SQLException e1) { + e1.printStackTrace(); + } //数据库连接 + + try(PreparedStatement insPrepareStatement = insConnection.prepareStatement(sqlStatement)) { + // 格式化SQL + this.formatStatement(insPrepareStatement, params); + + // 执行插入 + int resCount = insPrepareStatement.executeUpdate(); + boolean res = resCount >= 0; + // 关闭SQL + insPrepareStatement.close(); + return res; + }catch (SQLException ex) { + ex.printStackTrace(); + return false; + }finally { + try { + dbManager.closeConnection(); + } catch (SQLException e) { + e.printStackTrace(); + }// 关闭连接 + } + + } + /** + * 查询数据 + * @param sqlStatement SQL语句 + * @param params 参数 + * @return 查询到的结果集 + * */ + protected List> select(String sqlStatement, Object[]params){ + Connection selectConnection = null; + try { + selectConnection = this.connectToDatabase(); + } catch (ClassNotFoundException e1) { + e1.printStackTrace(); + } catch (SQLException e1) { + e1.printStackTrace(); + } // 连接 + ResultSet setResult = null; + try (PreparedStatement selelctStatement = selectConnection.prepareStatement(sqlStatement)) { // 获取到SQL声明 + // 格式化声明 + this.formatStatement(selelctStatement, params); + // 查询 + setResult = selelctStatement.executeQuery();// 执行查询 + // 结果集合转为集合 + + List> results = new ArrayList<>(); + + while (setResult.next()) { + Map rowObj = this.setTransformToMap(setResult); // 一条元祖 + + if (null != rowObj) { + results.add(rowObj); // 加入 + } + + } + return results; + }catch (SQLException ex) { + ex.printStackTrace(); + return null; // 出现SQL异常 + } finally { + try { + setResult.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + //关闭SQL + try { + dbManager.closeConnection(); + } catch (SQLException e) { + e.printStackTrace(); + } + } + + } + /** + * 格式化SQL语句 + * @param statement SQL语句 + * @param params 要格式化填充的参数 + * @throws SQLException 在填充SQL语句时,发生填充项索引和待填充项发生冲突的异常 + * */ + private void formatStatement(PreparedStatement statement, Object[]params) throws SQLException{ + for (int i = 0; i < params.length; i++) { + statement.setObject(i + 1, params[i]); + } + } + /** + * 连接到数据库 + * @throws DBOpenException 数据库无法打开的异常 + * @return 返回数据库连接实例 + * @throws SQLException 数据库异常 + * @throws ClassNotFoundException 驱动未找到 + * */ + private Connection connectToDatabase() throws ClassNotFoundException, SQLException { + if (dbManager.isOpened()) { // 是否连接已经打开 + return dbManager.connection();// 获取连接 + }else { + dbManager.openConnection(); + return dbManager.connection(); + } + } + + /** + * 将集合转为字典型数据 + * @param set 当前行的数据集合 + * @return 返回转换后的键值对 + * */ + private Map setTransformToMap(ResultSet set) { + try { + int columnCount = set.getMetaData().getColumnCount(); + // 获取所有列 + Map queryObject = new HashMap<>(); + for (int col = 1; col <= columnCount; col++) { + try { + String colName = set.getMetaData().getColumnName(col); // 获取列名 + Object volValue = set.getObject(colName); // 列值 + queryObject.put(colName, volValue); // 生成键值对 + } catch (SQLException e) { + e.printStackTrace(); + continue; + } + } + return queryObject; + + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + /** + * 动态构建SQL语句,并将值填充到参数表中 + * @param map 要构建的动态参数 + * @param fillInParams 要填充的参数表 + * */ + protected String generateDynamicUpdateSQL(String tableName, Map map, Object[] fillInParams) { + // 动态构建SQL语句字符串 + StringBuilder sqlBuilder = new StringBuilder("UPDATE "); // 创建SQLBuilder + sqlBuilder.append(tableName).append(" SET "); + // 将Map中所有键构建到SQL中 + Set keys = map.keySet(); // 所有键 + Iterator keyIterator = keys.iterator(); // 迭代器 + int i = 0; + while (keyIterator.hasNext()) { + String key = keyIterator.next(); + if (!keyIterator.hasNext()) { //最后一个键 + sqlBuilder.append(key).append(" = ? "); + } else { + sqlBuilder.append(key).append(" = ? ,"); + } + // 将值加入到属性中 + if (null != fillInParams) { + fillInParams[i++] = map.get(key); + } + } + + // 构建完要更新的键 + + // 设置唯一标识 + System.out.println(sqlBuilder); + + return sqlBuilder.toString(); + } + /** + * 获取数据库管理类 + * @return the dbManager + */ + public IConnection getDbManager() { + return dbManager; + } + /*虚方法*/ + + /** + * 载入数据库连接管理对象 + */ + protected abstract void setupDatabase(); + + /** + * 避免数据库未绑定信息 + */ + protected void avoidNotBindDatabase() { + if (null == this.dbManager) { + setupDatabase(); + } + } +} diff --git a/src/com/dbquery/interfaces/DBBasicInfo.java b/src/com/dbquery/interfaces/DBBasicInfo.java new file mode 100644 index 0000000..104c7cd --- /dev/null +++ b/src/com/dbquery/interfaces/DBBasicInfo.java @@ -0,0 +1,106 @@ + +package com.dbquery.interfaces; + +/** + * 抽象基类,表示所有可用数据库的基类 + * @author Frank + * @version 1.0 + */ +public abstract class DBBasicInfo { + + protected String url; // 数据连接URL + protected String driver; // 数据库驱动 + protected String username; // 数据库用户名 + protected String password; // 数据库密码 + protected String databaseName; // 数据库名 + protected String machineAddress; // 数据库主机名 + protected int port; // 端口,默认端口根据数据库不同而不同 + + /*getter 和 setter*/ + /** + * 获取数据库地址 + * @return 数据库连接URL + * */ + public abstract String getUrl(); + /** + * 获取驱动路径 + * @return 驱动名称 + * */ + public String getDriver() { + return driver; + } + /** + * 获取数据库登录用户名 + * @return 数据库用户名 + * */ + public String getUsername() { + return username; + } + /** + * 设置数据库登录用户名 + * @param username 用户名 + * */ + public void setUsername(String username) { + this.username = username; + } + /** + * 获取登录用户密码 + * @return 数据库密码 + * */ + public String getPassword() { + return password; + } + /** + * 设置用户登录密码 + * @param password 密码 + * */ + public void setPassword(String password) { + this.password = password; + } + + /** + * 获取数据库名 + * @return 数据库名 + * */ + public String getDatabaseName() { + return databaseName; + } + /** + * 设置数据库名 + * @param databaseName 数据库名 + * */ + public void setDatabaseName(String databaseName){ + this.databaseName = databaseName; + } + + /** + * 获取数据库主机地址 + * @return 数据库主机地址 + * */ + public String getMachineAddress() { + return machineAddress; + } + + /** + * 设置数据库主机地址 + * @param machineAddress 主机地址 + * */ + public void setMachineAddress(String machineAddress) { + this.machineAddress = machineAddress; + } + + /** + * 获取端口号 + * @return the port + */ + public int getPort() { + return port; + } + /** + * 设置端口号 + * @param port 要设置的数据库端口 + */ + public void setPort(int port) { + this.port = port; + } +} diff --git a/src/com/dbquery/interfaces/IConnection.java b/src/com/dbquery/interfaces/IConnection.java new file mode 100644 index 0000000..87b3d8d --- /dev/null +++ b/src/com/dbquery/interfaces/IConnection.java @@ -0,0 +1,43 @@ +/** + * + */ +package com.dbquery.interfaces; + +import java.sql.Connection; +import java.sql.SQLException; + +/** + * 数据库连接接口 + * @author Frank + * @version 1.0 + */ +public interface IConnection { + + /** + * 打开数据库连接 + * @throws SQLException 可能抛出数据库异常,包括用户名和密码的错误,主机的错误等 + * @throws ClassNotFoundException 可能抛出驱动未找到的异常 + * @return 返回是否连接成功 + * */ + public boolean openConnection() throws SQLException, ClassNotFoundException; + + /** + * 关闭连接 + * @throws SQLException 可能抛出数据库异常,连接不能正常关闭 + * @return 返回是否关闭的状态 + * */ + public boolean closeConnection() throws SQLException; + + /** + * 数据库是否连接 + * @return 返回是否连接的状态 + * @throws SQLException 可能抛出连接异常 + * */ + public boolean isOpened() throws SQLException; + + /** + * 获取数据库连接 + * @return 数据库连接 + */ + public Connection connection(); +} diff --git a/src/com/dbquery/modelgoon/classdiagram.mgc b/src/com/dbquery/modelgoon/classdiagram.mgc new file mode 100644 index 0000000..cf75ea6 --- /dev/null +++ b/src/com/dbquery/modelgoon/classdiagram.mgc @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/com/dbquery/test/TestUnit.java b/src/com/dbquery/test/TestUnit.java new file mode 100644 index 0000000..8528dcd --- /dev/null +++ b/src/com/dbquery/test/TestUnit.java @@ -0,0 +1,19 @@ +package com.dbquery.test; + +import static org.junit.Assert.*; + +import org.junit.Test; + +import com.dbquery.demo.QueryObject; + +public class TestUnit { + + @Test + public void testCreateTable() { + QueryObject query = new QueryObject(); + if(!query.createTable()) { + fail("创建失败!"); + } + } + +} diff --git a/src/com/dbquery/util/Model.java b/src/com/dbquery/util/Model.java new file mode 100644 index 0000000..3062686 --- /dev/null +++ b/src/com/dbquery/util/Model.java @@ -0,0 +1,96 @@ +/** + * 实体模型包 + */ +package com.dbquery.util; + +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; +import java.util.HashMap; +import java.util.Map; + +/** + * @author Frank + * 用户对模型的快速生成和解析 + */ +public class Model { + + + /** + * 将Map键值对模型化 + * @param mapPair 键值对 + * @param className 目标类型 + * @return 返回创建的对象 + * */ + public static Object parseObject(Map mapPair, Class className) { + if (null == mapPair) { + return null; + } + try { + Object destObj = className.newInstance();// 创建对象实例 + Field[] fields = destObj.getClass().getDeclaredFields(); // 获取声明的属性域 + for (Field field : fields) { + int mod = field.getModifiers(); + if(Modifier.isStatic(mod) || Modifier.isFinal(mod)){ + continue; + } + + field.setAccessible(true); + Object fieldValue = mapPair.get(field.getName());// 获取属性值 + if (null == fieldValue) { // 属性值为空不加入到属性中 + continue; + } + try { + field.set(destObj, fieldValue); + } catch (IllegalArgumentException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + return destObj; + } catch (InstantiationException e) { + e.printStackTrace(); + } catch (IllegalAccessException e) { + e.printStackTrace(); + } + return null; + } + + /** + * 将实体类序列化为键值对 + * @param object 要序列化的实体 + * @return 返回序列化后的键值对 + * */ + public static Map serializeModel(Object object) { + if (null == object) + return null; // 防止空对象 + try { + Field[] allDeclaredFields = object.getClass().getDeclaredFields();// 获取以声明的属性域 + Map objectPair = new HashMap<>();// 键值对容器 + + for (Field field : allDeclaredFields) { // 遍历属性 + int mod = field.getModifiers(); + if (Modifier.isStatic(mod) || Modifier.isFinal(mod)) { + continue; + } + + // 设置可访问性 + field.setAccessible(true); + Object fieldValue = field.get(object); // 获取到object的该属性值 + if (null == fieldValue) { + // 属性值为空 + continue; + } + + // 属性值非空 + String fieldName = field.getName(); + objectPair.put(fieldName, fieldValue); + + } + return objectPair; + + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } +} diff --git a/src/mysql-connector-java.jar b/src/mysql-connector-java.jar new file mode 100644 index 0000000..dac6e14 Binary files /dev/null and b/src/mysql-connector-java.jar differ