name stringlengths 12 178 | code_snippet stringlengths 8 36.5k | score float64 3.26 3.68 |
|---|---|---|
morf_DatabaseSchemaManager_dropAllViews_rdh | /**
* Drop all views.
*/
public void dropAllViews() {
ProducerCache producerCache = new ProducerCache();
log.debug("Dropping all views");
try {
Schema databaseSchema = producerCache.get().getSchema();ImmutableList<View> v24 = ImmutableList.copyOf(databaseSchema.views());
List<String> script = Lists.newArrayList();
f... | 3.26 |
morf_TestingDataSourceModule_provideDataSource_rdh | /**
* Provide the same {@link DataSource} for every subsequent call in static scope.
* Avoids excessive synchronisation where possible.
*/ @Provides
DataSource provideDataSource(ConnectionResources connectionResources) {
if (dataSource != null)
return dataSource;
synchronized(TestingDataSourceModul... | 3.26 |
morf_RecordComparator_compare_rdh | /**
*
* @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public int compare(Record o1, Record o2) {
for (Column column : columnSortOrder) {
Comparable value1 = RecordHelper.convertToComparableType(column, o1);
Compar... | 3.26 |
morf_GraphBasedUpgradeScriptGenerator_generatePreUpgradeStatements_rdh | /**
*
* @return pre-upgrade statements to be executed before the Graph Based Upgrade
*/
public List<String> generatePreUpgradeStatements() {
ImmutableList.Builder<String> statements = ImmutableList.builder();
// Initialisation SQL (zzzUpgradeStatus table & optimistic locking to prevent duplicate execution o... | 3.26 |
morf_GraphBasedUpgradeScriptGenerator_create_rdh | /**
* Creates {@link GraphBasedUpgradeScriptGenerator}.
*
* @param sourceSchema
* schema prior to upgrade step
* @param targetSchema
* target schema to upgrade to
* @param connectionResources
* connection resources with a dialect to generate statements for the target database
* @param idTable
* table ... | 3.26 |
morf_GraphBasedUpgradeScriptGenerator_generatePostUpgradeStatements_rdh | /**
*
* @return post-upgrade statements to be executed after the Graph Based Upgrade
*/
public List<String> generatePostUpgradeStatements() {
ImmutableList.Builder<String> statements = ImmutableList.builder();
// temp table drop
statements.addAll(connectionResources.sqlDialect().truncateTableStatements(i... | 3.26 |
morf_DataSetAdapter_open_rdh | /**
*
* @see org.alfasoftware.morf.dataset.DataSetConsumer#open()
*/
@Override
public void open() {
consumer.open();
} | 3.26 |
morf_DataSetAdapter_table_rdh | /**
*
* @see org.alfasoftware.morf.dataset.DataSetConsumer#table(org.alfasoftware.morf.metadata.Table, java.lang.Iterable)
*/
@Override
public void
table(Table table, Iterable<Record> records) {
consumer.table(table, records);
} | 3.26 |
morf_DataSetAdapter_close_rdh | /**
*
* @see org.alfasoftware.morf.dataset.DataSetConsumer#close(org.alfasoftware.morf.dataset.DataSetConsumer.CloseState)
*/
@Override
public void close(CloseState closeState) {
consumer.close(closeState);
} | 3.26 |
morf_AbstractSetOperator_validateNotNull_rdh | /**
* Don't allow {@code null} references to {@linkplain SelectStatement}.
*
* @param parentSelect
* the select statement to be validated.
* @param childSelect
* the select statement to be validated.
*/
void validateNotNull(SelectStatement parentSelect, SelectStatement childSelect) throws IllegalArgumentExce... | 3.26 |
morf_AbstractSetOperator_validateFields_rdh | /**
* Don't allow {@code childSelect} have a different number of fields from
* {@code parentSelect}.
* <p>
* The column names from the parent select statement are used as the column
* names for the results returned. Selected columns listed in corresponding
* positions of each SELECT statement should have the same... | 3.26 |
morf_Escaping_unescapeCharacters_rdh | /**
* Un- escape strings from XML format back to internal format:
* \0 -> 0
* \\ -> \
*/
static String unescapeCharacters(String attributeValue) {
if (attributeValue == null)
return null;
char[] attributeChars = attributeValue.toCharArray();
StringBuild... | 3.26 |
morf_Escaping_escapeCharacters_rdh | /**
* Escape for writing to XML, from the internal format.
*/
static String escapeCharacters(String recordValue) {
// Escape any null characters - these aren't valid XML so in format version 3 we escape these as \0
// We also, consequently, have to escape backslashes as \\
// can't use String::replace as it doesn't... | 3.26 |
morf_Escaping_isCharValidForXml_rdh | /**
* https://www.w3.org/TR/xml/#NT-Char
*/
static boolean isCharValidForXml(int c) {
return (((((c >= 0x20) && (c <= 0xd7ff)) || ((c >= 0xe000) && (c <= 0xfffd))) || (c == 0x9)) || (c == 0xd)) || (c == 0xa);
} | 3.26 |
morf_BaseDataSetReader_addTableName_rdh | /**
* Add a table, along with its local filename
*
* @param tableName
* The table name, in it's correct case
* @param fileName
* The file name that holds it
*/
protected void addTableName(String tableName, String fileName) {
tableNameToFileNameMap.put(tableName.toUpperCase(), fileName);
tableNames.ad... | 3.26 |
morf_BaseDataSetReader_close_rdh | /**
*
* @see org.alfasoftware.morf.xml.XmlStreamProvider#close()
*/
@Override
public void close() {
// no-op
} | 3.26 |
morf_BaseDataSetReader_open_rdh | /**
*
* @see org.alfasoftware.morf.xml.XmlStreamProvider#open()
*/
@Override
public void open() {
// no-op
} | 3.26 |
morf_BaseDataSetReader_tableExists_rdh | /**
*
* @see org.alfasoftware.morf.xml.XmlStreamProvider.XmlInputStreamProvider#tableExists(java.lang.String)
*/
@Override
public final boolean tableExists(String name) {
return tableNameToFileNameMap.containsKey(name.toUpperCase());
} | 3.26 |
morf_BaseDataSetReader_fileNameForTable_rdh | /**
* Return the file name for a given table name.
*
* @param tableName
* The table name
* @return The file name
*/
protected final String fileNameForTable(String tableName) {
String
filename = tableNameToFileNameMap.get(tableName.toUpperCase());
if (filename == null)
throw new IllegalArgume... | 3.26 |
morf_BaseDataSetReader_availableStreamNames_rdh | /**
*
* @see org.alfasoftware.morf.xml.XmlStreamProvider.XmlInputStreamProvider#availableStreamNames()
*/
@Overridepublic Collection<String> availableStreamNames() {
return Lists.newArrayList(tableNames);// return a copy, as we are about to clear the list
} | 3.26 |
morf_DefaultAdditionalSchemaDataImpl_columnDocumentation_rdh | /**
*
* @see org.alfasoftware.morf.excel.AdditionalSchemaData#columnDocumentation(Table, java.lang.String)
*/
@Override
public String columnDocumentation(Table table, String columnName) {
return StringUtils.EMPTY;
} | 3.26 |
morf_UpgradeStatusTableServiceImpl_create_rdh | /**
*
* @see UpgradeStatusTableService.Factory#create(ConnectionResources)
*/
public UpgradeStatusTableService create(final ConnectionResources connectionResources) {
return new UpgradeStatusTableServiceImpl(connectionResources);
} | 3.26 |
morf_UpgradeStatusTableServiceImpl_getStatus_rdh | /**
*
* @see org.alfasoftware.morf.upgrade.UpgradeStatusTableService#getStatus(Optional)
*/
@Override
public UpgradeStatus getStatus(Optional<DataSource> dataSource) {
SelectStatement select = SqlUtils.select(SqlUtils.field(STATUS_COLUMN)).from(tableRef(UpgradeStatusTableService.UPGR... | 3.26 |
morf_UpgradeStatusTableServiceImpl_resultSetProcessor_rdh | /**
* Returns a {@link ResultSetProcessor} which converts the first value in the current row of a {@link ResultSet}
* to an {@link UpgradeStatus}.
*/
private ResultSetProcessor<UpgradeStatus> resultSetProcessor() {
return new ResultSetProcessor<UpgradeStatus>() {
@Override
public UpgradeStatus p... | 3.26 |
morf_UpgradeStatusTableServiceImpl_writeStatusFromStatus_rdh | /**
*
* @see org.alfasoftware.morf.upgrade.UpgradeStatusTableService#writeStatusFromStatus(org.alfasoftware.morf.upgrade.UpgradeStatus, org.alfasoftware.morf.upgrade.UpgradeStatus)
*/
@Overridepublic int writeStatusFromStatus(UpgradeStatus fromStatus, UpgradeStatus toStatus) {
List<String> script = updateTableS... | 3.26 |
morf_UpgradeStatusTableServiceImpl_tidyUp_rdh | /**
*
* @see org.alfasoftware.morf.upgrade.UpgradeStatusTableService#tidyUp(javax.sql.DataSource)
*/@Override
public void tidyUp(DataSource dataSource) {
try {
new SqlScriptExecutorProvider(dataSource,
sqlDialect).get().execute(sqlDialect.dropSt... | 3.26 |
morf_MathsField_getRightField_rdh | /**
*
* @return the rightField
*/public AliasedField getRightField() {
return rightField;
} | 3.26 |
morf_MathsField_multiply_rdh | /**
* Provides the multiply operation for SQL.
*
* @param leftField
* left multiplier
* @param rightField
* right multiplier
* @return The function representing the product
*/
public static MathsField multiply(AliasedField leftField, AliasedField rightField) {
AliasedField rightOperand = (rightField ... | 3.26 |
morf_MathsField_getLeftField_rdh | /**
*
* @return the leftField
*/
public AliasedField getLeftField() {
return leftField;} | 3.26 |
morf_MathsField_getOperator_rdh | /**
*
* @return the operator
*/
public MathsOperator getOperator() {
return operator;
} | 3.26 |
morf_MathsField_plus_rdh | /**
* Provides the plus operation for SQL.
*
* @param leftField
* left addendum
* @param rightField
* right addendum
* @return The function representing the sum
*/
public static MathsField
plus(AliasedField leftField, AliasedField rightField) {
AliasedField rightOperand = (rightField instanceof MathsFie... | 3.26 |
morf_MathsField_drive_rdh | /**
*
* @see org.alfasoftware.morf.util.ObjectTreeTraverser.Driver#drive(ObjectTreeTraverser)
*/
@Override
public void drive(ObjectTreeTraverser traverser) {
traverser.dispatch(getLeftField()).dispatch(getRightField());
} | 3.26 |
morf_MathsField_deepCopyInternal_rdh | /**
*
* @see org.alfasoftware.morf.sql.element.AliasedField#deepCopyInternal(DeepCopyTransformation)
*/
@Override
protected AliasedField deepCopyInternal(DeepCopyTransformation transformer) {
return new MathsField(this.getAlias(), transformer.deepCopy(leftField),
operator, transformer.deepCopy(rightField))... | 3.26 |
morf_ViewBean_knowsSelectStatement_rdh | /**
*
* @see org.alfasoftware.morf.metadata.View#knowsSelectStatement()
*/
@Override
public boolean knowsSelectStatement() {
return knowsSelectStatement;
} | 3.26 |
morf_ViewBean_m0_rdh | /**
*
* @see org.alfasoftware.morf.metadata.View#knowsSelectStatement()
*/
@Override
public boolean m0() {
return knowsDependencies;
} | 3.26 |
morf_ViewBean_getDependencies_rdh | /**
*
* @see org.alfasoftware.morf.metadata.View#getDependencies()
*/
@Override
public String[] getDependencies() {
return Arrays.copyOf(dependencies, dependencies.length);
} | 3.26 |
morf_ViewBean_getSelectStatement_rdh | /**
*
* @see org.alfasoftware.morf.metadata.View#getSelectStatement()
*/@Override
public SelectStatement getSelectStatement() {
if (!knowsSelectStatement)
throw new UnsupportedOperationException(("Unable to return select statement for view [" + name) + "]");
return selectStatement;
} | 3.26 |
morf_NamedParameterPreparedStatement_createForQueryOn_rdh | /**
* Create the prepared statement against the specified connection. The prepared statement
* can only be used to run queries (not updates/inserts etc) and is strictly read only
* and forward only. For use in bulk data loads.
*
* @param connection
* the connection
* @return the prepared statement.
* @throw... | 3.26 |
morf_NamedParameterPreparedStatement_setBoolean_rdh | /**
* Sets the value of a named boolean parameter.
*
* @param parameter
* the parameter metadata.
* @param value
* the parameter value.
* @return this, for method chaining
* @exception SQLException
* if an error occurs when setting the parameter
*/public NamedParameterPreparedStatement setBoolean(SqlPar... | 3.26 |
morf_NamedParameterPreparedStatement_toString_rdh | /**
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return (sql + " ") + indexMap;
} | 3.26 |
morf_NamedParameterPreparedStatement_close_rdh | /**
*
* @see PreparedStatement#close()
* @exception SQLException
* if a database access error occurs
*/
@Override
public void close() throws SQLException {
statement.close();
} | 3.26 |
morf_NamedParameterPreparedStatement_setString_rdh | /**
* Sets the value of a named string parameter.
*
* @param parameter
* the parameter metadata.
* @param value
* the parameter value.
* @return this, for method chaining
* @exception SQLException
* if an error occurs when setting the parameter
*/
public NamedParameterPreparedStatement setString(SqlPara... | 3.26 |
morf_NamedParameterPreparedStatement_setQueryTimeout_rdh | /**
* Sets the timeout in <b>seconds</b> after which the query will time out on
* database side. In such case JDBC driver will throw an exception which is
* specific to database implementation but is likely to extend
* {@link SQLTimeoutException}.
*
* @param queryTimeout
* timeout in <b>seconds</b>
* @excepti... | 3.26 |
morf_NamedParameterPreparedStatement_parse_rdh | /**
* Parses a SQL query with named parameters. The parameter-index mappings are extracted
* and stored in a map, and the parsed query with parameter placeholders is returned.
*
* @param query
* The SQL query to parse, which may contain named parameters.
* @return The parsed SQL query with named parameters repl... | 3.26 |
morf_NamedParameterPreparedStatement_addBatch_rdh | /**
*
* @see PreparedStatement#addBatch()
* @exception SQLException
* if a database access error occurs,
* this method is called on a closed <code>Statement</code> or the
* driver does not support batch statements.
* @throws SQLTimeoutException
* when the driver has determined that the
* timeout valu... | 3.26 |
morf_NamedParameterPreparedStatement_forEachOccurrenceOfParameter_rdh | /**
* Allows arbitrary code to be executed for each index position at which the named parameter can be found.
*/private void forEachOccurrenceOfParameter(SqlParameter parameter, Operation operation) throws SQLException {
List<Integer> indexes
= indexMap.get(parameter.getImpliedName());
if (indexes == nul... | 3.26 |
morf_NamedParameterPreparedStatement_clearBatch_rdh | /**
*
* @see PreparedStatement#clearBatch()
* @exception SQLException
* if a database access error occurs,
* this method is called on a closed <code>Statement</code> or the
* driver does not support batch updates
*/
public void clearBatch() throws SQLException {
statement.clearBatch();
} | 3.26 |
morf_NamedParameterPreparedStatement_setBinaryStream_rdh | /**
* Sets the value of a named binary stream parameter.
*
* @param parameter
* the parameter metadata.
* @param value
* the parameter value.
* @return this, for method chaining
* @exception SQLException
* if an error occurs when setting the parameter
*/
public NamedParameterPreparedStatement setBinaryS... | 3.26 |
morf_NamedParameterPreparedStatement_setMaxRows_rdh | /**
* Sets the limit for the maximum number of rows that any
* <code>ResultSet</code> object generated by this <code>Statement</code>
* object can contain to the given number.
* If the limit is exceeded, the excess
* rows are silently dropped.
*
* @param maxRows
* the new max rows limit; zero means there is ... | 3.26 |
morf_NamedParameterPreparedStatement_parseSql_rdh | /**
* Parses the SQL string containing named parameters in such a form that
* can be cached, so that prepared statements using the parsed result
* can be created rapidly.
*
* @param sql
* the SQL
* @param sqlDialect
* Dialect of the SQL.
* @return the parsed result
*/
public static ParseResult parseSql(S... | 3.26 |
morf_NamedParameterPreparedStatement_setLong_rdh | /**
* Sets the value of a named long parameter.
*
* @param parameter
* the parameter metadata.
* @param value
* the parameter value.
* @return this, for method chaining
* @exception SQLException
* if an error occurs when setting the parameter
*/
public NamedParameterPreparedStatement setLong(SqlParamete... | 3.26 |
morf_NamedParameterPreparedStatement_setFetchSize_rdh | /**
*
* @param rows
* the number of rows to fetch
* @see PreparedStatement#setFetchSize(int)
* @exception SQLException
* if a database access error occurs,
* this method is called on a closed <code>Statement</code> or the
* condition {@code rows >= 0} is not satisfied.
*/
public void setFetchSize(int r... | 3.26 |
morf_NamedParameterPreparedStatement_setBlob_rdh | /**
* Sets the value of a named blob parameter.
*
* @param parameter
* the parameter metadata.
* @param value
* the parameter value.
* @return this, for method chaining
* @exception SQLException
* if an error occurs when setting the parameter
*/
public NamedParameterPreparedStatement setBlob(SqlParamete... | 3.26 |
morf_NamedParameterPreparedStatement_setBigDecimal_rdh | /**
* Sets the value of a named big decimal parameter.
*
* @param parameter
* the parameter metadata.
* @param value
* the parameter value.
* @return this, for method chaining
* @exception SQLException
* if an error occurs when setting the parameter
*/
public NamedParameterPreparedStatement setBigDecima... | 3.26 |
morf_NamedParameterPreparedStatement_setDate_rdh | /**
* Sets the value of a named date parameter.
*
* @param parameter
* the parameter metadata.
* @param value
* the parameter value.
* @return this, for method chaining
* @exception SQLException
* if an error occurs when setting the parameter
*/
public NamedParameterPreparedStatement setDate(SqlParamete... | 3.26 |
morf_NamedParameterPreparedStatement_getParsedSql_rdh | /**
* For testing only.
*
* @return the parsed SQL.
*/
public String getParsedSql() {
return query;
} | 3.26 |
morf_NamedParameterPreparedStatement_createFor_rdh | /**
* Create the prepared statement against the specified connection.
*
* @param connection
* the connection
* @return the prepared statement.
* @throws SQLException
* if the statement could not be created
*/
public NamedParameterPreparedStatement createFor(Connection connection) throws SQLException {
r... | 3.26 |
morf_NamedParameterPreparedStatement_setObject_rdh | /**
* Sets the value of a named object parameter.
*
* @param parameter
* the parameter metadata.
* @param value
* the parameter value.
* @return this, for method chaining
* @exception SQLException
* if an error occurs when setting the parameter
*/
public NamedParameterPreparedStatement setObject(SqlPara... | 3.26 |
morf_NamedParameterPreparedStatement_setInt_rdh | /**
* Sets the value of a named integer parameter.
*
* @param parameter
* the parameter metadata.
* @param value
* the parameter value.
* @return this, for method chaining
* @exception SQLException
* if an error occurs when setting the parameter
*/
public NamedParameterPreparedStatement setInt(SqlParame... | 3.26 |
morf_OracleDialect_getDatabaseType_rdh | /**
*
* @see org.alfasoftware.morf.jdbc.SqlDialect#getDatabaseType()
*/
@Override
public DatabaseType getDatabaseType() {
return DatabaseType.Registry.findByIdentifier(Oracle.IDENTIFIER);
} | 3.26 |
morf_OracleDialect_dropPrimaryKeyConstraint_rdh | /**
* ALTER TABLE ABC.DEF DROP PRIMARY KEY DROP INDEX
*/
private String dropPrimaryKeyConstraint(String tableName) {
// Drop the associated unique index at the same time
return (("ALTER TABLE " + schemaNamePrefix()) + tableName) + " DROP PRIMARY KEY DROP INDEX";
} | 3.26 |
morf_OracleDialect_createTrigger_rdh | /**
* Returns a list of SQL statement to create a trigger to populate a table's autonumber column
* from a sequence.
*
* @param table
* Table for which the trigger should be created.
* @param onColumn
* The autonumber column.
* @return SQL string list.
*/
private List<String> createTrigger(Table table, Co... | 3.26 |
morf_OracleDialect_indexDropStatements_rdh | /**
*
* @see org.alfasoftware.morf.jdbc.SqlDialect#indexDropStatements(org.alfasoftware.morf.metadata.Table, org.alfasoftware.morf.metadata.Index)
*/
@Override
public Collection<String> indexDropStatements(Table table, Index indexToBeRemoved) {
StringBuilder statement = new StringBuilder();
statement.appen... | 3.26 |
morf_OracleDialect_truncatedTableName_rdh | /**
* Truncate table names to 30 characters since this is the maximum supported by Oracle.
*/
private String truncatedTableName(String tableName) {
return StringUtils.substring(tableName, 0, 30);
} | 3.26 |
morf_OracleDialect_addIndexStatements_rdh | /**
*
* @see org.alfasoftware.morf.jdbc.SqlDialect#addIndexStatements(org.alfasoftware.morf.metadata.Table, org.alfasoftware.morf.metadata.Index)
*/
@Override
public Collection<String> addIndexStatements(Table table, Index index) {
return // when adding indexes to existing tables, use PARALLEL NOLOGGING to effi... | 3.26 |
morf_OracleDialect_getSqlForAnalyseTable_rdh | /**
*
* @see org.alfasoftware.morf.jdbc.SqlDialect#getSqlForAnalyseTable(Table)
*/
@Override
public Collection<String> getSqlForAnalyseTable(Table table) {
return ImmutableList.of(((((((("BEGIN \n" + "DBMS_STATS.GATHER_TABLE_STATS(ownname=> '") + getSchemaName()) + "', ") + "tabname=>'") + table.getName()) + "',... | 3.26 |
morf_OracleDialect_getSqlFrom_rdh | /**
*
* @see org.alfasoftware.morf.jdbc.SqlDialect#getSqlFrom(org.alfasoftware.morf.sql.ExceptSetOperator)
*/
@Override
protected String getSqlFrom(ExceptSetOperator operator) {
return // MINUS has been supported by Oracle for a long time and the EXCEPT support was added in 21c
String.format(" MINUS %s", ge... | 3.26 |
morf_OracleDialect_createSequenceStartingFromExistingData_rdh | /**
* Returns a SQL statement to create a sequence for a table's autonumber column, where
* the sequence should start from the greater of either the autonumber column's start value
* or the maximum value for that column existing in the table.
*
* @param table
* Table for which the sequence should be created.
*... | 3.26 |
morf_OracleDialect_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("(%s) - (%s)", getSqlFro... | 3.26 |
morf_OracleDialect_dropSequence_rdh | /**
* Returns a SQL statement to safely drop a sequence, if it exists.
*
* @param table
* Table for which the sequence should be dropped.
* @return SQL string.
*/
private String dropSequence(Table table) {
String sequenceName = sequenceName(table.getName());
return new StringBuilder("DECLARE \n").append... | 3.26 |
morf_OracleDialect_internalTableDeploymentStatements_rdh | /**
*
* @see org.alfasoftware.morf.jdbc.SqlDialect#tableDeploymentStatements(org.alfasoftware.morf.metadata.Table)
*/
@Override
public Collection<String> internalTableDeploymentStatements(Table table) {return tableDeploymentStatements(table, false);
} | 3.26 |
morf_OracleDialect_commentOnTable_rdh | /**
* Adds the table name into comments.
*/
private String commentOnTable(String truncatedTableName) {
return
(((((("COMMENT ON TABLE " + schemaNamePrefix()) + truncatedTableName) + " IS '") + REAL_NAME_COMMENT_LABEL)
+ ":[") + truncatedTableName)
+ "]'";
} | 3.26 |
morf_OracleDialect_indexPostDeploymentStatements_rdh | /**
* Generate the SQL to alter the index back to NOPARALLEL LOGGING.
*
* @param index
* The index we want to alter.
* @return The SQL to alter the index.
*/
private String indexPostDeploymentStatements(Index index) {
return new StringBuilder().append("ALTER INDEX ").append(schemaNamePrefix()).append(index.... | 3.26 |
morf_OracleDialect_rebuildTriggers_rdh | /**
*
* @see org.alfasoftware.morf.jdbc.SqlDialect#rebuildTriggers(org.alfasoftware.morf.metadata.Table)
*/
@Override
public Collection<String> rebuildTriggers(Table table) {
return rebuildSequenceAndTrigger(table, getAutoIncrementColumnForTable(table));
}
/**
*
* @deprecated this method returns the legacy fe... | 3.26 |
morf_OracleDialect_postInsertWithPresetAutonumStatements_rdh | /**
*
* @see org.alfasoftware.morf.jdbc.SqlDialect#postInsertWithPresetAutonumStatements(org.alfasoftware.morf.metadata.Table, SqlScriptExecutor, Connection, boolean)
*/
@Override
public void postInsertWithPresetAutonumStatements(Table table, SqlScriptExecutor executor, Connection connection, boolean insertingUnderA... | 3.26 |
morf_OracleDialect_truncatedTableNameWithSuffix_rdh | /**
* Truncate table names to 27 characters, then add a 3 character suffix since 30 is the maximum supported by Oracle.
*/
private String truncatedTableNameWithSuffix(String tableName, String suffix) {
return StringUtils.substring(tableName, 0, 27) + StringUtils.substring(suffi... | 3.26 |
morf_OracleDialect_m2_rdh | /**
*
* @see org.alfasoftware.morf.jdbc.SqlDialect#getSqlFrom(org.alfasoftware.morf.sql.SelectFirstStatement)
*/
@Override
protected String m2(SelectFirstStatement stmt) {
StringBuilder result = new StringBuilder("SELECT MIN(");
// Start by adding the field
result.append(getSqlFrom(stmt.getFields().get(0... | 3.26 |
morf_OracleDialect_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> result =
new ArrayList<>();
String ... | 3.26 |
morf_OracleDialect_splitSqlStatement_rdh | /**
* If the SQL statement line is greater than 2499 characters then split
* it into multiple lines where each line is less than 2500 characters in
* length. The split is done on a space character; if a space character
* cannot be found then a warning will be logged but the statement line
* will still be returned ... | 3.26 |
morf_OracleDialect_truncateTableStatements_rdh | /**
*
* @see org.alfasoftware.morf.jdbc.SqlDialect#truncateTableStatements(org.alfasoftware.morf.metadata.Table)
*/
@Override
public Collection<String> truncateTableStatements(Table table) {
String mainTruncate = ("TRUNCATE TABLE " + schemaNamePrefix()) + table.getName();if (table.is... | 3.26 |
morf_OracleDialect_getSqlForRandomString_rdh | /**
*
* @see org.alfasoftware.morf.jdbc.SqlDialect#getSqlForRandomString(org.alfasoftware.morf.sql.element.Function)
*/
@Override
protected String
getSqlForRandomString(Function function) {
return String.format("dbms_random.string('A', %s)", getSqlFrom(function.getArguments().get(0)));
} | 3.26 |
morf_OracleDialect_getSqlForLastDayOfMonth_rdh | /**
*
* @see org.alfasoftware.morf.jdbc.SqlDialect#getSqlForLastDayOfMonth
*/
@Override
protected String getSqlForLastDayOfMonth(AliasedField date) {
return ("LAST_DAY(" + getSqlFrom(date)) + ")";
} | 3.26 |
morf_OracleDialect_dropTrigger_rdh | /**
* Create statements to safely drop a trigger, if it exists.
*
* @param table
* Table for which the trigger should be dropped.
* @return Query string.
*/
private String dropTrigger(Table table) {
String triggerName = schemaNamePrefix() + triggerName(table.getName());
return new StringBuil... | 3.26 |
morf_OracleDialect_getSqlForNow_rdh | /**
*
* @see org.alfasoftware.morf.jdbc.SqlDialect#getSqlForNow(org.alfasoftware.morf.sql.element.Function)
*/
@Override
protected String getSqlForNow(Function function) {
return "SYSTIMESTAMP AT TIME ZONE 'UTC'";
} | 3.26 |
morf_OracleDialect_buildSQLToStopTracing_rdh | /**
*
* @see org.alfasoftware.morf.jdbc.SqlDialect#buildSQLToStopTracing()
*/
@Override
public List<String> buildSQLToStopTracing() {return Arrays.asList("ALTER SESSION SET EVENTS '10046 TRACE NAME CONTEXT OFF'");
} | 3.26 |
morf_OracleDialect_createNewSequence_rdh | /**
* Returns a SQL statement to create a sequence for a table's autonumber column
*
* @param table
* Table for which the sequence should be created.
* @param onColumn
* The autonumber column.
* @return SQL string.
*/
private String createNewSequence(Table table, Column onColumn) {int autoNumberStart = (onC... | 3.26 |
morf_OracleDialect_getSqlForDateToYyyymmdd_rdh | /**
*
* @see org.alfasoftware.morf.jdbc.SqlDialect#getSqlForDateToYyyymmdd(org.alfasoftware.morf.sql.element.Function)
*/
@Override
protected String getSqlForDateToYyyymmdd(Function function) {
return String.format("TO_NUMBER(TO_CHAR(%s, 'yyyymmdd'))", getSqlFrom(function.getArguments().get(0)));
} | 3.26 |
morf_OracleDialect_triggerName_rdh | /**
* Form the standard name for a table's autonumber trigger.
*
* @param tableName
* Name of the table for which the trigger name is required.
* @return Name of trigger.
*/
private String triggerName(String tableName) {
return truncatedTableNameWithSuffix(tableName, "_TG").toUpperCase();
} | 3.26 |
morf_OracleDialect_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
... | 3.26 |
morf_OracleDialect_sequenceName_rdh | /**
* Form the standard name for a table's autonumber sequence.
*
* @param tableName
* Name of the table for which the sequence name is required.
* @return Name of sequence.
*/
private String sequenceName(String tableName) {
return truncatedTableNameWithSuffix(tableName, "_SQ").toUpperCase();
} | 3.26 |
morf_OracleDialect_usesNVARCHARforStrings_rdh | /**
* We do use NVARCHAR for strings on Oracle.
*
* @see org.alfasoftware.morf.jdbc.SqlDialect#usesNVARCHARforStrings()
*/
@Override
public boolean usesNVARCHARforStrings() {
return true;
} | 3.26 |
morf_OracleDialect_addTableFromStatements_rdh | /**
*
* @see org.alfasoftware.morf.jdbc.SqlDialect#addTableFromStatements(org.alfasoftware.morf.metadata.Table, org.alfasoftware.morf.sql.SelectStatement)
*/
@Override
public Collection<String> addTableFromStatements(Table table, SelectStatement selectStatement) {
return internalAddTableFromStatements(table, se... | 3.26 |
morf_OracleDialect_getSqlForIsNull_rdh | /**
*
* @see org.alfasoftware.morf.jdbc.SqlDialect#getSqlForIsNull(org.alfasoftware.morf.sql.element.Function)
*/
@Override
protected String getSqlForIsNull(Function function) {
return ((("nvl(" +
getSqlFrom(function.getArguments().get(0))) + ", ") + getSqlFrom(function.getArguments().get(1))) + ") ";
} | 3.26 |
morf_OracleDialect_makeColumnNotNull_rdh | /**
* It returns the SQL statement to make the column not null. The function
* catches the exception with SQL error code ORA-01442: column to be modified
* to NOT NULL is already NOT NULL.
*
* <p>Example of the generated SQL statement:</p>
* <pre>
* DECLARE
* e EXCEPTION;
* pragma exception_init(e,-1442);
... | 3.26 |
morf_OracleDialect_tableNameWithSchemaName_rdh | /**
*
* @see org.alfasoftware.morf.jdbc.SqlDialect#tableNameWithSchemaName(org.alfasoftware.morf.sql.element.TableReference)
*/
@Override
protected String tableNameWithSchemaName(TableReference tableRef) {
if (StringUtils.isEmpty(tableRef.getDblink())) {
return super.tableNameWithSchemaName(tableRef);
... | 3.26 |
morf_OracleDialect_getSqlForAddMonths_rdh | /**
*
* @see org.alfasoftware.morf.jdbc.SqlDialect#getSqlForAddMonths(org.alfasoftware.morf.sql.element.Function)
*/
@Override
protected String getSqlForAddMonths(Function function) {
return ((("ADD_MONTHS(" + getSqlFrom(function.getArguments().get(0))) + ", ") + getSqlFrom(function.getArguments().get(1))) + "... | 3.26 |
morf_OracleDialect_dropStatements_rdh | /**
*
* @see org.alfasoftware.morf.jdbc.SqlDialect#dropStatements(org.alfasoftware.morf.metadata.View)
*/@Override
public Collection<String> dropStatements(View view) {
return Arrays.asList((((((("BEGIN FOR i IN (SELECT null FROM all_views WHERE OWNER='" + getSchemaName().toUpperCase()) + "' AND VIEW_NAME='") + ... | 3.26 |
morf_OracleDialect_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_OracleDialect_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_OracleDialect_getSqlForAddDays_rdh | /**
*
* @see org.alfasoftware.morf.jdbc.SqlDialect#getSqlForAddDays(org.alfasoftware.morf.sql.element.Function)
*/
@Override
protected String getSqlForAddDays(Function function) {
return String.format("(%s) + (%s)", getSqlFrom(function.getArguments().get(0)), getSqlFrom(function.getArguments().get(1)));
} | 3.26 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.