Skip to content

Commit

Permalink
Ocient compile fix
Browse files Browse the repository at this point in the history
  • Loading branch information
serge-rider committed Aug 13, 2024
1 parent 31abed9 commit eac5df7
Showing 1 changed file with 23 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@
*/
package org.jkiss.dbeaver.ext.ocient.model;

import org.jkiss.code.NotNull;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.DBDatabaseException;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.ext.generic.model.GenericDataSource;
import org.jkiss.dbeaver.ext.generic.model.GenericTableBase;
import org.jkiss.dbeaver.ext.generic.model.GenericStructContainer;
import org.jkiss.dbeaver.ext.generic.model.GenericTableBase;
import org.jkiss.dbeaver.ext.generic.model.GenericView;
import org.jkiss.dbeaver.ext.generic.model.meta.GenericMetaModel;
import org.jkiss.dbeaver.model.DBUtils;
Expand All @@ -45,7 +47,7 @@ public GenericTableBase createTableOrViewImpl(
@Nullable String tableOrViewType,
@Nullable JDBCResultSet dbResult)
{
if (isView(tableOrViewType))
if (tableOrViewType != null && isView(tableOrViewType))
{
return new OcientView(
container,
Expand All @@ -61,9 +63,13 @@ public GenericTableBase createTableOrViewImpl(
}
}

protected String getObjectDDL(DBRProgressMonitor monitor,
GenericTableBase sourceObject, Map<String, Object> options,
String sql, String description) throws DBException {
protected String getObjectDDL(
DBRProgressMonitor monitor,
GenericTableBase sourceObject,
Map<String, Object> options,
String sql,
String description
) throws DBException {
GenericDataSource dataSource = sourceObject.getDataSource();

try (JDBCSession session = DBUtils.openMetaSession(monitor, sourceObject, description)) {
Expand All @@ -77,7 +83,7 @@ protected String getObjectDDL(DBRProgressMonitor monitor,
createText.append(creationDDL);
}

if (createText.length() == 0) {
if (createText.isEmpty()) {
return "-- Create text not found";
}
else {
Expand All @@ -87,12 +93,15 @@ protected String getObjectDDL(DBRProgressMonitor monitor,
}
}
catch (SQLException e) {
throw new DBException(e, dataSource);
throw new DBDatabaseException(e, dataSource);
}
}

public String getViewDDL(DBRProgressMonitor monitor,
GenericView sourceObject, Map<String, Object> options) throws DBException {
public String getViewDDL(
@NotNull DBRProgressMonitor monitor,
@NotNull GenericView sourceObject,
@NotNull Map<String, Object> options
) throws DBException {
String fullQualifiedName =
DBUtils.getFullQualifiedName(sourceObject.getDataSource(), sourceObject.getContainer(), sourceObject);
String viewDDLSQL = String.format("export view %s", fullQualifiedName);
Expand All @@ -104,8 +113,11 @@ public String getViewDDL(DBRProgressMonitor monitor,
}
}

public String getTableDDL(DBRProgressMonitor monitor,
GenericTableBase sourceObject, Map<String, Object> options) throws DBException {
public String getTableDDL(
@NotNull DBRProgressMonitor monitor,
@NotNull GenericTableBase sourceObject,
@NotNull Map<String, Object> options
) throws DBException {
String fullQualifiedName =
DBUtils.getFullQualifiedName(sourceObject.getDataSource(), sourceObject.getContainer(), sourceObject);
String tableDDLSQL = String.format("export table %s", fullQualifiedName);
Expand Down

0 comments on commit eac5df7

Please sign in to comment.