name
stringlengths
12
178
code_snippet
stringlengths
8
36.5k
score
float64
3.26
3.68
morf_InlineTableUpgrader_addAuditRecord_rdh
/** * * @see org.alfasoftware.morf.upgrade.SchemaChangeVisitor#addAuditRecord(java.util.UUID, java.lang.String) */ @Override public void addAuditRecord(UUID uuid, String description) { AuditRecordHelper.addAuditRecord(this, currentSchema, uuid, description); }
3.26
morf_InlineTableUpgrader_postUpgrade_rdh
/** * Perform clear up after the main upgrade is completed. */ public void postUpgrade() { sqlStatementWriter.writeSql(sqlDialect.truncateTableStatements(idTable)); sqlStatementWriter.writeSql(sqlDialect.dropStatements(idTable)); }
3.26
morf_InlineTableUpgrader_visit_rdh
/** * * @see org.alfasoftware.morf.upgrade.SchemaChangeVisitor#visit(org.alfasoftware.morf.upgrade.AnalyseTable) */ @Overridepublic void visit(AnalyseTable analyseTable) { currentSchema = analyseTable.apply(currentSchema); writeStatements(sqlDialect.getSqlForAnalyseTable(currentSchema.getTable(analyseTable.g...
3.26
morf_InlineTableUpgrader_preUpgrade_rdh
/** * Perform initialisation before the main upgrade steps occur. */ public void preUpgrade() { sqlStatementWriter.writeSql(sqlDialect.tableDeploymentStatements(idTable)); }
3.26
morf_ArchiveDataSetWriter_close_rdh
/** * * @see java.util.zip.ZipOutputStream#close() */ @Override public void close() throws IOException { // Suppress the close }
3.26
morf_ArchiveDataSetWriter_openOutputStreamForTable_rdh
/** * * @see org.alfasoftware.morf.xml.XmlStreamProvider.XmlOutputStreamProvider#openOutputStreamForTable(java.lang.String) */ @Override public OutputStream openOutputStreamForTable(String tableName) { if (zipOutput == null) { throw new IllegalStateException("Archive data set has not been opened"); }...
3.26
morf_ArchiveDataSetWriter_clearDestination_rdh
/** * * @see org.alfasoftware.morf.xml.XmlStreamProvider.XmlOutputStreamProvider#clearDestination() */ @Override public void clearDestination() { // No-op. Done by the open method. }
3.26
morf_ArchiveDataSetWriter_m0_rdh
/** * * @see java.util.zip.ZipOutputStream#close() * @throws IOException * If the exception is thrown from {@link ZipOutputStream#close()} */ public void m0() throws IOException { super.close(); }
3.26
morf_ArchiveDataSetWriter_open_rdh
/** * * @see org.alfasoftware.morf.xml.XmlStreamProvider#open() */ @Override public void open() { if (zipOutput != null) { throw new IllegalStateException(("Archive data set instance for [" + file) + "] already open"); } try { zipOutput = new AdaptedZipOutputStream(new FileOutputS...
3.26
morf_ViewDeploymentValidator_validateExistingView_rdh
/** * * @param view * View being examined. This is an existing schema view. * @return boolean true if view is valid. * @deprecated kept to ensure backwards compatibility. */ @Override @Deprecated public boolean validateExistingView(View view) { return true;// the given existing view is okay as is }
3.26
morf_ViewDeploymentValidator_validateMissingView_rdh
/** * * @param view * View being examined. This is a non-existing schema view. * @return boolean true if view is valid. * @deprecated kept to ensure backwards compatibility. */ @Override @Deprecated public boolean validateMissingView(View view) { return true;// the given new view can be created right a...
3.26
morf_ColumnBean_getAutoNumberStart_rdh
/** * * @see org.alfasoftware.morf.metadata.Column#getAutoNumberStart() */ @Override public int getAutoNumberStart() { return autoNumberStart; }
3.26
morf_ColumnBean_isPrimaryKey_rdh
/** * * @see org.alfasoftware.morf.metadata.Column#isPrimaryKey() */ @Override public boolean isPrimaryKey() { return primaryKey; }
3.26
morf_ColumnBean_toString_rdh
/** * * @see java.lang.Object#toString() */ @Override public String toString() {return this.toStringHelper(); }
3.26
morf_ColumnBean_getUpperCaseName_rdh
/** * * @return the upper case name */ @Override public String getUpperCaseName() { return upperCaseName.get();}
3.26
morf_ColumnBean_getName_rdh
/** * * @return the name */ @Override public String getName() { return name; }
3.26
morf_ColumnBean_getDefaultValue_rdh
/** * * @see org.alfasoftware.morf.metadata.Column#getDefaultValue() */ @Override public String getDefaultValue() { return StringUtils.defaultString(defaultValue); }
3.26
morf_ColumnBean_isAutoNumbered_rdh
/** * * @see org.alfasoftware.morf.metadata.Column#isAutoNumbered() */ @Override public boolean isAutoNumbered() { return autoNumber; }
3.26
morf_OracleMetaDataProvider_expensiveReadTableKeys_rdh
/** * Read the tables, and the primary keys for the database. * * @return A map of table name to primary key(s). */ private Map<String, List<String>> expensiveReadTableKeys() { log.info("Starting read of key definitions"); long start = System.currentTimeMillis(); fina...
3.26
morf_OracleMetaDataProvider_tables_rdh
/** * {@inheritDoc } * * <p>The {@link Table} implementation returned may contain {@link Column} implementations * which evaluate the metadata elements ({@link Column#getType()}, {@link Column#getWidth()} * etc.) lazily. If the database column type is not supported, this may throw an * {@link UnexpectedDataTypeE...
3.26
morf_OracleMetaDataProvider_isEmptyDatabase_rdh
/** * Reading all the table metadata is slow on Oracle, so we can optimise the empty * database check by just seeing if there are any tables. * * @see org.alfasoftware.morf.jdbc.DatabaseMetaDataProvider#isEmptyDatabase() */ @Override public boolean isEmptyDatabase() { return keyMap().isEmpty(); }
3.26
morf_OracleMetaDataProvider_tableMap_rdh
/** * Use to access the metadata for the tables in the specified connection. * Lazily initialises the metadata, and only loads it once. * * @return Table metadata. */ private Map<String, Table> tableMap() {if (tableMap != null) { return tableMap; } tableMap = new TreeMap<>(String.CASE_INSENSITIVE_O...
3.26
morf_OracleMetaDataProvider_tableNames_rdh
/** * * @see org.alfasoftware.morf.metadata.Schema#tableNames() */ @Override public Collection<String> tableNames() { return tableMap().keySet(); }
3.26
morf_OracleMetaDataProvider_determineDefaultValue_rdh
/** * Sets the default value to an empty string for any column other than version. Database-schema level default values are * not supported by ALFA's domain model hence we don't want to include a default value in the xml definition of a table. * * @param columnName * the name of the column * @return the default...
3.26
morf_OracleMetaDataProvider_runSQL_rdh
/** * Run some SQL, and tidy up afterwards. * * Note this assumes a predicate on the schema name will be present with a single parameter in position "1". * * @param sql * The SQL to run. * @param handler * The handler to handle the result-set. */ private void runSQL(String sql, ResultSetHandler handler) {...
3.26
morf_OracleMetaDataProvider_viewMap_rdh
/** * Use to access the metadata for the views in the specified connection. * Lazily initialises the metadata, and only loads it once. * * @return View metadata. */ private Map<String, View> viewMap() {if (viewMap != null) { return viewMap; } viewMap = new TreeMap<>(String.CASE_INSENSITIVE_...
3.26
morf_OracleMetaDataProvider_getTable_rdh
/** * {@inheritDoc } * * <p>The {@link Table} implementation returned may contain {@link Column} implementations * which evaluate the metadata elements ({@link Column#getType()}, {@link Column#getWidth()} * etc.) lazily. If the database column type is not supported, this may throw an * {@link UnexpectedDataTypeE...
3.26
morf_OracleMetaDataProvider_expensiveReadTableNames_rdh
/** * A table name reading method which is more efficient than the Oracle driver meta-data version. * * @see <a href="http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/statviews_2094.htm">ALL_TAB_COLUMNS specification</a> */ private void expensiveReadTableNames() { log.info("Starting read of table ...
3.26
morf_OracleMetaDataProvider_compare_rdh
/** * * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object) */ @Override public int compare(Column o1, Column o2) { String col1 = o1.getName().toUpperCase(); String col2 = o2.getName().toUpperCase(); if (primaryKeysForTable.contains(col1) && primaryKeysForTable.contains(col2)) { ...
3.26
morf_OracleMetaDataProvider_isSystemTable_rdh
/** * Oracle sometimes spits back some very odd table names, something to do with the system. We don't want those. * * @see org.alfasoftware.morf.jdbc.DatabaseMetaDataProvider#isSystemTable(DatabaseMetaDataProvider.RealName) */ private boolean isSystemTable(String tableName) { return ((!tableName.matches("\\w+")) |...
3.26
morf_OracleMetaDataProvider_views_rdh
/** * * @see org.alfasoftware.morf.metadata.Schema#views() */@Override public Collection<View> views() { return viewMap().values(); }
3.26
morf_OracleMetaDataProvider_viewNames_rdh
/** * * @see org.alfasoftware.morf.metadata.Schema#viewNames() */ @Override public Collection<String> viewNames() { return viewMap().keySet(); }
3.26
morf_OracleMetaDataProvider_handleTableColumnRow_rdh
/** * Handle the column read from the result set. */ private void handleTableColumnRow(final Map<String, List<String>> primaryKeys, String tableName, String tableComment, String columnName, String columnComment, String dataTypeName, Integer dataLength, Integer dataPrecision, Integer dataScale, String nullableStr, S...
3.26
morf_OracleMetaDataProvider_tableExists_rdh
/** * * @see org.alfasoftware.morf.metadata.Schema#tableExists(java.lang.String) */ @Override public boolean tableExists(String name) { return tableMap().containsKey(name.toUpperCase()); }
3.26
morf_OracleMetaDataProvider_dataTypeForColumn_rdh
/** * Get our {@link DataType} from the Oracle type. This serves the same purpose * as {@link DatabaseMetaDataProvider#dataTypeFromSqlType(int, String, int)} but is * entirely Oracle specific. * * @param dataTypeName * The Oracle type name. * @param commentType * the type of the column stored in a comment. ...
3.26
morf_OracleMetaDataProvider_viewExists_rdh
/** * * @see org.alfasoftware.morf.metadata.Schema#viewExists(java.lang.String) */ @Override public boolean viewExists(String name) { return viewMap().containsKey(name.toUpperCase()); }
3.26
morf_OracleMetaDataProvider_keyMap_rdh
/** * Use to access the metadata for the primary keys in the specified connection. * Lazily initialises the metadata, and only loads it once. * * @return Primary keys metadata. */ private Map<String, List<String>> keyMap() { if (keyMap != null) {return keyMap; } keyMap = new HashMap<>(); expensiveR...
3.26
morf_OracleMetaDataProvider_readViewMap_rdh
/** * Populate {@link #viewMap} with information from the database. Since JDBC metadata reading * is slow on Oracle, this uses an optimised query. * * @see <a href="http://docs.oracle.com/cd/B19306_01/server.102/b14237/statviews_2117.htm">ALL_VIEWS specification</a> */ private void readViewMap() { log.info("St...
3.26
morf_OracleMetaDataProvider_isPrimaryKeyIndex_rdh
/** * * @see org.alfasoftware.morf.jdbc.DatabaseMetaDataProvider#isPrimaryKeyIndex(DatabaseMetaDataProvider.RealName) */ private boolean isPrimaryKeyIndex(String indexName) { return indexName.endsWith("_PK"); }
3.26
morf_SqlDialect_getMergeStatementAssignmentsSql_rdh
/** * Returns the assignments for updating part of an SQL MERGE statement * based on the given {@link AliasedField}s. * * @param fields * The {@link AliasedField}s to create the assignments from * @return the assignments for the updating part as a string */ protected String getMergeStatementAssignmentsSql(Iter...
3.26
morf_SqlDialect_schemaNamePrefix_rdh
/** * * @param table * The table for which the schema name will be retrieved * @return Base implementation calls {@link #schemaNamePrefix()}. */ protected String schemaNamePrefix(@SuppressWarnings("unused") Table table) { return schemaNamePrefix(); }
3.26
morf_SqlDialect_appendWhere_rdh
/** * appends where clause to the result * * @param result * where clause will be appended here * @param stmt * statement with where clause * @param <T> * The type of AbstractSelectStatement */ protected <T extends AbstractSelectStatement<T>> void appendWhere(StringBuilder result, AbstractSelectStatement...
3.26
morf_SqlDialect_getDeleteLimitWhereClause_rdh
/** * Returns the SQL that specifies the deletion limit in the WHERE clause, if any, for the dialect. * * @param limit * The delete limit. * @return The SQL fragment. */ protected Optional<String> getDeleteLimitWhereClause(@SuppressWarnings("unused") int limit) { return Optional.empty(); }
3.26
morf_SqlDialect_literalValue_rdh
/** * Infers the value of the field in a format suitable for direct substitution * into an sql statement. * <p> * If the supplied field is not a {@link FieldLiteral}, {@code null} will be * returned. If it is, the type will be taken directly from the * {@linkplain FieldLiteral} itself and single quotes (') added ...
3.26
morf_SqlDialect_convertStatementToHash_rdh
/** * Converts a structured {@code SELECT} statement to a hash representation. * * @param statement * the statement to convert * @return A hash representation of {@code statement}. */ public String convertStatementToHash(SelectFirstStatement statement) { return md5HashHexEncoded(convertStatementToSQL(statement)...
3.26
morf_SqlDialect_getSqlForCountDistinct_rdh
/** * Converts the count function into SQL. * * @param function * the function details * @return a string representation of the SQL */ protected String getSqlForCountDistinct(Function function) { return ("COUNT(DISTINCT " + getSqlFrom(function.getArguments().get(0))) + ")"; }
3.26
morf_SqlDialect_addIndexStatements_rdh
/** * Generates the SQL to add an index to an existing table. * * @param table * The existing table. * @param index * The new index being added. * @return A collection of SQL statements. */ public Collection<String> addIndexStatements(Table table, Index index) { return indexDeploymentStatements(table, index...
3.26
morf_SqlDialect_getSqlFromInsert_rdh
/** * Convert an {@link InsertStatement} into standards compliant SQL. * <p> * For example, the following code: * </p> * <blockquote> * * <pre> * InsertStatement stmt = new InsertStatement().into(new Tabl...
3.26
morf_SqlDialect_appendGroupBy_rdh
/** * appends group by clause to the result * * @param result * group by clause will be appended here * @param stmt * statement with group by clause */ protected void appendGroupBy(StringBuilder result, SelectStatement stmt) { if (stmt.getGroupBys().size() > 0) { result.append(" GROUP BY "); ...
3.26
morf_SqlDialect_autoNumberId_rdh
/** * Builds SQL to get the autonumber value. * * @param statement * the insert statement to get for. * @param idTable * the ID Table. * @return SQL fetching the AutoNumber value. */ private String autoNumberId(InsertStatement statement, Table idTable) { AliasedField idValue = nextIdValue(statement.getTable...
3.26
morf_SqlDialect_getDeleteLimitSuffix_rdh
/** * Returns the SQL that specifies the deletion limit as a suffix, if any, for the dialect. * * @param limit * The delete limit. * @return The SQL fragment. */ protected Optional<String> getDeleteLimitSuffix(@SuppressWarnings("unused") int limit) { return Optional.empty(); }
3.26
morf_SqlDialect_appendHaving_rdh
/** * appends having clause to the result * * @param result * having clause will be appended here * @param stmt * statement with having clause */ protected void appendHaving(StringBuilder result, SelectStatement stmt) { if (stmt.getHaving() != null) { result.append(" HAVING "); result.app...
3.26
morf_SqlDialect_rebuildTriggers_rdh
/** * Drops and recreates the triggers and supporting items for the target table. * * @param table * the table for which to rebuild triggers * @return a collection of sql statements to execute */ public Collection<String> rebuildTriggers(@SuppressWarnings("unused") Table table) {return SqlDialect.NO_STATEMENTS;...
3.26
morf_SqlDialect_m2_rdh
/** * * @param result * the string builder to append to * @param join * the join statement * @param innerJoinKeyword * usually an INNER JOIN, but this can be changed for optimisations */ protected void m2(StringBuilder result, Join join, String innerJoinKeyword) { // Put the type in switch (join....
3.26
morf_SqlDialect_appendFrom_rdh
/** * appends from clause to the result * * @param result * from clause will be appended here * @param stmt * statement with from clause * @param <T> * The type of AbstractSelectStatement */ protected <T extends AbstractSelectStatement<T>> void appendFrom(StringBuilder result, AbstractSelectStatement<T...
3.26
morf_SqlDialect_viewDeploymentStatementsAsScript_rdh
/** * Creates SQL script to deploy a database view. * * @param view * The meta data for the view to deploy. * @return The statements required to deploy the view joined into a script. */ public String viewDeploymentStatementsAsScript(View view) { final String v4 = ("-- " + getDatabaseType().identifier()) + ...
3.26
morf_SqlDialect_getSqlForLeast_rdh
/** * Converts the least function into SQL. * * @param function * the function details * @return a string representation of the SQL */ protected String getSqlForLeast(Function function) { return ((getLeastFunctionName() + '(') + Joiner.on(", ").join(function.getArguments().stream().map(f -> getSqlFrom(f)).iter...
3.26
morf_SqlDialect_addTableFromStatementsWithCasting_rdh
/** * Generates the SQL to create a table and insert the data specified in the {@link SelectStatement}. * * For supported dialects, this method casts each field in the provided select using the column definition of the provided table. * * Validation is performed to confirm that the fields included in the select st...
3.26
morf_SqlDialect_getForUpdateSql_rdh
/** * Default behaviour for FOR UPDATE. Can be overridden. * * @return The String representation of the FOR UPDATE clause. */ protected String getForUpdateSql() { return " FOR UPDATE"; }
3.26
morf_SqlDialect_dropStatements_rdh
/** * Creates SQL to drop the named view. * * @param view * The view to drop * @return The SQL statements as strings. */ public Collection<String> dropStatements(View view) { return ImmutableList.of((("DROP VIEW " + schemaNamePrefix()) + view.getName()) + " IF EXISTS CASCADE"); }
3.26
morf_SqlDialect_getAutoNumberName_rdh
/** * Gets the autonumber name for the {@code destinationReference}. * * @param destinationReference * the table name to get the autonumber name for. * @return the autonumber name. */ protected String getAutoNumberName(String destinationReference) { String autoNumberName = destinationReference; if (autoNumberNa...
3.26
morf_SqlDialect_getOperatorLine_rdh
/** * Convert a criterion into a string expression of the form * "[operand] [operator] [operand]". * * @param criterion * the criterion to convert * @param operator * the operator to use in the expression * @return a string representation of the criterion */ protected String getOperatorLine(Criterion crite...
3.26
morf_SqlDialect_addTableFromStatements_rdh
/** * Generates the SQL to create a table and insert the data specified in the {@link SelectStatement}. * * @param table * The table to create. * @param selectStatement * The {@link SelectStatement} * @return A collection of SQL statements */ public Collection<String> addTableFromStatements(Table table, Sel...
3.26
morf_SqlDialect_isAutonumbered_rdh
/** * Checks whether the table the InsertStatement is referring to has any * autonumbered columns * * @param statement * The statement to check * @param databaseMetadata * the database schema * @return true if autonumbered, false otherwise */ protected boolean isAutonumbered(InsertStatement statement, Sch...
3.26
morf_SqlDialect_usesNVARCHARforStrings_rdh
/** * Indicates whether the dialect uses NVARCHAR or VARCHAR to store string values. * * @return true if NVARCHAR is used, false is VARCHAR is used. */ public boolean usesNVARCHARforStrings() { return false; }
3.26
morf_SqlDialect_preInsertWithPresetAutonumStatements_rdh
/** * Creates SQL to execute prior to bulk-inserting to a table. * * @param table * {@link Table} to be inserted to. * @param insertingUnderAutonumLimit * Determines whether we are inserting under an auto-numbering limit. * @return SQL statements to be executed prior to insert. */ @SuppressWarnings("unused"...
3.26
morf_SqlDialect_tableDeploymentStatements_rdh
/** * Creates SQL to deploy a database table and its associated indexes. * * @param table * The meta data for the table to deploy. * @return The statements required to deploy the table and its indexes. */ public Collection<String> tableDeploymentStatements(Table table) { Builder<String> statements = Immutab...
3.26
morf_SqlDialect_makeStringLiteral_rdh
/** * Turn a string value into an SQL string literal which has that value. * <p> * We use {@linkplain StringUtils#isEmpty(CharSequence)} because we want to * differentiate between a single space and an empty string. * </p> * <p> * This is necessary because char types cannot be null and must contain a * single s...
3.26
morf_SqlDialect_m3_rdh
/** * Converts the some function into SQL. * * @param function * the function details * @return a string representation of the SQL */ protected String m3(Function function) { return getSqlForMax(function); }
3.26
morf_SqlDialect_matchConditionSqlForMergeFields_rdh
/** * Creates matching conditions SQL for a list of fields used in the ON section * of a Merge Statement. For example: * "table1.fieldA = table2.fieldA AND table1.fieldB = table2.fieldB". * * @param statement * the merge statement. * @param selectAlias * the alias of the select statement of a merge statemen...
3.26
morf_SqlDialect_convertStatementToSQL_rdh
/** * Converts a structured {@link SelectFirstStatement} to the equivalent SQL * text. * * @param statement * the statement to convert * @return a string containing the SQL to run against the database */ public String convertStatementToSQL(SelectFirstStatement statement) { if (statement == null) { throw new Il...
3.26
morf_SqlDialect_indexDropStatements_rdh
/** * Generate the SQL to drop an index from a table. * * @param table * The table to drop the index from. * @param indexToBeRemoved * The index to be dropped. * @return The SQL to drop the specified index. */ public Collection<String> indexDropStatements(@SuppressWarnings("unused") Table table, Index index...
3.26
morf_SqlDialect_getSqlForSumDistinct_rdh
/** * Converts the sum function into SQL. * * @param function * the function details * @return a string representation of the SQL */ protected String getSqlForSumDistinct(Function function) { return ("SUM(DISTINCT " + getSqlFrom(function.getArguments().get(0))) + ")"; }
3.26
morf_SqlDialect_convertCommentToSQL_rdh
/** * Convert a string to an SQL comment * * @param string * The comment string * @return An SQL comment containing the comment string */ public String convertCommentToSQL(String string) { return "-- " + string; }
3.26
morf_SqlDialect_getUpdateStatementAssignmentsSql_rdh
/** * Returns the assignments for the SET clause of an SQL UPDATE statement * based on the {@link List} of {@link AliasedField}s provided. * * @param fields * The {@link List} of {@link AliasedField}s to create the assignments from * @return the assignments for the SET clause as a string */ protected String ge...
3.26
morf_SqlDialect_columns_rdh
/** * * @see org.alfasoftware.morf.metadata.Table#columns() */ @Override public List<Column> columns() { List<Column> columns = new ArrayList<>(); columns.add(SchemaUtils.column(ID_INCREMENTOR_TABLE_COLUMN_NAME, DataType.STRING, 132).primaryKey()); columns.add(SchemaUtils.column(ID_INCREMENTOR_TABLE_COLUMN_VALUE, D...
3.26
morf_SqlDialect_getSqlForOrderByField_rdh
/** * When executing order by a database platform may apply its defaults for: - * null values handling (to either put them first or last) - direction * (ascending or descending) * <p> * In order for explicit settings. e.g: order by field asc nulls last. * </p> * <p> * This method is an implementation for H2 and...
3.26
morf_SqlDialect_prepareStatementParameters_rdh
/** * Sets up a parameter on {@link NamedParameterPreparedStatement} with a value. * * @param statement * The {@link PreparedStatement} to set up * @param values * The values. * @param parameter * The parameters. * @throws RuntimeException * if a data type is not supported or if a * supplied string...
3.26
morf_SqlDialect_sqlForDefaultClauseLiteral_rdh
/** * Creates the representation of the default clause literal value. * * @param column * The column whose default will be converted. * @return An SQL fragment representing the literal in a DEFAULT clause in an SQL statement */ protected String sqlForDefaultClauseLiteral(Column column) { return getSqlFrom(new F...
3.26
morf_SqlDialect_getSqlforLength_rdh
/** * Converts the LENGTH function into SQL. * * @param function * the function to convert. * @return a string representation of the SQL. * @see org.alfasoftware.morf.sql.element.Function#length(AliasedField) */ protected String getSqlforLength(Function function) { return String.format("LENGTH(%s)", getSqlFrom...
3.26
morf_SqlDialect_indexes_rdh
/** * * @see org.alfasoftware.morf.metadata.Table#indexes() */ @Override public List<Index> indexes() { return new ArrayList<>(); }
3.26
morf_SqlDialect_appendOrderBy_rdh
/** * appends order by clause to the result * * @param result * order by clause will be appended here * @param stmt * statement with order by clause * @param <T> * The type of AbstractSelectStatemen...
3.26
morf_SqlDialect_sqlRepresentationOfColumnType_rdh
/** * Creates the SQL representation of a column data type. * * @param column * The column to map. * @return The SQL representation for the column type. * @see #sqlRepresentationOfColumnType(Column, boolean, boolean, boolean) */ protected String sqlRepresentationOfColumnType(Column column) { StringBuilder defa...
3.26
morf_SqlDialect_isTemporary_rdh
/** * {@inheritDoc } * * @see org.alfasoftware.morf.metadata.Table#isTemporary() */ @Override public boolean isTemporary() { return f1; }
3.26
morf_SqlDialect_repairAutoNumberStartPosition_rdh
/** * Make sure the table provided has its next autonum value set to at least the value specified in the column metadata. * * <p>Generally databases do not need to do anything special here, but MySQL can lose the value.</p> * * @param table * The table to repair. * @param executor * The executor to use * @...
3.26
morf_SqlDialect_getSqlForSubstring_rdh
/** * Converts the substring function into SQL. * * @param function * the function details * @return a string representation of the SQL */ protected String getSqlForSubstring(Function function) { return ((((((getSubstringFunctionName() + "(") + getSqlFrom(function.getArguments().get(0))) + ", ") + getSqlFrom(f...
3.26
morf_SqlDialect_replaceTableFromStatements_rdh
/** * This method: * - Uses the provided select statement to generate a CTAS statement using a temporary name * - Drops the original table * - Renames the new table using the original table's name * - Adds indexes from the original table * * @param originalTable * the original table this method will replace ...
3.26
morf_SqlDialect_getSqlForOrderByFieldNullValueHandling_rdh
/** * Get the SQL expression for NULL values handling. * * @param orderByField * The order by clause * @return The resulting SQL String */ protected String getSqlForOrderByFieldNullVal...
3.26
morf_SqlDialect_postInsertWithPresetAutonumStatements_rdh
/** * Creates SQL to execute after bulk-inserting to a table. * * @param table * The table that was populated. * @param executor * The executor to use * @param connection * The connection to use * @param insertingUnderAutonumLimit * Determines whether we are inserting under an auto-numbering limit. *...
3.26
morf_SqlDialect_getSqlForTrim_rdh
/** * Converts the TRIM function into SQL. * * @param function * the function to convert. * @return a string representation of the SQL. */ protected String getSqlForTrim(Function function) { return ("TRIM(" + getSqlFrom(function.getArguments().get(0))) + ")"; }
3.26
morf_SqlDialect_getName_rdh
/** * * @see org.alfasoftware.morf.metadata.Table#getName() */ @Override public String getName() { return tableName; }
3.26
morf_SqlDialect_getSqlForFloor_rdh
/** * Converts the FLOOR function into SQL. * * @param function * the function to convert. * @return a string representation of the SQL. * @see org.alfasoftware.morf.sql.element.Function#floor(AliasedField) */ protected String getSqlForFloor(Function function) { return ("FLOOR(" + getSqlFrom(function.getArgum...
3.26
morf_SqlDialect_getSqlForCoalesce_rdh
/** * Converts the coalesce function into SQL. * * @param function * the function details * @return a string representation of the SQL */ protected String getSqlForCoalesce(Function function) { StringBuilder expression = new StringBuilder(); expression.append(getCoalesceFunctionName()).append('('); boolean fi...
3.26
morf_SqlDialect_getFromDummyTable_rdh
/** * An additional clause to use in SELECT statements where there is no select * source, which allows us to include "FROM &lt;dummy table&gt;" on RDBMSes such as * Oracle where selecting from no table is not allowed but the RDBMS provides * a dummy table (such as "dual"). * * @return the additional clause. */ p...
3.26
morf_SqlDialect_withDeterministicName_rdh
/** * For testing only - the tableName might not be appropriate for your * dialect! The table will be a temporary table, specific to the dialect. * * @param tableName * table name for the id table. * @return {@link IdTable}. */ public static IdTable withDeterministicName(String tableName) { return new IdTable(...
3.26
morf_SqlDialect_tableHasBlobColumns_rdh
/** * Whether this table has any BLOB columns. * * @param table * The table. * @return true if the table has one or more BLOB columns. */ protected boolean tableHasBlobColumns(Table table) { for (Column column : table.columns()) { if (column.getType() == DataType.BLOB) { return true; } } return false; }
3.26
morf_SqlDialect_getSqlforBlobLength_rdh
/** * Converts the function get LENGTH of Blob data or field into SQL. * Use LENGTH instead of OCTET_LENGTH as they are synonymous in MySQl and PostGreSQL. In H2 LENGTH returns the correct * number of bytes, whereas OCTET_LENGTH returns 2 times the byte length. * * @param function * the function to convert. * ...
3.26
morf_SqlDialect_createAllIndexStatements_rdh
/** * Helper method to create all index statements defined for a table * * @param table * the table to create indexes for * @return a list of index statements */ protected List<String> createAllIndexStatements(Table table) { List<String> indexStatements = new ArrayList<>(); for (Index index : table.indexes()) {...
3.26
morf_SqlDialect_m1_rdh
/** * Extracts the parameters from a SQL statement. * * @param statement * the SQL statement. * @return the list of parameters. */ public List<SqlParameter> m1(UpdateStatement statement) { SqlParameterExtractor extractor = new SqlParameterExtractor(); ObjectTreeTraverser.forCallback(extractor).dispatch(statemen...
3.26
morf_SqlDialect_appendAlias_rdh
/** * appends alias to the result * * @param result * alias will be appended to this * @param currentField * field to be aliased */ protected void appendAlias(StringBuilder result, AliasedField currentField) { if (!StringUtils.isBlank(currentField.getAlias())) { result.append(String.format(" ...
3.26