提交 d7adee0b authored 作者: Noel Grandin's avatar Noel Grandin

spellcheck

上级 0c4ecec6
...@@ -702,24 +702,24 @@ public class Parser { ...@@ -702,24 +702,24 @@ public class Parser {
return getSchema(schemaName); return getSchema(schemaName);
} }
/* /*
* Gets the current schema for scenarios that need a guranteed, non-null schema object. * Gets the current schema for scenarios that need a guaranteed, non-null schema object.
* *
* This routine is solely here * This routine is solely here
* because of the function readIdentifierWithSchema(String defaultSchemaName) - which * because of the function readIdentifierWithSchema(String defaultSchemaName) - which
* is often called with a null parameter (defaultSchemaName) - then 6 lines into the function * is often called with a null parameter (defaultSchemaName) - then 6 lines into the function
* that routine nullifies the state field schemaName - which I believe is a bug. * that routine nullifies the state field schemaName - which I believe is a bug.
* *
* There are about 7 places where "readIdentifierWithSchema(null)" is called in this file. * There are about 7 places where "readIdentifierWithSchema(null)" is called in this file.
* *
* In other words when is it legal to not have an active schema defined by schemaName ? * In other words when is it legal to not have an active schema defined by schemaName ?
* I don't think it's ever a valid case. I don't understand when that would be allowed. * I don't think it's ever a valid case. I don't understand when that would be allowed.
* I spent a long time trying to figure this out. * I spent a long time trying to figure this out.
* As another proof of this point, the command "SET SCHEMA=NULL" is not a valid command. * As another proof of this point, the command "SET SCHEMA=NULL" is not a valid command.
* *
* I did try to fix this in readIdentifierWithSchema(String defaultSchemaName) * I did try to fix this in readIdentifierWithSchema(String defaultSchemaName)
* - but every fix I tried cascaded so many unit test errors - so * - but every fix I tried cascaded so many unit test errors - so
* I gave up. I think this needs a bigger effort to fix his, as part of bigger, dedicated story. * I gave up. I think this needs a bigger effort to fix his, as part of bigger, dedicated story.
* *
*/ */
private Schema getSchemaWithDefault() { private Schema getSchemaWithDefault() {
if(schemaName==null){ if(schemaName==null){
...@@ -827,7 +827,7 @@ public class Parser { ...@@ -827,7 +827,7 @@ public class Parser {
Expression limit = readTerm().optimize(session); Expression limit = readTerm().optimize(session);
command.setLimit(limit); command.setLimit(limit);
} }
setSQL(command, "UPDATE", start); setSQL(command, "UPDATE", start);
} }
private TableFilter readSimpleTableFilter(int orderInFrom) { private TableFilter readSimpleTableFilter(int orderInFrom) {
...@@ -858,8 +858,8 @@ public class Parser { ...@@ -858,8 +858,8 @@ public class Parser {
} }
return new TableFilter(session, table, alias, rightsChecked, return new TableFilter(session, table, alias, rightsChecked,
currentSelect, orderInFrom, null); currentSelect, orderInFrom, null);
} }
private Delete parseDelete() { private Delete parseDelete() {
Delete command = new Delete(session); Delete command = new Delete(session);
Expression limit = null; Expression limit = null;
...@@ -1073,7 +1073,7 @@ public class Parser { ...@@ -1073,7 +1073,7 @@ public class Parser {
read(); read();
return select; return select;
} }
private Prepared parseMerge() { private Prepared parseMerge() {
Merge command = new Merge(session); Merge command = new Merge(session);
...@@ -1082,9 +1082,9 @@ public class Parser { ...@@ -1082,9 +1082,9 @@ public class Parser {
read("INTO"); read("INTO");
List<String> excludeIdentifiers = Arrays.asList("USING","KEY","VALUES"); List<String> excludeIdentifiers = Arrays.asList("USING","KEY","VALUES");
TableFilter targetTableFilter = readSimpleTableFilterWithAliasExcludes(0,excludeIdentifiers); TableFilter targetTableFilter = readSimpleTableFilterWithAliasExcludes(0,excludeIdentifiers);
command.setTargetTableFilter(targetTableFilter); command.setTargetTableFilter(targetTableFilter);
Table table = command.getTargetTable(); Table table = command.getTargetTable();
if (readIf("USING")){ if (readIf("USING")){
return parseMergeUsing(command,start); return parseMergeUsing(command,start);
} }
...@@ -1126,7 +1126,7 @@ public class Parser { ...@@ -1126,7 +1126,7 @@ public class Parser {
private MergeUsing parseMergeUsing(Merge oldCommand, int start) { private MergeUsing parseMergeUsing(Merge oldCommand, int start) {
MergeUsing command = new MergeUsing(oldCommand); MergeUsing command = new MergeUsing(oldCommand);
currentPrepared = command; currentPrepared = command;
if (readIf("(")) { if (readIf("(")) {
/* a select query is supplied */ /* a select query is supplied */
if (isSelect()) { if (isSelect()) {
...@@ -1134,20 +1134,20 @@ public class Parser { ...@@ -1134,20 +1134,20 @@ public class Parser {
read(")"); read(")");
} }
command.setQueryAlias(readFromAlias(null, Arrays.asList("ON"))); command.setQueryAlias(readFromAlias(null, Arrays.asList("ON")));
String[] querySQLOutput = new String[]{null}; String[] querySQLOutput = new String[]{null};
List<Column> columnTemplateList = createQueryColumnTemplateList(null, command.getQuery(), querySQLOutput); List<Column> columnTemplateList = createQueryColumnTemplateList(null, command.getQuery(), querySQLOutput);
TableView temporarySourceTableView = createTemporarySessionView(command.getQueryAlias(), querySQLOutput[0], columnTemplateList, false/*no recursion*/, false/* do not add to session*/); TableView temporarySourceTableView = createTemporarySessionView(command.getQueryAlias(), querySQLOutput[0], columnTemplateList, false/*no recursion*/, false/* do not add to session*/);
TableFilter sourceTableFilter = new TableFilter(session, temporarySourceTableView, command.getQueryAlias(), rightsChecked, TableFilter sourceTableFilter = new TableFilter(session, temporarySourceTableView, command.getQueryAlias(), rightsChecked,
(Select) command.getQuery(), 0, null); (Select) command.getQuery(), 0, null);
command.setSourceTableFilter(sourceTableFilter); command.setSourceTableFilter(sourceTableFilter);
} }
else{ else{
/* Its a table name, simulate a query by building a select query for the table */ /* Its a table name, simulate a query by building a select query for the table */
List<String> excludeIdentifiers = Arrays.asList("ON"); List<String> excludeIdentifiers = Arrays.asList("ON");
TableFilter sourceTableFilter = readSimpleTableFilterWithAliasExcludes(0,excludeIdentifiers); TableFilter sourceTableFilter = readSimpleTableFilterWithAliasExcludes(0,excludeIdentifiers);
command.setSourceTableFilter(sourceTableFilter); command.setSourceTableFilter(sourceTableFilter);
StringBuilder buff = new StringBuilder( StringBuilder buff = new StringBuilder(
"SELECT * FROM "+sourceTableFilter.getTable().getName()); "SELECT * FROM "+sourceTableFilter.getTable().getName());
if(sourceTableFilter.getTableAlias()!=null){ if(sourceTableFilter.getTableAlias()!=null){
...@@ -1155,14 +1155,14 @@ public class Parser { ...@@ -1155,14 +1155,14 @@ public class Parser {
} }
Prepared preparedQuery = prepare(session, buff.toString(), null/*paramValues*/); Prepared preparedQuery = prepare(session, buff.toString(), null/*paramValues*/);
command.setQuery((Select)preparedQuery); command.setQuery((Select)preparedQuery);
} }
read("ON"); read("ON");
read("("); read("(");
Expression condition = readExpression(); Expression condition = readExpression();
command.setOnCondition(condition); command.setOnCondition(condition);
read(")"); read(")");
if(readIfAll("WHEN","MATCHED","THEN")){ if(readIfAll("WHEN","MATCHED","THEN")){
int startMatched = lastParseIndex; int startMatched = lastParseIndex;
if (readIf("UPDATE")){ if (readIf("UPDATE")){
...@@ -1180,7 +1180,7 @@ public class Parser { ...@@ -1180,7 +1180,7 @@ public class Parser {
deleteCommand.setTableFilter(filter); deleteCommand.setTableFilter(filter);
parseDeleteGivenTable(deleteCommand,null,startMatched); parseDeleteGivenTable(deleteCommand,null,startMatched);
command.setDeleteCommand(deleteCommand); command.setDeleteCommand(deleteCommand);
} }
} }
if(readIfAll("WHEN","NOT","MATCHED","THEN")){ if(readIfAll("WHEN","NOT","MATCHED","THEN")){
if (readIf("INSERT")){ if (readIf("INSERT")){
...@@ -1192,7 +1192,7 @@ public class Parser { ...@@ -1192,7 +1192,7 @@ public class Parser {
} }
setSQL(command, "MERGE", start); setSQL(command, "MERGE", start);
// build and prepare the targetMatchQuery ready to test each rows existence in the target table (using source row to match) // build and prepare the targetMatchQuery ready to test each rows existence in the target table (using source row to match)
StringBuffer targetMatchQuerySQL = new StringBuffer("SELECT _ROWID_ FROM "+command.getTargetTable().getName()); StringBuffer targetMatchQuerySQL = new StringBuffer("SELECT _ROWID_ FROM "+command.getTargetTable().getName());
if(command.getTargetTableFilter().getTableAlias()!=null){ if(command.getTargetTableFilter().getTableAlias()!=null){
...@@ -1209,7 +1209,7 @@ public class Parser { ...@@ -1209,7 +1209,7 @@ public class Parser {
// preparedTargetMatchQuery.setExpressions(selectList); // preparedTargetMatchQuery.setExpressions(selectList);
// preparedTargetMatchQuery.init(); // preparedTargetMatchQuery.init();
command.setTargetMatchQuery((Select)parse(targetMatchQuerySQL.toString())); command.setTargetMatchQuery((Select)parse(targetMatchQuerySQL.toString()));
// Select command = new Select(session); // Select command = new Select(session);
// currentSelect = command; // currentSelect = command;
// TableFilter filter = parseValuesTable(0); // TableFilter filter = parseValuesTable(0);
...@@ -1217,8 +1217,8 @@ public class Parser { ...@@ -1217,8 +1217,8 @@ public class Parser {
// list.add(new Wildcard(null, null)); // list.add(new Wildcard(null, null));
// command.setExpressions(list); // command.setExpressions(list);
// command.addTableFilter(filter, true); // command.addTableFilter(filter, true);
// command.init(); // command.init();
return command; return command;
} }
...@@ -1492,7 +1492,7 @@ public class Parser { ...@@ -1492,7 +1492,7 @@ public class Parser {
} }
return alias; return alias;
} }
private String readFromAlias(String alias) { private String readFromAlias(String alias) {
// left and right are not keywords (because they are functions as // left and right are not keywords (because they are functions as
// well) // well)
...@@ -1930,7 +1930,7 @@ public class Parser { ...@@ -1930,7 +1930,7 @@ public class Parser {
private Query parseSelect() { private Query parseSelect() {
// This method and its subroutines sometimes resets the schema name - the try-finally block // This method and its subroutines sometimes resets the schema name - the try-finally block
// makes sure it is reverted if nulled // makes sure it is reverted if nulled
//String savedSchemaName = schemaName; //String savedSchemaName = schemaName;
Query command = null; Query command = null;
//try{ //try{
...@@ -3513,7 +3513,7 @@ public class Parser { ...@@ -3513,7 +3513,7 @@ public class Parser {
} }
return true; return true;
} }
private boolean isToken(String token) { private boolean isToken(String token) {
boolean result = equalsToken(token, currentToken) && boolean result = equalsToken(token, currentToken) &&
!currentTokenQuoted; !currentTokenQuoted;
...@@ -3534,7 +3534,7 @@ public class Parser { ...@@ -3534,7 +3534,7 @@ public class Parser {
} }
return false; return false;
} }
private boolean equalsTokenIgnoreCase(String a, String b) { private boolean equalsTokenIgnoreCase(String a, String b) {
if (a == null) { if (a == null) {
return b == null; return b == null;
...@@ -3545,10 +3545,10 @@ public class Parser { ...@@ -3545,10 +3545,10 @@ public class Parser {
} }
return false; return false;
} }
private boolean isTokenInList(Collection<String> upperCaseTokenList){ private boolean isTokenInList(Collection<String> upperCaseTokenList){
String upperCaseCurrentToken = currentToken.toUpperCase(); String upperCaseCurrentToken = currentToken.toUpperCase();
return upperCaseTokenList.contains(upperCaseCurrentToken); return upperCaseTokenList.contains(upperCaseCurrentToken);
} }
private void addExpected(String token) { private void addExpected(String token) {
...@@ -5259,7 +5259,7 @@ public class Parser { ...@@ -5259,7 +5259,7 @@ public class Parser {
* Creates a list of column templates from a query (usually from WITH query, but could be any query) * Creates a list of column templates from a query (usually from WITH query, but could be any query)
* @param cols - an optional list of column names (can be specified by WITH clause overriding usual select names) * @param cols - an optional list of column names (can be specified by WITH clause overriding usual select names)
* @param theQuery - the query object we want the column list for * @param theQuery - the query object we want the column list for
* @param querySQLOutput - array of length 1 to receive extra 'output' field in addition to return value * @param querySQLOutput - array of length 1 to receive extra 'output' field in addition to return value
* - containing the SQL query of the Query object * - containing the SQL query of the Query object
* @return a list of column object returned by withQuery * @return a list of column object returned by withQuery
*/ */
......
...@@ -23,7 +23,6 @@ import java.util.HashSet; ...@@ -23,7 +23,6 @@ import java.util.HashSet;
import java.util.Set; import java.util.Set;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import java.util.UUID; import java.util.UUID;
import org.h2.api.Trigger; import org.h2.api.Trigger;
import org.h2.command.Parser; import org.h2.command.Parser;
import org.h2.engine.Session; import org.h2.engine.Session;
...@@ -266,7 +265,7 @@ public class FullText { ...@@ -266,7 +265,7 @@ public class FullText {
removeAllTriggers(conn, TRIGGER_PREFIX); removeAllTriggers(conn, TRIGGER_PREFIX);
FullTextSettings setting = FullTextSettings.getInstance(conn); FullTextSettings setting = FullTextSettings.getInstance(conn);
setting.removeAllIndexes(); setting.removeAllIndexes();
setting.clearInored(); setting.clearIgnored();
setting.clearWordList(); setting.clearWordList();
} }
...@@ -1151,8 +1150,8 @@ public class FullText { ...@@ -1151,8 +1150,8 @@ public class FullText {
return buff.toString(); return buff.toString();
} }
private PreparedStatement getStatement(Connection conn, int indx) throws SQLException { private PreparedStatement getStatement(Connection conn, int index) throws SQLException {
return useOwnConnection ? conn.prepareStatement(SQL[indx]) : prepStatements[indx]; return useOwnConnection ? conn.prepareStatement(SQL[index]) : prepStatements[index];
} }
} }
......
...@@ -13,7 +13,6 @@ import java.sql.Statement; ...@@ -13,7 +13,6 @@ import java.sql.Statement;
import java.util.Collections; import java.util.Collections;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import org.h2.util.New; import org.h2.util.New;
import org.h2.util.SoftHashMap; import org.h2.util.SoftHashMap;
...@@ -69,7 +68,7 @@ final class FullTextSettings { ...@@ -69,7 +68,7 @@ final class FullTextSettings {
/** /**
* Clear set of ignored words * Clear set of ignored words
*/ */
public void clearInored() { public void clearIgnored() {
synchronized (ignoreList) { synchronized (ignoreList) {
ignoreList.clear(); ignoreList.clear();
} }
......
...@@ -17,7 +17,7 @@ import org.h2.test.TestBase; ...@@ -17,7 +17,7 @@ import org.h2.test.TestBase;
*/ */
public class TestMergeUsing extends TestBase implements Trigger { public class TestMergeUsing extends TestBase implements Trigger {
private static final String GATHER_ORDERED_RESULTS_SQL = "SELECT ID, NAME FROM PARENT ORDER BY ID ASC"; private static final String GATHER_ORDERED_RESULTS_SQL = "SELECT ID, NAME FROM PARENT ORDER BY ID ASC";
private static int triggerTestingUpdateCount = 0; private static int triggerTestingUpdateCount = 0;
...@@ -34,7 +34,7 @@ public class TestMergeUsing extends TestBase implements Trigger { ...@@ -34,7 +34,7 @@ public class TestMergeUsing extends TestBase implements Trigger {
@Override @Override
public void test() throws Exception { public void test() throws Exception {
// Simple ID,NAME inserts, target table with PK initially empty // Simple ID,NAME inserts, target table with PK initially empty
testMergeUsing( testMergeUsing(
"CREATE TABLE PARENT(ID INT, NAME VARCHAR, PRIMARY KEY(ID) );", "CREATE TABLE PARENT(ID INT, NAME VARCHAR, PRIMARY KEY(ID) );",
...@@ -117,8 +117,8 @@ public class TestMergeUsing extends TestBase implements Trigger { ...@@ -117,8 +117,8 @@ public class TestMergeUsing extends TestBase implements Trigger {
GATHER_ORDERED_RESULTS_SQL, GATHER_ORDERED_RESULTS_SQL,
"SELECT X AS ID, 'Marcy'||X||X AS NAME FROM SYSTEM_RANGE(2,2) UNION ALL SELECT X AS ID, 'Marcy'||X AS NAME FROM SYSTEM_RANGE(3,3)", "SELECT X AS ID, 'Marcy'||X||X AS NAME FROM SYSTEM_RANGE(2,2) UNION ALL SELECT X AS ID, 'Marcy'||X AS NAME FROM SYSTEM_RANGE(3,3)",
3 3
); );
// Only insert clause, no update or delete clauses // Only insert clause, no update or delete clauses
testMergeUsing( testMergeUsing(
"CREATE TABLE PARENT AS (SELECT X AS ID, 'Marcy'||X AS NAME FROM SYSTEM_RANGE(1,1) );"+ "CREATE TABLE PARENT AS (SELECT X AS ID, 'Marcy'||X AS NAME FROM SYSTEM_RANGE(1,1) );"+
...@@ -146,8 +146,8 @@ public class TestMergeUsing extends TestBase implements Trigger { ...@@ -146,8 +146,8 @@ public class TestMergeUsing extends TestBase implements Trigger {
"SELECT X AS ID, 'Marcy'||X AS NAME FROM SYSTEM_RANGE(1,1) WHERE X<0", "SELECT X AS ID, 'Marcy'||X AS NAME FROM SYSTEM_RANGE(1,1) WHERE X<0",
2 2
); );
// Duplicate source keys but different ROWID update - so no error // Duplicate source keys but different ROWID update - so no error
// SQL standard says duplicate or repeated updates of same row in same statement should cause errors - but because first row is updated, deleted (on source row 1) then inserted (on source row 2) // SQL standard says duplicate or repeated updates of same row in same statement should cause errors - but because first row is updated, deleted (on source row 1) then inserted (on source row 2)
// it's considered different - with respect to to ROWID - so no error // it's considered different - with respect to to ROWID - so no error
// One insert, one update one delete happens (on same row) , target table missing PK, no source or target alias // One insert, one update one delete happens (on same row) , target table missing PK, no source or target alias
testMergeUsing( testMergeUsing(
...@@ -158,7 +158,7 @@ public class TestMergeUsing extends TestBase implements Trigger { ...@@ -158,7 +158,7 @@ public class TestMergeUsing extends TestBase implements Trigger {
"SELECT 1 AS ID, 'Marcy'||X||X UNION ALL SELECT 1 AS ID, 'Marcy2'", "SELECT 1 AS ID, 'Marcy'||X||X UNION ALL SELECT 1 AS ID, 'Marcy2'",
2 2
); );
// Multiple update on same row: SQL standard says duplicate or repeated updates in same statement should cause errors -but because first row is updated, delete then insert it's considered different // Multiple update on same row: SQL standard says duplicate or repeated updates in same statement should cause errors -but because first row is updated, delete then insert it's considered different
// One insert, one update one delete happens (on same row, which is okay), then another update (which is illegal)target table missing PK, no source or target alias // One insert, one update one delete happens (on same row, which is okay), then another update (which is illegal)target table missing PK, no source or target alias
testMergeUsingException( testMergeUsingException(
...@@ -179,7 +179,7 @@ public class TestMergeUsing extends TestBase implements Trigger { ...@@ -179,7 +179,7 @@ public class TestMergeUsing extends TestBase implements Trigger {
"SELECT X AS ID, 'Marcy'||X||X AS NAME FROM SYSTEM_RANGE(2,2) UNION ALL SELECT X AS ID, 'Marcy'||X AS NAME FROM SYSTEM_RANGE(3,3)", "SELECT X AS ID, 'Marcy'||X||X AS NAME FROM SYSTEM_RANGE(2,2) UNION ALL SELECT X AS ID, 'Marcy'||X AS NAME FROM SYSTEM_RANGE(3,3)",
3, 3,
"Duplicate key updated 3 rows at once, only 1 expected" "Duplicate key updated 3 rows at once, only 1 expected"
); );
// Missing target columns in ON expression // Missing target columns in ON expression
testMergeUsingException( testMergeUsingException(
"CREATE TABLE PARENT AS (SELECT 1 AS ID, 'Marcy'||X AS NAME FROM SYSTEM_RANGE(1,3) );"+ "CREATE TABLE PARENT AS (SELECT 1 AS ID, 'Marcy'||X AS NAME FROM SYSTEM_RANGE(1,3) );"+
...@@ -189,7 +189,7 @@ public class TestMergeUsing extends TestBase implements Trigger { ...@@ -189,7 +189,7 @@ public class TestMergeUsing extends TestBase implements Trigger {
"SELECT X AS ID, 'Marcy'||X||X AS NAME FROM SYSTEM_RANGE(2,2) UNION ALL SELECT X AS ID, 'Marcy'||X AS NAME FROM SYSTEM_RANGE(3,3)", "SELECT X AS ID, 'Marcy'||X||X AS NAME FROM SYSTEM_RANGE(2,2) UNION ALL SELECT X AS ID, 'Marcy'||X AS NAME FROM SYSTEM_RANGE(3,3)",
3, 3,
"No references to target columns found in ON clause" "No references to target columns found in ON clause"
); );
// Missing source columns in ON expression // Missing source columns in ON expression
testMergeUsingException( testMergeUsingException(
"CREATE TABLE PARENT AS (SELECT 1 AS ID, 'Marcy'||X AS NAME FROM SYSTEM_RANGE(1,3) );"+ "CREATE TABLE PARENT AS (SELECT 1 AS ID, 'Marcy'||X AS NAME FROM SYSTEM_RANGE(1,3) );"+
...@@ -199,7 +199,7 @@ public class TestMergeUsing extends TestBase implements Trigger { ...@@ -199,7 +199,7 @@ public class TestMergeUsing extends TestBase implements Trigger {
"SELECT X AS ID, 'Marcy'||X||X AS NAME FROM SYSTEM_RANGE(2,2) UNION ALL SELECT X AS ID, 'Marcy'||X AS NAME FROM SYSTEM_RANGE(3,3)", "SELECT X AS ID, 'Marcy'||X||X AS NAME FROM SYSTEM_RANGE(2,2) UNION ALL SELECT X AS ID, 'Marcy'||X AS NAME FROM SYSTEM_RANGE(3,3)",
3, 3,
"No references to source columns found in ON clause" "No references to source columns found in ON clause"
); );
// Insert does not insert correct values with respect to ON condition (inserts ID value above 100, instead) // Insert does not insert correct values with respect to ON condition (inserts ID value above 100, instead)
testMergeUsingException( testMergeUsingException(
"CREATE TABLE PARENT AS (SELECT 1 AS ID, 'Marcy'||X AS NAME FROM SYSTEM_RANGE(4,4) );"+ "CREATE TABLE PARENT AS (SELECT 1 AS ID, 'Marcy'||X AS NAME FROM SYSTEM_RANGE(4,4) );"+
...@@ -209,7 +209,7 @@ public class TestMergeUsing extends TestBase implements Trigger { ...@@ -209,7 +209,7 @@ public class TestMergeUsing extends TestBase implements Trigger {
"SELECT X AS ID, 'Marcy'||X AS NAME FROM SYSTEM_RANGE(4,4)", "SELECT X AS ID, 'Marcy'||X AS NAME FROM SYSTEM_RANGE(4,4)",
1, 1,
"Expected to find key after row inserted, but none found. Insert does not match ON condition." "Expected to find key after row inserted, but none found. Insert does not match ON condition."
); );
// One insert, one update one delete happens, target table missing PK, triggers update all NAME fields // One insert, one update one delete happens, target table missing PK, triggers update all NAME fields
triggerTestingUpdateCount=0; triggerTestingUpdateCount=0;
testMergeUsing( testMergeUsing(
...@@ -219,7 +219,7 @@ public class TestMergeUsing extends TestBase implements Trigger { ...@@ -219,7 +219,7 @@ public class TestMergeUsing extends TestBase implements Trigger {
GATHER_ORDERED_RESULTS_SQL, GATHER_ORDERED_RESULTS_SQL,
"SELECT 2 AS ID, 'Marcy22-updated2' AS NAME UNION ALL SELECT X AS ID, 'Marcy'||X||'-inserted'||X AS NAME FROM SYSTEM_RANGE(3,4)", "SELECT 2 AS ID, 'Marcy22-updated2' AS NAME UNION ALL SELECT X AS ID, 'Marcy'||X||'-inserted'||X AS NAME FROM SYSTEM_RANGE(3,4)",
4 4
); );
} }
/** /**
...@@ -243,20 +243,20 @@ public class TestMergeUsing extends TestBase implements Trigger { ...@@ -243,20 +243,20 @@ public class TestMergeUsing extends TestBase implements Trigger {
try{ try{
stat = conn.createStatement(); stat = conn.createStatement();
stat.execute(setupSQL); stat.execute(setupSQL);
prep = conn.prepareStatement(statementUnderTest); prep = conn.prepareStatement(statementUnderTest);
rowCountUpdate = prep.executeUpdate(); rowCountUpdate = prep.executeUpdate();
// compare actual results from SQL resultsset with expected results - by diffing (aka set MINUS operation) // compare actual results from SQL result set with expected results - by diffing (aka set MINUS operation)
rs = stat.executeQuery("( "+gatherResultsSQL+" ) MINUS ( "+expectedResultsSQL+" )"); rs = stat.executeQuery("( "+gatherResultsSQL+" ) MINUS ( "+expectedResultsSQL+" )");
int rowCount = 0; int rowCount = 0;
StringBuffer diffBuffer = new StringBuffer(""); StringBuffer diffBuffer = new StringBuffer("");
while (rs.next()) { while (rs.next()) {
rowCount++; rowCount++;
diffBuffer.append("|"); diffBuffer.append("|");
for(int ndx = 1; ndx <= rs.getMetaData().getColumnCount(); ndx++){ for(int i = 1; i <= rs.getMetaData().getColumnCount(); i++){
diffBuffer.append(rs.getObject(ndx)); diffBuffer.append(rs.getObject(i));
diffBuffer.append("|\n"); diffBuffer.append("|\n");
} }
} }
...@@ -289,11 +289,11 @@ public class TestMergeUsing extends TestBase implements Trigger { ...@@ -289,11 +289,11 @@ public class TestMergeUsing extends TestBase implements Trigger {
e.printStackTrace(); e.printStackTrace();
} }
assertContains(e.getMessage(),exceptionMessage); assertContains(e.getMessage(),exceptionMessage);
return; return;
} }
fail("Failed to see exception with message:"+exceptionMessage); fail("Failed to see exception with message:"+exceptionMessage);
} }
@Override @Override
public void fire(Connection conn, Object[] oldRow, Object[] newRow) public void fire(Connection conn, Object[] oldRow, Object[] newRow)
throws SQLException { throws SQLException {
...@@ -307,7 +307,7 @@ public class TestMergeUsing extends TestBase implements Trigger { ...@@ -307,7 +307,7 @@ public class TestMergeUsing extends TestBase implements Trigger {
newRow[1] = newRow[1] + "-updated"+(++triggerTestingUpdateCount); newRow[1] = newRow[1] + "-updated"+(++triggerTestingUpdateCount);
} else if (triggerName.startsWith("DEL_BEFORE")) { } else if (triggerName.startsWith("DEL_BEFORE")) {
oldRow[1] = oldRow[1] + "-deleted"+(++triggerTestingUpdateCount); oldRow[1] = oldRow[1] + "-deleted"+(++triggerTestingUpdateCount);
} }
} }
@Override @Override
...@@ -337,7 +337,7 @@ public class TestMergeUsing extends TestBase implements Trigger { ...@@ -337,7 +337,7 @@ public class TestMergeUsing extends TestBase implements Trigger {
throw new AssertionError("triggerName: " + trigger + " type:" + type); throw new AssertionError("triggerName: " + trigger + " type:" + type);
} }
} }
private String getCreateTriggerSQL(){ private String getCreateTriggerSQL(){
StringBuffer buf = new StringBuffer(); StringBuffer buf = new StringBuffer();
buf.append("CREATE TRIGGER INS_BEFORE " + buf.append("CREATE TRIGGER INS_BEFORE " +
...@@ -351,6 +351,6 @@ public class TestMergeUsing extends TestBase implements Trigger { ...@@ -351,6 +351,6 @@ public class TestMergeUsing extends TestBase implements Trigger {
"FOR EACH ROW NOWAIT CALL \"" + getClass().getName() + "\";"); "FOR EACH ROW NOWAIT CALL \"" + getClass().getName() + "\";");
return buf.toString(); return buf.toString();
} }
} }
...@@ -115,7 +115,7 @@ public class TestScript extends TestBase { ...@@ -115,7 +115,7 @@ public class TestScript extends TestBase {
for (String s : new String[] { "array-contains", "array-get", for (String s : new String[] { "array-contains", "array-get",
"array-length", "autocommit", "cancel-session", "casewhen", "array-length", "autocommit", "cancel-session", "casewhen",
"cast", "coalesce", "convert", "csvread", "csvwrite", "currval", "cast", "coalesce", "convert", "csvread", "csvwrite", "currval",
"database-path", "datebase", "decode", "disk-space-used", "database-path", "database", "decode", "disk-space-used",
"file-read", "file-write", "greatest", "h2version", "identity", "file-read", "file-write", "greatest", "h2version", "identity",
"ifnull", "least", "link-schema", "lock-mode", "lock-timeout", "ifnull", "least", "link-schema", "lock-mode", "lock-timeout",
"memory-free", "memory-used", "nextval", "nullif", "nvl2", "memory-free", "memory-used", "nextval", "nullif", "nvl2",
......
...@@ -104,7 +104,7 @@ collaborative collapse collate collateral collation collations collator collator ...@@ -104,7 +104,7 @@ collaborative collapse collate collateral collation collations collator collator
collect collected collecting collection collections collectively collector collect collected collecting collection collections collectively collector
collide collision collisions colon color cols colspan column columnlist columns collide collision collisions colon color cols colspan column columnlist columns
com combination combinations combinatorics combine combined combines combining com combination combinations combinatorics combine combined combines combining
combo combobox come comes comma command commands commas comment commented combo combobox come comes coming comma command commands commas comment commented
comments commercial commit commits committed committing common commonly commons comments commercial commit commits committed committing common commonly commons
communicates communication community comp compact compacted compacting compaction communicates communication community comp compact compacted compacting compaction
compacts companies company comparable comparative comparator compare compared compacts companies company comparable comparative comparator compare compared
...@@ -561,7 +561,7 @@ safes safety said sainsbury salary sale sales saload salt salz sam same ...@@ -561,7 +561,7 @@ safes safety said sainsbury salary sale sales saload salt salz sam same
sameorigin samp sample samples sanitize sanity sans sastore sat satisfy saturday sauce sameorigin samp sample samples sanitize sanity sans sastore sat satisfy saturday sauce
sauerkraut sava save saved savepoint savepoints saves saving savings say saying sauerkraut sava save saved savepoint savepoints saves saving savings say saying
says sbquo scala scalability scalable scalar scale scaled scales scan scanned says sbquo scala scalability scalable scalar scale scaled scales scan scanned
scanner scanners scanning scans scapegoat scc schedule scheduler schem schema scanner scanners scanning scans scapegoat scc scenarios schedule scheduler schem schema
schemas schemata scheme schmorp school schwietzke sciences scientific scjp scm schemas schemata scheme schmorp school schwietzke sciences scientific scjp scm
scones scoop scope scoped score scott scramble scrambling scratch screen scones scoop scope scoped score scott scramble scrambling scratch screen
screenshot script scriptable scriptella scripting scripts scroll scrollable screenshot script scriptable scriptella scripting scripts scroll scrollable
...@@ -677,7 +677,7 @@ undetected undo undocumented undone unencrypted unenforceable unescape unexpecte ...@@ -677,7 +677,7 @@ undetected undo undocumented undone unencrypted unenforceable unescape unexpecte
unfortunately unhandled uni unicode unified uniform uniformly unimplemented unfortunately unhandled uni unicode unified uniform uniformly unimplemented
unindexed uninitialized uninstall uninteresting uninterpreted uninterruptible unindexed uninitialized uninstall uninteresting uninterpreted uninterruptible
union unique uniquely uniqueness uniques unit united units universal universally union unique uniquely uniqueness uniques unit united units universal universally
unix unixtime unknown unless unlike unlimited unlink unlinked unload unloaded unix unixtime unknown unless unlike unlikely unlimited unlink unlinked unload unloaded
unloading unloads unlock unlocked unlocking unlocks unmaintained unmappable unloading unloads unlock unlocked unlocking unlocks unmaintained unmappable
unmapped unmodified unmounted unnamed unnecessarily unnecessary unneeded uno unmapped unmodified unmounted unnamed unnecessarily unnecessary unneeded uno
unofficial unordered unpredictable unquoted unrecognized unrecoverable unofficial unordered unpredictable unquoted unrecognized unrecoverable
...@@ -740,4 +740,10 @@ stumc numbered ...@@ -740,4 +740,10 @@ stumc numbered
reopening cloudera hive clustername whomooz unittest anymore snowflakecomputing unpadded endpoint redshift backingtable reopening cloudera hive clustername whomooz unittest anymore snowflakecomputing unpadded endpoint redshift backingtable
trimming hadoop azure resolves snowflake testsynonym plays charsettable synonyms nonexisting impala codepage recognize trimming hadoop azure resolves snowflake testsynonym plays charsettable synonyms nonexisting impala codepage recognize
dbm forwarded amazon stmnt excessive testvalue dbm forwarded amazon stmnt excessive testvalue
\ No newline at end of file
rowids searchers tcnt enforcing timeanddate nullifies determines believe giving
vectorwise preparation corrupting cubrid diffing unrestricted cleanups warns
rowspan specifically unoptimized stand emphasize cascaded exasol minimize rnum figure
emptying goal gathers multithread amend raised iter gathered gather especially requiring
collaboration thank essentially bunch vmlens subroutines nulled
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论