name
stringlengths
12
178
code_snippet
stringlengths
8
36.5k
score
float64
3.26
3.68
morf_H2Dialect_getSqlFrom_rdh
/** * TODO * The following is a workaround to a bug in H2 version 1.4.200 whereby the MERGE...USING statement does not release the source select statement * Please remove this method once <a href="https://github.com/h2database/h2database/issues/2196">issue 2196</a> has been fixed and H2 upgraded to the fixed version...
3.26
morf_H2Dialect_getSqlForAddDays_rdh
/** * * @see org.alfasoftware.morf.jdbc.SqlDialect#getSqlForAddDays(org.alfasoftware.morf.sql.element.Function) */ @Override protected String getSqlForAddDays(Function function) { return String.format("DATEADD('DAY', %s, %s)", getSqlFrom(function.getArguments().get(1)), getSqlFrom(function.getArguments().ge...
3.26
morf_H2Dialect_alterTableChangeColumnStatements_rdh
/** * * @see org.alfasoftware.morf.jdbc.SqlDialect#alterTableChangeColumnStatements(org.alfasoftware.morf.metadata.Table, org.alfasoftware.morf.metadata.Column, org.alfasoftware.morf.metadata.Column) */ @Override public Collection<String> alterTableChangeColumnStatements(Table table, Column oldColumn, Column newColu...
3.26
morf_H2Dialect_getDatabaseType_rdh
/** * * @see org.alfasoftware.morf.jdbc.SqlDialect#getDatabaseType() */ @Override public DatabaseType getDatabaseType() { return DatabaseType.Registry.findByIdentifier(H2.IDENTIFIER); }
3.26
morf_H2Dialect_alterTableAddColumnStatements_rdh
/** * * @see org.alfasoftware.morf.jdbc.SqlDialect#alterTableAddColumnStatements(org.alfasoftware.morf.metadata.Table, org.alfasoftware.morf.metadata.Column) */ @Override public Collection<String> alterTableAddColumnStatements(Table table, Column column) { String statement = ((((("ALTER TABLE " + schemaNamePrefi...
3.26
morf_H2Dialect_changePrimaryKeyColumns_rdh
/** * * @see org.alfasoftware.morf.jdbc.SqlDialect#changePrimaryKeyColumns(org.alfasoftware.morf.metadata.Table, java.util.List, java.util.List) */ @Override public Collection<String> changePrimaryKeyColumns(Table table, List<String> oldPrimaryKeyColumns, List<String> newPrimaryKeyColumns) { List<String> result...
3.26
morf_H2Dialect_getSqlForRandomString_rdh
/** * * @see org.alfasoftware.morf.jdbc.SqlDialect#getSqlForRandomString(org.alfasoftware.morf.sql.element.Function) */@Override protected String getSqlForRandomString(Function function) { return String.format("SUBSTRING(REPLACE(RANDOM_UUID(),'-'), 1, %s)", getSqlFrom(function.getArguments().get(0))); }
3.26
morf_H2Dialect_m0_rdh
/** * It does explicit VARCHAR casting to avoid a HSQLDB 'feature' in which * string literal values are effectively returned as CHAR (fixed width) data * types rather than VARCHARs, where the length of the CHAR to hold the value * is given by the maximum string length of any of the values that can be * returned by...
3.26
morf_H2Dialect_connectionTestStatement_rdh
/** * * @see org.alfasoftware.morf.jdbc.SqlDialect#connectionTestStatement() */ @Override public String connectionTestStatement() { return "select 1"; }
3.26
morf_H2Dialect_decorateTemporaryTableName_rdh
/** * * @see org.alfasoftware.morf.jdbc.SqlDialect#decorateTemporaryTableName(java.lang.String) */ @Override public String decorateTemporaryTableName(String undecoratedName) { return TEMPORARY_TABLE_PREFIX + undecoratedName; }
3.26
morf_H2Dialect_getFromDummyTable_rdh
/** * * @see org.alfasoftware.morf.jdbc.SqlDialect#getFromDummyTable() */@Override protected String getFromDummyTable() { return " FROM dual"; }
3.26
morf_H2Dialect_getSqlForMonthsBetween_rdh
/** * * @see org.alfasoftware.morf.jdbc.SqlDialect#getSqlForMonthsBetween(org.alfasoftware.morf.sql.element.AliasedField, org.alfasoftware.morf.sql.element.AliasedField) */ @Override protected String getSqlForMonthsBetween(AliasedField toDate, AliasedField fromDate) { return String.format(((((((((((((((("CASE " ...
3.26
morf_H2Dialect_getSqlForLastDayOfMonth_rdh
/** * * @see org.alfasoftware.morf.jdbc.SqlDialect#getSqlForLastDayOfMonth */ @Override protected String getSqlForLastDayOfMonth(AliasedField date) { return ((("DATEADD(dd, -DAY(DATEADD(m,1," + getSqlFrom(date)) + ")), DATEADD(m,1,") + getSqlFrom(date)) + "))"; }
3.26
morf_H2Dialect_getSqlForRowNumber_rdh
/** * * @see org.alfasoftware.morf.jdbc.SqlDialect#getSqlForRowNumber() */ @Override protected String getSqlForRowNumber() { return "ROW_NUMBER() OVER()"; }
3.26
morf_H2Dialect_getSqlForDateToYyyymmddHHmmss_rdh
/** * * @see org.alfasoftware.morf.jdbc.SqlDialect#getSqlForDateToYyyymmddHHmmss(org.alfasoftware.morf.sql.element.Function) */ @Override protected String getSqlForDateToYyyymmddHHmmss(Function function) { String sqlExpression = getSqlFrom(function.getArguments().get(0)); // Example for CURRENT_TIMESTAMP() -...
3.26
morf_H2Dialect_getSqlForAddMonths_rdh
/** * * @see org.alfasoftware.morf.jdbc.SqlDialect#getSqlForAddMonths(org.alfasoftware.morf.sql.element.Function) */ @Override protected String getSqlForAddMonths(Function function) {return String.format("DATEADD('MONTH', %s, %s)", getSqlFrom(function.getArguments().get(1)), getSqlFrom(function.getArguments().get(0)...
3.26
morf_H2Dialect_getSqlForDateToYyyymmdd_rdh
/** * * @see org.alfasoftware.morf.jdbc.SqlDialect#getSqlForDateToYyyymmdd(org.alfasoftware.morf.sql.element.Function) */ @Override protected String getSqlForDateToYyyymmdd(Function function) { String v13 = getSqlFrom(function.getArguments().get(0)); return String.format("CAST(SUBSTRING(%1$s, 1, 4)||SUBSTRIN...
3.26
morf_H2Dialect_dropPrimaryKeyConstraintStatement_rdh
/** * * @param table * The table whose primary key should be dropped * @return The statement */ private String dropPrimaryKeyConstraintStatement(Table table) { return (("ALTER TABLE " + schemaNamePrefix()) + table.getName()) + " DROP PRIMARY KEY"; }
3.26
morf_H2Dialect_getSqlForNow_rdh
/** * * @see org.alfasoftware.morf.jdbc.SqlDialect#getSqlForNow(org.alfasoftware.morf.sql.element.Function) */ @Override protected String getSqlForNow(Function function) { return "CURRENT_TIMESTAMP()"; }
3.26
morf_ChangePrimaryKeyColumns_reverse_rdh
/** * * @see org.alfasoftware.morf.upgrade.SchemaChange#reverse(org.alfasoftware.morf.metadata.Schema) */ @Override public Schema reverse(Schema schema) { return applyChange(schema, newPrimaryKeyColumns, oldPrimaryKeyColumns); }
3.26
morf_ChangePrimaryKeyColumns_getNewPrimaryKeyColumns_rdh
/** * * @return the new primary key column names */ public List<String> getNewPrimaryKeyColumns() { return newPrimaryKeyColumns; }
3.26
morf_ChangePrimaryKeyColumns_apply_rdh
/** * * @see org.alfasoftware.morf.upgrade.SchemaChange#apply(org.alfasoftware.morf.metadata.Schema) */ @Override public Schema apply(Schema schema) { return applyChange(schema, oldPrimaryKeyColumns, newPrimaryKeyColumns); }
3.26
morf_ChangePrimaryKeyColumns_applyChange_rdh
/** * Applies the change * * @param schema * The target schema * @param from * the old primary key * @param to * the new primary key * @return The resulting schema */ protected Schema applyChange(Schema schema, List<String> from, List<String> to) { // Construct a list of column names converted to al...
3.26
morf_ChangePrimaryKeyColumns_getTableName_rdh
/** * * @return the table name */ public String getTableName() { return tableName; }
3.26
morf_ChangePrimaryKeyColumns_getOldPrimaryKeyColumns_rdh
/** * * @return the old primary key column names */ public List<String> getOldPrimaryKeyColumns() { return oldPrimaryKeyColumns; }
3.26
morf_ChangePrimaryKeyColumns_assertExistingPrimaryKey_rdh
/** * Verify that the "from" position actually matches the schema we have been given * * @param from * The from position * @param table * The target table */ protected void assertExistingPrimaryKey(List<String> from, Table table) { List<String> fromUpperCase = toUpperCase(from); List<String> existing...
3.26
morf_ChangePrimaryKeyColumns_accept_rdh
/** * * @see org.alfasoftware.morf.upgrade.SchemaChange#accept(org.alfasoftware.morf.upgrade.SchemaChangeVisitor) */ @Overridepublic void accept(SchemaChangeVisitor visitor) { visitor.visit(this); }
3.26
morf_ChangePrimaryKeyColumns_verifyNewPrimaryKeyIsNotIndexed_rdh
/** * Verify that the proposed PK does not already exist as an index. Permitting this confuses Oracle. */ private void verifyNewPrimaryKeyIsNotIndexed(Table table, List<String> newPrimaryKeyColumnsUpperCase) { for (Index index : table.indexes()) { List<String> indexColumnNames = toUpperC...
3.26
morf_ChangePrimaryKeyColumns_isApplied_rdh
/** * * @see org.alfasoftware.morf.upgrade.SchemaChange#isApplied(org.alfasoftware.morf.metadata.Schema, org.alfasoftware.morf.jdbc.ConnectionResources) */ @Override public boolean isApplied(Schema schema, ConnectionResources database) { List<String> actual = namesOfColumns(primaryKeysForTable(schema.getTable(...
3.26
morf_ChangelogBuilder_m0_rdh
/** * Set whether to include data changes in the log output. The default is to * omit data changes. * * @param includeDataChanges * Indicates whether data changes should be included or not. * @return This builder for chaining */ public ChangelogBuilder m0(boolean includeDataChanges) { this.includeDataChang...
3.26
morf_ChangelogBuilder_withPreferredSQLDialect_rdh
/** * Set which SQL dialect to use for data change statements that cannot be * converted to a human- readable form. The default is ORACLE. * * @param preferredSQLDialect * The SQL dialect to use * @return This builder for chaining */ public ChangelogBuilder withPreferredSQLDialect(String preferredSQLDialect) {...
3.26
morf_ChangelogBuilder_withOutputTo_rdh
/** * Set the {@link PrintWriter} target for this changelog. Default is the * console. * * @param outputStream * The {@link PrintWriter} to output to. * @return This builder for chaining */ public ChangelogBuilder withOutputTo(PrintWriter outputStream) { this.outputStream = outputStream; return this; }
3.26
morf_ChangelogBuilder_withUpgradeSteps_rdh
/** * Add to the collection of {@link UpgradeStep}'s to include in this * changelog. * * @param upgradeSteps * The upgrade steps to add * @return This builder for chaining */ public ChangelogBuilder withUpgradeSteps(Collection<Class<? extends UpgradeStep>> upgradeSteps) { this.upgradeSteps.addAll(upgradeSt...
3.26
morf_ChangelogBuilder_produceChangelog_rdh
/** * Produces the Changelog based on the given input settings. */ public void produceChangelog() { HumanReadableStatementProducer producer = new HumanReadableStatementProducer(upgradeSteps, includeDataChanges, preferredSQLDialect); producer.produceFor(new ChangelogStatementConsumer(outputStream)); ...
3.26
morf_SqlServerDialect_dropStatements_rdh
/** * * @see org.alfasoftware.morf.jdbc.SqlDialect#dropStatements(org.alfasoftware.morf.metadata.View) */ @Override public Collection<String> dropStatements(View view) {List<String> statements = new ArrayList<>();StringBuilder createTableStatement = new StringBuilder(); createTableStatement.append(String.format(...
3.26
morf_SqlServerDialect_getSqlFrom_rdh
/** * * @see org.alfasoftware.morf.jdbc.SqlDialect#getSqlFrom(org.alfasoftware.morf.sql.SelectFirstStatement) */ @Override protected String getSqlFrom(SelectFirstStatement stmt) { StringBuilder result = new StringBuilder("SELECT TOP 1 "); // Start by adding the field result.append(getSqlFrom(stmt.getFiel...
3.26
morf_SqlServerDialect_internalTableDeploymentStatements_rdh
/** * * @see org.alfasoftware.morf.jdbc.SqlDialect#tableDeploymentStatements(org.alfasoftware.morf.metadata.Table) */ @Override public Collection<String> internalTableDeploymentStatements(Table table) { List<String> statements = new ArrayList<>(); // Create the table deploymen...
3.26
morf_SqlServerDialect_getSqlForMonthsBetween_rdh
/** * * @see org.alfasoftware.morf.jdbc.SqlDialect#getSqlForMonthsBetween(org.alfasoftware.morf.sql.element.AliasedField, org.alfasoftware.morf.sql.element.AliasedField) */ @Override protected String getSqlForMonthsBetween(AliasedField toDate, AliasedField fromDate) { String toDateStr = getSqlFrom(toDate); S...
3.26
morf_SqlServerDialect_getColumnDefaultConstraintName_rdh
/** * Get the name of the DEFAULT constraint for a column. * * @param table * The table on which the column exists. * @param column * The column to get the name for. * @return The name of the DEFAULT constraint for the column on the table. */ private String getColumnDefaultConstraintName(final Table table, ...
3.26
morf_SqlServerDialect_getForUpdateSql_rdh
/** * SQL server places a shared lock on a record when it is selected without doing anything else (no MVCC) * so no need to specify a lock mode. * * @see org.alfasoftware.morf.jdbc.SqlDialect#getForUpdateSql() * @see <a href="http://stackoverflow.com/questions/10935850/when-to-use-select-for-update">When to use se...
3.26
morf_SqlServerDialect_changePrimaryKeyColumns_rdh
/** * * @see org.alfasoftware.morf.jdbc.SqlDialect#changePrimaryKeyColumns(org.alfasoftware.morf.metadata.Table, java.util.List, java.util.List) */ @Override public Collection<String> changePrimaryKeyColumns(Table table, List<String> oldPrimaryKeyColumns, List<String> newPrimaryKeyColumns) { List<String> stateme...
3.26
morf_SqlServerDialect_alterTableChangeColumnStatements_rdh
/** * * @see org.alfasoftware.morf.jdbc.SqlDialect#alterTableChangeColumnStatements(org.alfasoftware.morf.metadata.Table, org.alfasoftware.morf.metadata.Column, org.alfasoftware.morf.metadata.Column) */ @Override public Collection<String> alterTableChangeColumnStatements(Table table, final Column oldColumn, Column ...
3.26
morf_SqlServerDialect_preInsertWithPresetAutonumStatements_rdh
/** * * @see org.alfasoftware.morf.jdbc.SqlDialect#preInsertWithPresetAutonumStatements(org.alfasoftware.morf.metadata.Table, boolean) */ @Override public Collection<String> preInsertWithPresetAutonumStatements(Table table, boolean insertingUnderAutonumLimit) { if (getAutoIncrementColumnForTable(table) != null) ...
3.26
morf_SqlServerDialect_getSqlForDateToYyyymmddHHmmss_rdh
/** * * @see org.alfasoftware.morf.jdbc.SqlDialect#getSqlForDateToYyyymmddHHmmss(org.alfasoftware.morf.sql.element.Function) */@Override protected String getSqlForDateToYyyymmddHHmmss(Function function) { return String.format("REPLACE(REPLACE(REPLACE(CONVERT(VARCHAR(19),%s, 120),'-',''), ':', ''), ' ', '')", get...
3.26
morf_SqlServerDialect_buildPrimaryKeyConstraint_rdh
/** * * @param tableName * Name of the table. * @param primaryKeys * List of the primary keys on the table. */ private String buildPrimaryKeyConstraint(String tableName, List<String> primaryKeys) { StringBuilder pkConstraint = new StringBuilder(); pkConstraint.append("CONSTRAINT ["); pkConstraint...
3.26
morf_SqlServerDialect_getSqlForAddMonths_rdh
/** * * @see org.alfasoftware.morf.jdbc.SqlDialect#getSqlForAddMonths(org.alfasoftware.morf.sql.element.Function) */ @Override protected String getSqlForAddMonths(Function function) { return String.format("DATEADD(month, %s, %s)", getSqlFrom(function.getArguments().get(1)), getSqlFrom(function.getArguments().get...
3.26
morf_SqlServerDialect_getSqlforLength_rdh
/** * * @see org.alfasoftware.morf.jdbc.SqlDialect#getSqlforLength(Function) */ @Override protected String getSqlforLength(Function function) { return String.format("LEN(%s)", getSqlFrom(function.getArguments().get(0))); }
3.26
morf_SqlServerDialect_getSqlForAddDays_rdh
/** * * @see org.alfasoftware.morf.jdbc.SqlDialect#getSqlForAddDays(org.alfasoftware.morf.sql.element.Function) */ @Override protected String getSqlForAddDays(Function function) {return String.format("DATEADD(dd, %s, %s)", getSqlFrom(function.getArguments().get(1)), getSqlFrom(function.getArguments().get(0))); ...
3.26
morf_SqlServerDialect_alterTableDropColumnStatements_rdh
/** * * @see org.alfasoftware.morf.jdbc.SqlDialect#alterTableDropColumnStatements(org.alfasoftware.morf.metadata.Table, org.alfasoftware.morf.metadata.Column) */ @Override public Collection<String> alterTableDropColumnStatements(Table table, final Column column) { List<String> v34 = new ArrayList<>(); // Dro...
3.26
morf_SqlServerDialect_getSqlForLeftPad_rdh
/** * * @see org.alfasoftware.morf.jdbc.SqlDialect#getSqlForLeftPad(org.alfasoftware.morf.sql.element.AliasedField, org.alfasoftware.morf.sql.element.AliasedField, org.alfasoftware.morf.sql.element.AliasedField) */@Override protected String getSqlForLeftPad(AliasedField field, AliasedField length, AliasedField chara...
3.26
morf_SqlServerDialect_getDatabaseType_rdh
/** * * @see org.alfasoftware.morf.jdbc.SqlDialect#getDatabaseType() */@Override public DatabaseType getDatabaseType() { return DatabaseType.Registry.findByIdentifier(SqlServer.IDENTIFIER); }
3.26
morf_SqlServerDialect_needsCollation_rdh
/** * * @param dataType * a data type to examine * @return true if this data type should have COLLATE set. */ private static boolean needsCollation(DataType dataType) { return (dataType == DataType.STRING) || (dataType == DataType.CLOB); }
3.26
morf_SqlServerDialect_containsPrimaryKeyConstraint_rdh
/** * * @param statements * the statements to check for the primary key constraint * @param tableName * the table name which is expected to make up the pk constraint name * @return true if the statements contain tableName_PK */ private boolean containsPrimaryKeyConstraint(Collection<String> statements, Stri...
3.26
morf_SqlServerDialect_getSqlForYYYYMMDDToDate_rdh
/** * * @see org.alfasoftware.morf.jdbc.SqlDialect#getSqlForYYYYMMDDToDate(org.alfasoftware.morf.sql.element.Function) */ @Override protected String getSqlForYYYYMMDDToDate(Function function) { return ("CONVERT(date, " + getSqlFrom(function.getArguments().get(0))) + ", 112)"; }
3.26
morf_SqlServerDialect_getSqlForOrderByField_rdh
/** * * @see org.alfasoftware.morf.jdbc.SqlDialect#getSqlForOrderByField(org.alfasoftware.morf.sql.element.FieldReference) */ @Override protected String getSqlForOrderByField(FieldReference orderByField) { StringBuilder result = new StringBuilder(); String sqlFromField = getSqlFrom(orderByField); if (or...
3.26
morf_SqlServerDialect_undecorateName_rdh
/** * Removes any decoration characters from the name. (# for temp table). * * @param name * name of table * @return version of name with any decoration removed. */ public String undecorateName(String name) { if (name.startsWith("#")) { return name.substring(1); } else { return name; ...
3.26
morf_SqlServerDialect_m0_rdh
/** * {@inheritDoc } * * @see org.alfasoftware.morf.jdbc.SqlDialect#decorateTemporaryTableName(java.lang.String) */ @Override public String m0(String undecoratedName) { return "#" + undecoratedName; }
3.26
morf_SqlServerDialect_getSqlForMod_rdh
/** * * @see org.alfasoftware.morf.jdbc.SqlDialect#getSqlForMod(org.alfasoftware.morf.sql.element.Function) */ @Override protected String getSqlForMod(Function function) { return String.format("%s %% %s", getSqlFrom(function.getArguments().get(0)), getSqlFrom(function.getArguments().get(1))); }
3.26
morf_SqlServerDialect_getSqlForLastDayOfMonth_rdh
/** * * @see org.alfasoftware.morf.jdbc.SqlDialect#getSqlForLastDayOfMonth */ @Override protected String getSqlForLastDayOfMonth(AliasedField date) { return ("DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0," + getSqlFrom(date)) + ")+1,0))"; }
3.26
morf_SqlServerDialect_getInternalColumnRepresentation_rdh
/** * Gets the underlying column representation (e.g. without any COLLATE statements). * * @param dataType * the column datatype. * @param width * the column width. * @param scale * the column scale. * @return a string representation of the column definition. */private String getInternalColumnRepresenta...
3.26
morf_SqlServerDialect_sqlRepresentationOfColumnType_rdh
/** * Return the SQL representation for the column on the table. * * @see #sqlRepresentationOfColumnType(Table, Column, boolean) * @param table * The table * @param column * The column * @param includeDefaultWithValues * Whether to include the WITH VALUES clause. * This is only applicable on ALTER sta...
3.26
morf_SqlServerDialect_renameIndexStatements_rdh
/** * * @see org.alfasoftware.morf.jdbc.SqlDialect#renameIndexStatements(org.alfasoftware.morf.metadata.Table, java.lang.String, java.lang.String) */ @Override public Collection<String> renameIndexStatements(Table table, String fromIndexName, String toIndexName) { return ImmutableList.of(String.format("sp_rename...
3.26
morf_SqlServerDialect_getSqlForDateToYyyymmdd_rdh
/** * * @see org.alfasoftware.morf.jdbc.SqlDialect#getSqlForDateToYyyymmdd(org.alfasoftware.morf.sql.element.Function) */ @Override protected String getSqlForDateToYyyymmdd(Function function) { return String.format("CONVERT(VARCHAR(8),%s, 112)", getSqlFrom(function.getArguments().get(0))); }
3.26
morf_SqlServerDialect_getDeleteLimitPreFromClause_rdh
/** * * @see SqlDialect#getDeleteLimitPreFromClause(int) */ @Override protected Optional<String> getDeleteLimitPreFromClause(int limit) { return Optional.of(("TOP (" + limit) + ")"); }
3.26
morf_SqlServerDialect_connectionTestStatement_rdh
/** * * @see org.alfasoftware.morf.jdbc.SqlDialect#connectionTestStatement() */ @Override public String connectionTestStatement() { return "select 1"; }
3.26
morf_SqlServerDialect_dropPrimaryKey_rdh
/** * Drops the primary key from a {@link Table}. * * @param table * The table to drop the primary key from */ private String dropPrimaryKey(Table table) { StringBuilder dropPkStatement = new StringBuilder(); dropPkStatement.append("ALTER TABLE ").append(schemaNamePrefix()).append(table.getName()).appen...
3.26
morf_SqlServerDialect_getSqlForRandomString_rdh
/** * * @see org.alfasoftware.morf.jdbc.SqlDialect#getSqlForRandomString(org.alfasoftware.morf.sql.element.Function) */ @Override protected String getSqlForRandomString(Function function) { return String.format("SUBSTRING(REPLACE(CONVERT(varchar(255),NEWID()),'-',''), 1, %s)", getSqlFrom(function.getArguments()....
3.26
morf_SqlServerDialect_alterTableAddColumnStatements_rdh
/** * * @see org.alfasoftware.morf.jdbc.SqlDialect#alterTableAddColumnStatements(org.alfasoftware.morf.metadata.Table, org.alfasoftware.morf.metadata.Column) */ @Override public Collection<String> alterTableAddColumnStatements(Table table, Column column) { List<String> statements = new ArrayList<>(); // ...
3.26
morf_SqlServerDialect_getSqlForDaysBetween_rdh
/** * * @see org.alfasoftware.morf.jdbc.SqlDialect#getSqlForDaysBetween(org.alfasoftware.morf.sql.element.AliasedField, org.alfasoftware.morf.sql.element.AliasedField) */ @Override protected String getSqlForDaysBetween(AliasedField toDate, AliasedField fromDate) { return String.format("DATEDIFF(DAY, %s, %s)", ge...
3.26
morf_SqlServerDialect_m1_rdh
/** * * @see org.alfasoftware.morf.jdbc.SqlDialect#tableNameWithSchemaName(org.alfasoftware.morf.sql.element.TableReference) */ @Override protected String m1(TableReference tableRef) { if (!StringUtils.isEmpty(tableRef.getDblink())) throw new IllegalStateException((("DB Links are not supported in the Sql...
3.26
morf_SqlServerDialect_getFromDummyTable_rdh
/** * * @see org.alfasoftware.morf.jdbc.SqlDialect#getFromDummyTable() */ @Override protected String getFromDummyTable() { return StringUtils.EMPTY;// SQLServer doesn't have a "DUAL" table like oracle etc. }
3.26
morf_SqlServerDialect_postInsertWithPresetAutonumStatements_rdh
/** * * @see org.alfasoftware.morf.jdbc.SqlDialect#postInsertWithPresetAutonumStatements(Table, SqlScriptExecutor, Connection, boolean) */ @Override public void postInsertWithPresetAutonumStatements(Table table, SqlScriptExecutor executor, Connection connection, boolean insertingUnderAutonumLimit) { Column auton...
3.26
morf_SchemaValidator_validateName_rdh
/** * Validates the basic naming rules for a database object (currently a table or view). */ private void validateName(String tableOrViewName) { if (!isEntityNameLengthValid(tableOrViewName)) { validationFailures.add(((("Name of table or view [" + tableOrViewName) + "] is not allowed - it is over ") + MA...
3.26
morf_SchemaValidator_hashCode_rdh
/** * * @see java.lang.Object#hashCode() */ @Override public int hashCode() { return index.columnNames().hashCode() + Boolean.valueOf(index.isUnique()).hashCode(); } /** * {@inheritDoc }
3.26
morf_SchemaValidator_isSQLReservedWord_rdh
/** * Method to establish if a given string is an SQL Reserved Word * * @param word * the string to establish if its a SQL Reserved Word * @return true if its a SQL Reserved Word otherwise false. */ boolean isSQLReservedWord(String word) { return sqlReservedWords.get().contains(word.toUpperCase()); }
3.26
morf_SchemaValidator_validate_rdh
/** * Validate a {@link View} meets the rules * * @param view * The {@link View} to validate */ public void validate(View view) { validateView(view); checkForValidationErrors(); }
3.26
morf_SchemaValidator_validateIndices_rdh
/** * Validates a {@link Table}'s {@link Index}s meet the rules. * * @param table * The {@link Table} on which to validate indexes. */ private void validateIndices(Table table) { Map<IndexSignature, Index> indexesBySignature = new HashMap<>(); // -- First add the 'PRIMARY' index which is always present i...
3.26
morf_SchemaValidator_validateColumnNames_rdh
/** * Validates a {@link Table} or {@link View}'s {@link Column}s meet the rules. * * @param tableOrViewName * The Table or View on which to validate columns. */ private void validateColumnNames(Collection<String> columnNames, String tableOrViewName) { for (String columnName : columnNames) { if (!isE...
3.26
morf_SchemaValidator_isEntityNameLengthValid_rdh
/** * Method to establish if a given string representing an Entity name is within the allowed length of charchaters. * * @see #MAX_LENGTH * @param name * the string to establish if its within the allowed length * @return true if its within the allowed length otherwise false. */ boolean isEntityNameLengthValid(...
3.26
morf_SchemaValidator_validateView_rdh
/** * Validates a {@link View} meets the rules. * * @param view * The {@link View} to validate. */ private void validateView(View view) { validateName(view.getName()); if (view.knowsSelectStatement()) { validateColumnNames(FluentIterable.from(view.getSelectStatement().getFields()).transform(FIELD...
3.26
morf_SchemaValidator_validateColumns_rdh
/** * Validates a {@link Table}'s {@link Column}s meet the rules. * * @param table * The {@link Table} on which to validate columns. */ private void validateColumns(Table table) { validateColumnNames(FluentIterable.from(table.columns()).transform(COLUMN_TO_NAME).toList(), table.getName()); for (Column co...
3.26
morf_SchemaValidator_validateTable_rdh
/** * Validates a {@link Table} meets the rules. * * @param table * The {@link Table} to validate. */ private void validateTable(Table table) { validateName(table.getName()); validateIndices(table); validateColumns(table); }
3.26
morf_SchemaValidator_m0_rdh
/** * <p> * Method to establish if a name matches an allowed pattern of characters to * follow the correct naming convention. * </p> * <p> * The name must: * </p> * <ul> * <li>begin with an alphabetic character [a-zA-Z]</li> * <li>only contain alphanumeric characters or underscore [a-zA-Z0-9_]</li> * </ul> ...
3.26
morf_SchemaValidator_checkForValidationErrors_rdh
/** * Check whether any errors have been added */ private void checkForValidationErrors() { // check for errors if (!validationFailures.isEmpty()) { StringBuilder message = new StringBuilder("Schema validation failures:"); for (String failure : validationFailures) { me...
3.26
morf_DeleteStatementBuilder_getTable_rdh
/** * Gets the table being deleted from. * * @return the table being inserted into */ TableReference getTable() { return table; }
3.26
morf_DeleteStatementBuilder_where_rdh
/** * Specifies the where criteria * * <blockquote><pre>DeleteStatement.delete([table]) * .where([criteria]) * .build();</pre></blockquote> * * @param criterion * the criteria to filter the results by * @return this, for method chaining. */ public DeleteStatementBuilder where(Criterion criterion) { ...
3.26
morf_DeleteStatementBuilder_limit_rdh
/** * Specifies the limit for the delete statement. * * <blockquote><pre>DeleteStatement.delete([table]) * .where([criteria]) * .limit(1000) * .build();</pre></blockquote> * * @param limit * the limit on the number of deleted records. * @return this, for...
3.26
morf_DeleteStatementBuilder_getWhereCriterion_rdh
/** * Gets the where criteria. * * @return the where criteria */ Criterion getWhereCriterion() { return whereCriterion; }
3.26
morf_FieldFromSelectFirst_toString_rdh
/** * * @see java.lang.Object#toString() */ @Override public String toString() { return selectFirstStatement.toString() + super.toString(); }
3.26
morf_FieldFromSelectFirst_getSelectFirstStatement_rdh
/** * * @return the selectStatement */ public SelectFirstStatement getSelectFirstStatement() { return selectFirstStatement; }
3.26
morf_FieldFromSelectFirst_drive_rdh
/** * * @see org.alfasoftware.morf.util.ObjectTreeTraverser.Driver#drive(ObjectTreeTraverser) */ @Override public void drive(ObjectTreeTraverser traverser) { traverser.dispatch(getSelectFirstStatement()); }
3.26
morf_FieldFromSelectFirst_deepCopyInternal_rdh
/** * * @see org.alfasoftware.morf.sql.element.AliasedField#deepCopyInternal(DeepCopyTransformation) */ @Override protected AliasedField deepCopyInternal(DeepCopyTransformation transformer) { return new FieldFromSelectFirst(getAlias(), transformer.deepCopy(selectFirstStatement)); }
3.26
morf_UseIndex_getTable_rdh
/** * * @return The table whose index should be used. */ public TableReference getTable() { return table;}
3.26
morf_UseIndex_getIndexName_rdh
/** * * @return The name of the index to use. */ public String getIndexName() { return indexName; }
3.26
morf_Function_dateToYyyymmdd_rdh
/** * Helper method to create an instance of the "DATE_TO_YYYYMMDD" SQL function. * {@code expression} must result in a string. * * @see Cast * @param expression * the expression to evaluate * @return an instance of the DATE_TO_YYYYMMDD function */ public static Function dateToYyyymmdd(AliasedField expressi...
3.26
morf_Function_rowNumber_rdh
/** * * @return an instance or ROW_NUMBER function */ public static Function rowNumber() {return new Function(FunctionType.ROW_NUMBER); }
3.26
morf_Function_m2_rdh
/** * Helper method to create an instance of the "greatest" SQL function. * * @param fields * the fields to evaluate. * @return an instance of the "greatest" function. */ public static Function m2(Iterable<? extends AliasedField> fields) { return new Function(FunctionType.GREATEST, fields);}
3.26
morf_Function_monthsBetween_rdh
/** * The number of whole months between two dates. The logic used is equivalent to * {@link Months#monthsBetween(org.joda.time.ReadableInstant, org.joda.time.ReadableInstant)}. * * <p>As an example, assuming two dates are in the same year and the {@code fromDate} is from two months prior to * the {@code toDate} ...
3.26
morf_Function_round_rdh
/** * Rounding result for all of the below databases is equivalent to the Java RoundingMode#HALF_UP * for the datatypes which are currently in use at Alfa, where rounding is performed to the nearest integer * unless rounding 0.5 in which case the number is rounded up. Note that this is the rounding mode * commonly ...
3.26
morf_Function_average_rdh
/** * Helper method to create an instance of the "average" SQL function. * * @param field * the field to evaluate in the average function. * @return an instance of a average function. */ public static Function average(AliasedField field) { return new Function(FunctionType.AVERAGE, field); }
3.26