name stringlengths 12 178 | code_snippet stringlengths 8 36.5k | score float64 3.26 3.68 |
|---|---|---|
morf_AbstractSqlDialectTest_testSelectWithUnionStatements_rdh | /**
* Tests the generation of a select statement with multiple union statements.
*/
@Test
public void testSelectWithUnionStatements() {
SelectStatement stmt = new SelectStatement(new FieldReference(STRING_FIELD)).from(new TableReference(OTHER_TABLE)).union(new SelectStatement(new FieldReference(STRING_FIELD)).from(ne... | 3.26 |
morf_AbstractSqlDialectTest_testNullStatementError_rdh | /**
* Tests that a null statement causes an error.
*/
@Test
public void testNullStatementError() {
try {
SelectStatement stmt = null;
testDialect.convertStatementToSQL(stmt);
fail("Should not be able to get SQL from a null statement");
} catch (IllegalArgumentException e) {
// Expected exception
}
} | 3.26 |
morf_AbstractSqlDialectTest_checkDatabaseByteArrayToRecordValue_rdh | /**
* Format a value through the result set record for testing.
*
* @param value
* The value to format.
* @return The formatted value.
*/
private String checkDatabaseByteArrayToRecordValue(final byte[] value) throws SQLException {
ResultSet resultSet
= mock(ResultSet.class);
when(resultSet.getBytes(anyInt())).t... | 3.26 |
morf_AbstractSqlDialectTest_testSelectMaximumWithExpression_rdh | /**
* Tests select statement with maximum function using more than a simple field.
*/
@Test
public void testSelectMaximumWithExpression()
{
SelectStatement stmt = select(max(field(INT_FIELD).plus(literal(1)))).from(tableRef(TEST_TABLE));
assertEquals("Select scripts are not the same", expectedSelectMaximumWithExpress... | 3.26 |
morf_AbstractSqlDialectTest_windowFunctions_rdh | /**
* The window functions to test
*/
private FluentIterable<AliasedField> windowFunctions() {
return FluentIterable.from(Lists.newArrayList(windowFunction(count()).build(), windowFunction(count()).partitionBy(field("field1")).build(), windowFunction(sum(field("field1"))).partitionBy(field("field2"), field("field3"))... | 3.26 |
morf_AbstractSqlDialectTest_testConcatenateWithOneField_rdh | /**
* Check that we get an illegal argument exception when we try to concatenate
* a single field.
*/
@Test
public void testConcatenateWithOneField() {
try {
new SelectStatement(new ConcatenatedField(new FieldReference("field1")).as("test")).from(new TableReference("schedule"));
fail("Should have thrown an exceptio... | 3.26 |
morf_AbstractSqlDialectTest_testAlterBlobColumn_rdh | /**
* Test altering a blob column.
*/
@Test
public void testAlterBlobColumn() {
testAlterTableColumn(TEST_TABLE, AlterationType.ALTER, getColumn(TEST_TABLE, BLOB_FIELD), column(BLOB_FIELD, DataType.BLOB), expectedAlterTableAlterBlobColumnStatement());
} | 3.26 |
morf_AbstractSqlDialectTest_expectedSqlForMathOperations16_rdh | /**
*
* @return expected SQL for math operation 16
*/
protected String expectedSqlForMathOperations16() {
return "a + b + c / 2 + z";
} | 3.26 |
morf_AbstractSqlDialectTest_testLower_rdh | /**
* Tests that LOWER functionality works.
*/
@Test
public void testLower() {
SelectStatement v349 = new SelectStatement(lowerCase(new FieldReference("field1"))).from(new TableReference("schedule"));
String actual = testDialect.convertStatementToSQL(v349);
assertEquals("LowerCase script should match expected", expec... | 3.26 |
morf_AbstractSqlDialectTest_m4_rdh | /**
* Tests a select with a greater than or equals to clause.
*/
@Test
public void m4() {
SelectStatement stmt = new SelectStatement().from(new TableReference(TEST_TABLE)).where(greaterThanOrEqualTo(new FieldReference(INT_FIELD), 20090101));
String expectedSql = ("SELECT * FROM " + tableName(TEST_TABLE)) + " WHERE... | 3.26 |
morf_AbstractSqlDialectTest_testAnalyseTableStatement_rdh | /**
* Tests that the analyse table statement
*/
@Test
public void testAnalyseTableStatement() {
assertEquals("Analyse table scripts are not the same ",
expectedAnalyseTableSql(), testDialect.getSqlForAnalyseTable(testTempTable));
} | 3.26 |
morf_AbstractSqlDialectTest_expectedPreInsertStatementsNotInsertingUnderAutonumLimit_rdh | /**
*
* @return The expected SQL statements to be run prior to insert for the test database table.
*/
protected List<String> expectedPreInsertStatementsNotInsertingUnderAutonumLimit() {
return Collections.emptyList();
} | 3.26 |
morf_AbstractSqlDialectTest_nullOrder_rdh | /**
* A database platform may need to specify the null order.
*
* <p>If a null order is not required for a SQL dialect descendant classes need to implement this method.</p>
*
* @return the null order for an SQL dialect
*/
protected String nullOrder() {
return StringUtils.EMPTY;
} | 3.26 |
morf_AbstractSqlDialectTest_expectedLeftPad_rdh | /**
*
* @return the expected SQL for Left pad
*/
protected String expectedLeftPad() {
return "SELECT LPAD(stringField, 10, 'j') FROM " + tableName(TEST_TABLE);
} | 3.26 |
morf_AbstractSqlDialectTest_testSelectWhereExists_rdh | /**
* Tests a select an exists check.
*/
@Test
public void testSelectWhereExists() {SelectStatement existsStatement = new SelectStatement().from(new TableReference(TEST_TABLE)).where(isNotNull(new FieldReference(INT_FIELD)));
SelectStatement stmt = new SelectStatement().from(new TableReference(ALTERNATE_TABLE)).where... | 3.26 |
morf_AbstractSqlDialectTest_testCastToBigInt_rdh | /**
* Tests the output of a cast to a big int.
*/
@Test
public void testCastToBigInt() {
String result = testDialect.getSqlFrom(new Cast(new FieldReference("value"), DataType.BIG_INTEGER, 10));
assertEquals(m30(), result);
} | 3.26 |
morf_AbstractSqlDialectTest_testInsertFromSelectIgnoresCase_rdh | /**
* Tests that when forming an insert/select from two table references, the {@link SqlDialect} acts in a case insensitive manner
* when determining if source fields are present in the destination table.
*/
@Test
public void
testInsertFromSelectIgnoresCase() {
InsertStatement insertStatement = new InsertStatement()... | 3.26 |
morf_AbstractSqlDialectTest_testNullMetadataError_rdh | /**
* Tests that passing a null value for the metadata fails.
*/
@Test
public void testNullMetadataError() {
InsertStatement stmt = new InsertStatement().into(new TableReference(TEST_TABLE));try {
testDialect.convertStatementToSQL(stmt, null, SqlDialect.IdTable.withDeterministicName(ID_VALUES_TABLE));
fail("Should ha... | 3.26 |
morf_AbstractSqlDialectTest_expectedPower_rdh | /**
*
* @return The expected SQL for the POWER function
*/private Object expectedPower() {
return "SELECT POWER(floatField, intField) FROM " + tableName(TEST_TABLE);
} | 3.26 |
morf_AbstractSqlDialectTest_m32_rdh | /**
*
* @return The expected SQL for the {@link UpdateStatement#useParallelDml()} directive.
*/
protected String m32() {
return ("UPDATE " + tableName("Foo")) + " SET a = b";
} | 3.26 |
morf_AbstractSqlDialectTest_expectedSqlForMathOperationsForExistingDataFix1_rdh | /**
*
* @return expected SQL for math operation for existing data fix 1
*/
protected String expectedSqlForMathOperationsForExistingDataFix1() {
return "ROUND(doublevalue / 1000 * doublevalue, 2)";
} | 3.26 |
morf_AbstractSqlDialectTest_expectedWindowFunctionStatements_rdh | /**
*
* @return The expected SQL statements resulting from converting the elements of windowFunctions()
*/
protected List<String> expectedWindowFunctionStatements() {
String paddedNullOrder = (StringUtils.isEmpty(nullOrder())) ? StringUtils.EMPTY : " " + nullOrder();
String paddedNullOrderDesc = (StringUtils.isEmp... | 3.26 |
morf_AbstractSqlDialectTest_testSelectWithConcatenationUsingFunction_rdh | /**
* Tests concatenation in a select with {@linkplain Function}.
*/
@Test
public void testSelectWithConcatenationUsingFunction() {
SelectStatement stmt = new SelectStatement(new ConcatenatedField(new FieldReference("assetDescriptionLine1"), max(new FieldReference("scheduleStartDate"))).as("test")).from(new TableRefe... | 3.26 |
morf_AbstractSqlDialectTest_testUpdateUsingFieldFromSelect_rdh | /**
* Tests that an update from a select works when defaults are supplied.
*/
@Test
public void testUpdateUsingFieldFromSelect() {
SelectStatement fieldOneSelect = new SelectStatement(new FieldReference(FLOAT_FIELD)).from(new TableReference(TEST_TABLE)).where(eq(new FieldReference(new TableReference(TEST_TABLE), STR... | 3.26 |
morf_AbstractSqlDialectTest_testSelectSpecificFields_rdh | /**
* Tests a simple select with fields specified
*/
@Test
public void testSelectSpecificFields() {
SelectStatement stmt = new SelectStatement(new FieldReference(STRING_FIELD), new FieldReference(INT_FIELD), new FieldReference(DATE_FIELD).as("aliasDate")).from(new TableReference(TEST_TABLE));
String expectedS... | 3.26 |
morf_AbstractSqlDialectTest_expectedSqlForMathOperations7_rdh | /**
*
* @return expected SQL for math operation 7
*/
protected String expectedSqlForMathOperations7() {
return "(a + b) / (c - d)";
} | 3.26 |
morf_AbstractSqlDialectTest_expectedSelectMaximumWithExpression_rdh | /**
*
* @return The decimal representation of a literal for testing
*/
protected String expectedSelectMaximumWithExpression() {
return "SELECT MAX(intField + 1) FROM " + tableName(TEST_TABLE);
} | 3.26 |
morf_AbstractSqlDialectTest_testUseIndexOnMerge_rdh | /**
* Check that we don't allow the use of the use index hint with a MERGE.
*/
@Test(expected = IllegalArgumentException.class)
public void testUseIndexOnMerge() {
testDialect.convertStatementToSQL(merge().into(tableRef("a")).from(select().from(tableRef("b")).useIndex(tableRef("b"), "b_1")).tableUniqueKey(field("id")... | 3.26 |
morf_AbstractSqlDialectTest_testAlterColumnFromNotNullableToNotNullable_rdh | /**
* Test changing a non-nullable column to a non-nullable column (i.e. alter column statement without leaving nullability set to <code>false</code>.
*/@Test
public void testAlterColumnFromNotNullableToNotNullable() {
testAlterTableColumn(TEST_TABLE, AlterationType.ALTER, getColumn(TEST_TABLE, FLOAT_FIELD), column(F... | 3.26 |
morf_AbstractSqlDialectTest_testUpdateWithLiteralValues_rdh | /**
* Test whether the right update SQL statement was generated
*/
@Test
public void testUpdateWithLiteralValues() {
UpdateStatement stmt = update(tableRef(TEST_TABLE)).set(literal("Value").as(STRING_FIELD)).set(blobLiteral(NEW_BLOB_VALUE).as("blobFieldOne")).set(blobLiteral(NEW_BLOB_VALUE.getBytes(StandardCharsets.U... | 3.26 |
morf_AbstractSqlDialectTest_expectedSqlInsertIntoValuesWithComplexField_rdh | /**
*
* @return The expected SQL for Insert Into Values With Complex Field
*/
protected List<String> expectedSqlInsertIntoValuesWithComplexField() {
return Arrays.asList(("INSERT INTO " + tableName("TableOne")) + " (id, value) VALUES (3, 1 + 2)");
} | 3.26 |
morf_AbstractSqlDialectTest_expectedCoalesce_rdh | /**
*
* @return The expected SQL statement when performing the ANSI COALESCE call
*/
protected String expectedCoalesce() {
return "SELECT COALESCE(NULL, bob) FROM " + tableName("MyTable");
} | 3.26 |
morf_AbstractSqlDialectTest_testTemporaryCreateTableStatements_rdh | /**
* Tests the SQL for creating tables.
*/
@SuppressWarnings("unchecked")
@Test
public void testTemporaryCreateTableStatements() {
compareStatements(expectedCreateTemporaryTableStatements(), testDialect.tableDeploymentStatements(testTempTable), testDialect.tableDeploymentStatements(alternateTestTempTable), test... | 3.26 |
morf_AbstractSqlDialectTest_testChangeIndexFollowedByChangeOfAssociatedColumn_rdh | /**
* Tests that after changing an index, column from that index can be changed afterwards.
*/
@Test
@SuppressWarnings("unchecked")
public void testChangeIndexFollowedByChangeOfAssociatedColumn() {
Schema schema;
// alter an index
// note the different case
ChangeIndex changeIndex =
new ChangeIndex(TEST_TABLE, index(... | 3.26 |
morf_AbstractSqlDialectTest_verifyPostInsertStatementsInsertingUnderAutonumLimit_rdh | /**
* Verify on the expected SQL statements to be run after insert for the test database table.
*
* @param sqlScriptExecutor
* The script executor to use
* @param connection
* The connection to use
*/
@SuppressWarnings("unused")
protected void verifyPostInsertStatementsInsertingUnderAutonumLimit(SqlScriptExe... | 3.26 |
morf_AbstractSqlDialectTest_testUpdateWithNull_rdh | /**
* Test that an update statement is generated with a null value.
*/
@Test
public void testUpdateWithNull() {
UpdateStatement stmt = new UpdateStatement(new TableReference(TEST_TABLE)).set(new NullFieldLiteral().as(STRING_FIELD));
String expectedSql = ("UPDATE " + tableName(TEST_TABLE)) + " SET stringField = null";... | 3.26 |
morf_AbstractSqlDialectTest_testUpper_rdh | /**
* Tests that UPPER functionality works.
*/
@Test
public void testUpper() {
SelectStatement statement =
new SelectStatement(upperCase(new FieldReference("field1"))).from(new TableReference("schedule"));
String actual = testDialect.convertStatementToSQL(statement);
assertEquals("UpperCase script should match expe... | 3.26 |
morf_AbstractSqlDialectTest_m8_rdh | /**
* Tests the SQL statement that are run before a data insert.
*/
@SuppressWarnings("unchecked")
@Test
public void m8() {
compareStatements(expectedPreInsertStatementsInsertingUnderAutonumLimit(), testDialect.preInsertWithPresetAutonumStatements(metadata.getTable(TEST_TABLE), true), testDialect.preInsertWithPreset... | 3.26 |
morf_AbstractSqlDialectTest_testCastToString_rdh | /**
* Tests the output of a cast to a string.
*/
@Test
public void testCastToString() {
String result = testDialect.getSqlFrom(new Cast(new FieldReference("value"), DataType.STRING, 10));
assertEquals(m29(), result);
} | 3.26 |
morf_AbstractSqlDialectTest_testSqlDateConversion_rdh | /**
* Tests SQL date conversion to string via databaseSafeStringtoRecordValue
*
* @throws SQLException
* If a SQL exception is thrown.
*/
@Test
public void testSqlDateConversion() throws SQLException {
ResultSet rs = mock(ResultSet.class);
LocalDate localDate1 = new LocalDate(2010, 1, 1);
LocalDate localDate2 ... | 3.26 |
morf_AbstractSqlDialectTest_testSelectWithLessThanWhereClauses_rdh | /**
* Tests a select with a simple where clause.
*/
@Test
public void testSelectWithLessThanWhereClauses() {
SelectStatement stmt = new SelectStatement().from(new TableReference(TEST_TABLE)).where(lessThan(new FieldReference(INT_FIELD), 20090101));
String expectedSql = ("SELECT * FROM " + tableName(TEST_TABLE)) + " W... | 3.26 |
morf_AbstractSqlDialectTest_testAddDateColumn_rdh | /**
* Test adding a date column.
*/
@Test
public void testAddDateColumn() {
testAlterTableColumn(AlterationType.ADD, column("dateField_new", DataType.DATE).nullable(), expectedAlterTableAddDateColumnStatement());
} | 3.26 |
morf_AbstractSqlDialectTest_shouldGenerateCorrectSqlForMathOperations2_rdh | /**
* Test for proper SQL mathematics operation generation from DSL expressions.
* <p>
* Since it is a chain of operations, and all of the operations takes a field
* or a literal as a second operand, there should be no brackets in the
* generated SQL.
* </p>
*/
@Test
public void shouldGenerateCorrectSqlForMathOp... | 3.26 |
morf_AbstractSqlDialectTest_testSelectWhereInSubqueryWithMoreThanOneField_rdh | /**
* Tests if a select with an IN operator and a sub-select with more than one
* selected field throws an exception.
*/
@Test
public void testSelectWhereInSubqueryWithMoreThanOneField() {
SelectStatement inStatement = new SelectStatement(new FieldReference(STRING_FIELD), new FieldReference(BOOLEAN_FIELD)).from(new ... | 3.26 |
morf_AbstractSqlDialectTest_testInsertFromSelectWithSourceInDifferentSchema_rdh | /**
* Tests that an insert from a select works when the source table is in a different schema.
*/
@Test
public void testInsertFromSelectWithSourceInDifferentSchema() {
SelectStatement sourceStmt = new SelectStatement(new FieldReference("id"), new FieldReference("version"), new
FieldReference(STRING_FIELD),
new FieldR... | 3.26 |
morf_AbstractSqlDialectTest_expectedCreateViewOverUnionSelectStatements_rdh | /**
*
* @return The expected SQL statements for creating the test database view over a union select.
*/
protected List<String> expectedCreateViewOverUnionSelectStatements() {
return Arrays.asList(((((((((("CREATE VIEW " + tableName("TestView")) + " AS (SELECT stringField FROM ") + tableName(TEST_TABLE)) + " WHERE (... | 3.26 |
morf_AbstractSqlDialectTest_shouldGenerateCorrectSqlForMathOperations14_rdh | /**
* Test for proper SQL mathematics operation generation from DSL expressions.
* <p>
* Bracket should be generated for subexpression "b+c". Even without explicit
* {@link org.alfasoftware.morf.sql.SqlUtils#bracket(MathsField)} call.
* </p>
*/
@Test
public void shouldGenerateCorrectSqlForMathOperations14() {
Str... | 3.26 |
morf_AbstractSqlDialectTest_m17_rdh | /**
* Tests that Right Trim functionality works.
*/
@Testpublic void m17() {
// Given
Function rightTrim = rightTrim(new FieldReference("field1"));
SelectStatement selectStatement = new SelectStatement(rightTrim).from(new TableReference("schedule"));
// When
String result = testDialect.convertStatementToSQL(selectSta... | 3.26 |
morf_AbstractSqlDialectTest_testSelectMinimumWithExpression_rdh | /**
* Tests select statement with minimum function using more than a simple field.
*/
@Test
public void testSelectMinimumWithExpression() {
SelectStatement stmt = select(min(field(INT_FIELD).minus(literal(1)))).from(tableRef(TEST_TABLE));
assertEquals("Select scripts are not the same", m5(), testDialect.convertStatem... | 3.26 |
morf_AbstractSqlDialectTest_expectedHints6a_rdh | /**
*
* @return The expected SQL for the {@link SelectStatement#withParallelQueryPlan(int)} and {@link SelectStatement#allowParallelDml()} directive.
*/
protected String expectedHints6a() {
return ("SELECT a, b FROM " + tableName("Foo")) + " ORDER BY a";
} | 3.26 |
morf_AbstractSqlDialectTest_testDeleteAllFromTableStatements_rdh | /**
* Tests SQL for clearing table with a delete.
*/
@SuppressWarnings("unchecked")
@Test
public void testDeleteAllFromTableStatements() {
Table table = metadata.getTable(TEST_TABLE);
compareStatements(expectedDeleteAllFromTableStatements(), testDialect.deleteAllFromTableStatements(table));
} | 3.26 |
morf_AbstractSqlDialectTest_expectedLeast_rdh | /**
*
* @return The expected SQL statement when performing the ANSI LEAST call
*/
protected String expectedLeast() {
return "SELECT LEAST(NULL, bob) FROM " + tableName("MyTable");
} | 3.26 |
morf_AbstractSqlDialectTest_verifyBlobColumnCallPrepareStatementParameter_rdh | /**
* Expected outcome for calling {@link #callPrepareStatementParameter} with a blob data type in {@link #testPrepareStatementParameter()}
*
* @param blobColumn
* the parameter to verify
* @throws SQLException
* exception
*/
protected void verifyBlobColumnCallPrepareStatementParameter(SqlParameter blobColum... | 3.26 |
morf_AbstractSqlDialectTest_expectedSqlStatementFormat_rdh | /**
* Provides the tests for the correct format expected.
* This method can be overridden for dialect specific formatting.
*/
protected void expectedSqlStatementFormat() {
// When
String statement1 = testDialect.formatSqlStatement("END;");
String statement2 = testDialect.formatSqlStatement("test");
// Then
assertEqu... | 3.26 |
morf_AbstractSqlDialectTest_testCastStringLiteralToInteger_rdh | /**
* Tests the output of a cast to a date.
*/
@Test
public void testCastStringLiteralToInteger() {
String result = testDialect.getSqlFrom(new Cast(new FieldLiteral("1234567890"), DataType.INTEGER, 10));
assertEquals(expectedStringLiteralToIntegerCast(), result);
} | 3.26 |
morf_AbstractSqlDialectTest_testJoinSubSelect_rdh | /**
* Tests a join on to a sub-select.
*/
@Test
public void testJoinSubSelect()
{
final TableReference tableOne = tableRef("TableOne");
final TableReference tableTwo = tableRef("Two");
SelectStatement testStatement = select().from(tableOne).innerJoin(select().from("TableTwo").alias("Two"), tableOne.field("id").eq(tab... | 3.26 |
morf_AbstractSqlDialectTest_m13_rdh | /**
* Test that adding numbers returns as expected.
*/
@Test
public void m13() { String result = testDialect.getSqlFrom(new MathsField(new FieldLiteral(1), MathsOperator.DIVIDE, new FieldLiteral(1)));
assertEquals(expectedMathsDivide(), result);
} | 3.26 |
morf_AbstractSqlDialectTest_shouldGenerateCorrectSqlForMathOperations10_rdh | /**
* Test for proper SQL mathematics operation generation from DSL expressions
* that use brackets.
*/
@Test
public void shouldGenerateCorrectSqlForMathOperations10() {
AliasedField dDivByE = field("c").divideBy(field("d"));
AliasedField bracketed = bracket(field("a").plus(field("b")).plus(dDivByE).plus(field("e"... | 3.26 |
morf_AbstractSqlDialectTest_testSelectOrderByTwoFields_rdh | /**
* Tests a select with an "order by" clause with two fields.
*/
@Test
public void testSelectOrderByTwoFields() {FieldReference fieldReference1 = new FieldReference("stringField1");
FieldReference fieldReference2 = new FieldReference("stringField2");
SelectStatement stmt = new SelectStatement(fieldReference1, fi... | 3.26 |
morf_AbstractSqlDialectTest_testInsertFromSelectStatementWhereJoinOnInnerSelect_rdh | /**
* Tests an insert from a select which joins inner selects using a where clause. The fields for selection are not specified.
*/
@Test
public void testInsertFromSelectStatementWhereJoinOnInnerSelect() {
SelectStatement inner1 = select(field(INNER_FIELD_A).as(INNER_FIELD_A), field(INNER_FIELD_B).as(INNER_FIELD_B))... | 3.26 |
morf_AbstractSqlDialectTest_testSelectHash_rdh | /**
* Test that {@link SqlDialect#convertStatementToHash(SelectStatement)} works.
*/
@Test
public void testSelectHash() {
SelectStatement stmt = new SelectStatement().from(new TableReference(TEST_TABLE));
String hash = testDialect.convertStatementToHash(stmt);
assertFalse("Valid", StringUtils.isBlank(hash... | 3.26 |
morf_AbstractSqlDialectTest_expectedHints7_rdh | /**
*
* @return The expected SQL for the {@link SelectStatement#withCustomHint(CustomHint customHint)} directive. Testing the OracleDialect adds the hints successfully.
*/
protected String expectedHints7() {
return "SELECT * FROM SCHEMA2.Foo";// NOSONAR
} | 3.26 |
morf_AbstractSqlDialectTest_testMissingMetadataError_rdh | /**
* Tests that passing a null value for the metadata fails
*/
@Test
public void testMissingMetadataError() {
InsertStatement stmt = new InsertStatement().into(new TableReference("missingTable"));
try
{
testDialect.convertStatementToSQL(stmt, metadata, SqlDialect.IdTable.withDeterministicName(ID_VALUES_TABLE));
fail... | 3.26 |
morf_AbstractSqlDialectTest_testCastFunctionToString_rdh | /**
* Tests the output of a cast of a function to a string.
*/
@Test
public void testCastFunctionToString() {
String result = testDialect.getSqlFrom(cast(min(field("field"))).asString(8));
assertEquals(expectedStringFunctionCast(), result);
} | 3.26 |
morf_AbstractSqlDialectTest_shouldGenerateCorrectSqlForMathOperations6_rdh | /**
* Test for proper SQL mathematics operation generation from DSL expressions.
* <p>
* Subexpression "c-d" should be put to the bracket implicitly, even without
* explicit
* {@link org.alfasoftware.morf.sql.SqlUtils#bracket(MathsField)} call.
* </p>
*/
@Test
public void shouldGenerateCorrectSqlForMathOperation... | 3.26 |
morf_AbstractSqlDialectTest_expectedSelectOrderByNullsFirstDesc_rdh | /**
*
* @return Expected SQL for {@link #testSelectOrderByNullsFirstDescendingScript()}
*/
protected String expectedSelectOrderByNullsFirstDesc() {
return ("SELECT stringField FROM " + tableName(ALTERNATE_TABLE)) + " ORDER BY stringField DESC NULLS FIRST";
} | 3.26 |
morf_DeepCopyTransformations_transformIterable_rdh | /**
* Convenience method to transform all items in a list.
*
* @param transformables
* The target of the transformation
* @param transformation
* The tranformation to be applied during the copy
* @param <T>
* The type of transformation
* @param <U>
* The type of the results of the transformation
* @p... | 3.26 |
morf_DeepCopyTransformations_deepCopy_rdh | /**
*
* @see org.alfasoftware.morf.util.DeepCopyTransformation#deepCopy(org.alfasoftware.morf.util.DeepCopyableWithTransformation)
*/
@Override
public <T> T
deepCopy(DeepCopyableWithTransformation<T, ? extends Builder<T>> element) {
return element == null ? null : element.deepCopy(this).build();
} | 3.26 |
morf_DeepCopyTransformations_noTransformation_rdh | /**
* Returns a DeepCopyTransformation that always delegates the copy
* to the element.
*
* @return A no-op transformation (just deep-copy)
*/
public static DeepCopyTransformation noTransformation() {
return new NoTransformDeepCopyTransformer();
} | 3.26 |
morf_Oracle_extractJdbcUrl_rdh | /**
*
* @see org.alfasoftware.morf.jdbc.AbstractDatabaseType#extractJdbcUrl(java.lang.String)
*/
@Override
public Optional<JdbcUrlElements> extractJdbcUrl(String jdbcUrl) {
Stack<String> splitURL = splitJdbcUrl(jdbcUrl);
String scheme = splitURL.pop();
if (!scheme.equalsIgnoreCase("oracle")) {
re... | 3.26 |
morf_Oracle_m0_rdh | /**
* Recursively try and extract the error code from any nested OracleXAException
*/
private Optional<Integer> m0(Throwable exception) {
try {
if ("oracle.jdbc.xa.OracleXAException".equals(exception.getClass().getName())) {
return Optional.of(((Integer) (exception... | 3.26 |
morf_Oracle_openSchema_rdh | /**
*
* @see org.alfasoftware.morf.jdbc.DatabaseType#openSchema(Connection, String, String)
*/
@Override
public Schema openSchema(Connection connection, String databaseName, String schemaName) {
if (StringUtils.isEmpty(schemaName))
throw new IllegalStateException("No schema name has been provided, but a ... | 3.26 |
morf_Oracle_canTrace_rdh | /**
*
* @see org.alfasoftware.morf.jdbc.DatabaseType#canTrace()
*/
@Override
public boolean canTrace() {
return true;
}
/**
* Returns an Oracle XA data source. Note that this method may fail at
* run-time if {@code OracleXADataSource} | 3.26 |
morf_Oracle_reclassifyException_rdh | /**
*
* @see org.alfasoftware.morf.jdbc.DatabaseType#reclassifyException(java.lang.Exception)
*/@Override
public Exception reclassifyException(Exception e) {
// Reclassify OracleXA exceptions
Optional<Integer> xaErrorCode = m0(e);
if (xaErrorCode.isPresent()) {
// ORA-00060: Deadlock detected w... | 3.26 |
morf_Oracle_matchesProduct_rdh | /**
*
* @see org.alfasoftware.morf.jdbc.DatabaseType#matchesProduct(java.lang.String)
*/
@Override
public boolean matchesProduct(String product) {
return product.equalsIgnoreCase("Oracle");
} | 3.26 |
morf_Oracle_sqlDialect_rdh | /**
*
* @see org.alfasoftware.morf.jdbc.DatabaseType#sqlDialect(java.lang.String)
*/
@Overridepublic SqlDialect sqlDialect(String schemaName) {
return new OracleDialect(schemaName);
} | 3.26 |
morf_Criterion_deepCopy_rdh | /**
* Create a deep copy for this criteria
*
* @return a deep copy of this criteria
*/
public Criterion deepCopy() {
return new Criterion(this, noTransformation());
} | 3.26 |
morf_Criterion_or_rdh | /**
* Helper method to create a new "OR" expression.
*
* <blockquote><pre>
* Criterion.or(listOfCriterions);</pre></blockquote>
*
* @param criteria
* the criteria
* @return a new Criterion object
*/
public static Criterion or(Iterable<Criterion> criteria) {
return new Criterion(Operator.OR, criteria... | 3.26 |
morf_Criterion_getCriteria_rdh | /**
* Get the list of criteria (if any) associated with the criterion
*
* @return the criteria
*/
public List<Criterion> getCriteria() {
return criteria;
} | 3.26 |
morf_Criterion_getField_rdh | /**
* Get the {@link AliasedField} associated with the criterion. This is the left hand
* side of an expression.
*
* @return the field
*/
public AliasedField getField() {
return field;
} | 3.26 |
morf_Criterion_drive_rdh | /**
*
* @see org.alfasoftware.morf.util.ObjectTreeTraverser.Driver#drive(ObjectTreeTraverser)
*/
@Override
public void drive(ObjectTreeTraverser traverser) {
traverser.dispatch(field).dispatch(value).dispatch(selectStatement).dispatch(criteria);
} | 3.26 |
morf_Criterion_getValue_rdh | /**
* Get the value associate with the criterion. This is the right hand side
* of an expression.
*
* @return the value
*/
public Object getValue() {
return value;
} | 3.26 |
morf_Criterion_eq_rdh | /**
* Helper method to create a new "EQUALS" expression.
*
* <blockquote><pre>
* Criterion.eq(new Field("agreementnumber"), "A0001");</pre></blockquote>
*
* @param field
* the field to evaluate in the expression (the left hand side of the expression)
* @param value
* the value to evaluate in the express... | 3.26 |
morf_Criterion_isNull_rdh | /**
* Helper method to create a new "IS NULL" expression.
*
* <blockquote><pre>
* Criterion.isNull(new Field("agreementflag"));</pre></blockquote>
*
* @param field
* the field to check if null
* @return a new Criterion object
*/
public static Criterion isNull(AliasedField field) {
return new Criterion... | 3.26 |
morf_Criterion_like_rdh | /**
* Helper method to create a new "LIKE" expression.
*
* <blockquote><pre>
* Criterion.like(new Field("agreementnumber"), "A%");</pre></blockquote>
*
* <p>Note the escape character is set to '\' (backslash) by the underlying system.</p>
*
* @param field
* the field to evaluate in the expression (the lef... | 3.26 |
morf_Criterion_and_rdh | /**
* Helper method to create a new "AND" expression.
*
* <blockquote><pre>
* Criterion.and(Criterion.eq(new Field("agreementnumber"), "A0001"), Criterion.greaterThan(new Field("startdate"), 20090101));</pre></blockquote>
*
* @param criterion
* the first in the list of criteria
* @param criteria
* the r... | 3.26 |
morf_Criterion_toString_rdh | /**
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
if (selectStatement != null) {
return (operator.toString() +
" ") + selectStatement;
}
if (criteria.isEmpty()) {
switch (operator) {
case ISNULL :
case ISNOTNULL :
... | 3.26 |
morf_Criterion_isNotNull_rdh | /**
* Helper method to create a new "IS NOT NULL" expression.
*
* <blockquote><pre>
* Criterion.isNotNull(new Field("agreementflag"));</pre></blockquote>
*
* @param field
* the field to check if not null
* @return a new Criterion object
*/public static Criterion isNotNull(AliasedField field) {
return ... | 3.26 |
morf_Criterion_in_rdh | /**
* Helper method to create a new "IN" expression.
*
* <blockquote>
* <pre>
* SelectStatement stmt = select()
* .from(tableRef("Schedule"))
* .where(
* Criterion.in(field("chargeType"), 1, 2, 3)
* )
* </pre>
* </blockquote>
*
* <strong>Any null values returned by {@code selectStatement}
* that... | 3.26 |
morf_Criterion_lessThan_rdh | /**
* Helper method to create a new "LESS THAN" expression.
*
* <blockquote><pre>
* Criterion.lessThan(new Field("startdate"), 20091001);</pre></blockquote>
*
* @param field
* the field to evaluate in the expression (the left hand side of the expression)
* @param value
* the value to evaluate in the exp... | 3.26 |
morf_Criterion_greaterThan_rdh | /**
* Helper method to create a new "GREATER THAN" expression.
*
* <blockquote><pre>
* Criterion.greaterThan(new Field("startdate"), 20091001);</pre></blockquote>
*
* @param field
* the field to evaluate in the expression (the left hand side of the expression)
* @param value
* the value to evaluate in t... | 3.26 |
morf_Criterion_getSelectStatement_rdh | /**
* Get the {@link SelectStatement} associated with the criterion.
*
* @return the selectStatement
*/
public SelectStatement getSelectStatement() {return selectStatement;
} | 3.26 |
morf_Criterion_not_rdh | /**
* Helper method to create a new "NOT" expression.
*
* <blockquote><pre>
* Criterion.not(Criterion.eq(new Field("agreementnumber"), "A0001"));</pre></blockquote>
*
* @param criterion
* the first in the list of criteria
* @return a new Criterion object
*/
public static Criterion not(Criterion criterion)... | 3.26 |
morf_Criterion_exists_rdh | /**
* Helper method to create a new "EXISTS" expression.
*
* <blockquote><pre>
* SelectStatement stmt = new SelectStatement(new Table("agreement")).where(Criterion.eq(new Field("agreementnumber"), "A0001"));
* Criterion.exists(stmt);</pre></blockquote>
*
* @param selectStatement
* the select statement t... | 3.26 |
morf_Criterion_lessThanOrEqualTo_rdh | /**
* Helper method to create a new "LESS THAN OR EQUAL TO" expression.
*
* <blockquote><pre>
* Criterion.lessThanOrEqualTo(new Field("startdate"), 20091001);</pre></blockquote>
*
* @param field
* the field to evaluate in the expression (the left hand side of the expression)
* @param value
* the value t... | 3.26 |
morf_Criterion_getOperator_rdh | /**
* Get the operator associated with the criterion
*
* @return the operator
*/
public Operator getOperator() {
return operator;
} | 3.26 |
morf_Criterion_greaterThanOrEqualTo_rdh | /**
* Helper method to create a new "GREATER THAN OR EQUAL TO" expression.
*
* <blockquote><pre>
* Criterion.greaterThanOrEqualTo(new Field("startdate"), 20091001);</pre></blockquote>
*
... | 3.26 |
morf_DataSetProducerAdapter_isTableEmpty_rdh | /**
*
* @see org.alfasoftware.morf.dataset.DataSetProducer#isTableEmpty(java.lang.String)
*/
@Override
public boolean isTableEmpty(String tableName) {
return delegate.isTableEmpty(tableName);
} | 3.26 |
morf_DataSetProducerAdapter_m0_rdh | /**
*
* @see org.alfasoftware.morf.dataset.DataSetProducer#records(java.lang.String)
*/
@Override
public Iterable<Record> m0(String tableName) {
return delegate.records(tableName);
} | 3.26 |
morf_DataSetProducerAdapter_open_rdh | /**
*
* @see org.alfasoftware.morf.dataset.DataSetProducer#open()
*/
@Override
public void open() {
delegate.open();
} | 3.26 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.