📄 sysstatementsrowfactory.java
字号:
DataDictionary dd ) throws StandardException { DataValueDescriptor col; SPSDescriptor descriptor; String name; String text; String usingText; UUID uuid; UUID compUuid; String uuidStr; UUID suuid; // schema String suuidStr; // schema String typeStr; char type; boolean valid; Timestamp time = null; ExecPreparedStatement preparedStatement = null; boolean initiallyCompilable; DataDescriptorGenerator ddg = dd.getDataDescriptorGenerator(); if (SanityManager.DEBUG) { SanityManager.ASSERT(row.nColumns() == SYSSTATEMENTS_COLUMN_COUNT, "Wrong number of columns for a SYSSTATEMENTS row"); } // 1st column is STMTID (UUID - char(36)) col = row.getColumn(1); uuidStr = col.getString(); uuid = getUUIDFactory().recreateUUID(uuidStr); // 2nd column is STMTNAME (varchar(128)) col = row.getColumn(2); name = col.getString(); // 3rd column is SCHEMAID (UUID - char(36)) col = row.getColumn(3); suuidStr = col.getString(); suuid = getUUIDFactory().recreateUUID(suuidStr); // 4th column is TYPE (char(1)) col = row.getColumn(4); type = col.getString().charAt(0); if (SanityManager.DEBUG) { if (!SPSDescriptor.validType(type)) { SanityManager.THROWASSERT("Bad type value ("+type+") for statement "+name); } } // In soft upgrade mode the plan may not be understand by this engine // so force a recompile. if (((DataDictionaryImpl) dd).readOnlyUpgrade) { valid = false; } else { // 5th column is VALID (boolean) col = row.getColumn(5); valid = col.getBoolean(); } // 6th column is TEXT (LONG VARCHAR) col = row.getColumn(6); text = col.getString(); /* 7th column is LASTCOMPILED (TIMESTAMP) */ col = row.getColumn(7); time = col.getTimestamp(new java.util.GregorianCalendar()); // 8th column is COMPILATIONSCHEMAID (UUID - char(36)) col = row.getColumn(8); uuidStr = col.getString(); compUuid = getUUIDFactory().recreateUUID(uuidStr); // 9th column is TEXT (LONG VARCHAR) col = row.getColumn(9); usingText = col.getString(); // 10th column is CONSTANTSTATE (COM...ExecPreparedStatement) // Only load the compiled plan if the statement is valid if (valid) { col = row.getColumn(10); preparedStatement = (ExecPreparedStatement) col.getObject(); } // 11th column is INITIALLY_COMPILABLE (boolean) col = row.getColumn(11); if ( col.isNull() ) { initiallyCompilable = true; } else { initiallyCompilable = col.getBoolean(); } descriptor = new SPSDescriptor(dd, name, uuid, suuid, compUuid, type, valid, text, usingText, time, preparedStatement, initiallyCompilable ); return descriptor; } public ExecRow makeEmptyRow() throws StandardException { return makeSYSSTATEMENTSrow(false, (SPSDescriptor) null); } /** * Builds a list of columns suitable for creating this Catalog. * The last column, the serialized statement, is not added * to the column list. This is done deliberately to make it * a 'hidden' column -- one that is not visible to customers, * but is visible to the system. * * * @return array of SystemColumn suitable for making this catalog. */ public SystemColumn[] buildColumnList() { /* ** Create one less than the number of columns, we ** skip the last one deliberately. */ SystemColumn[] columnList = new SystemColumn[SYSSTATEMENTS_COLUMN_COUNT - SYSSTATEMENTS_HIDDEN_COLUMN_COUNT]; // describe columns columnList[0] = new SystemColumnImpl( convertIdCase( "STMTID"), // name SYSSTATEMENTS_STMTID, // column number 0, // precision 0, // scale false, // nullability "CHAR", // dataType true, // built-in type 36 // maxLength ); columnList[1] = new SystemColumnImpl( // SQL IDENTIFIER convertIdCase( "STMTNAME"), // column name SYSSTATEMENTS_STMTNAME, // column number false // nullability ); columnList[2] = new SystemColumnImpl( convertIdCase( "SCHEMAID"), // name SYSSTATEMENTS_SCHEMAID, // column number 0, // precision 0, // scale false, // nullability "CHAR", // dataType true, // built-in type 36 // maxLength ); columnList[3] = new SystemColumnImpl( convertIdCase( "TYPE"), // name SYSSTATEMENTS_TYPE, // column number 0, // precision 0, // scale false, // nullability "CHAR", // dataType true, // built-in type 1 // maxLength ); columnList[4] = new SystemColumnImpl( convertIdCase( "VALID"), // name SYSSTATEMENTS_VALID,// column number 0, // precision 0, // scale false, // nullability "BOOLEAN", // dataType true, // built-in type 1 // maxLength ); columnList[5] = new SystemColumnImpl( convertIdCase( "TEXT"), // name SYSSTATEMENTS_TEXT, // column number 0, // precision 0, // scale false, // nullability "LONG VARCHAR", // dataType true, // built-in type TypeId.LONGVARCHAR_MAXWIDTH // maxLength ); columnList[6] = new SystemColumnImpl( convertIdCase( "LASTCOMPILED"), // name SYSSTATEMENTS_LASTCOMPILED, // column number 0, // precision 0, // scale true, // nullability "TIMESTAMP", // dataType true, // built-in type TypeId.TIMESTAMP_MAXWIDTH // maxLength ); columnList[7] = new SystemColumnImpl( convertIdCase( "COMPILATIONSCHEMAID"), // name SYSSTATEMENTS_COMPILATION_SCHEMAID, // column number 0, // precision 0, // scale false, // nullability "CHAR", // dataType true, // built-in type 36 // maxLength ); columnList[8] = new SystemColumnImpl( convertIdCase( "USINGTEXT"), // name SYSSTATEMENTS_USINGTEXT,// column number 0, // precision 0, // scale true, // nullability "LONG VARCHAR", // dataType true, // built-in type TypeId.LONGVARCHAR_MAXWIDTH // maxLength ); /* ** This column is deliberately left out. It ** is effectively 'hidden' from users. The code ** to create it is left here to demonstrate what ** it really looks like. */ //columnList[9] = // new SystemColumnImpl( // convertIdCase( "CONSTANTSTATE"), // name // SYSSTATEMENTS_CONSTANTSTATE,// column number // 0, // precision // 0, // scale // false, // nullability // ExecPreparedStatement.CLASS_NAME, //datatype // false, // built-in type // DataTypeDescriptor.MAXIMUM_WIDTH_UNKNOWN // maxLength // ); /* ** This column is also deliberately left out. It ** is effectively 'hidden' from users. The code ** to create it is left here to demonstrate what ** it really looks like. */ //columnList[10] = // new SystemColumnImpl( // convertIdCase( "INITIALLY_COMPILABLE"), // name // SYSSTATEMENTS_INITIALLY_COMPILABLE,// column number // 0, // precision // 0, // scale // true, // nullability // "BOOLEAN", // dataType // true, // built-in type // 1 // maxLength // ); return columnList; } /** * Get the Properties associated with creating the heap. * * @return The Properties associated with creating the heap. */ public Properties getCreateHeapProperties() { Properties properties = new Properties(); // keep page size at 2K since most stmts are that size // anyway properties.put(Property.PAGE_SIZE_PARAMETER,"2048"); // default properties for system tables: properties.put(RawStoreFactory.PAGE_RESERVED_SPACE_PARAMETER,"0"); properties.put(RawStoreFactory.MINIMUM_RECORD_SIZE_PARAMETER,"1"); return properties; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -