/*
Copyright (C) 2002 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package com.mysql.jdbc;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Types;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.StringTokenizer;
import java.util.TreeMap;
/**
* JDBC Interface to Mysql functions
*
* <p>
* This class provides information about the database as a whole.
* </p>
*
* <p>
* Many of the methods here return lists of information in ResultSets. You can
* use the normal ResultSet methods such as getString and getInt to retrieve
* the data from these ResultSets. If a given form of metadata is not
* available, these methods show throw a java.sql.SQLException.
* </p>
*
* <p>
* Some of these methods take arguments that are String patterns. These
* methods all have names such as fooPattern. Within a pattern String "%"
* means match any substring of 0 or more characters and "_" means match any
* one character.
* </p>
*
* @author Mark Matthews
* @version $Id: DatabaseMetaData.java,v 1.27.2.34 2004/02/04 02:47:36 mmatthew Exp $
*/
public class DatabaseMetaData implements java.sql.DatabaseMetaData {
private static final byte[] TABLE_AS_BYTES = "TABLE".getBytes();
/** The table type for generic tables that support foreign keys. */
private static final String SUPPORTS_FK = "SUPPORTS_FK";
//
// Column indexes used by all DBMD foreign key
// ResultSets
//
private static final int PKTABLE_CAT = 0;
private static final int PKTABLE_SCHEM = 1;
private static final int PKTABLE_NAME = 2;
private static final int PKCOLUMN_NAME = 3;
private static final int FKTABLE_CAT = 4;
private static final int FKTABLE_SCHEM = 5;
private static final int FKTABLE_NAME = 6;
private static final int FKCOLUMN_NAME = 7;
private static final int KEY_SEQ = 8;
private static final int UPDATE_RULE = 9;
private static final int DELETE_RULE = 10;
private static final int FK_NAME = 11;
private static final int PK_NAME = 12;
private static final int DEFERRABILITY = 13;
/** The connection to the database */
private Connection conn;
/** The 'current' database name being used */
private String database = null;
/** What character to use when quoting identifiers */
private String quotedId = null;
/**
* Creates a new DatabaseMetaData object.
*
* @param conn DOCUMENT ME!
* @param database DOCUMENT ME!
*/
public DatabaseMetaData(Connection conn, String database) {
this.conn = conn;
this.database = database;
try {
this.quotedId = this.conn.supportsQuotedIdentifiers()
? getIdentifierQuoteString() : "";
} catch (SQLException sqlEx) {
// Forced by API, never thrown from getIdentifierQuoteString() in this
// implementation.
AssertionFailedException.shouldNotHappen(sqlEx);
}
}
/**
* @see DatabaseMetaData#getAttributes(String, String, String, String)
*/
public java.sql.ResultSet getAttributes(String arg0, String arg1,
String arg2, String arg3) throws SQLException {
Field[] fields = new Field[21];
fields[0] = new Field("", "TYPE_CAT", Types.CHAR, 32);
fields[1] = new Field("", "TYPE_SCHEM", Types.CHAR, 32);
fields[2] = new Field("", "TYPE_NAME", Types.CHAR, 32);
fields[3] = new Field("", "ATTR_NAME", Types.CHAR, 32);
fields[4] = new Field("", "DATA_TYPE", Types.SMALLINT, 32);
fields[5] = new Field("", "ATTR_TYPE_NAME", Types.CHAR, 32);
fields[6] = new Field("", "ATTR_SIZE", Types.INTEGER, 32);
fields[7] = new Field("", "DECIMAL_DIGITS", Types.INTEGER, 32);
fields[8] = new Field("", "NUM_PREC_RADIX", Types.INTEGER, 32);
fields[9] = new Field("", "NULLABLE ", Types.INTEGER, 32);
fields[10] = new Field("", "REMARKS", Types.CHAR, 32);
fields[11] = new Field("", "ATTR_DEF", Types.CHAR, 32);
fields[12] = new Field("", "SQL_DATA_TYPE", Types.INTEGER, 32);
fields[13] = new Field("", "SQL_DATETIME_SUB", Types.INTEGER, 32);
fields[14] = new Field("", "CHAR_OCTET_LENGTH", Types.INTEGER, 32);
fields[15] = new Field("", "ORDINAL_POSITION", Types.INTEGER, 32);
fields[16] = new Field("", "IS_NULLABLE", Types.CHAR, 32);
fields[17] = new Field("", "SCOPE_CATALOG", Types.CHAR, 32);
fields[18] = new Field("", "SCOPE_SCHEMA", Types.CHAR, 32);
fields[19] = new Field("", "SCOPE_TABLE", Types.CHAR, 32);
fields[20] = new Field("", "SOURCE_DATA_TYPE", Types.SMALLINT, 32);
return buildResultSet(fields, new ArrayList());
}
/**
* Get a description of a table's optimal set of columns that uniquely
* identifies a row. They are ordered by SCOPE.
*
* <P>
* Each column description has the following columns:
*
* <OL>
* <li>
* <B>SCOPE</B> short => actual scope of result
*
* <UL>
* <li>
* bestRowTemporary - very temporary, while using row
* </li>
* <li>
* bestRowTransaction - valid for remainder of current transaction
* </li>
* <li>
* bestRowSession - valid for remainder of current session
* </li>
* </ul>
*
* </li>
* <li>
* <B>COLUMN_NAME</B> String => column name
* </li>
* <li>
* <B>DATA_TYPE</B> short => SQL data type from java.sql.Types
* </li>
* <li>
* <B>TYPE_NAME</B> String => Data source dependent type name
* </li>
* <li>
* <B>COLUMN_SIZE</B> int => precision
* </li>
* <li>
* <B>BUFFER_LENGTH</B> int => not used
* </li>
* <li>
* <B>DECIMAL_DIGITS</B> short => scale
* </li>
* <li>
* <B>PSEUDO_COLUMN</B> short => is this a pseudo column like an Oracle
* ROWID
*
* <UL>
* <li>
* bestRowUnknown - may or may not be pseudo column
* </li>
* <li>
* bestRowNotPseudo - is NOT a pseudo column
* </li>
* <li>
* bestRowPseudo - is a pseudo column
* </li>
* </ul>
*
* </li>
* </ol>
* </p>
*
* @param catalog a catalog name; "" retrieves those without a catalog
* @param schema a schema name; "" retrieves those without a schema
* @param table a table name
* @param scope the scope of interest; use same values as SCOPE
* @param nullable include columns that are nullable?
*
* @return ResultSet each row is a column description
*
* @throws java.sql.SQLException DOCUMENT ME!
*/
public java.sql.ResultSet getBestRowIdentifier(String catalog,
String schema, String table, int scope, boolean nullable)
throws java.sql.SQLException {
Field[] fields = new Field[8];
fields[0] = new Field("", "SCOPE", Types.SMALLINT, 5);
fields[1] = new Field("", "COLUMN_NAME", Types.CHAR, 32);
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
2-1.rar 在线购物程序 jsp 2-1.rar 在线购物程序 jsp2-1.rar 在线购物程序 jsp2-1.rar 在线购物程序 jsp2-1.rar 在线购物程序 jsp2-1.rar 在线购物程序 jsp2-1.rar 在线购物程序 jsp2-1.rar 在线购物程序 jsp2-1.rar 在线购物程序 jsp
资源推荐
资源详情
资源评论
收起资源包目录
2-1.rar 在线购物程序 jsp (537个子文件)
buy.jsp.bak 3KB
buy.jsp.bak 3KB
sub.inc.bak 790B
sub.inc.bak 790B
DatabaseMetaData.class 61KB
Connection.class 38KB
ResultSet.class 38KB
PreparedStatement.class 33KB
MysqlIO.class 31KB
TimeUtil.class 30KB
UpdatableResultSet.class 25KB
Connection$UltraDevWorkAround.class 20KB
Statement.class 16KB
op_buy.class 13KB
op_buy.class 13KB
index_jsp.class 12KB
NonRegisteringDriver.class 12KB
op_book.class 11KB
op_book.class 11KB
PreparedStatementWrapper.class 9KB
op_user.class 9KB
op_user.class 9KB
ConnectionWrapper.class 9KB
Buffer.class 9KB
StatementWrapper.class 8KB
EscapeProcessor.class 8KB
HttpServlet.class 8KB
Field.class 7KB
StringUtils.class 7KB
SQLError.class 6KB
MysqlDataSource.class 5KB
ResultSetMetaData.class 5KB
MysqlDefs.class 5KB
RowDataDynamic.class 5KB
Util.class 5KB
NoBodyResponse.class 5KB
CharsetMapping.class 5KB
Clob.class 4KB
HttpUtils.class 4KB
Security.class 4KB
PreparedStatement$ParseInfo.class 4KB
StandardSocketFactory.class 4KB
op_bookclass.class 4KB
op_bookclass.class 4KB
Cookie.class 3KB
Cookie.class 3KB
CompressedInputStream.class 3KB
Blob.class 3KB
SingleByteCharsetConverter.class 3KB
TagSupport.class 3KB
book.class 3KB
book.class 3KB
ServletOutputStream.class 3KB
ServletOutputStream.class 3KB
Debug.class 3KB
TagInfo.class 3KB
MysqlPooledConnection.class 3KB
RowDataStatic.class 3KB
user.class 3KB
user.class 3KB
MysqlDataSourceFactory.class 3KB
HttpServletResponse.class 3KB
order.class 3KB
order.class 3KB
login.class 2KB
login.class 2KB
PageContext.class 2KB
dataFormat.class 2KB
dataFormat.class 2KB
GenericServlet.class 2KB
BaseBugReport.class 2KB
EscapeTokenizer.class 2KB
TimezoneDump.class 2KB
NamedPipeSocketFactory$NamedPipeSocket.class 2KB
NamedPipeSocketFactory.class 2KB
TagAttributeInfo.class 2KB
TagLibraryInfo.class 2KB
DataBase.class 2KB
DataBase.class 2KB
TagData.class 2KB
BodyTagSupport.class 1KB
JspWriter.class 1KB
NamedPipeSocketFactory$RandomAccessFileInputStream.class 1KB
UnavailableException.class 1KB
MiniAdmin.class 1KB
ServletContext.class 1KB
NoBodyOutputStream.class 1KB
NamedPipeSocketFactory$RandomAccessFileOutputStream.class 1KB
PreparedStatement$BatchParams.class 1KB
MysqlConnectionPoolDataSource.class 1KB
ServletRequest.class 1KB
ServletRequest.class 1KB
HttpServletRequest.class 1KB
HttpServletRequest.class 1KB
allorder.class 1KB
allorder.class 1KB
BodyContent.class 1KB
RowData.class 1KB
VariableInfo.class 1016B
TagExtraInfo.class 995B
共 537 条
- 1
- 2
- 3
- 4
- 5
- 6
资源评论
- sapphire8462012-09-04挺好的,不过分部分下载源码太麻烦了,所以我就去买了本实体书。
wang_df_cn
- 粉丝: 0
- 资源: 49
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功