📄 language.java
字号:
* if duplicate entry is found.
*/
private final void setSqlStates() {
Set inserted = new HashSet(); // for duplicates checking
for (int i = 0; i < SQL_STATES.length; i++) {
String key = SQL_STATES[i][0];
if (! inserted.add(key)) {
throw new IllegalArgumentException("Duplicate key: " + key);
}
else {
String value = SQL_STATES[i][1];
sqlStates.put(key, value);
}
}
}
public String getMessage(String key) {
String message = (String) messages.get(key);
assert(message != null): "Message code not found: " + key;
return message;
}
public String getSqlState(String key) {
String sqlState = (String) sqlStates.get(key);
assert(sqlState != null): "SQL State code not found: " + key;
return sqlState;
}
public String[][] getEntries() {
return MESSAGES;
}
//////////////////////////////////////////////////////////////////////
// MESSAGES
//////////////////////////////////////////////////////////////////////
private final String[][] MESSAGES = {
{ CUSTOM_MESSAGE , "{0}" },
{ UNSUPPORTED_OPERATION , "Unsupported Operation {0}." },
{ CANT_LOCK_FILE , "Can''t lock file ''{0}''. A single SmallSQL Database can only be opened from a single process." },
{ DB_EXISTENT , "Database ''{0}'' already exists." },
{ DB_NONEXISTENT , "Database ''{0}'' does not exist." },
{ DB_NOT_DIRECTORY , "Directory ''{0}'' is not a SmallSQL database." },
{ DB_NOTCONNECTED , "You are not connected with a Database." },
{ CONNECTION_CLOSED , "Connection is already closed." },
{ VIEW_INSERT , "INSERT is not supported for a view." },
{ VIEWDROP_NOT_VIEW , "Cannot use DROP VIEW with ''{0}'' because it does not is a view." },
{ VIEW_CANTDROP , "View ''{0}'' can''t be dropped." },
{ RSET_NOT_PRODUCED , "No ResultSet was produced." },
{ RSET_READONLY , "ResultSet is read only." },
{ RSET_FWDONLY , "ResultSet is forward only." },
{ RSET_CLOSED , "ResultSet is closed." },
{ RSET_NOT_INSERT_ROW , "Cursor is currently not on the insert row." },
{ RSET_ON_INSERT_ROW , "Cursor is currently on the insert row." },
{ ROWSOURCE_READONLY , "Rowsource is read only." },
{ STMT_IS_CLOSED , "Statement is already closed." },
{ SUBQUERY_COL_COUNT , "Count of columns in subquery must be 1 and not {0}." },
{ JOIN_DELETE , "The method deleteRow not supported on joins." },
{ JOIN_INSERT , "The method insertRow not supported on joins." },
{ DELETE_WO_FROM , "The method deleteRow need a FROM expression." },
{ INSERT_WO_FROM , "The method insertRow need a FROM expression." },
{ TABLE_CANT_RENAME , "Table ''{0}'' can''t be renamed." },
{ TABLE_CANT_DROP , "Table ''{0}'' can''t be dropped." },
{ TABLE_CANT_DROP_LOCKED , "Table ''{0}'' can''t drop because is locked." },
{ TABLE_CORRUPT_PAGE , "Corrupt table page at position: {0}." },
{ TABLE_MODIFIED , "Table ''{0}'' was modified." },
{ TABLE_DEADLOCK , "Deadlock, can not create a lock on table ''{0}''." },
{ TABLE_OR_VIEW_MISSING , "Table or View ''{0}'' does not exist." },
{ TABLE_FILE_INVALID , "File ''{0}'' does not include a valid SmallSQL Table." },
{ TABLE_OR_VIEW_FILE_INVALID , "File ''{0}'' is not a valid Table or View store." },
{ TABLE_EXISTENT , "Table or View ''{0}'' already exists." },
{ FK_NOT_TABLE , "''{0}'' is not a table." },
{ PK_ONLYONE , "A table can have only one primary key." },
{ KEY_DUPLICATE , "Duplicate Key." },
{ MONTH_TOOLARGE , "Months are too large in DATE or TIMESTAMP value ''{0}''." },
{ DAYS_TOOLARGE , "Days are too large in DATE or TIMESTAMP value ''{0}''." },
{ HOURS_TOOLARGE , "Hours are too large in TIME or TIMESTAMP value ''{0}''." },
{ MINUTES_TOOLARGE , "Minutes are too large in TIME or TIMESTAMP value ''{0}''." },
{ SECS_TOOLARGE , "Seconds are too large in TIME or TIMESTAMP value ''{0}''." },
{ MILLIS_TOOLARGE , "Milliseconds are too large in TIMESTAMP value ''{0}''." },
{ DATETIME_INVALID , "''{0}'' is an invalid DATE, TIME or TIMESTAMP." },
{ UNSUPPORTED_CONVERSION_OPER , "Unsupported conversion to data type ''{0}'' from data type ''{1}'' for operation ''{2}''." },
{ UNSUPPORTED_DATATYPE_OPER , "Unsupported data type ''{0}'' for operation ''{1}''." },
{ UNSUPPORTED_DATATYPE_FUNC , "Unsupported data type ''{0}'' for function ''{1}''." },
{ UNSUPPORTED_CONVERSION_FUNC , "Unsupported conversion to data type ''{0}'' for function ''{1}''." },
{ UNSUPPORTED_TYPE_CONV , "Unsupported type for CONVERT function: {0}." },
{ UNSUPPORTED_TYPE_SUM , "Unsupported data type ''{0}'' for SUM function." },
{ UNSUPPORTED_TYPE_MAX , "Unsupported data type ''{0}'' for MAX function." },
{ UNSUPPORTED_CONVERSION , "Can''t convert ''{0}'' [{1}] to ''{2}''." },
{ INSERT_INVALID_LEN , "Invalid length ''{0}'' in function INSERT." },
{ SUBSTR_INVALID_LEN , "Invalid length ''{0}'' in function SUBSTRING." },
{ VALUE_STR_TOOLARGE , "String value too large for column." },
{ VALUE_BIN_TOOLARGE , "Binary value with length {0} to large for column with size {1}." },
{ VALUE_NULL_INVALID , "Null values are not valid for column ''{0}''." },
{ VALUE_CANT_CONVERT , "Cannot convert a {0} value to a {1} value." },
{ BYTEARR_INVALID_SIZE , "Invalid byte array size {0} for UNIQUEIDENFIER." },
{ LOB_DELETED , "Lob Object was deleted." },
{ PARAM_CLASS_UNKNOWN , "Unknown parameter class: ''{0}''." },
{ PARAM_EMPTY , "Parameter {0} is empty." },
{ PARAM_IDX_OUT_RANGE , "Parameter index {0} out of range. The value must be between 1 and {1}." },
{ COL_DUPLICATE , "There is a duplicated column name: ''{0}''." },
{ COL_MISSING , "Column ''{0}'' not found." },
{ COL_VAL_UNMATCH , "Columns and Values count is not identical." },
{ COL_INVALID_SIZE , "Invalid column size {0} for column ''{1}''." },
{ COL_WRONG_PREFIX , "The column prefix ''{0}'' does not match with a table name or alias name used in this query." },
{ COL_READONLY , "Column {0} is read only." },
{ COL_INVALID_NAME , "Invalid column name ''{0}''." },
{ COL_IDX_OUT_RANGE , "Column index out of range: {0}." },
{ COL_AMBIGUOUS , "Column ''{0}'' is ambiguous." },
{ GROUP_AGGR_INVALID , "Aggregate function are not valid in the GROUP BY clause ({0})." },
{ GROUP_AGGR_NOTPART , "Expression ''{0}'' is not part of a aggregate function or GROUP BY clause." },
{ ORDERBY_INTERNAL , "Internal Error with ORDER BY." },
{ UNION_DIFFERENT_COLS , "Different SELECT of the UNION have different column count: {0} and {1}." },
{ INDEX_EXISTS , "Index ''{0}'' already exists." },
{ INDEX_MISSING , "Index ''{0}'' does not exist." },
{ INDEX_FILE_INVALID , "File ''{0}'' is not a valid Index store." },
{ INDEX_CORRUPT , "Error in loading Index. Index file is corrupt. ({0})." },
{ INDEX_TOOMANY_EQUALS , "Too many equals entry in Index." },
{ FILE_TOONEW , "File version ({0}) of file ''{1}'' is too new for this runtime." },
{ FILE_TOOOLD , "File version ({0}) of file ''{1}'' is too old for this runtime." },
{ ROW_0_ABSOLUTE , "Row 0 is invalid for method absolute()." },
{ ROW_NOCURRENT , "No current row." },
{ ROWS_WRONG_MAX , "Wrong max rows value: {0}." },
{ ROW_LOCKED , "Row is locked from another Connection." },
{ ROW_DELETED , "Row already deleted." },
{ SAVEPT_INVALID_TRANS , "Savepoint is not valid for this transaction." },
{ SAVEPT_INVALID_DRIVER , "Savepoint is not valid for this driver {0}." },
{ ALIAS_UNSUPPORTED , "Alias not supported for this type of row source." },
{ ISOLATION_UNKNOWN , "Unknown Transaction Isolation Level: {0}." },
{ FLAGVALUE_INVALID , "Invalid flag value in method getMoreResults: {0}." },
{ ARGUMENT_INVALID , "Invalid argument in method setNeedGenratedKeys: {0}." },
{ GENER_KEYS_UNREQUIRED , "GeneratedKeys not requested." },
{ SEQUENCE_HEX_INVALID , "Invalid hex sequence at {0}." },
{ SEQUENCE_HEX_INVALID_STR , "Invalid hex sequence at position {0} in ''{1}''." },
{ SYNTAX_BASE_OFS , "Syntax error at offset {0} on ''{1}''. " },
{ SYNTAX_BASE_END , "Syntax error, unexpected end of SQL string. " },
{ STXADD_ADDITIONAL_TOK , "Additional token after end of SQL statement." },
{ STXADD_IDENT_EXPECT , "Identifier expected." },
{ STXADD_IDENT_EMPTY , "Empty Identifier." },
{ STXADD_IDENT_WRONG , "Wrong Identifier ''{0}''." },
{ STXADD_OPER_MINUS , "Invalid operator minus for data type VARBINARY." },
{ STXADD_FUNC_UNKNOWN , "Unknown function." },
{ STXADD_PARAM_INVALID_COUNT , "Invalid parameter count." },
{ STXADD_JOIN_INVALID , "Invalid Join Syntax." },
{ STXADD_FROM_PAR_CLOSE , "Unexpected closing parenthesis in FROM clause." },
{ STXADD_KEYS_REQUIRED , "Required keywords are: " },
{ STXADD_NOT_NUMBER , "Number value required (passed = ''{0}'')." },
{ STXADD_COMMENT_OPEN , "Missing end comment mark (''*/'')." },
};
//////////////////////////////////////////////////////////////////////
// SQL_STATES
//////////////////////////////////////////////////////////////////////
private final String[][] SQL_STATES = {
{ CUSTOM_MESSAGE , "01000" },
{ UNSUPPORTED_OPERATION , "01000" },
{ CANT_LOCK_FILE , "01000" },
{ DB_EXISTENT , "01000" },
{ DB_NONEXISTENT , "01000" },
{ DB_NOT_DIRECTORY , "01000" },
{ DB_NOTCONNECTED , "01000" },
{ CONNECTION_CLOSED , "01000" },
{ VIEW_INSERT , "01000" },
{ VIEWDROP_NOT_VIEW , "01000" },
{ VIEW_CANTDROP , "01000" },
{ RSET_NOT_PRODUCED , "01000" },
{ RSET_READONLY , "01000" },
{ RSET_FWDONLY , "01000" },
{ RSET_CLOSED , "01000" },
{ RSET_NOT_INSERT_ROW , "01000" },
{ RSET_ON_INSERT_ROW , "01000" },
{ ROWSOURCE_READONLY , "01000" },
{ STMT_IS_CLOSED , "HY010" },
{ SUBQUERY_COL_COUNT , "01000" },
{ JOIN_DELETE , "01000" },
{ JOIN_INSERT , "01000" },
{ DELETE_WO_FROM , "01000" },
{ INSERT_WO_FROM , "01000" },
{ TABLE_CANT_RENAME , "01000" },
{ TABLE_CANT_DROP , "01000" },
{ TABLE_CANT_DROP_LOCKED , "01000" },
{ TABLE_CORRUPT_PAGE , "01000" },
{ TABLE_MODIFIED , "01000" },
{ TABLE_DEADLOCK , "01000" },
{ TABLE_OR_VIEW_MISSING , "01000" },
{ TABLE_FILE_INVALID , "01000" },
{ TABLE_OR_VIEW_FILE_INVALID , "01000" },
{ TABLE_EXISTENT , "01000" },
{ FK_NOT_TABLE , "01000" },
{ PK_ONLYONE , "01000" },
{ KEY_DUPLICATE , "01000" },
{ MONTH_TOOLARGE , "01000" },
{ DAYS_TOOLARGE , "01000" },
{ HOURS_TOOLARGE , "01000" },
{ MINUTES_TOOLARGE , "01000" },
{ SECS_TOOLARGE , "01000" },
{ MILLIS_TOOLARGE , "01000" },
{ DATETIME_INVALID , "01000" },
{ UNSUPPORTED_CONVERSION_OPER , "01000" },
{ UNSUPPORTED_DATATYPE_OPER , "01000" },
{ UNSUPPORTED_DATATYPE_FUNC , "01000" },
{ UNSUPPORTED_CONVERSION_FUNC , "01000" },
{ UNSUPPORTED_TYPE_CONV , "01000" },
{ UNSUPPORTED_TYPE_SUM , "01000" },
{ UNSUPPORTED_TYPE_MAX , "01000" },
{ UNSUPPORTED_CONVERSION , "01000" },
{ INSERT_INVALID_LEN , "01000" },
{ SUBSTR_INVALID_LEN , "01000" },
{ VALUE_STR_TOOLARGE , "01000" },
{ VALUE_BIN_TOOLARGE , "01000" },
{ VALUE_NULL_INVALID , "01000" },
{ VALUE_CANT_CONVERT , "01000" },
{ BYTEARR_INVALID_SIZE , "01000" },
{ LOB_DELETED , "01000" },
{ PARAM_CLASS_UNKNOWN , "01000" },
{ PARAM_EMPTY , "01000" },
{ PARAM_IDX_OUT_RANGE , "01000" },
{ COL_DUPLICATE , "01000" },
{ COL_MISSING , "01000" },
{ COL_VAL_UNMATCH , "01000" },
{ COL_INVALID_SIZE , "01000" },
{ COL_WRONG_PREFIX , "01000" },
{ COL_READONLY , "01000" },
{ COL_INVALID_NAME , "01000" },
{ COL_IDX_OUT_RANGE , "01000" },
{ COL_AMBIGUOUS , "01000" },
{ GROUP_AGGR_INVALID , "01000" },
{ GROUP_AGGR_NOTPART , "01000" },
{ ORDERBY_INTERNAL , "01000" },
{ UNION_DIFFERENT_COLS , "01000" },
{ INDEX_EXISTS , "01000" },
{ INDEX_MISSING , "01000" },
{ INDEX_FILE_INVALID , "01000" },
{ INDEX_CORRUPT , "01000" },
{ INDEX_TOOMANY_EQUALS , "01000" },
{ FILE_TOONEW , "01000" },
{ FILE_TOOOLD , "01000" },
{ ROW_0_ABSOLUTE , "01000" },
{ ROW_NOCURRENT , "01000" },
{ ROWS_WRONG_MAX , "01000" },
{ ROW_LOCKED , "01000" },
{ ROW_DELETED , "01000" },
{ SAVEPT_INVALID_TRANS , "01000" },
{ SAVEPT_INVALID_DRIVER , "01000" },
{ ALIAS_UNSUPPORTED , "01000" },
{ ISOLATION_UNKNOWN , "01000" },
{ FLAGVALUE_INVALID , "01000" },
{ ARGUMENT_INVALID , "01000" },
{ GENER_KEYS_UNREQUIRED , "01000" },
{ SEQUENCE_HEX_INVALID , "01000" },
{ SEQUENCE_HEX_INVALID_STR , "01000" },
{ SYNTAX_BASE_OFS , "01000" },
{ SYNTAX_BASE_END , "01000" },
{ STXADD_ADDITIONAL_TOK , "01000" },
{ STXADD_IDENT_EXPECT , "01000" },
{ STXADD_IDENT_EMPTY , "01000" },
{ STXADD_IDENT_WRONG , "01000" },
{ STXADD_OPER_MINUS , "01000" },
{ STXADD_FUNC_UNKNOWN , "01000" },
{ STXADD_PARAM_INVALID_COUNT , "01000" },
{ STXADD_JOIN_INVALID , "01000" },
{ STXADD_FROM_PAR_CLOSE , "01000" },
{ STXADD_KEYS_REQUIRED , "01000" },
{ STXADD_NOT_NUMBER , "01000" },
{ STXADD_COMMENT_OPEN , "01000" },
};
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -