use of org.apache.derby.iapi.types.DataValueDescriptor in project derby by apache.
the class DataDictionaryImpl method getSPSDescriptorIndex2Scan.
/**
* Scan sysstatements_index2 (stmtid) for a match.
* Note that we do not do a lookup of parameter info.
*
* @return SPSDescriptor The matching descriptor, if any.
*
* @exception StandardException Thrown on failure
*/
private SPSDescriptor getSPSDescriptorIndex2Scan(String stmtUUID) throws StandardException {
DataValueDescriptor stmtIDOrderable;
TabInfoImpl ti = getNonCoreTI(SYSSTATEMENTS_CATALOG_NUM);
/* Use stmtIdOrderable in both start
* and stop position for scan.
*/
stmtIDOrderable = new SQLChar(stmtUUID);
/* Set up the start/stop position for the scan */
ExecIndexRow keyRow = exFactory.getIndexableRow(1);
keyRow.setColumn(1, stmtIDOrderable);
SPSDescriptor spsd = getDescriptorViaIndex(SYSSTATEMENTSRowFactory.SYSSTATEMENTS_INDEX1_ID, keyRow, (ScanQualifier[][]) null, ti, (TupleDescriptor) null, (List<TupleDescriptor>) null, SPSDescriptor.class, false);
return spsd;
}
use of org.apache.derby.iapi.types.DataValueDescriptor in project derby by apache.
the class SYSSTATISTICSRowFactory method buildDescriptor.
public TupleDescriptor buildDescriptor(ExecRow row, TupleDescriptor parentDesc, DataDictionary dd) throws StandardException {
if (SanityManager.DEBUG) {
SanityManager.ASSERT(row.nColumns() == SYSSTATISTICS_COLUMN_COUNT, "Wrong number of columns for a SYSSTATISTICS row");
}
DataValueDescriptor col;
String scratch;
UUIDFactory uuidFactory = getUUIDFactory();
UUID statUUID, statReferenceUUID, statTableUUID;
String statName;
/* 1st column is UUID */
col = row.getColumn(SYSSTATISTICS_ID);
scratch = col.getString();
statUUID = uuidFactory.recreateUUID(scratch);
/* 2nd column is reference UUID */
col = row.getColumn(SYSSTATISTICS_REFERENCEID);
scratch = col.getString();
statReferenceUUID = uuidFactory.recreateUUID(scratch);
/* 3rd column is table UUID */
col = row.getColumn(SYSSTATISTICS_TABLEID);
scratch = col.getString();
statTableUUID = uuidFactory.recreateUUID(scratch);
/* 4th column is timestamp */
col = row.getColumn(SYSSTATISTICS_TIMESTAMP);
Timestamp updateTime = (Timestamp) col.getObject();
/* 5th column is stat type -- string */
col = row.getColumn(SYSSTATISTICS_TYPE);
String statType = col.getString();
/* 6th column is stat valid -- boolean */
col = row.getColumn(SYSSTATISTICS_VALID);
boolean valid = col.getBoolean();
/* 7th column is column count */
col = row.getColumn(SYSSTATISTICS_COLCOUNT);
int columnCount = col.getInt();
/* 8th column is statistics itself */
col = row.getColumn(SYSSTATISTICS_STAT);
Statistics stat = (Statistics) col.getObject();
return new StatisticsDescriptor(dd, statUUID, statReferenceUUID, // statName, colMap,
statTableUUID, statType, stat, columnCount);
}
use of org.apache.derby.iapi.types.DataValueDescriptor in project derby by apache.
the class SYSTABLEPERMSRowFactory method setUUIDOfThePassedDescriptor.
// end of removeOnePermission
/**
* @see PermissionsCatalogRowFactory#setUUIDOfThePassedDescriptor
*/
public void setUUIDOfThePassedDescriptor(ExecRow row, PermissionsDescriptor perm) throws StandardException {
DataValueDescriptor existingPermDVD = row.getColumn(TABLEPERMSID_COL_NUM);
perm.setUUID(getUUIDFactory().recreateUUID(existingPermDVD.getString()));
}
use of org.apache.derby.iapi.types.DataValueDescriptor in project derby by apache.
the class SYSTABLEPERMSRowFactory method removeOnePermission.
// end of removePermissions
private boolean removeOnePermission(ExecRow row, boolean[] colsChanged, int column, String permission) throws StandardException {
DataValueDescriptor existingPermDVD = row.getColumn(column);
char existingPerm = existingPermDVD.getString().charAt(0);
if (// Don't remove this one
permission.charAt(0) == 'N')
// The grantee still has some permissions on this table
return existingPerm != 'N';
if (SanityManager.DEBUG)
SanityManager.ASSERT(permission.charAt(0) == 'Y' || permission.charAt(0) == 'y', "Invalid permission passed to SYSTABLEPERMSRowFactory.removeOnePermission");
if (existingPerm != 'N') {
existingPermDVD.setValue("N");
colsChanged[column - 1] = true;
}
return false;
}
use of org.apache.derby.iapi.types.DataValueDescriptor in project derby by apache.
the class SYSTABLEPERMSRowFactory method makeRow.
public ExecRow makeRow(TupleDescriptor td, TupleDescriptor parent) throws StandardException {
UUID oid;
DataValueDescriptor grantee = null;
DataValueDescriptor grantor = null;
String tablePermID = null;
String tableID = null;
String selectPriv = null;
String deletePriv = null;
String insertPriv = null;
String updatePriv = null;
String referencesPriv = null;
String triggerPriv = null;
if (td == null) {
grantee = getNullAuthorizationID();
grantor = getNullAuthorizationID();
} else {
TablePermsDescriptor tpd = (TablePermsDescriptor) td;
oid = tpd.getUUID();
if (oid == null) {
oid = getUUIDFactory().createUUID();
tpd.setUUID(oid);
}
tablePermID = oid.toString();
grantee = getAuthorizationID(tpd.getGrantee());
grantor = getAuthorizationID(tpd.getGrantor());
tableID = tpd.getTableUUID().toString();
selectPriv = tpd.getSelectPriv();
deletePriv = tpd.getDeletePriv();
insertPriv = tpd.getInsertPriv();
updatePriv = tpd.getUpdatePriv();
referencesPriv = tpd.getReferencesPriv();
triggerPriv = tpd.getTriggerPriv();
}
ExecRow row = getExecutionFactory().getValueRow(COLUMN_COUNT);
row.setColumn(TABLEPERMSID_COL_NUM, new SQLChar(tablePermID));
row.setColumn(GRANTEE_COL_NUM, grantee);
row.setColumn(GRANTOR_COL_NUM, grantor);
row.setColumn(TABLEID_COL_NUM, new SQLChar(tableID));
row.setColumn(SELECTPRIV_COL_NUM, new SQLChar(selectPriv));
row.setColumn(DELETEPRIV_COL_NUM, new SQLChar(deletePriv));
row.setColumn(INSERTPRIV_COL_NUM, new SQLChar(insertPriv));
row.setColumn(UPDATEPRIV_COL_NUM, new SQLChar(updatePriv));
row.setColumn(REFERENCESPRIV_COL_NUM, new SQLChar(referencesPriv));
row.setColumn(TRIGGERPRIV_COL_NUM, new SQLChar(triggerPriv));
return row;
}
Aggregations