name stringlengths 12 178 | code_snippet stringlengths 8 36.5k | score float64 3.26 3.68 |
|---|---|---|
morf_SqlUtils_update_rdh | /**
* Constructs an update statement.
*
* <p>Usage is discouraged; this method will be deprecated at some point. Use
* {@link UpdateStatement#update(TableReference)} for preference.</p>
*
* @param tableReference
* the database table to update
* @return {@link UpdateStatement}
*/
public static UpdateStatement... | 3.26 |
morf_SqlUtils_delete_rdh | /**
* Constructs a Delete Statement.
*
* <p>Usage is discouraged; this method will be deprecated at some point. Use
* {@link DeleteStatement#delete(TableReference)} for preference.</p>
*
* @param table
* the database table to delete from.
* @return {@link DeleteStatement}
*/
public static DeleteStatement de... | 3.26 |
morf_SqlUtils_type_rdh | /**
* Specifies the data type for the parameter.
*
* @param dataType
* The data type
* @return the next phase of the parameter builder.
*/
public SqlParameterWidthBuilder type(DataType dataType) {
return new SqlParameterWidthBuilder(name, dataType);
} | 3.26 |
morf_SqlUtils_nullLiteral_rdh | /**
*
* @return a {@link NullFieldLiteral}.
*/
public static FieldLiteral nullLiteral() {
return new NullFieldLiteral();
} | 3.26 |
morf_SqlUtils_concat_rdh | /**
* Returns an expression concatenating all the passed expressions.
*
* @param fields
* the expressions to concatenate.
* @return the expression concatenating the passed expressions.
*/
public static ConcatenatedField concat(Iterable<? extends AliasedField> fields) {
retu... | 3.26 |
morf_SqlUtils_truncate_rdh | /**
* Constructs a Truncate Statement.
*
* <p>Usage is discouraged; this method will be deprecated at some point. Use
* {@link TruncateStatement#truncate(TableReference)} for preference.</p>
*
* @param table
* The table to truncate.
* @return The statement.
*/
public static TruncateStatement truncate(TableRe... | 3.26 |
morf_SqlUtils_tableRef_rdh | /**
* Construct a new table with a given name with provided DB-link.
*
* @param tableName
* the name of the table
* @param dblink
* database link if table exists in another database
* @return {@link TableReference}
*/
public static TableReference tableRef(String tableName, String dblink) {
Validate.... | 3.26 |
morf_SqlUtils_literal_rdh | /**
* Constructs a new {@link FieldLiteral} with a Character source.
*
* @param value
* the literal value to use
* @return {@link FieldLiteral}
*/
public static FieldLiteral literal(Character value) {return new FieldLiteral(value);
} | 3.26 |
morf_SqlUtils_select_rdh | /**
* Constructs a Select Statement which optionally selects on a subset of fields.
* If no fields are specified then this is equivalent of selecting all
* fields (i.e. {@code SELECT * FROM x}).
*
* <p>Usage is discouraged; this method will be deprecated at some point. Use
* {@link SelectStatement#select(AliasedF... | 3.26 |
morf_SqlUtils_asType_rdh | /**
* Returns a SQL DSL expression to return the field CASTed to
* the specified type, length and scale.
*
* @param type
* The target type.
* @param length
* The target length.
* @param scale
* The target scale.
* @return The SQL DSL expression applying the cast function.
*/
public Cast asType(DataType... | 3.26 |
morf_SqlUtils_windowFunction_rdh | /**
* Encapsulates the generation of an PARTITION BY SQL statement.
*
* <p>The call structure imitates the end SQL and is structured as follows:</p>
*
* <blockquote><pre>
* SqlUtils.windowFunction([function]) = [function]
* |----> .partitionBy([fields]...) =... | 3.26 |
morf_SqlUtils_m2_rdh | /**
* Constructs a new ClobFieldLiteral from a given string.
*
* @param value
* - the literal value to use.
* @return ClobFieldLiteral
*/
public static ClobFieldLiteral m2(String value) {
return new ClobFieldLiteral(value);
} | 3.26 |
morf_SqlUtils_asDecimal_rdh | /**
* Returns a SQL DSL expression to return the field CASTed to
* a decimal of the specified length
*
* @param length
* length of the decimal cast
* @param scale
* scale of the decimal cast
* @return {@link Cast} as decimal of given length
*/
public Cast asDecimal(int length, int scale) {
return asTyp... | 3.26 |
morf_SqlUtils_merge_rdh | /**
* Constructs a Merge Statement which either inserts or updates
* a record into a table depending on whether a condition exists in
* the table.
*
* <p>Usage is discouraged; this method will be deprecated at some point. Use
* {@link MergeStatement#merge()} for preference.</p>
*
* @return {@link MergeStatement... | 3.26 |
morf_SqlUtils_then_rdh | /**
*
* @param value
* The value returned if the criteria is true
* @return {@link WhenCondition}
*/
public WhenCondition then(long value) {
return then(literal(value));
} | 3.26 |
morf_SqlUtils_selectDistinct_rdh | /**
* Constructs a distinct Select Statement which optionally selects on a subset of fields.
* If no fields are specified then this is equivalent of selecting all
* fields (i.e. {@code SELECT DISTINCT * FROM x}).
*
* <p>Usage is discouraged; this method will be deprecated at some point. Use
* {@link SelectStateme... | 3.26 |
morf_SqlUtils_blobLiteral_rdh | /**
* Constructs a new {@link BlobFieldLiteral} from given String,
* which is turned into bytes using a UTF-8 encoding.
*
* @param value
* the literal value to use
* @return {@link BlobFieldLiteral}
*/
public static BlobFieldLiteral blobLiteral(String value) {
return new BlobFieldLiteral(value.getBytes(St... | 3.26 |
morf_SqlUtils_selectFirst_rdh | /**
* Constructs a Select First Statement.
*
* <p>Usage is discouraged; this method will be deprecated at some point. Use
* {@link SelectFirstStatement#selectFirst(AliasedFieldBuilder)} for preference.</p>
*
* @param field
* the field that should be selected
* @return {@link SelectStatement}
*/
public static... | 3.26 |
morf_SqlUtils_field_rdh | /**
* Constructs a new field with a given name
*
* <p>Consider using {@link TableReference#field(String)} instead.</p>
*
* @param fieldName
* the name of the field
* @return {@link FieldReference}
* @see TableReference#field(String)
*/
public static FieldReference field(String fieldName) {
return new Fie... | 3.26 |
morf_SqlUtils_math_rdh | /**
* Returns a mathematical expression.
*
* @param leftField
* The left field
* @param operator
* The operator
* @param rightField
* The right field
* @return the expression.
*/
public static MathsField math(AliasedField leftField, MathsOperator operator, AliasedField rightField) {
return new Math... | 3.26 |
morf_UnsupportedDatabaseTestStatement_evaluate_rdh | /**
*
* @see org.junit.runners.model.Statement#evaluate()
*/
@Override
public void evaluate() {
String
message = String.format("Test %s ignored by %s as it is marked as unsupported", description.getMethodName(), description.getTestClass().getSimpleName());
log.info(message);
Assume.assumeTrue(message... | 3.26 |
morf_ResultSetMetadataSorter_sortedCopy_rdh | /**
* Creates a copy of an {@link Iterable} of columns, where the copy is sorted such that the
* columns appear in the same order as they do in the supplied {@link ResultSet}.
*
* @param columns
* Columns expected.
* @param resultSet
* The result set containing the values.
* @return The sorted columns.
*/
... | 3.26 |
morf_SqlServerMetaDataProvider_dataTypeFromSqlType_rdh | /**
* SqlServerDialect maps CLOB data types to NVARCHAR(MAX) but NVARCHAR sqlTypes are mapped as Strings in the {@link DatabaseMetaDataProvider}.
* This method uses the column width to determine whether a sqlType == Type.NVARCHAR should be mapped to a String
* or to a CLOB data type. If the column with is large (> ~... | 3.26 |
morf_SqlServerMetaDataProvider_setAdditionalColumnMetadata_rdh | /**
* SQL Server does not return information on auto-increment columns in any way which JDBC can pick up,
* so we need a customised method for fetching this information.
*
* @see org.alfasoftware.morf.jdbc.DatabaseMetaDataProvider#setAdditionalColumnMetadata(RealName, ColumnBuilder, ResultSet)
*/
@Override
protect... | 3.26 |
morf_SqlServerMetaDataProvider_fetchIdentityColumns_rdh | /**
* Fetch the column extended properties
*/
private void fetchIdentityColumns() {
try {Statement statement = connection.createStatement();
try {
ResultSet resultSet = statement.executeQuery(String.format(AUTONUM_START_QUERY, schemaName));
try {
while (resultSet.ne... | 3.26 |
morf_SqlServerMetaDataProvider_isPrimaryKeyIndex_rdh | /**
*
* @see org.alfasoftware.morf.jdbc.DatabaseMetaDataProvider#isPrimaryKeyIndex(RealName)
*/
@Override
protected boolean
isPrimaryKeyIndex(RealName indexName) {
return indexName.getDbName().endsWith("_PK");
} | 3.26 |
morf_ViewChanges_getViewsToDrop_rdh | /**
*
* @return sorted list of the views to drop in the order they should be dropped.
*/
public List<View> getViewsToDrop() {
// Sort the list in reverse order of creation for dropping
List<String> sortedViewNamesToDrop = newArrayList(dropSet);
Collections.sort(sortedViewNamesToDrop,
Ordering.explici... | 3.26 |
morf_ViewChanges_getViewsToDeploy_rdh | /**
*
* @return sorted list of the views to deploy in the order they should be deployed.
*/
public List<View> getViewsToDeploy() {
// Sort the list into creation order based on toposort result
List<String> sortedViewNamesToDeploy =
newArrayList(deploySet);
Collections.sort(sortedViewNamesToDeploy, Or... | 3.26 |
morf_ViewChanges_droppingAlso_rdh | /**
*
* @param extraViewsToDrop
* Additional views to drop
* @return a new {@link ViewChanges} which also drops the specified views.
*/
public ViewChanges droppingAlso(Collection<View> extraViewsToDrop) {
Set<String> extraViewNames = ImmutableSet.copyOf(Collections2.transform(extraViewsToDrop, viewToName())... | 3.26 |
morf_ViewChanges_viewToName_rdh | /**
*
* @return the name of a given view.
*/
private Function<View, String> viewToName() {
return new Function<View, String>() {
@Overridepublic String
apply(View view) {
return view.getName();
}
};
} | 3.26 |
morf_ViewChanges_nameToView_rdh | /**
*
* @return the view for a given name.
*/
private Function<String, View> nameToView() {
return new Function<String, View>() {
@Override
public View apply(String name) { return viewIndex.get(name);
}
};
} | 3.26 |
morf_ViewChanges_topoSortViews_rdh | /**
* Performs a topological sort using a depth-first search algorithm and returns a sorted list of
* database views for the schema upgrade.
*
* @param allViews
* all of the database views bound into the target schema.
* @param index
* a complete index of all views in both the source and target schema.
* @r... | 3.26 |
morf_ViewChanges_dropNode_rdh | /**
* Add a node to the drop set
*
* @param node
* the node to drop.
*/
private void dropNode(String node) {
dropSet.add(node);
if (knownSet.contains(node)) {if (log.isDebugEnabled())
... | 3.26 |
morf_ViewChanges_visit_rdh | /**
* Visit the selected node for the topological sort. If it has been marked start working
* back up the list. Otherwise, mark it and then try visiting all of its dependent nodes.
*
* @param node
* the node being visited.
* @param sortedList
* the list of sorted results. Items in this list are 'permanently'... | 3.26 |
morf_ViewChanges_isEmpty_rdh | /**
*
* @return true if both sets are empty, false otherwise.
*/
public boolean isEmpty() {
return dropSet.isEmpty() && deploySet.isEmpty();
} | 3.26 |
morf_ViewChanges_correctCase_rdh | /**
* Correct case of names with respect to all the views we know about.
*
* @return equivalent collection with names case-corrected where possible.
*/private Collection<String> correctCase(Collection<String> names) {
Map<String, String> namesMap = names.stream().collect(Collectors.toMap(String::toLowerCase, n... | 3.26 |
morf_ViewChanges_deployingAlso_rdh | /**
*
* @param extraViewsToDeploy
* Additional views to deploy
* @return a new {@link ViewChanges} which also deploys the specified views.
*/
public ViewChanges deployingAlso(Collection<View> extraViewsToDeploy) {
Set<String> extraViewNames = ImmutableSet.copyOf(Collections2.transform(extraViewsToDeploy, vie... | 3.26 |
morf_ViewChangesDeploymentHelper_createView_rdh | /**
* Creates SQL statements for creating given view.
*
* @param view
* View to be created.
* @param updateDeployedViews
* Whether to update the DeployedViews table.
* @return SQL statements to be run to create the view.
* @deprecated kept to ensure backwards compatibility.
*/
@Deprecated
List<String> crea... | 3.26 |
morf_ViewChangesDeploymentHelper_dropViewIfExists_rdh | /**
* Creates SQL statements for dropping given view.
*
* @param view
* View to be dropped.
* @param updateDeployedViews
* Whether to update the DeployedViews table.
* @param dropTheView
* Whether to actually drop the view from the database.
* @return SQL statements to be run to drop the view.
* @deprec... | 3.26 |
morf_ViewChangesDeploymentHelper_deregisterAllViews_rdh | /**
* Creates SQL statements for removing all views from the view register.
*
* @return SQL statements to be run to de-register all views.
* @deprecated kept to ensure backwards compatibility.
*/
@Deprecated
public List<String> deregisterAllViews() {
return deregisterAllViews(new UpgradeSchemas(schema(), schem... | 3.26 |
morf_ViewChangesDeploymentHelper_deregisterViewIfExists_rdh | /**
* Creates SQL statements for removing given view from the view register.
*
* @param view
* View to be dropped.
* @param updateDeployedViews
* Whether to update the DeployedViews table.
* @return SQL statements to be run to drop the view.
* @deprecated kept to ensure backwards compatibility.
*/
@Depreca... | 3.26 |
morf_ViewChangesDeploymentHelper_create_rdh | /**
* Creates a {@link ViewChangesDeploymentHelper} implementation for the given connection details.
*
* @param connectionResources
* connection resources for the data source.
* @return ViewChangesDeploymentHelper.
*/
public ViewChangesDeploymentHelper create(ConnectionResources connectionResources) {
retur... | 3.26 |
morf_NullFieldLiteral_deepCopyInternal_rdh | /**
*
* @see org.alfasoftware.morf.sql.element.AliasedField#deepCopyInternal(DeepCopyTransformation)
*/
@Override
protected NullFieldLiteral deepCopyInternal(final DeepCopyTransformation transformer) {
return new NullFieldLiteral(this.getAlias());
} | 3.26 |
morf_AnalyseTable_isApplied_rdh | /**
* {@inheritDoc }
*
* @see org.alfasoftware.morf.upgrade.SchemaChange#isApplied(Schema, ConnectionResources)
*/
@Override
public boolean isApplied(Schema schema, ConnectionResources database) {
return true;
} | 3.26 |
morf_AnalyseTable_reverse_rdh | /**
* {@inheritDoc }
*
* @see org.alfasoftware.morf.upgrade.SchemaChange#reverse(Schema)
*/
@Override
public Schema reverse(Schema schema) {
return schema;
} | 3.26 |
morf_AnalyseTable_getTableName_rdh | /**
* Method to get the table that is being analysed.
*
* @return {@link Statement} to be executed
*/
public String getTableName() {
return tableName;
} | 3.26 |
morf_AnalyseTable_accept_rdh | /**
*
* @see org.alfasoftware.morf.upgrade.SchemaChange#accept(org.alfasoftware.morf.upgrade.SchemaChangeVisitor)
*/
@Override
public void accept(SchemaChangeVisitor visitor) {
visitor.visit(this);
} | 3.26 |
morf_AnalyseTable_apply_rdh | /**
* Before an upgrade step is run, if the table for analysis is not present, an illegal argument exception is thrown
* to prevent the upgrade step from starting.
*/
@Override
public Schema apply(Schema schema) {
if (!schema.tableExists(tableName.toUpperCase())) {
throw new IllegalArgumentException(("Ca... | 3.26 |
morf_HumanReadableStatementHelper_generateAddTableFromString_rdh | /**
* Generates a human-readable "Add Table From" string.
*
* @param definition
* the definition of the new table
* @return a string containing the human-readable version of the action
*/
public static String generateAddTableFromString(final Table definition, final SelectStatement selectStatement) {
StringB... | 3.26 |
morf_HumanReadableStatementHelper_generateIndexCountString_rdh | /**
* Generates a string which represents the number of indexes specified.
*
* @param indexCount
* the number of indexes
* @return a string representation of the number of indexes
*/
private static String generateIndexCountString(final int indexCount) {
if (indexCount == 0) {
return "no indexes";
... | 3.26 |
morf_HumanReadableStatementHelper_generateNullableString_rdh | /**
* Generates a nullable / non-null string for the specified definition.
*
* @param definition
* the column definition
* @return a string representation of nullable / non-null
*/
private static String generateNullableString(final Column definition) {
return definition.isNullable() ? "nullable" : "non-null... | 3.26 |
morf_HumanReadableStatementHelper_m2_rdh | /**
* Generates a human-readable description of a data truncate operation.
*
* @param table
* the table to be truncated to describe
* @return a string containing the human-readable description of the operation
*/ private static String m2(final TableReference table) {
return String.format("Delete all recor... | 3.26 |
morf_HumanReadableStatementHelper_generateFromAndWhereClause_rdh | /**
* Generates the from and where clause for a select statement. If there is no selection
* expression then the 'where' fragment will be omitted.
*
* @param statement
* the statement to describe.
* @param prefix
* whether to include the " from " prefix in the clause
* @return a string containing the human-... | 3.26 |
morf_HumanReadableStatementHelper_generateRemoveColumnString_rdh | /**
* Generates a human-readable "Remove Column" string.
*
* @param tableName
* the name of the table on which the column currently resides
* @param definition
* the definition of the column to remove
* @return a string containing the human-readable version of the action
*/
public static String generateRe... | 3.26 |
morf_HumanReadableStatementHelper_generateOrderByClause_rdh | /**
* Generates a string describing a record ordering clause. If there is no ordering clause
* then an empty string is returned.
*/
private static String generateOrderByClause(final List<AliasedField> fields) {
if ((fields == null) || fields.isEmpty()) {
return "";
} else {
return " ordered by " + generate... | 3.26 |
morf_HumanReadableStatementHelper_generateCriterionString_rdh | /**
* Generates a string describing a predicate. This gets used as part of generating a
* 'where' clause for record selection as well as the {@link CaseStatement} fields.
*
* <p>This has package visibility for testing.</p>
*
* @param criterion
* the criterion to describe.
* @return a string containing the hum... | 3.26 |
morf_HumanReadableStatementHelper_generateDeleteStatementString_rdh | /**
* Generates a human-readable description of a data delete operation.
*
* @param statement
* the data upgrade statement to describe.
* @return a string containing the human-readable description of the operation.
*/
private static String generateDeleteStatementString(final DeleteStatement statement) {
if ... | 3.26 |
morf_HumanReadableStatementHelper_paren_rdh | /**
* Wraps a string in parenthesis if the field is considered {@link #isComplexField}.
*
* @param string
* the string to process.
* @param field
* the field to evaluate.
* @return the original string, or one wrapped in parenthesis.
*/
private static String paren(final String string, final AliasedField fiel... | 3.26 |
morf_HumanReadableStatementHelper_generateAliasedFieldAssignmentString_rdh | /**
* Generates a string describing a field reference update.
*
* <p>Package visibility for testing.</p>
*
* @param field
* the field to describe.
* @return a string containing the human-readable description of the field update.
*/
static String generateAliasedFieldAssignmentString(final AliasedField field) {... | 3.26 |
morf_HumanReadableStatementHelper_generatePortableSqlStatementString_rdh | /**
* Generates a human-readable description of a raw SQL operation.
*
* @param statement
* the data upgrade statement to describe.
* @param preferredSQLDialect
* the SQL dialect to use, if available. If this is {@code null} or the preferred
* dialect is not available in the statement bundle then an arbitr... | 3.26 |
morf_HumanReadableStatementHelper_generateRemoveIndexString_rdh | /**
* Generates a human-readable "Remove Index" string.
*
* @param tableName
* the name of the table on which the index resides.
* @param index
* the definition of the index which will be removed
* @return a string containing the human-readable version of the action
*/
public static String generateRemoveInd... | 3.26 |
morf_HumanReadableStatementHelper_generateInsertStatementString_rdh | /**
* Generates a human-readable description of a data insert operation.
*
* @param statement
* the data upgrade statement to describe.
* @return a string containing the human-readable description of the operation.
*/
private static String generateInsertStatementString(final InsertStatement statement) {
fin... | 3.26 |
morf_HumanReadableStatementHelper_generateRenameIndexString_rdh | /**
* Generates a human-readable "Rename Index" string.
*
* @param tableName
* the name of the table to rename the index on
* @param fromIndexName
* the original index name
* @param toIndexName
* the replacement name for the index
* @return a string containing the human-readable version of the action
*/... | 3.26 |
morf_HumanReadableStatementHelper_generateDataUpgradeString_rdh | /**
* Generates a human-readable data upgrade description.
*
* @param statement
* the data upgrade statement to describe.
* @param preferredSQLDialect
* the dialect to use, by preference, when a human readable description is not available. If
* SQL is not available in this dialect, or none was specified, t... | 3.26 |
morf_HumanReadableStatementHelper_generateFieldSymbolStrings_rdh | /**
* Generates a string describing a collection of fields.
*
* @param fields
* the fields to describe.
* @return a string with a comma separated list of field names.
*/
private static String generateFieldSymbolStrings(final Collection<AliasedField> fields) {
final StringBuilder sb = new StringBuilder();
int c... | 3.26 |
morf_HumanReadableStatementHelper_generateSelectStatementString_rdh | /**
* Generates a string for a select, or sub-select, statement. The "select" prefixing keyword is optional;
* depending on the context it is being used the result may be more readable if it is omitted.
*
* @param statement
* the select statement to describe.
* @param prefix
* {@code true} to include a leadi... | 3.26 |
morf_HumanReadableStatementHelper_generateNewTableColumnString_rdh | /**
* Generates a human-readable column description string for columns of a new table.
*
* @param columnDefinition
* the definition of the column
* @return a string containing a human-readable description of the column
*/
private static String generateNewTableColumnString(final Column columnDefinition) {
re... | 3.26 |
morf_HumanReadableStatementHelper_generateChangePrimaryKeyColumnsString_rdh | /**
*
* @param tableName
* - the table name which needs its primary key columns changed
* @param newPrimaryKeyColumns
* - the list of table names to primary key columns will become
* @return a string containing the human-readable version of the action
*/
public static String
generateChangePrimaryKeyColumnsSt... | 3.26 |
morf_HumanReadableStatementHelper_generateRenameTableString_rdh | /**
*
* @param from
* - The table name to change from
* @param to
* - The table name to change to
* @return a string containing the human-readable version of the action
*/public static String generateRenameTableString(String from, String to) {
StringBuilder renameTableBuilder = new StringBuilder();
r... | 3.26 |
morf_HumanReadableStatementHelper_generateUniqueIndexString_rdh | /**
* Generates a unique / non-unique string for the specified index definition.
*
* @param definition
* the definition of the index
* @return a string representation of unique / non-unique
*/
private static String generateUniqueIndexString(final Index definition) {
return definition.isUnique() ? "unique" ... | 3.26 |
morf_HumanReadableStatementHelper_generateUpdateStatementString_rdh | /**
* Generates a human-readable description of a data update operation.
*
* @param statement
* the data upgrade statement to describe
* @return a string containing the human-readable description of the operation
*/
private static String generateUpdateStatementString(final UpdateStatement statement) {
final Str... | 3.26 |
morf_HumanReadableStatementHelper_generateRemoveTableString_rdh | /**
* Generates a human-readable "Remove Table" string.
*
* @param table
* the name of the table which will be removed
* @return a string containing the human-readable version of the action
*/public static String generateRemoveTableString(final Table table) {
return String.format("Remove table %s", table.ge... | 3.26 |
morf_HumanReadableStatementHelper_generateInCriterionString_rdh | /**
* Generates a string describing the IN binary operator. This may generate either a list of literal
* values, such as "x in ('1', '2')", or a sub-select statement. For the single-field sub-select form
* a more readable "x in Foo table" form is produced rather than "x in (select x from foo)".
*
* @param criterio... | 3.26 |
morf_HumanReadableStatementHelper_generateCriterionValueString_rdh | /**
* Generates a literal string from a value held in a {@link Criterion} object. The value might be a
* either a standard Java type, such as {@link String} or {@link Double}, or a {@link FieldLiteral}.
*
* @param value
* the value to produce a string for.
* @return the string.
*/
private static String generat... | 3.26 |
morf_HumanReadableStatementHelper_isComplexField_rdh | /**
* Tests if a field instance is sufficiently complicated to warrant putting brackets around it
* when it is used as a criterion operand.
*
* @param field
* the field to test.
* @return {@code true} if it should be placed in parenthesis.
*/
private static boolean isComplexField(final AliasedField field) {
if... | 3.26 |
morf_HumanReadableStatementHelper_generateWhereClause_rdh | /**
* Generates a string describing record selection criteria. If there are no selection
* criteria then an empty string is returned.
*
* @param criterion
* the criterion to describe.
* @return a string containing the human-readable description of the clause.
*/
private static String generateWhereClause(final
... | 3.26 |
morf_HumanReadableStatementHelper_m1_rdh | /**
* Generates a human-readable description of a data truncate operation.
*
* @param statement
* the data upgrade statement to describe.
* @return a string containing the human-readable description of the operation.
*/private static String m1(final TruncateStatement statement) {return m1(statement.getTable()... | 3.26 |
morf_HumanReadableStatementHelper_generateLiteral_rdh | /**
* Generates a string with a literal value. If the value is numeric then it is unquoted, otherwise it
* is surrounded by single quote characters.
*
* @param value
* the value to process.
* @return the string form, created by the value's {@link Object#toString} method with quotes if necessary.
*/
private sta... | 3.26 |
morf_HumanReadableStatementHelper_generateColumnDefaultValueClause_rdh | /**
* Generates a clause for any default column value.
*
* @param definition
* the column definition.
* @return a string containing a readable version of the default value
*/
private static String generateColumnDefaultValueClause(final Column definition) {
if (StringUtils.isEmpty(definition.getDefaultValue(... | 3.26 |
morf_HumanReadableStatementHelper_generateColumnCountString_rdh | /**
* Generates a string which represents the number of columns specified.
*
* @param columnCount
* the number of columns
* @return a string representation of the number of columns
*/ private static String generateColumnCountString(final int columnCount) {
if (columnCount == 0) {
return "no columns... | 3.26 |
morf_HumanReadableStatementHelper_generateChangeIndexString_rdh | /**
* Generates a human-readable "Change Index" string.
*
* @param tableName
* the name of the table to change the index on
* @param fromIndex
* the original index definition
* @param toIndex
* the replacement definition for the index
* @return a string containing the human-readable version of the action... | 3.26 |
morf_HumanReadableStatementHelper_generateAddColumnString_rdh | /**
* Generates a human-readable "Add Column" string for a column with no default value
* set at the database level but with a default initialiser for any existing records.
*
* @param tableName
* the table name to which the column is being added
* @param definition
* the definition of the new column
* @retu... | 3.26 |
morf_HumanReadableStatementHelper_generateBinaryOperatorString_rdh | /**
* Generates a string describing a binary criterion operator.
*
* @param criterion
* the item to describe.
* @param operator
* the string operator to separate the first and second parameter, not including spaces.
* @return the string.
*/
private static String generateBinaryOperatorString(final Criterion ... | 3.26 |
morf_HumanReadableStatementHelper_generateMergeStatementString_rdh | /**
* Generates a human-readable description of a data merge operation.
*
* @param statement
* the data upgrade statement to describe.
* @return a string containing the human-readable description of the operation.
*/
private static String generateMergeStatementString(final MergeStatement statement) {
final ... | 3.26 |
morf_HumanReadableStatementHelper_m0_rdh | /**
* Generates a human-readable "Add Table" string.
*
* @param definition
* the definition of the new table
* @return a string containing the human-readable version of the action
*/
public static String m0(final Table definition) {
StringBuilder addTableBuilder = new StringBuilder();
addTableBuilder.ap... | 3.26 |
morf_HumanReadableStatementHelper_generateColumnDefinitionString_rdh | /**
* Generates a column definition string of the format "TYPE(LENGTH,PRECISION)".
*
* @param definition
* the column definition
* @return the column definition as a string
*/
private static String generateColumnDefinitionString(final Column definition) {
if (definition.getType().hasScale()) {
retur... | 3.26 |
morf_HumanReadableStatementHelper_generateListCriterionString_rdh | /**
* Generates a string describing a criterion made up of a list of sub-criteria and a joining
* operator, for example the OR or AND operators.
*
* @param criterion
* the criterion with a list of sub-criteria to be composed.
* @param join
* the joining operator, including spaces, for example " or ".
* @par... | 3.26 |
morf_HumanReadableStatementHelper_generateFieldSymbolString_rdh | /**
* Generates a string describing a field. This is a symbolic name, if available, otherwise any literal values.
*
* @param field
* the field to describe.
* @return a string containing the name of the field.
*/
private static String generateFieldSymbolString(final AliasedField field) {
if (StringUtils.isEmpty(... | 3.26 |
morf_HumanReadableStatementHelper_generateAddIndexString_rdh | /**
* Generates a human-readable "Add Index" string.
*
* @param tableName
* the name of the table to add the index to
* @param index
* the definition of the index to add
* @return a string containing the human-readable version of the action
*/
public static String gen... | 3.26 |
morf_HumanReadableStatementHelper_generateChangeColumnString_rdh | /**
* Generates a human-readable "Change Column" string.
*
* @param tableName
* the name of the table on which the column currently exists
* @param fromDefinition
* the original definition of the column
* @param toDefinition
* the replacement definition of the column
* @return a string containing the hum... | 3.26 |
morf_HumanReadableStatementHelper_generateAnalyseTableFromString_rdh | /**
* Generates human-readable "Analyse Table" string.
*
* @param tableName
* The table to analyse.
*/
public static String generateAnalyseTableFromString(String tableName) {
return String.format("Analyse table %s", tableName);} | 3.26 |
morf_DatabaseMetaDataProviderUtils_shouldIgnoreIndex_rdh | /**
* Indexes which contain the suffix _PRF and a digit are to be ignored:
* this allows performance testing of new index to verify their effect,
* without breaking the schema checking.
*
* eg. Schedule_PRF1
*
* @param indexName
* The name of an index
* @return Whether it should be ignored
*/
public static ... | 3.26 |
morf_DatabaseMetaDataProviderUtils_getAutoIncrementStartValue_rdh | /**
* Get the auto increment start value (if available) from the column comments
*
* @param columnComment
* The column comment
* @return the auto increment start value
*/
public static int getAutoIncrementStartValue(String columnComment) {
if (StringUtils.isNotEmpty(columnComment)) {
Matcher matche... | 3.26 |
morf_FilteredDataSetProducerAdapter_tableNames_rdh | /**
* If multiple calls to this are expected, consider caching the list of table names.
*
* @see org.alfasoftware.morf.dataset.SchemaAdapter#tableNames()
*/
@Override
public Collection<String> tableNames() {
return Collections2.filter(delegate.tableNames(), includingPredicate);} | 3.26 |
morf_FilteredDataSetProducerAdapter_getSchema_rdh | /**
* Produce a {@link Schema} that represents the filtered view.
*
* @see org.alfasoftware.morf.dataset.DataSetProducer#getSchema()
*/
@Override
public Schema getSchema() { return new SchemaAdapter(delegate.getSchema()) {
@Override
public Table getTable(String name) {
if (includeTable(... | 3.26 |
morf_FilteredDataSetProducerAdapter_tables_rdh | /**
* If multiple calls to this are expected, consider caching the list of tables.
*
* @see org.alfasoftware.morf.dataset.SchemaAdapter#tableNames()
*/
@Override
public Collection<Table> tables() {
return Collections2.filter(delegate.tables(), t -> includingPredicate.apply(t.getName()));
} | 3.26 |
morf_DataValueLookupMetadata_getChildren_rdh | /**
* Given the following record arrangements:
*
* [A]
* [A, B]
* [A, B, C]
* [A, D, E]
* [A, D, F]
*
* We arrange our metadata in a tree:
*
* [A]
* - [+ B]
* - [+ C]
* - [+ D]
* - [+ E]
* - [+ F]
*
* This method returns the children of this record arrangement in that tree.
* It... | 3.26 |
morf_DataValueLookupMetadata_readResolve_rdh | /**
* When deserializing, resolve via the static factory. This prevents us getting duplicate
* instances.
*
* @return The interned instance.
*/
private Object readResolve() {
return DataValueLookupMetadataRegistry.deduplicate(this);
} | 3.26 |
morf_DataValueLookupMetadata_equals_rdh | /**
*
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
return this == obj;// Fully interned
} | 3.26 |
morf_DataValueLookupMetadata_hashCode_rdh | /**
*
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
int h = hash;
if (h != 0) {
return h;
}
final int v4 = 31;
h = 1;
h = (v4 * h) + (keys == null ? 0 : keys.hashCode());
hash = h;
return h;
} | 3.26 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.