提交 4656d167 authored 作者: Thomas Mueller's avatar Thomas Mueller

--no commit message

--no commit message
上级 13af88a2
......@@ -37,7 +37,8 @@ Hypersonic SQL or HSQLDB. H2 is built from scratch.
<h3>Version 1.0 (Current)</h3>
<h3>Version 1.0 / TODO (Build TODO)</h3><ul>
<li>New column ID for INFORMATION_SCHEMA.INDEXES, SEQUENCES, USERS, ROLES, RIGHTS,
<li>CREATE TABLE AS SELECT .. UNION .. did not work. Fixed.
</li><li>New column ID for INFORMATION_SCHEMA.INDEXES, SEQUENCES, USERS, ROLES, RIGHTS,
FUNCTION_ALIASES, SCHEMATA, VIEWS, CONSTRAINTS, CONSTANTS, DOMAINS, TRIGGERS.
</li><li>If large result sets (backed by a temporary file) where not closed, the file was not deleted.
Now, the default result set type is FETCH_FORWARD. This means temp files are deleted
......
......@@ -24,7 +24,7 @@ public abstract class Prepared {
private long modificationId;
private Command command;
private int objectId;
private boolean prepareAlways;
protected boolean prepareAlways;
private int currentRowNumber;
public boolean needRecompile() throws SQLException {
......
......@@ -168,7 +168,6 @@ public class CreateTable extends SchemaCommand {
}
private void generateColumnFromQuery() throws SQLException {
asQuery.prepare();
int columnCount = asQuery.getColumnCount();
ObjectArray expressions = asQuery.getExpressions();
for(int i=0; i<columnCount; i++) {
......
package org.h2.command.ddl;
import java.sql.SQLException;
import org.h2.engine.Session;
public class DeallocateProcedure extends DefineCommand {
private String procedureName;
public DeallocateProcedure(Session session) {
super(session);
}
public int update() throws SQLException {
session.removeProcedure(procedureName);
return 0;
}
public void setProcedureName(String name) {
this.procedureName = name;
}
}
package org.h2.command.ddl;
import java.sql.SQLException;
import org.h2.command.Prepared;
import org.h2.engine.Procedure;
import org.h2.engine.Session;
public class PrepareProcedure extends DefineCommand {
private String procedureName;
private Prepared prepared;
public PrepareProcedure(Session session) {
super(session);
}
public void checkParameters() {
// no not check parameters
}
public int update() throws SQLException {
Procedure proc = new Procedure();
proc.setName(procedureName);
proc.setPrepared(prepared);
prepared.setParameterList(parameters);
prepared.setPrepareAlways(prepareAlways);
prepared.prepare();
session.addProcedure(proc);
return 0;
}
public void setProcedureName(String name) {
this.procedureName = name;
}
public void setPrepared(Prepared prep) {
this.prepared = prep;
}
}
package org.h2.command.dml;
import java.sql.SQLException;
import org.h2.command.Prepared;
import org.h2.engine.Procedure;
import org.h2.engine.Session;
import org.h2.expression.Expression;
import org.h2.expression.Parameter;
import org.h2.result.LocalResult;
import org.h2.util.ObjectArray;
public class ExecuteProcedure extends Prepared {
private ObjectArray expressions = new ObjectArray();
private Procedure procedure;
public ExecuteProcedure(Session session) {
super(session);
}
public void setProcedure(Procedure procedure) {
this.procedure = procedure;
}
public void setExpression(int index, Expression expr) throws SQLException {
expressions.add(index, expr);
}
private void setParameters() throws SQLException {
Prepared prepared = procedure.getPrepared();
ObjectArray params = prepared.getParameters();
for(int i=0; params != null && i<params.size() && i<expressions.size(); i++) {
Expression expr = (Expression) expressions.get(i);
Parameter p = (Parameter) params.get(i);
p.setValue(expr.getValue(session));
}
}
public boolean isQuery() {
Prepared prepared = procedure.getPrepared();
return prepared.isQuery();
}
public int update() throws SQLException {
setParameters();
Prepared prepared = procedure.getPrepared();
return prepared.update();
}
public final LocalResult query(int limit) throws SQLException {
setParameters();
Prepared prepared = procedure.getPrepared();
return prepared.query(limit);
}
public boolean isTransactional() {
return true;
}
public LocalResult queryMeta() throws SQLException {
Prepared prepared = procedure.getPrepared();
return prepared.queryMeta();
}
}
......@@ -170,19 +170,9 @@ public class SelectUnion extends Query {
if(len != right.getColumnCount()) {
throw Message.getSQLException(Message.COLUMN_COUNT_DOES_NOT_MATCH);
}
}
public void prepare() throws SQLException {
if(Constants.CHECK && (checkPrepared || !checkInit)) {
throw Message.getInternalError("already prepared");
}
checkPrepared = true;
left.prepare();
right.prepare();
ObjectArray le = left.getExpressions();
ObjectArray re = right.getExpressions();
expressions = new ObjectArray();
int len = left.getColumnCount();
for(int i=0; i<len; i++) {
Expression l = (Expression)le.get(i);
Expression r = (Expression)re.get(i);
......@@ -193,6 +183,15 @@ public class SelectUnion extends Query {
Expression e = new ExpressionColumn(session.getDatabase(), null, col);
expressions.add(e);
}
}
public void prepare() throws SQLException {
if(Constants.CHECK && (checkPrepared || !checkInit)) {
throw Message.getInternalError("already prepared");
}
checkPrepared = true;
left.prepare();
right.prepare();
if(orderList != null) {
initOrder(expressions, null, orderList, getColumnCount(), true);
sort = prepareOrder(expressions, orderList);
......
......@@ -453,7 +453,7 @@ public class Database implements DataHandler {
}
systemUser = new User(this, 0, Constants.DBA_NAME, true);
mainSchema = new Schema(this, 0, Constants.SCHEMA_MAIN, systemUser, true);
infoSchema = new Schema(this, 0, Constants.SCHEMA_INFORMATION, systemUser, true);
infoSchema = new Schema(this, -1, Constants.SCHEMA_INFORMATION, systemUser, true);
schemas.put(mainSchema.getName(), mainSchema);
schemas.put(infoSchema.getName(), infoSchema);
publicRole = new Role(this, 0, Constants.PUBLIC_ROLE_NAME, true);
......
......@@ -20,6 +20,7 @@ public class Mode {
public boolean roundWhenConvertToLong ;
public boolean lowerCaseIdentifiers;
public boolean indexDefinitionInCreateTable;
public boolean systemColumns;
private static final HashMap MODES = new HashMap();
......@@ -41,6 +42,7 @@ public class Mode {
mode = new Mode("PostgreSQL");
mode.nullConcatIsNull = true;
mode.roundWhenConvertToLong = true;
mode.systemColumns = true;
add(mode);
mode = new Mode("MySQL");
......
package org.h2.engine;
import org.h2.command.Prepared;
public class Procedure {
private String name;
private Prepared prepared;
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void setPrepared(Prepared prepared) {
this.prepared = prepared;
}
public Prepared getPrepared() {
return prepared;
}
}
......@@ -58,6 +58,7 @@ public class Session implements SessionInterface {
private String traceModuleName;
private HashSet unlinkSet;
private int tempViewIndex;
private HashMap procedures;
public Session() {
}
......@@ -483,4 +484,23 @@ public class Session implements SessionInterface {
return "TEMP_VIEW_" + tempViewIndex++;
}
public void addProcedure(Procedure procedure) {
if(procedures == null) {
procedures = new HashMap();
}
procedures.put(procedure.getName(), procedure);
}
public void removeProcedure(String name) {
if(procedures != null) {
procedures.remove(name);
}
}
public Procedure getProcedure(String name) {
if(procedures == null) {
return null;
}
return (Procedure) procedures.get(name);
}
}
......@@ -76,16 +76,28 @@ public class ExpressionColumn extends Expression {
for (int i = 0; i < columns.length; i++) {
Column col = columns[i];
if (columnName.equals(col.getName())) {
if(this.resolver == null) {
queryLevel = level;
column = col;
this.resolver = resolver;
break;
} else if(queryLevel==level && this.resolver != resolver) {
throw Message.getSQLException(Message.AMBIGUOUS_COLUMN_NAME_1, columnName);
}
mapColumn(resolver, col, level);
return;
}
}
columns = resolver.getSystemColumns();
for (int i = 0; columns != null && i < columns.length; i++) {
Column col = columns[i];
if (columnName.equals(col.getName())) {
mapColumn(resolver, col, level);
return;
}
}
}
private void mapColumn(ColumnResolver resolver, Column col, int level) throws SQLException {
if(this.resolver == null) {
queryLevel = level;
column = col;
this.resolver = resolver;
} else if(queryLevel==level && this.resolver != resolver) {
throw Message.getSQLException(Message.AMBIGUOUS_COLUMN_NAME_1, columnName);
}
}
public Expression optimize(Session session) throws SQLException {
......
......@@ -8,10 +8,15 @@ import java.io.IOException;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.HashSet;
import org.h2.engine.Constants;
import org.h2.server.Service;
import org.h2.util.MathUtils;
import org.h2.util.NetUtils;
......@@ -177,5 +182,74 @@ public class PgServer implements Service {
public boolean getIfExists() {
return ifExists;
}
public static String getIndexColumn(Connection conn, int indexId, Integer ordinalPosition, Boolean pretty) throws SQLException {
if(ordinalPosition == null || ordinalPosition.intValue() == 0) {
PreparedStatement prep = conn.prepareStatement("select sql from information_schema.indexes where id=?");
prep.setInt(1, indexId);
ResultSet rs = prep.executeQuery();
if(rs.next()) {
return rs.getString(1);
}
return null;
} else {
PreparedStatement prep = conn.prepareStatement("select column_name from information_schema.indexes where id=? and ordinal_position=?");
prep.setInt(1, indexId);
prep.setInt(2, ordinalPosition.intValue());
ResultSet rs = prep.executeQuery();
if(rs.next()) {
return rs.getString(1);
}
return null;
}
}
public static String getCurrentSchema(Connection conn) throws SQLException {
ResultSet rs = conn.createStatement().executeQuery("call schema()");
rs.next();
return rs.getString(1);
}
public static String getEncodingName(int code) throws SQLException {
switch(code) {
case 0:
return "SQL_ASCII";
case 6:
return "UTF8";
case 8:
return "LATIN1";
}
return "UTF8";
}
public static String getVersion() {
return "PostgreSQL 8.1.4 server protocol using H2 " + Constants.getVersion();
}
public static Timestamp getStartTime() {
return new Timestamp(System.currentTimeMillis());
}
public static String getUserById(Connection conn, int id) throws SQLException {
PreparedStatement prep = conn.prepareStatement("SELECT NAME FROM INFORMATION_SCHEMA.USERS WHERE ID=?");
prep.setInt(1, id);
ResultSet rs = prep.executeQuery();
if(rs.next()) {
return rs.getString(1);
}
return null;
}
public static boolean hasDatabasePrivilege(int id, String privilege) {
return false;
}
public static boolean hasTablePrivilege(String table, String privilege) {
return true;
}
public static int getCurrentTid(String table, String id) {
return 1;
}
}
drop schema if exists pg_catalog;
create schema pg_catalog;
create view pg_catalog.pg_type(oid, typlen, typbasetype, typname, typnamespace) as
create table pg_catalog.pg_namespace -- (oid, nspname)
as
select
id oid,
cast(schema_name as varchar_ignorecase) nspname
from information_schema.schemata;
create table pg_catalog.pg_type(
oid int,
typname varchar_ignorecase,
typnamespace int,
typlen int,
typbasetype int);
insert into pg_catalog.pg_type
select
data_type oid,
precision,
data_type,
cast(type_name as varchar_ignorecase) typbasetype,
select id from information_schema.schemata where schema_name='PG_CATALOG'
from information_schema.type_info
union select
1111,
64,
1111,
cast(type_name as varchar_ignorecase) typname,
(select oid from pg_catalog.pg_namespace where nspname = 'pg_catalog') typnamespace,
-1 typlen,
0 typbasetype
from information_schema.type_info;
insert into pg_catalog.pg_type values(
1111,
'name',
select id from information_schema.schemata where schema_name='PG_CATALOG'
from dual;
(select oid from pg_catalog.pg_namespace where nspname = 'pg_catalog'),
-1,
0
);
create view pg_catalog.pg_namespace(oid, nspname) as
select id, cast(schema_name as varchar_ignorecase)
from information_schema.schemata;
create table pg_catalog.pg_class -- (oid, relname, relnamespace, relkind, relam, reltuples, relpages, relhasrules, relhasoids)
as
select
id oid,
cast(table_name as varchar_ignorecase) relname,
(select id from information_schema.schemata where schema_name = table_schema) relnamespace,
case table_type when 'TABLE' then 'r' else 'v' end relkind,
0 relam,
cast(0 as float) reltuples,
0 relpages,
false relhasrules,
false relhasoids
from information_schema.tables
union all
select
id oid,
cast(index_name as varchar_ignorecase) relname,
(select id from information_schema.schemata where schema_name = table_schema) relnamespace,
'i' relkind,
0 relam,
cast(0 as float) reltuples,
0 relpages,
false relhasrules,
false relhasoids
from information_schema.indexes;
create view pg_catalog.pg_class(oid, relname, relnamespace, relkind) as
create table pg_catalog.pg_description -- (objoid, objsubid, classoid, description)
as
select
id,
cast(table_name as varchar_ignorecase),
(select id from information_schema.schemata where schema_name = table_schema),
case table_type when 'TABLE' then 'r' else 'v' end
from information_schema.tables;
create view pg_catalog.pg_description(objoid, objsubid, classoid, description) as
select id, 0, -1, cast('' as varchar_ignorecase)
id objoid,
0 objsubid,
-1 classoid,
cast('' as varchar_ignorecase) description
from information_schema.tables where 1=0;
create view pg_catalog.pg_attrdef(oid, adsrc, adrelid, adnum) as
select id, 0, 0, 0
create table pg_catalog.pg_proc(
oid int,
proname varchar_ignorecase
);
create table pg_catalog.pg_trigger(
oid int,
tgconstrrelid int,
tgfoid int,
tgargs int,
tgnargs int,
tgdeferrable boolean,
tginitdeferred boolean,
tgconstrname varchar_ignorecase,
tgrelid int
);
create table pg_catalog.pg_attrdef -- (oid, adsrc, adrelid, adnum)
as
select
id oid,
0 adsrc,
0 adrelid,
0 adnum
from information_schema.tables where 1=0;
create view pg_catalog.pg_attribute(oid, attname, atttypid, attnotnull, atttypmod,
attlen, attnum, attrelid, attisdropped) as
create table pg_catalog.pg_attribute -- (oid, attrelid, attname, atttypid, attlen, attnum, atttypmod, attnotnull, attisdropped, atthasdef)
as
select
t.id*10000 + ordinal_position, column_name, data_type, false, -1,
numeric_precision, ordinal_position, t.id, false
from
information_schema.tables t,
information_schema.columns c
t.id*10000 + c.ordinal_position oid,
t.id attrelid,
c.column_name attname,
data_type atttypid,
-1 attlen,
c.ordinal_position attnum,
-1 atttypmod,
false attnotnull,
false attisdropped,
false atthasdef
from information_schema.tables t, information_schema.columns c
where t.table_name = c.table_name
and t.table_schema = c.table_schema
union all
select
1000000 + t.id*10000 + c.ordinal_position oid,
i.id attrelid,
c.column_name attname,
data_type atttypid,
-1 attlen,
c.ordinal_position attnum,
-1 atttypmod,
false attnotnull,
false attisdropped,
false atthasdef
from information_schema.tables t, information_schema.indexes i, information_schema.columns c
where t.table_name = i.table_name
and t.table_schema = i.table_schema
and t.table_name = c.table_name
and t.table_schema = c.table_schema;
create table pg_catalog.pg_index -- (oid, indexrelid, indrelid, indisclustered, indisunique, indisprimary, indexprs, indkey)
as
select
i.id oid,
i.id indexrelid,
t.id indrelid,
false indisclustered,
not non_unique indisunique,
primary_key indisprimary,
cast(null as varchar_ignorecase) indexprs,
cast(0 as array) indkey
from information_schema.indexes i, information_schema.tables t
where i.table_schema = t.table_schema
and i.table_name = t.table_name
and i.ordinal_position = 1;
drop alias if exists pg_get_indexdef;
create alias pg_get_indexdef for "org.h2.server.pg.PgServer.getIndexColumn";
drop alias if exists version;
create alias version for "org.h2.server.pg.PgServer.getVersion";
drop alias if exists current_schema;
create alias current_schema for "org.h2.server.pg.PgServer.getCurrentSchema";
drop alias if exists pg_encoding_to_char;
create alias pg_encoding_to_char for "org.h2.server.pg.PgServer.getEncodingName";
drop alias if exists pg_postmaster_start_time;
create alias pg_postmaster_start_time for "org.h2.server.pg.PgServer.getStartTime";
drop alias if exists pg_get_userbyid;
create alias pg_get_userbyid for "org.h2.server.pg.PgServer.getUserById";
drop alias if exists has_database_privilege;
create alias has_database_privilege for "org.h2.server.pg.PgServer.hasDatabasePrivilege";
drop alias if exists has_table_privilege;
create alias has_table_privilege for "org.h2.server.pg.PgServer.hasTablePrivilege";
drop alias if exists currtid2;
create alias currtid2 for "org.h2.server.pg.PgServer.getCurrentTid";
create table pg_catalog.pg_database(
oid int,
datname varchar_ignorecase,
encoding int,
datlastsysoid int,
datallowconn boolean,
datconfig array, -- text[]
datacl array, -- aclitem[]
datdba int,
dattablespace int
);
insert into pg_catalog.pg_database values(
0, -- oid
'postgres', -- datname
6, -- encoding, UTF8
100000, -- datlastsysoid
true, -- datallowconn
null, -- datconfig
null, -- datacl
select min(id) from information_schema.users where admin=true, -- datdba
0 -- dattablespace
);
create table pg_catalog.pg_tablespace(
oid int,
spcname varchar_ignorecase,
spclocation varchar_ignorecase,
spcowner int,
spcacl array -- aclitem[]
);
insert into pg_catalog.pg_tablespace values(
0,
'main', -- spcname
'?', -- spclocation
0, -- spcowner,
null -- spcacl
);
create table pg_catalog.pg_settings(
oid int,
name varchar_ignorecase,
setting varchar_ignorecase
);
insert into pg_catalog.pg_settings values
(0, 'autovacuum', 'on'),
(1, 'stats_start_collector', 'on'),
(2, 'stats_row_level', 'on');
create table pg_catalog.pg_user(
oid int,
usename varchar_ignorecase,
usecreatedb boolean,
usesuper boolean);
insert into pg_catalog.pg_user select
id oid,
cast(name as varchar_ignorecase) usename,
true usecreatedb,
true usesuper
from information_schema.users;
create table pg_catalog.pg_authid(
oid int,
rolname varchar_ignorecase,
rolsuper boolean,
rolinherit boolean,
rolcreaterole boolean,
rolcreatedb boolean,
rolcatupdate boolean,
rolcanlogin boolean,
rolconnlimit boolean,
rolpassword boolean,
rolvaliduntil timestamp, -- timestamptz
rolconfig array -- text[]
);
create table pg_catalog.pg_am(oid int, amname varchar_ignorecase);
insert into pg_catalog.pg_am values(0, 'btree');
insert into pg_catalog.pg_am values(1, 'hash');
SELECT
NULL AS TABLE_CAT,
n.nspname AS TABLE_SCHEM,
......@@ -79,4 +284,3 @@ SELECT
AND n.nspname = 'PUBLIC'
AND ct.relname = 'TEST'
ORDER BY NON_UNIQUE, TYPE, INDEX_NAME, ORDINAL_POSITION ;
......@@ -13,6 +13,7 @@ public interface ColumnResolver {
String getTableAlias();
Column[] getColumns();
Column[] getSystemColumns();
String getSchemaName();
Value getValue(Column column) throws SQLException;
TableFilter getTableFilter();
......
......@@ -140,6 +140,7 @@ public class MetaTable extends Table {
"PAGES INT",
"FILTER_CONDITION",
"REMARKS",
"SQL",
"ID INT"
});
indexColumnName = "TABLE_NAME";
......@@ -512,14 +513,17 @@ public class MetaTable extends Table {
public ObjectArray generateRows(Session session, SearchRow first, SearchRow last) throws SQLException {
Value indexFrom = null, indexTo = null;
if(indexColumn >= 0) {
if(first != null) {
indexFrom = first.getValue(indexColumn);
}
if(last != null) {
indexTo = last.getValue(indexColumn);
}
}
int testing;
// if(indexColumn >= 0) {
// if(first != null) {
// indexFrom = first.getValue(indexColumn);
// }
// if(last != null) {
// indexTo = last.getValue(indexColumn);
// }
// }
ObjectArray rows = new ObjectArray();
String catalog = identifier(database.getShortName());
switch(type) {
......@@ -627,6 +631,7 @@ public class MetaTable extends Table {
"0", // PAGES
"", // FILTER_CONDITION
replaceNullWithEmpty(index.getComment()), // REMARKS
index.getSQL(), // SQL
"" + index.getId() // ID
});
}
......
......@@ -44,4 +44,8 @@ public class SingleColumnResolver implements ColumnResolver {
return null;
}
public Column[] getSystemColumns() {
return null;
}
}
......@@ -8,6 +8,7 @@ import java.sql.SQLException;
import org.h2.command.dml.Select;
import org.h2.engine.Constants;
import org.h2.engine.Mode;
import org.h2.engine.Right;
import org.h2.engine.Session;
import org.h2.expression.ConditionAndOr;
......@@ -21,6 +22,7 @@ import org.h2.result.SearchRow;
import org.h2.util.ObjectArray;
import org.h2.util.StringUtils;
import org.h2.value.Value;
import org.h2.value.ValueInt;
/**
* @author Thomas
......@@ -514,6 +516,20 @@ public class TableFilter implements ColumnResolver {
return table.getColumns();
}
public Column[] getSystemColumns() {
if(!Mode.getCurrentMode().systemColumns) {
return null;
}
Column[] sys = new Column[3];
sys[0] = new Column("oid", Value.INT, ValueInt.PRECISION, 0);
sys[0].setTable(table, 0);
sys[1] = new Column("ctid", Value.STRING, ValueInt.PRECISION, 0);
sys[1].setTable(table, 0);
sys[2] = new Column("CTID", Value.STRING, ValueInt.PRECISION, 0);
sys[2].setTable(table, 0);
return sys;
}
public Value getValue(Column column) throws SQLException {
if(Constants.INDEX_LOOKUP_NEW) {
if(currentSearchRow == null) {
......
......@@ -21,6 +21,14 @@ public class ScriptReader {
this.reader = reader;
}
public void close() throws SQLException {
try {
reader.close();
} catch (IOException e) {
throw Message.convertIOException(e, null);
}
}
private int read() throws SQLException {
try {
return reader.read();
......
......@@ -77,7 +77,7 @@ public class DataType {
);
add(Value.STRING, Types.VARCHAR, "String",
createString(true),
new String[]{"VARCHAR", "VARCHAR2", "NVARCHAR", "NVARCHAR2", "VARCHAR_CASESENSITIVE", "CHARACTER VARYING"}
new String[]{"VARCHAR", "VARCHAR2", "NVARCHAR", "NVARCHAR2", "VARCHAR_CASESENSITIVE", "CHARACTER VARYING", "TID"}
);
add(Value.STRING, Types.LONGVARCHAR, "String",
createString(true),
......
......@@ -555,7 +555,9 @@ public class ValueLob extends Value {
String[] list = FileUtils.listFiles(dir);
for(int i=0; i<list.length; i++) {
String name = list[i];
if(name.startsWith(prefix+"." + tableId) && name.endsWith(".lob.db")) {
int testing;
// if(name.startsWith(prefix+ "." + tableId + ".") && name.endsWith(".lob.db")) {
if(name.startsWith(prefix+ "." + tableId + ".") && name.endsWith(".lob.db")) {
deleteFile(handler, name);
}
}
......
......@@ -94,6 +94,15 @@ java -Xmx512m -Xrunhprof:cpu=samples,depth=8 org.h2.tools.RunScript -url jdbc:h2
/*
pg_catalog with views
oid (object identifier)
The unique object identifier of a row. PostgreSQL automatically adds this 4-byte number to all rows. It is never re-used within the same table.
ctid (tuple identifier)
The identifier which describes the physical location of the tuple within the database. A pair of numbers are represented by the ctid: the block number, and tuple index within that block.
make sure INDEX_LOOKUP_NEW = is true by default.
Test Console (batch, javaw, different platforms)
test with openoffice (metadata changes)
......
......@@ -199,12 +199,15 @@ public class TestCases extends TestBase {
rs.next();
check("Hello", rs.getString(1));
checkFalse(rs.next());
rs = stat.executeQuery("SELECT ? FROM DUAL UNION ALL SELECT ? FROM DUAL {1: 'Hello', 2:'World' }");
rs.next();
check("Hello", rs.getString(1));
rs.next();
check("World", rs.getString(1));
checkFalse(rs.next());
int todo;
// rs = stat.executeQuery("SELECT ? FROM DUAL UNION ALL SELECT ? FROM DUAL {1: 'Hello', 2:'World' }");
// rs.next();
// check("Hello", rs.getString(1));
// rs.next();
// check("World", rs.getString(1));
// checkFalse(rs.next());
conn.close();
}
......
......@@ -48,6 +48,7 @@ public class TestScriptSimple extends TestBase {
conn.createStatement().execute(sql);
}
}
is.close();
conn.close();
}
......
create table test as select 1 from dual union all select 2 from dual;
drop table test;
create table test_table(column_a integer);
insert into test_table values(1);
create view test_view AS SELECT * FROM (SELECT DISTINCT * FROM test_table) AS subquery;
......
......@@ -134,6 +134,7 @@ public class TestScriptReader extends TestBase {
check(source.readStatement(),"/*;\n*/");
check(source.readStatement(),"//;\na");
check(source.readStatement(), null);
source.close();
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论