use of org.jkiss.code.NotNull in project dbeaver by serge-rider.
the class DB2TableForeignKeyCache method prepareObjectsStatement.
@NotNull
@Override
protected JDBCStatement prepareObjectsStatement(JDBCSession session, DB2Schema db2Schema, DB2Table forTable) throws SQLException {
String sql;
if (forTable != null) {
sql = SQL_FK_TAB;
} else {
sql = SQL_FK_ALL;
}
JDBCPreparedStatement dbStat = session.prepareStatement(sql);
dbStat.setString(1, db2Schema.getName());
if (forTable != null) {
dbStat.setString(2, forTable.getName());
}
return dbStat;
}
use of org.jkiss.code.NotNull in project dbeaver by serge-rider.
the class OracleMaintenanceDialog method getScriptListener.
@Override
protected SQLScriptProgressListener<T> getScriptListener() {
return new SQLScriptStatusDialog<T>(getShell(), getTitle() + " progress", null) {
@Override
protected void createStatusColumns(Tree objectTree) {
TreeColumn msgColumn = new TreeColumn(objectTree, SWT.NONE);
msgColumn.setText("Message");
}
@Override
public void processObjectResults(@NotNull T object, @Nullable DBCStatement statement, @Nullable DBCResultSet resultSet) throws DBCException {
}
@Override
public void endObjectProcessing(@NotNull T object, Exception error) {
super.endObjectProcessing(object, error);
TreeItem treeItem = getTreeItem(object);
if (treeItem != null) {
treeItem.setText(1, error == null ? "Done" : error.getMessage());
}
}
};
}
use of org.jkiss.code.NotNull in project dbeaver by serge-rider.
the class PostgreArrayValueHandler method getValueDisplayString.
@NotNull
@Override
public String getValueDisplayString(@NotNull DBSTypedObject column, Object value, @NotNull DBDDisplayFormat format) {
DBDCollection collection = (DBDCollection) value;
if (!DBUtils.isNullValue(value)) {
DBDValueHandler valueHandler = collection.getComponentValueHandler();
StringBuilder str = new StringBuilder();
str.append("{");
for (int i = 0; i < collection.getItemCount(); i++) {
if (i > 0) {
//$NON-NLS-1$
str.append(',');
}
final Object item = collection.getItem(i);
String itemString;
if (item instanceof JDBCCollection) {
// Multi-dimensional arrays case
itemString = getValueDisplayString(column, item, format);
} else {
itemString = valueHandler.getValueDisplayString(collection.getComponentType(), item, DBDDisplayFormat.NATIVE);
}
str.append(itemString);
}
str.append("}");
return str.toString();
}
return super.getValueDisplayString(column, value, format);
}
use of org.jkiss.code.NotNull in project dbeaver by serge-rider.
the class PostgreTable method getSuperInheritance.
@NotNull
public List<PostgreTableInheritance> getSuperInheritance(DBRProgressMonitor monitor) throws DBException {
if (superTables == null) {
try (JDBCSession session = DBUtils.openMetaSession(monitor, getDataSource(), "Load table inheritance info")) {
try (JDBCPreparedStatement dbStat = session.prepareStatement("SELECT i.*,c.relnamespace " + "FROM pg_catalog.pg_inherits i,pg_catalog.pg_class c " + "WHERE i.inhrelid=? AND c.oid=i.inhparent " + "ORDER BY i.inhseqno")) {
dbStat.setLong(1, getObjectId());
try (JDBCResultSet dbResult = dbStat.executeQuery()) {
while (dbResult.next()) {
final long parentSchemaId = JDBCUtils.safeGetLong(dbResult, "relnamespace");
final long parentTableId = JDBCUtils.safeGetLong(dbResult, "inhparent");
PostgreSchema schema = getDatabase().getSchema(monitor, parentSchemaId);
if (schema == null) {
log.warn("Can't find parent table's schema '" + parentSchemaId + "'");
continue;
}
PostgreTableBase parentTable = schema.getTable(monitor, parentTableId);
if (parentTable == null) {
log.warn("Can't find parent table '" + parentTableId + "' in '" + schema.getName() + "'");
continue;
}
if (superTables == null) {
superTables = new ArrayList<>();
}
superTables.add(new PostgreTableInheritance(this, parentTable, JDBCUtils.safeGetInt(dbResult, "inhseqno"), true));
}
}
}
} catch (SQLException e) {
throw new DBCException(e, getDataSource());
}
if (superTables == null) {
superTables = Collections.emptyList();
}
}
return superTables;
}
use of org.jkiss.code.NotNull in project dbeaver by serge-rider.
the class ResultSetValueController method getColumnId.
@NotNull
@Override
public String getColumnId() {
DBCExecutionContext context = getExecutionContext();
DBCAttributeMetaData metaAttribute = binding.getMetaAttribute();
return DBUtils.getSimpleQualifiedName(context == null ? null : context.getDataSource().getContainer().getName(), metaAttribute.getEntityName(), metaAttribute.getName());
}
Aggregations