Skip to content

Commit

Permalink
dbeaver#22963 Add Cubrid constant varaiables
Browse files Browse the repository at this point in the history
  • Loading branch information
longhaseng52 committed Mar 21, 2024
1 parent 22253fb commit e7f873d
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,6 @@ public class CubridConstants
public static final String COLLATION = "collation";
public static final String DEFAULT_COLLATION = "utf8_bin";
public static final String REUSE_OID = "is_reuse_oid_class";
public static final String NAME = "name";
public static final String COMMENT = "comment";
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import org.jkiss.code.NotNull;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.ext.cubrid.CubridConstants;
import org.jkiss.dbeaver.model.impl.jdbc.JDBCUtils;
import org.jkiss.dbeaver.model.struct.DBSObject;

Expand All @@ -35,7 +36,7 @@ protected CubridCollation(@NotNull String name) {
}

protected CubridCollation(@NotNull CubridCharset charset, @NotNull ResultSet dbResult) throws SQLException {
this.name = JDBCUtils.safeGetString(dbResult, "collation");
this.name = JDBCUtils.safeGetString(dbResult, CubridConstants.COLLATION);
this.charset = charset;
this.dataSource = charset.getDataSource();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.jkiss.code.NotNull;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.ext.cubrid.CubridConstants;
import org.jkiss.dbeaver.ext.generic.model.GenericCatalog;
import org.jkiss.dbeaver.ext.generic.model.GenericFunctionResultType;
import org.jkiss.dbeaver.ext.generic.model.GenericPackage;
Expand Down Expand Up @@ -127,7 +128,7 @@ public void loadProcedureColumns(@NotNull DBRProgressMonitor monitor) throws DBE
String argName = JDBCUtils.safeGetString(dbResult, "arg_name");
String dataType = JDBCUtils.safeGetString(dbResult, "data_type");
String mode = JDBCUtils.safeGetString(dbResult, "mode");
String comment = JDBCUtils.safeGetString(dbResult, "comment");
String comment = JDBCUtils.safeGetString(dbResult, CubridConstants.COMMENT);
addColumn(new CubridProcedureParameter(this, getName(), argName, dataType, mode, comment));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.jkiss.code.NotNull;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.ext.cubrid.CubridConstants;
import org.jkiss.dbeaver.ext.generic.model.GenericTableBase;
import org.jkiss.dbeaver.ext.generic.model.GenericTableColumn;
import org.jkiss.dbeaver.model.exec.jdbc.JDBCResultSet;
Expand All @@ -35,7 +36,7 @@ public CubridTableColumn(@NotNull GenericTableBase table, @NotNull JDBCResultSet
setName(JDBCUtils.safeGetString(dbResult, "Field"));
setDataType(typeName);
setRequired(JDBCUtils.safeGetString(dbResult, "Null").equals("NO"));
setDescription(JDBCUtils.safeGetString(dbResult, "Comment"));
setDescription(JDBCUtils.safeGetString(dbResult, CubridConstants.COMMENT));
setDefaultValue(JDBCUtils.safeGetString(dbResult, "Default"));
setAutoIncrement(JDBCUtils.safeGetString(dbResult, "Extra").equals("auto_increment"));
setPersisted(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ public List<GenericSchema> loadSchemas(@NotNull JDBCSession session, @NotNull Ge
dbStat.executeStatement();
try (JDBCResultSet dbResult = dbStat.getResultSet()) {
while (dbResult.next()) {
String name = JDBCUtils.safeGetStringTrimmed(dbResult, "name");
String description = JDBCUtils.safeGetStringTrimmed(dbResult, "comment");
String name = JDBCUtils.safeGetStringTrimmed(dbResult, CubridConstants.NAME);
String description = JDBCUtils.safeGetStringTrimmed(dbResult, CubridConstants.COMMENT);
CubridUser user = new CubridUser(dataSource, name, description);
users.add(user);
}
Expand Down Expand Up @@ -258,8 +258,8 @@ public GenericSequence createSequenceImpl(
@NotNull GenericStructContainer container,
@NotNull JDBCResultSet dbResult)
throws DBException {
String name = JDBCUtils.safeGetStringTrimmed(dbResult, "name");
String description = JDBCUtils.safeGetString(dbResult, "comment");
String name = JDBCUtils.safeGetStringTrimmed(dbResult, CubridConstants.NAME);
String description = JDBCUtils.safeGetString(dbResult, CubridConstants.COMMENT);
Number lastValue = JDBCUtils.safeGetInteger(dbResult, "current_val");
Number minValue = JDBCUtils.safeGetInteger(dbResult, "min_val");
Number maxValue = JDBCUtils.safeGetInteger(dbResult, "max_val");
Expand Down Expand Up @@ -287,7 +287,7 @@ public GenericSynonym createSynonymImpl(
@NotNull JDBCResultSet dbResult)
throws DBException {
String name = JDBCUtils.safeGetStringTrimmed(dbResult, "synonym_name");
String description = JDBCUtils.safeGetString(dbResult, "comment");
String description = JDBCUtils.safeGetString(dbResult, CubridConstants.COMMENT);
return new CubridSynonym(container, name, description, dbResult);
}

Expand Down Expand Up @@ -330,8 +330,8 @@ public CubridTrigger createTableTriggerImpl(
@Nullable String triggerName,
@NotNull JDBCResultSet dbResult)
throws DBException {
String name = JDBCUtils.safeGetString(dbResult, "name");
String description = JDBCUtils.safeGetString(dbResult, "comment");
String name = JDBCUtils.safeGetString(dbResult, CubridConstants.NAME);
String description = JDBCUtils.safeGetString(dbResult, CubridConstants.COMMENT);
return new CubridTrigger(table, name, description, dbResult);
}

Expand All @@ -354,8 +354,8 @@ public CubridTrigger createContainerTriggerImpl(
@NotNull GenericStructContainer container,
@NotNull JDBCResultSet dbResult)
throws DBException {
String name = JDBCUtils.safeGetString(dbResult, "name");
String description = JDBCUtils.safeGetString(dbResult, "comment");
String name = JDBCUtils.safeGetString(dbResult, CubridConstants.NAME);
String description = JDBCUtils.safeGetString(dbResult, CubridConstants.COMMENT);
String tableName = JDBCUtils.safeGetString(dbResult, "target_class_name");
String owner = JDBCUtils.safeGetString(dbResult, "target_owner_name");
DBRProgressMonitor monitor = dbResult.getSession().getProgressMonitor();
Expand All @@ -375,7 +375,7 @@ public void loadProcedures(
try (JDBCResultSet dbResult = dbStat.executeQuery()) {
while (dbResult.next()) {
String procedureName = JDBCUtils.safeGetString(dbResult, "sp_name");
String description = JDBCUtils.safeGetString(dbResult, "comment");
String description = JDBCUtils.safeGetString(dbResult, CubridConstants.COMMENT);
String type = JDBCUtils.safeGetString(dbResult, "sp_type");
String target = JDBCUtils.safeGetString(dbResult, "target");
String returnType = JDBCUtils.safeGetString(dbResult, "return_type");
Expand Down

0 comments on commit e7f873d

Please sign in to comment.