|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectnet.neoremind.fountain.datasource.AbstractMysqlDataSource
public abstract class AbstractMysqlDataSource
数据源的抽象实现,实现大部分的通用的功能,比如打开连接、权限验证等,建议其他实现MysqlDataSource接口的类都继承本类
| 字段摘要 | |
|---|---|
protected DatasourceConfigure |
conf
数据源基础配置 |
| 构造方法摘要 | |
|---|---|
AbstractMysqlDataSource()
|
|
| 方法摘要 | |
|---|---|
protected abstract void |
applySocket(Socket socket)
使用给定的socket作为当前实现的主socket |
protected void |
closeSocket(Socket socket)
安全的关闭socket连接,使用apache commons io组件实现 |
protected abstract Socket |
createQuerySocket()
创建一个用于查询的socket |
DatasourceConfigure |
getConf()
|
String |
getIpAddress()
获取当前数据源的ip地址 |
protected abstract org.slf4j.Logger |
getLogger()
获取当前实现的logger |
protected Socket |
getNewSocket()
创建一个新的socket连接,完成mysql握手和权限验证,并且后续建立network stream,后续使用 |
int |
getPort()
获取当前数据源的端口 |
void |
open()
打开一个数据源,用以读取数据 |
protected void |
printMysqlInfo()
打印当前mysql的信息 |
ResultSetPacket |
query(String query)
执行查询sql |
TableMeta |
queryTableMeta(String tableFullName)
调用如下的命令获取列信息,保存为 ColumnMeta列表返回:
mysql> show full fields from City;
+------------+----------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------+----------+------+-----+---------+----------------+
| Id | int(11) | NO | PRI | NULL | auto_increment |
| Name | char(35) | NO | | | |
| Country | char(3) | NO | UNI | | |
| District | char(20) | YES | MUL | | |
| Population | int(11) | NO | | 0 | |
+------------+----------+------+-----+---------+----------------+
5 rows in set (0.00 sec)
|
void |
setConf(DatasourceConfigure conf)
|
protected OKPacket |
update(Socket socket,
String query)
封装mysql query text协议,实现update语句的执行 |
OKPacket |
update(String query)
执行修改数据的sql |
protected Socket |
updateSettings(Socket socket)
对新构建的mysql 连接设置配置信息: wait_timeout net_write_timeout net_read_timeout charset |
| 从类 java.lang.Object 继承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 从接口 net.neoremind.fountain.datasource.MysqlDataSource 继承的方法 |
|---|
close, isOpen |
| 字段详细信息 |
|---|
protected DatasourceConfigure conf
| 构造方法详细信息 |
|---|
public AbstractMysqlDataSource()
| 方法详细信息 |
|---|
protected abstract org.slf4j.Logger getLogger()
protected abstract Socket createQuerySocket()
protected abstract void applySocket(Socket socket)
socket -
public void open()
throws IOException,
NoSuchAlgorithmException,
TimeoutException
MysqlDataSource 复制的描述
MysqlDataSource 中的 openIOException
NoSuchAlgorithmException
TimeoutException
public OKPacket update(String query)
throws IOException
MysqlDataSource 复制的描述
MysqlDataSource 中的 updateIOException
public ResultSetPacket query(String query)
throws IOException
MysqlDataSource 复制的描述
MysqlDataSource 中的 queryIOException
public TableMeta queryTableMeta(String tableFullName)
throws IOException,
NoSuchAlgorithmException
ColumnMeta列表返回:
mysql> show full fields from City; +------------+----------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +------------+----------+------+-----+---------+----------------+ | Id | int(11) | NO | PRI | NULL | auto_increment | | Name | char(35) | NO | | | | | Country | char(3) | NO | UNI | | | | District | char(20) | YES | MUL | | | | Population | int(11) | NO | | 0 | | +------------+----------+------+-----+---------+----------------+ 5 rows in set (0.00 sec)
MysqlDataSource 中的 queryTableMetatableFullName - 表全名
IOException
NoSuchAlgorithmExceptionpublic String getIpAddress()
MysqlDataSource 复制的描述
MysqlDataSource 中的 getIpAddresspublic int getPort()
MysqlDataSource 复制的描述
MysqlDataSource 中的 getPortprotected void closeSocket(Socket socket)
socket -
protected void printMysqlInfo()
throws IOException
IOException
protected Socket getNewSocket()
throws IOException,
NoSuchAlgorithmException,
TimeoutException
IOException
NoSuchAlgorithmException
TimeoutException
protected OKPacket update(Socket socket,
String query)
throws IOException
socket - query -
IOException
protected Socket updateSettings(Socket socket)
throws IOException
socket -
IOExceptionpublic DatasourceConfigure getConf()
public void setConf(DatasourceConfigure conf)
|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||