提交 bebb211e authored 作者: Thomas Mueller's avatar Thomas Mueller

new experimental page store

上级 129a021d
...@@ -175,4 +175,8 @@ public class FunctionTable extends Table { ...@@ -175,4 +175,8 @@ public class FunctionTable extends Table {
return function.getSQL(); return function.getSQL();
} }
public long getRowCountApproximation() {
return rowCount;
}
} }
...@@ -64,6 +64,11 @@ import org.h2.value.ValueString; ...@@ -64,6 +64,11 @@ import org.h2.value.ValueString;
*/ */
public class MetaTable extends Table { public class MetaTable extends Table {
/**
* The approximate number of rows of a meta table.
*/
public static final long ROW_COUNT_APPROXIMATION = 1000;
// TODO INFORMATION_SCHEMA.tables: select table_name // TODO INFORMATION_SCHEMA.tables: select table_name
// from INFORMATION_SCHEMA.tables where TABLE_TYPE = 'BASE TABLE' // from INFORMATION_SCHEMA.tables where TABLE_TYPE = 'BASE TABLE'
...@@ -1779,4 +1784,8 @@ public class MetaTable extends Table { ...@@ -1779,4 +1784,8 @@ public class MetaTable extends Table {
return META_TABLE_TYPE_COUNT; return META_TABLE_TYPE_COUNT;
} }
public long getRowCountApproximation() {
return ROW_COUNT_APPROXIMATION;
}
} }
...@@ -164,4 +164,8 @@ public class RangeTable extends Table { ...@@ -164,4 +164,8 @@ public class RangeTable extends Table {
return null; return null;
} }
public long getRowCountApproximation() {
return 100;
}
} }
...@@ -242,6 +242,13 @@ public abstract class Table extends SchemaObjectBase { ...@@ -242,6 +242,13 @@ public abstract class Table extends SchemaObjectBase {
*/ */
public abstract long getRowCount(Session session) throws SQLException; public abstract long getRowCount(Session session) throws SQLException;
/**
* Get the approximated row count for this table.
*
* @return the approximated row count
*/
public abstract long getRowCountApproximation();
public String getCreateSQLForCopy(Table table, String quotedName) { public String getCreateSQLForCopy(Table table, String quotedName) {
throw Message.getInternalError(); throw Message.getInternalError();
} }
......
...@@ -684,4 +684,8 @@ public class TableData extends Table implements RecordReader { ...@@ -684,4 +684,8 @@ public class TableData extends Table implements RecordReader {
return containsLargeObject; return containsLargeObject;
} }
public long getRowCountApproximation() {
return scanIndex.getRowCountApproximation();
}
} }
...@@ -37,6 +37,8 @@ import org.h2.value.DataType; ...@@ -37,6 +37,8 @@ import org.h2.value.DataType;
* The table may be stored in a different database. * The table may be stored in a different database.
*/ */
public class TableLink extends Table { public class TableLink extends Table {
private static final long ROW_COUNT_APPROXIMATION = 100000;
private String driver, url, user, password, originalSchema, originalTable, qualifiedTableName; private String driver, url, user, password, originalSchema, originalTable, qualifiedTableName;
private TableLinkConnection conn; private TableLinkConnection conn;
...@@ -473,4 +475,8 @@ public class TableLink extends Table { ...@@ -473,4 +475,8 @@ public class TableLink extends Table {
return conn; return conn;
} }
public long getRowCountApproximation() {
return ROW_COUNT_APPROXIMATION;
}
} }
...@@ -31,6 +31,8 @@ import org.h2.value.Value; ...@@ -31,6 +31,8 @@ import org.h2.value.Value;
*/ */
public class TableView extends Table { public class TableView extends Table {
private static final long ROW_COUNT_APPROXIMATION = 100;
private String querySQL; private String querySQL;
private ObjectArray tables; private ObjectArray tables;
private final String[] columnNames; private final String[] columnNames;
...@@ -355,4 +357,8 @@ public class TableView extends Table { ...@@ -355,4 +357,8 @@ public class TableView extends Table {
return v; return v;
} }
public long getRowCountApproximation() {
return ROW_COUNT_APPROXIMATION;
}
} }
...@@ -30,7 +30,7 @@ create memory table test(id int); ...@@ -30,7 +30,7 @@ create memory table test(id int);
script nodata nopasswords nosettings; script nodata nopasswords nosettings;
> SCRIPT > SCRIPT
> -------------------------------------------------- > --------------------------------------------------
> -- 0 = SELECT COUNT(*) FROM PUBLIC.TEST; > -- 0 +/- SELECT COUNT(*) FROM PUBLIC.TEST;
> CREATE DOMAIN INT AS VARCHAR; > CREATE DOMAIN INT AS VARCHAR;
> CREATE MEMORY TABLE PUBLIC.TEST( ID VARCHAR ); > CREATE MEMORY TABLE PUBLIC.TEST( ID VARCHAR );
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN; > CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN;
...@@ -382,7 +382,7 @@ select * from test order by id; ...@@ -382,7 +382,7 @@ select * from test order by id;
script nopasswords nosettings; script nopasswords nosettings;
> SCRIPT > SCRIPT
> ----------------------------------------------------------------------------------------------------------------------------------------- > -----------------------------------------------------------------------------------------------------------------------------------------
> -- 3 = SELECT COUNT(*) FROM PUBLIC.TEST; > -- 3 +/- SELECT COUNT(*) FROM PUBLIC.TEST;
> CREATE MEMORY TABLE PUBLIC.TEST( ID INT, D DOUBLE, F FLOAT ); > CREATE MEMORY TABLE PUBLIC.TEST( ID INT, D DOUBLE, F FLOAT );
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN; > CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN;
> INSERT INTO PUBLIC.TEST(ID, D, F) VALUES (0, POWER(0, -1), POWER(0, -1)), (1, (-POWER(0, -1)), (-POWER(0, -1))), (2, SQRT(-1), SQRT(-1)); > INSERT INTO PUBLIC.TEST(ID, D, F) VALUES (0, POWER(0, -1), POWER(0, -1)), (1, (-POWER(0, -1)), (-POWER(0, -1))), (2, SQRT(-1), SQRT(-1));
...@@ -1609,7 +1609,7 @@ insert into test values(1, 'abc' || space(20)); ...@@ -1609,7 +1609,7 @@ insert into test values(1, 'abc' || space(20));
script nopasswords nosettings blocksize 10; script nopasswords nosettings blocksize 10;
> SCRIPT > SCRIPT
> ------------------------------------------------------------------------------------------------------------------- > -------------------------------------------------------------------------------------------------------------------
> -- 1 = SELECT COUNT(*) FROM PUBLIC.TEST; > -- 1 +/- SELECT COUNT(*) FROM PUBLIC.TEST;
> ALTER TABLE PUBLIC.TEST ADD CONSTRAINT PUBLIC.CONSTRAINT_2 PRIMARY KEY(ID); > ALTER TABLE PUBLIC.TEST ADD CONSTRAINT PUBLIC.CONSTRAINT_2 PRIMARY KEY(ID);
> CALL SYSTEM_COMBINE_BLOB(-1); > CALL SYSTEM_COMBINE_BLOB(-1);
> CREATE ALIAS IF NOT EXISTS SYSTEM_COMBINE_BLOB FOR "org.h2.command.dml.ScriptCommand.combineBlob"; > CREATE ALIAS IF NOT EXISTS SYSTEM_COMBINE_BLOB FOR "org.h2.command.dml.ScriptCommand.combineBlob";
...@@ -2014,7 +2014,7 @@ insert into test values('AA'); ...@@ -2014,7 +2014,7 @@ insert into test values('AA');
script nodata nopasswords nosettings; script nodata nopasswords nosettings;
> SCRIPT > SCRIPT
> ------------------------------------------------------------------------------- > -------------------------------------------------------------------------------
> -- 2 = SELECT COUNT(*) FROM PUBLIC.TEST; > -- 2 +/- SELECT COUNT(*) FROM PUBLIC.TEST;
> CREATE MEMORY TABLE PUBLIC.TEST( NAME VARCHAR CHECK (NAME = UPPER(NAME)) ); > CREATE MEMORY TABLE PUBLIC.TEST( NAME VARCHAR CHECK (NAME = UPPER(NAME)) );
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN; > CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN;
> rows: 3 > rows: 3
...@@ -2088,8 +2088,8 @@ select DOMAIN_NAME, COLUMN_DEFAULT, IS_NULLABLE, DATA_TYPE, PRECISION, SCALE, TY ...@@ -2088,8 +2088,8 @@ select DOMAIN_NAME, COLUMN_DEFAULT, IS_NULLABLE, DATA_TYPE, PRECISION, SCALE, TY
script nodata nopasswords nosettings; script nodata nopasswords nosettings;
> SCRIPT > SCRIPT
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ > ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> -- 1 = SELECT COUNT(*) FROM PUBLIC.ADDRESS; > -- 1 +/- SELECT COUNT(*) FROM PUBLIC.ADDRESS;
> -- 1 = SELECT COUNT(*) FROM PUBLIC.TEST; > -- 1 +/- SELECT COUNT(*) FROM PUBLIC.TEST;
> ALTER TABLE PUBLIC.ADDRESS ADD CONSTRAINT PUBLIC.CONSTRAINT_E PRIMARY KEY(ID); > ALTER TABLE PUBLIC.ADDRESS ADD CONSTRAINT PUBLIC.CONSTRAINT_E PRIMARY KEY(ID);
> CREATE DOMAIN EMAIL AS VARCHAR(200) CHECK (POSITION('@', VALUE) > 1); > CREATE DOMAIN EMAIL AS VARCHAR(200) CHECK (POSITION('@', VALUE) > 1);
> CREATE DOMAIN GMAIL AS VARCHAR(200) DEFAULT '@gmail.com' CHECK ((POSITION('@', VALUE) > 1) AND (POSITION('gmail', VALUE) > 1)); > CREATE DOMAIN GMAIL AS VARCHAR(200) DEFAULT '@gmail.com' CHECK ((POSITION('@', VALUE) > 1) AND (POSITION('gmail', VALUE) > 1));
...@@ -2151,7 +2151,7 @@ create memory table a(k10 blob(10k), m20 blob(20m), g30 clob(30g)); ...@@ -2151,7 +2151,7 @@ create memory table a(k10 blob(10k), m20 blob(20m), g30 clob(30g));
script NODATA NOPASSWORDS NOSETTINGS drop; script NODATA NOPASSWORDS NOSETTINGS drop;
> SCRIPT > SCRIPT
> ------------------------------------------------------------------------------------------------------- > -------------------------------------------------------------------------------------------------------
> -- 0 = SELECT COUNT(*) FROM PUBLIC.A; > -- 0 +/- SELECT COUNT(*) FROM PUBLIC.A;
> CREATE MEMORY TABLE PUBLIC.A( K10 BLOB(10240), M20 BLOB(20971520), G30 CLOB(32212254720) ); > CREATE MEMORY TABLE PUBLIC.A( K10 BLOB(10240), M20 BLOB(20971520), G30 CLOB(32212254720) );
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN; > CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN;
> DROP TABLE IF EXISTS PUBLIC.A; > DROP TABLE IF EXISTS PUBLIC.A;
...@@ -3148,11 +3148,11 @@ CREATE memory TABLE sp2(S_NO VARCHAR(5), p_no VARCHAR(5), qty INT, constraint c1 ...@@ -3148,11 +3148,11 @@ CREATE memory TABLE sp2(S_NO VARCHAR(5), p_no VARCHAR(5), qty INT, constraint c1
script NOPASSWORDS NOSETTINGS; script NOPASSWORDS NOSETTINGS;
> SCRIPT > SCRIPT
> ------------------------------------------------------------------------------------------------------------------- > -------------------------------------------------------------------------------------------------------------------
> -- 0 = SELECT COUNT(*) FROM PUBLIC.P; > -- 0 +/- SELECT COUNT(*) FROM PUBLIC.P;
> -- 0 = SELECT COUNT(*) FROM PUBLIC.S; > -- 0 +/- SELECT COUNT(*) FROM PUBLIC.S;
> -- 0 = SELECT COUNT(*) FROM PUBLIC.SP1; > -- 0 +/- SELECT COUNT(*) FROM PUBLIC.SP1;
> -- 0 = SELECT COUNT(*) FROM PUBLIC.SP2; > -- 0 +/- SELECT COUNT(*) FROM PUBLIC.SP2;
> -- 0 = SELECT COUNT(*) FROM PUBLIC.TEST; > -- 0 +/- SELECT COUNT(*) FROM PUBLIC.TEST;
> ALTER TABLE PUBLIC.P ADD CONSTRAINT PUBLIC.CONSTRAINT_50_0 PRIMARY KEY(P_NO); > ALTER TABLE PUBLIC.P ADD CONSTRAINT PUBLIC.CONSTRAINT_50_0 PRIMARY KEY(P_NO);
> ALTER TABLE PUBLIC.S ADD CONSTRAINT PUBLIC.CONSTRAINT_5 PRIMARY KEY(S_NO); > ALTER TABLE PUBLIC.S ADD CONSTRAINT PUBLIC.CONSTRAINT_5 PRIMARY KEY(S_NO);
> ALTER TABLE PUBLIC.SP1 ADD CONSTRAINT PUBLIC.CONSTRAINT_1 FOREIGN KEY(S_NO) REFERENCES PUBLIC.S(S_NO) NOCHECK; > ALTER TABLE PUBLIC.SP1 ADD CONSTRAINT PUBLIC.CONSTRAINT_1 FOREIGN KEY(S_NO) REFERENCES PUBLIC.S(S_NO) NOCHECK;
...@@ -3446,7 +3446,7 @@ create trigger test_trigger before insert on s.test call "org.h2.test.db.TestTri ...@@ -3446,7 +3446,7 @@ create trigger test_trigger before insert on s.test call "org.h2.test.db.TestTri
script NOPASSWORDS NOSETTINGS drop; script NOPASSWORDS NOSETTINGS drop;
> SCRIPT > SCRIPT
> --------------------------------------------------------------------------------------------------------------------- > ---------------------------------------------------------------------------------------------------------------------
> -- 0 = SELECT COUNT(*) FROM S.TEST; > -- 0 +/- SELECT COUNT(*) FROM S.TEST;
> CREATE FORCE TRIGGER S.TEST_TRIGGER BEFORE INSERT ON S.TEST QUEUE 1024 CALL "org.h2.test.db.TestTriggersConstraints"; > CREATE FORCE TRIGGER S.TEST_TRIGGER BEFORE INSERT ON S.TEST QUEUE 1024 CALL "org.h2.test.db.TestTriggersConstraints";
> CREATE INDEX S.INDEX_ID ON S.TEST(ID); > CREATE INDEX S.INDEX_ID ON S.TEST(ID);
> CREATE MEMORY TABLE S.TEST( ID INT ); > CREATE MEMORY TABLE S.TEST( ID INT );
...@@ -3481,7 +3481,7 @@ alter table test alter column id rename to i; ...@@ -3481,7 +3481,7 @@ alter table test alter column id rename to i;
script NOPASSWORDS NOSETTINGS drop; script NOPASSWORDS NOSETTINGS drop;
> SCRIPT > SCRIPT
> --------------------------------------------------------------------------------------------------- > ---------------------------------------------------------------------------------------------------
> -- 1 = SELECT COUNT(*) FROM PUBLIC.TEST; > -- 1 +/- SELECT COUNT(*) FROM PUBLIC.TEST;
> ALTER TABLE PUBLIC.TEST ADD CONSTRAINT PUBLIC.ABC FOREIGN KEY(I) REFERENCES PUBLIC.TEST(I) NOCHECK; > ALTER TABLE PUBLIC.TEST ADD CONSTRAINT PUBLIC.ABC FOREIGN KEY(I) REFERENCES PUBLIC.TEST(I) NOCHECK;
> ALTER TABLE PUBLIC.TEST ADD CONSTRAINT PUBLIC.CONSTRAINT_2 PRIMARY KEY(I); > ALTER TABLE PUBLIC.TEST ADD CONSTRAINT PUBLIC.CONSTRAINT_2 PRIMARY KEY(I);
> CREATE INDEX PUBLIC.IDX_N_ID ON PUBLIC.TEST(NAME, I); > CREATE INDEX PUBLIC.IDX_N_ID ON PUBLIC.TEST(NAME, I);
...@@ -3829,7 +3829,7 @@ create sequence test_seq; ...@@ -3829,7 +3829,7 @@ create sequence test_seq;
script NODATA NOPASSWORDS NOSETTINGS drop; script NODATA NOPASSWORDS NOSETTINGS drop;
> SCRIPT > SCRIPT
> ------------------------------------------------------------------------------ > ------------------------------------------------------------------------------
> -- 0 = SELECT COUNT(*) FROM PUBLIC.TEST; > -- 0 +/- SELECT COUNT(*) FROM PUBLIC.TEST;
> ALTER TABLE PUBLIC.TEST ADD CONSTRAINT PUBLIC.CONSTRAINT_2 PRIMARY KEY(ID); > ALTER TABLE PUBLIC.TEST ADD CONSTRAINT PUBLIC.CONSTRAINT_2 PRIMARY KEY(ID);
> CREATE MEMORY TABLE PUBLIC.TEST( ID INT NOT NULL, IM_IE VARCHAR(10) ); > CREATE MEMORY TABLE PUBLIC.TEST( ID INT NOT NULL, IM_IE VARCHAR(10) );
> CREATE SEQUENCE PUBLIC.TEST_SEQ START WITH 1; > CREATE SEQUENCE PUBLIC.TEST_SEQ START WITH 1;
...@@ -4517,7 +4517,7 @@ insert into test values(2, 'Cafe', X'cafe'); ...@@ -4517,7 +4517,7 @@ insert into test values(2, 'Cafe', X'cafe');
script simple nopasswords nosettings; script simple nopasswords nosettings;
> SCRIPT > SCRIPT
> ------------------------------------------------------------------------------- > -------------------------------------------------------------------------------
> -- 3 = SELECT COUNT(*) FROM PUBLIC.TEST; > -- 3 +/- SELECT COUNT(*) FROM PUBLIC.TEST;
> ALTER TABLE PUBLIC.TEST ADD CONSTRAINT PUBLIC.CONSTRAINT_2 PRIMARY KEY(ID); > ALTER TABLE PUBLIC.TEST ADD CONSTRAINT PUBLIC.CONSTRAINT_2 PRIMARY KEY(ID);
> CREATE MEMORY TABLE PUBLIC.TEST( ID INT NOT NULL, C CLOB, B BLOB ); > CREATE MEMORY TABLE PUBLIC.TEST( ID INT NOT NULL, C CLOB, B BLOB );
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN; > CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN;
...@@ -4967,7 +4967,7 @@ CREATE MEMORY TABLE TEST(ID INT PRIMARY KEY); ...@@ -4967,7 +4967,7 @@ CREATE MEMORY TABLE TEST(ID INT PRIMARY KEY);
SCRIPT NOPASSWORDS NOSETTINGS; SCRIPT NOPASSWORDS NOSETTINGS;
> SCRIPT > SCRIPT
> --------------------------------------------------------------------------- > ---------------------------------------------------------------------------
> -- 0 = SELECT COUNT(*) FROM PUBLIC.TEST; > -- 0 +/- SELECT COUNT(*) FROM PUBLIC.TEST;
> ALTER TABLE PUBLIC.TEST ADD CONSTRAINT PUBLIC.CONSTRAINT_2 PRIMARY KEY(ID); > ALTER TABLE PUBLIC.TEST ADD CONSTRAINT PUBLIC.CONSTRAINT_2 PRIMARY KEY(ID);
> CREATE MEMORY TABLE PUBLIC.TEST( ID INT NOT NULL ); > CREATE MEMORY TABLE PUBLIC.TEST( ID INT NOT NULL );
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN; > CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN;
...@@ -5051,8 +5051,8 @@ SELECT * FROM TEST_SEQ ORDER BY ID; ...@@ -5051,8 +5051,8 @@ SELECT * FROM TEST_SEQ ORDER BY ID;
SCRIPT SIMPLE NOPASSWORDS NOSETTINGS; SCRIPT SIMPLE NOPASSWORDS NOSETTINGS;
> SCRIPT > SCRIPT
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ > ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> -- 1 = SELECT COUNT(*) FROM PUBLIC.TEST; > -- 1 +/- SELECT COUNT(*) FROM PUBLIC.TEST;
> -- 4 = SELECT COUNT(*) FROM PUBLIC.TEST_SEQ; > -- 4 +/- SELECT COUNT(*) FROM PUBLIC.TEST_SEQ;
> ALTER TABLE PUBLIC.TEST ADD CONSTRAINT PUBLIC.CONSTRAINT_2 PRIMARY KEY(ID); > ALTER TABLE PUBLIC.TEST ADD CONSTRAINT PUBLIC.CONSTRAINT_2 PRIMARY KEY(ID);
> CREATE INDEX PUBLIC.IDXNAME ON PUBLIC.TEST(NAME); > CREATE INDEX PUBLIC.IDXNAME ON PUBLIC.TEST(NAME);
> CREATE MEMORY TABLE PUBLIC.TEST( ID INT NOT NULL, NAME VARCHAR(255) DEFAULT 1, CREATEDATE VARCHAR(255) DEFAULT '2001-01-01' NOT NULL, MODIFY_DATE TIMESTAMP ); > CREATE MEMORY TABLE PUBLIC.TEST( ID INT NOT NULL, NAME VARCHAR(255) DEFAULT 1, CREATEDATE VARCHAR(255) DEFAULT '2001-01-01' NOT NULL, MODIFY_DATE TIMESTAMP );
...@@ -5086,7 +5086,7 @@ DROP TABLE TEST_SEQ; ...@@ -5086,7 +5086,7 @@ DROP TABLE TEST_SEQ;
SCRIPT NOPASSWORDS NOSETTINGS; SCRIPT NOPASSWORDS NOSETTINGS;
> SCRIPT > SCRIPT
> --------------------------------------------------------------------------------------------------------------------------------------------- > ---------------------------------------------------------------------------------------------------------------------------------------------
> -- 1 = SELECT COUNT(*) FROM PUBLIC.TEST; > -- 1 +/- SELECT COUNT(*) FROM PUBLIC.TEST;
> ALTER TABLE PUBLIC.TEST ADD CONSTRAINT PUBLIC.CONSTRAINT_2 PRIMARY KEY(ID); > ALTER TABLE PUBLIC.TEST ADD CONSTRAINT PUBLIC.CONSTRAINT_2 PRIMARY KEY(ID);
> CREATE MEMORY TABLE PUBLIC.TEST( ID INT NOT NULL, CREATEDATE VARCHAR(255) DEFAULT '2001-01-01' NOT NULL, MODIFY_DATE TIMESTAMP ); > CREATE MEMORY TABLE PUBLIC.TEST( ID INT NOT NULL, CREATEDATE VARCHAR(255) DEFAULT '2001-01-01' NOT NULL, MODIFY_DATE TIMESTAMP );
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN; > CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN;
...@@ -5099,7 +5099,7 @@ ALTER TABLE TEST ADD NAME VARCHAR(255) NULL BEFORE CREATEDATE; ...@@ -5099,7 +5099,7 @@ ALTER TABLE TEST ADD NAME VARCHAR(255) NULL BEFORE CREATEDATE;
SCRIPT NOPASSWORDS NOSETTINGS; SCRIPT NOPASSWORDS NOSETTINGS;
> SCRIPT > SCRIPT
> -------------------------------------------------------------------------------------------------------------------------------------------------------------------- > --------------------------------------------------------------------------------------------------------------------------------------------------------------------
> -- 1 = SELECT COUNT(*) FROM PUBLIC.TEST; > -- 1 +/- SELECT COUNT(*) FROM PUBLIC.TEST;
> ALTER TABLE PUBLIC.TEST ADD CONSTRAINT PUBLIC.CONSTRAINT_2 PRIMARY KEY(ID); > ALTER TABLE PUBLIC.TEST ADD CONSTRAINT PUBLIC.CONSTRAINT_2 PRIMARY KEY(ID);
> CREATE MEMORY TABLE PUBLIC.TEST( ID INT NOT NULL, NAME VARCHAR(255), CREATEDATE VARCHAR(255) DEFAULT '2001-01-01' NOT NULL, MODIFY_DATE TIMESTAMP ); > CREATE MEMORY TABLE PUBLIC.TEST( ID INT NOT NULL, NAME VARCHAR(255), CREATEDATE VARCHAR(255) DEFAULT '2001-01-01' NOT NULL, MODIFY_DATE TIMESTAMP );
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN; > CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN;
...@@ -5129,7 +5129,7 @@ CREATE MEMORY TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR); ...@@ -5129,7 +5129,7 @@ CREATE MEMORY TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR);
SCRIPT NOPASSWORDS NOSETTINGS; SCRIPT NOPASSWORDS NOSETTINGS;
> SCRIPT > SCRIPT
> --------------------------------------------------------------------------- > ---------------------------------------------------------------------------
> -- 0 = SELECT COUNT(*) FROM PUBLIC.TEST; > -- 0 +/- SELECT COUNT(*) FROM PUBLIC.TEST;
> ALTER TABLE PUBLIC.TEST ADD CONSTRAINT PUBLIC.CONSTRAINT_2 PRIMARY KEY(ID); > ALTER TABLE PUBLIC.TEST ADD CONSTRAINT PUBLIC.CONSTRAINT_2 PRIMARY KEY(ID);
> CREATE MEMORY TABLE PUBLIC.TEST( ID INT NOT NULL, NAME VARCHAR ); > CREATE MEMORY TABLE PUBLIC.TEST( ID INT NOT NULL, NAME VARCHAR );
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN; > CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN;
...@@ -6673,7 +6673,7 @@ CAST(XT AS TIMESTAMP) D2TS, CAST(XD AS TIMESTAMP) D2TS FROM TEST; ...@@ -6673,7 +6673,7 @@ CAST(XT AS TIMESTAMP) D2TS, CAST(XD AS TIMESTAMP) D2TS FROM TEST;
SCRIPT SIMPLE NOPASSWORDS NOSETTINGS; SCRIPT SIMPLE NOPASSWORDS NOSETTINGS;
> SCRIPT > SCRIPT
> ---------------------------------------------------------------------------------------------------------------------------------- > ----------------------------------------------------------------------------------------------------------------------------------
> -- 4 = SELECT COUNT(*) FROM PUBLIC.TEST; > -- 4 +/- SELECT COUNT(*) FROM PUBLIC.TEST;
> CREATE MEMORY TABLE PUBLIC.TEST( ID INT, XT TIME, XD DATE, XTS TIMESTAMP ); > CREATE MEMORY TABLE PUBLIC.TEST( ID INT, XT TIME, XD DATE, XTS TIMESTAMP );
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN; > CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN;
> INSERT INTO PUBLIC.TEST(ID, XT, XD, XTS) VALUES(0, TIME '00:00:00', DATE '0001-02-03', TIMESTAMP '0002-03-04 00:00:00.0'); > INSERT INTO PUBLIC.TEST(ID, XT, XD, XTS) VALUES(0, TIME '00:00:00', DATE '0001-02-03', TIMESTAMP '0002-03-04 00:00:00.0');
...@@ -7572,8 +7572,8 @@ CREATE MEMORY TABLE CHILD(ID INT, PARENT_ID INT, FOREIGN KEY(PARENT_ID) REFERENC ...@@ -7572,8 +7572,8 @@ CREATE MEMORY TABLE CHILD(ID INT, PARENT_ID INT, FOREIGN KEY(PARENT_ID) REFERENC
SCRIPT NOPASSWORDS NOSETTINGS; SCRIPT NOPASSWORDS NOSETTINGS;
> SCRIPT > SCRIPT
> ------------------------------------------------------------------------------------------------------------------------ > ------------------------------------------------------------------------------------------------------------------------
> -- 0 = SELECT COUNT(*) FROM PUBLIC.CHILD; > -- 0 +/- SELECT COUNT(*) FROM PUBLIC.CHILD;
> -- 0 = SELECT COUNT(*) FROM PUBLIC.PARENT; > -- 0 +/- SELECT COUNT(*) FROM PUBLIC.PARENT;
> ALTER TABLE PUBLIC.CHILD ADD CONSTRAINT PUBLIC.CONSTRAINT_3 FOREIGN KEY(PARENT_ID) REFERENCES PUBLIC.PARENT(ID) NOCHECK; > ALTER TABLE PUBLIC.CHILD ADD CONSTRAINT PUBLIC.CONSTRAINT_3 FOREIGN KEY(PARENT_ID) REFERENCES PUBLIC.PARENT(ID) NOCHECK;
> ALTER TABLE PUBLIC.PARENT ADD CONSTRAINT PUBLIC.CONSTRAINT_8 PRIMARY KEY(ID); > ALTER TABLE PUBLIC.PARENT ADD CONSTRAINT PUBLIC.CONSTRAINT_8 PRIMARY KEY(ID);
> CREATE MEMORY TABLE PUBLIC.CHILD( ID INT, PARENT_ID INT ); > CREATE MEMORY TABLE PUBLIC.CHILD( ID INT, PARENT_ID INT );
...@@ -7635,7 +7635,7 @@ ALTER TABLE TEST ADD CONSTRAINT C1 FOREIGN KEY(A_INT) REFERENCES TEST(B_INT); ...@@ -7635,7 +7635,7 @@ ALTER TABLE TEST ADD CONSTRAINT C1 FOREIGN KEY(A_INT) REFERENCES TEST(B_INT);
SCRIPT NOPASSWORDS NOSETTINGS; SCRIPT NOPASSWORDS NOSETTINGS;
> SCRIPT > SCRIPT
> ---------------------------------------------------------------------------------------------------------- > ----------------------------------------------------------------------------------------------------------
> -- 0 = SELECT COUNT(*) FROM PUBLIC.TEST; > -- 0 +/- SELECT COUNT(*) FROM PUBLIC.TEST;
> ALTER TABLE PUBLIC.TEST ADD CONSTRAINT PUBLIC.C1 FOREIGN KEY(A_INT) REFERENCES PUBLIC.TEST(B_INT) NOCHECK; > ALTER TABLE PUBLIC.TEST ADD CONSTRAINT PUBLIC.C1 FOREIGN KEY(A_INT) REFERENCES PUBLIC.TEST(B_INT) NOCHECK;
> CREATE MEMORY TABLE PUBLIC.TEST( A_INT INT NOT NULL, B_INT INT NOT NULL ); > CREATE MEMORY TABLE PUBLIC.TEST( A_INT INT NOT NULL, B_INT INT NOT NULL );
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN; > CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN;
...@@ -7779,8 +7779,8 @@ SELECT * FROM B_TEST; ...@@ -7779,8 +7779,8 @@ SELECT * FROM B_TEST;
SCRIPT NOPASSWORDS NOSETTINGS; SCRIPT NOPASSWORDS NOSETTINGS;
> SCRIPT > SCRIPT
> ---------------------------------------------------------------------------------------------------------------------------------------------------------- > ----------------------------------------------------------------------------------------------------------------------------------------------------------
> -- 0 = SELECT COUNT(*) FROM PUBLIC.A_TEST; > -- 0 +/- SELECT COUNT(*) FROM PUBLIC.A_TEST;
> -- 1 = SELECT COUNT(*) FROM PUBLIC.B_TEST; > -- 1 +/- SELECT COUNT(*) FROM PUBLIC.B_TEST;
> ALTER TABLE PUBLIC.A_TEST ADD CONSTRAINT PUBLIC.CONSTRAINT_7 PRIMARY KEY(A_INT); > ALTER TABLE PUBLIC.A_TEST ADD CONSTRAINT PUBLIC.CONSTRAINT_7 PRIMARY KEY(A_INT);
> ALTER TABLE PUBLIC.A_TEST ADD CONSTRAINT PUBLIC.DATE_UNIQUE UNIQUE(A_DATE); > ALTER TABLE PUBLIC.A_TEST ADD CONSTRAINT PUBLIC.DATE_UNIQUE UNIQUE(A_DATE);
> ALTER TABLE PUBLIC.A_TEST ADD CONSTRAINT PUBLIC.DATE_UNIQUE_2 UNIQUE(A_DATE); > ALTER TABLE PUBLIC.A_TEST ADD CONSTRAINT PUBLIC.DATE_UNIQUE_2 UNIQUE(A_DATE);
...@@ -7880,9 +7880,9 @@ SELECT * FROM CHILD; ...@@ -7880,9 +7880,9 @@ SELECT * FROM CHILD;
SCRIPT SIMPLE NOPASSWORDS NOSETTINGS; SCRIPT SIMPLE NOPASSWORDS NOSETTINGS;
> SCRIPT > SCRIPT
> ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- > ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> -- 1 = SELECT COUNT(*) FROM PUBLIC.FAMILY; > -- 1 +/- SELECT COUNT(*) FROM PUBLIC.FAMILY;
> -- 1 = SELECT COUNT(*) FROM PUBLIC.PARENT; > -- 1 +/- SELECT COUNT(*) FROM PUBLIC.PARENT;
> -- 4 = SELECT COUNT(*) FROM PUBLIC.CHILD; > -- 4 +/- SELECT COUNT(*) FROM PUBLIC.CHILD;
> ALTER TABLE PUBLIC.CHILD ADD CONSTRAINT PUBLIC.CONSTRAINT_3 UNIQUE(ID, PARENTID); > ALTER TABLE PUBLIC.CHILD ADD CONSTRAINT PUBLIC.CONSTRAINT_3 UNIQUE(ID, PARENTID);
> ALTER TABLE PUBLIC.CHILD ADD CONSTRAINT PUBLIC.PARENT_CHILD FOREIGN KEY(PARENTID, FAMILY_ID) REFERENCES PUBLIC.PARENT(ID, FAMILY_ID) ON DELETE SET NULL ON UPDATE CASCADE NOCHECK; > ALTER TABLE PUBLIC.CHILD ADD CONSTRAINT PUBLIC.PARENT_CHILD FOREIGN KEY(PARENTID, FAMILY_ID) REFERENCES PUBLIC.PARENT(ID, FAMILY_ID) ON DELETE SET NULL ON UPDATE CASCADE NOCHECK;
> ALTER TABLE PUBLIC.PARENT ADD CONSTRAINT PUBLIC.PARENT_FAMILY FOREIGN KEY(FAMILY_ID) REFERENCES PUBLIC.FAMILY(ID) NOCHECK; > ALTER TABLE PUBLIC.PARENT ADD CONSTRAINT PUBLIC.PARENT_FAMILY FOREIGN KEY(FAMILY_ID) REFERENCES PUBLIC.FAMILY(ID) NOCHECK;
...@@ -7905,9 +7905,9 @@ ALTER TABLE CHILD DROP CONSTRAINT PARENT_CHILD; ...@@ -7905,9 +7905,9 @@ ALTER TABLE CHILD DROP CONSTRAINT PARENT_CHILD;
SCRIPT SIMPLE NOPASSWORDS NOSETTINGS; SCRIPT SIMPLE NOPASSWORDS NOSETTINGS;
> SCRIPT > SCRIPT
> -------------------------------------------------------------------------------------------------------------------------- > --------------------------------------------------------------------------------------------------------------------------
> -- 1 = SELECT COUNT(*) FROM PUBLIC.FAMILY; > -- 1 +/- SELECT COUNT(*) FROM PUBLIC.FAMILY;
> -- 1 = SELECT COUNT(*) FROM PUBLIC.PARENT; > -- 1 +/- SELECT COUNT(*) FROM PUBLIC.PARENT;
> -- 4 = SELECT COUNT(*) FROM PUBLIC.CHILD; > -- 4 +/- SELECT COUNT(*) FROM PUBLIC.CHILD;
> ALTER TABLE PUBLIC.CHILD ADD CONSTRAINT PUBLIC.CONSTRAINT_3 UNIQUE(ID, PARENTID); > ALTER TABLE PUBLIC.CHILD ADD CONSTRAINT PUBLIC.CONSTRAINT_3 UNIQUE(ID, PARENTID);
> ALTER TABLE PUBLIC.PARENT ADD CONSTRAINT PUBLIC.PARENT_FAMILY FOREIGN KEY(FAMILY_ID) REFERENCES PUBLIC.FAMILY(ID) NOCHECK; > ALTER TABLE PUBLIC.PARENT ADD CONSTRAINT PUBLIC.PARENT_FAMILY FOREIGN KEY(FAMILY_ID) REFERENCES PUBLIC.FAMILY(ID) NOCHECK;
> CREATE INDEX PUBLIC.FAMILY_ID_NAME ON PUBLIC.FAMILY(ID, NAME); > CREATE INDEX PUBLIC.FAMILY_ID_NAME ON PUBLIC.FAMILY(ID, NAME);
...@@ -7987,7 +7987,7 @@ CREATE MEMORY TABLE TEST(A INT, B INT, FOREIGN KEY (B) REFERENCES(A) ON UPDATE R ...@@ -7987,7 +7987,7 @@ CREATE MEMORY TABLE TEST(A INT, B INT, FOREIGN KEY (B) REFERENCES(A) ON UPDATE R
SCRIPT NOPASSWORDS NOSETTINGS; SCRIPT NOPASSWORDS NOSETTINGS;
> SCRIPT > SCRIPT
> ------------------------------------------------------------------------------------------------------------ > ------------------------------------------------------------------------------------------------------------
> -- 0 = SELECT COUNT(*) FROM PUBLIC.TEST; > -- 0 +/- SELECT COUNT(*) FROM PUBLIC.TEST;
> ALTER TABLE PUBLIC.TEST ADD CONSTRAINT PUBLIC.CONSTRAINT_2 FOREIGN KEY(B) REFERENCES PUBLIC.TEST(A) NOCHECK; > ALTER TABLE PUBLIC.TEST ADD CONSTRAINT PUBLIC.CONSTRAINT_2 FOREIGN KEY(B) REFERENCES PUBLIC.TEST(A) NOCHECK;
> CREATE MEMORY TABLE PUBLIC.TEST( A INT, B INT ); > CREATE MEMORY TABLE PUBLIC.TEST( A INT, B INT );
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN; > CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN;
...@@ -8036,8 +8036,8 @@ ALTER INDEX IDX_ID RENAME TO IDX_ID2; ...@@ -8036,8 +8036,8 @@ ALTER INDEX IDX_ID RENAME TO IDX_ID2;
SCRIPT NOPASSWORDS NOSETTINGS; SCRIPT NOPASSWORDS NOSETTINGS;
> SCRIPT > SCRIPT
> ------------------------------------------------------------------------------ > ------------------------------------------------------------------------------
> -- 0 = SELECT COUNT(*) FROM PUBLIC.TEST2; > -- 0 +/- SELECT COUNT(*) FROM PUBLIC.TEST2;
> -- 0 = SELECT COUNT(*) FROM PUBLIC.TEST; > -- 0 +/- SELECT COUNT(*) FROM PUBLIC.TEST;
> ALTER TABLE PUBLIC.TEST ADD CONSTRAINT PUBLIC.CONSTRAINT_2 PRIMARY KEY(ID); > ALTER TABLE PUBLIC.TEST ADD CONSTRAINT PUBLIC.CONSTRAINT_2 PRIMARY KEY(ID);
> CREATE INDEX PUBLIC.IDX_ID2 ON PUBLIC.TEST2(ID); > CREATE INDEX PUBLIC.IDX_ID2 ON PUBLIC.TEST2(ID);
> CREATE MEMORY TABLE PUBLIC.TEST( ID INT NOT NULL, NAME VARCHAR(255) ); > CREATE MEMORY TABLE PUBLIC.TEST( ID INT NOT NULL, NAME VARCHAR(255) );
...@@ -8215,7 +8215,7 @@ INSERT INTO TEST VALUES(2, STRINGDECODE('abcsond\344rzeich\344 ') || char(22222) ...@@ -8215,7 +8215,7 @@ INSERT INTO TEST VALUES(2, STRINGDECODE('abcsond\344rzeich\344 ') || char(22222)
script nopasswords nosettings; script nopasswords nosettings;
> SCRIPT > SCRIPT
> ------------------------------------------------------------------------------------------------------------------------------------------------------------- > -------------------------------------------------------------------------------------------------------------------------------------------------------------
> -- 1 = SELECT COUNT(*) FROM PUBLIC.TEST; > -- 1 +/- SELECT COUNT(*) FROM PUBLIC.TEST;
> ALTER TABLE PUBLIC.TEST ADD CONSTRAINT PUBLIC.CONSTRAINT_2 PRIMARY KEY(ID); > ALTER TABLE PUBLIC.TEST ADD CONSTRAINT PUBLIC.CONSTRAINT_2 PRIMARY KEY(ID);
> CREATE MEMORY TABLE PUBLIC.TEST( ID INT NOT NULL, NAME VARCHAR(255) ); > CREATE MEMORY TABLE PUBLIC.TEST( ID INT NOT NULL, NAME VARCHAR(255) );
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN; > CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论