name
stringlengths
12
178
code_snippet
stringlengths
8
36.5k
score
float64
3.26
3.68
morf_DataValueLookupMetadata_m0_rdh
/** * Get the array position of the specified column. * * @param columnName * The column name. * @return The array position, or null if not present. */ @Nullable Integer m0(CaseInsensitiveString columnName) { return lookups.get(columnName); }
3.26
morf_DataValueLookupMetadata_setChildren_rdh
/** * Updates the children during internment. * * @param children * The new map of child arrangements. */ void setChildren(ImmutableMap<CaseInsensitiveString, DataValueLookupMetadata> children) { this.children = children; } /** * * @return The column names stored, where the array index corresponds with the ...
3.26
morf_DataValueLookupMetadata_toString_rdh
/** * * @see java.lang.Object#toString() */ @Override public String toString() { return ("DataValueLookupMetadata [columnNames=" + keys) + "]"; }
3.26
morf_Cast_getWidth_rdh
/** * * @return the width */ public int getWidth() { return width; }
3.26
morf_Cast_getExpression_rdh
/** * * @return The {@link AliasedField} being casted */ public AliasedField getExpression() { return expression; }
3.26
morf_Cast_getDataType_rdh
/** * * @return the dataType */ public DataType getDataType() { return dataType; }
3.26
morf_Cast_as_rdh
/** * * @see org.alfasoftware.morf.sql.element.AliasedField#as(java.lang.String) */ @Override public Cast as(String aliasName) { return ((Cast) (super.as(aliasName))); }
3.26
morf_Cast_toString_rdh
/** * * @see java.lang.Object#toString() */ @Override public String toString() { return String.format("CAST(%s AS %s(%s, %s))%s", expression, dataType, width, scale, super.toString()); }
3.26
morf_Cast_drive_rdh
/** * * @see org.alfasoftware.morf.util.ObjectTreeTraverser.Driver#drive(ObjectTreeTraverser) */ @Override public void drive(ObjectTreeTraverser traverser) { traverser.dispatch(getExpression()); }
3.26
morf_Cast_getScale_rdh
/** * * @return the scale */ public int getScale() { return scale; }
3.26
morf_Cast_deepCopyInternal_rdh
/** * * @see org.alfasoftware.morf.sql.element.AliasedField#deepCopyInternal(DeepCopyTransformation) */ @Override protected AliasedField deepCopyInternal(DeepCopyTransformation transformer) { return new Cast(getAlias(), transformer.deepCopy(expression), dataType, width, scale); }
3.26
morf_TableReference_deepCopy_rdh
/** * Create a deep copy of this table. * * @return TableReference a deep copy for this table */ public TableReference deepCopy() { return new TableReference(this, this.alias); }
3.26
morf_TableReference_isTemporary_rdh
/** * Indicates whether the table is temporary. * * @return true if the table is a temporary table. */ public boolean isTemporary() { return temporary; }
3.26
morf_TableReference_getSchemaName_rdh
/** * Get the schema which contains this table. * * @return the schema name */ public String getSchemaName() { return schemaName; }
3.26
morf_TableReference_getAlias_rdh
/** * Get the alias for the table * * @return the alias */ public String getAlias() { return alias; }
3.26
morf_TableReference_equals_rdh
/** * * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if (obj == null) return false; if (obj == this) return true; // TODO incorrect - permits other types. Can't change this - need to fix existing misuse in subtypes if (!(obj inst...
3.26
morf_TableReference_toString_rdh
/** * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder v0 = new StringBuilder(); if (isTemporary()) v0.append("/*Temporary table*/ "); if (!StringUtils.isEmpty(schemaName)) v0.append(schemaName).append("."); v0.append(name); if (!StringUtils.i...
3.26
morf_TableReference_getName_rdh
/** * Get the name of the table * * @return the name */ public String getName() { return name; }
3.26
morf_TableReference_getDblink_rdh
/** * Get the dblink for the table * * @return the dblink */ public String getDblink() { return dblink; }
3.26
morf_TableReference_hashCode_rdh
/** * * @see java.lang.Object#hashCode() */ @Override public int hashCode() { return new HashCodeBuilder(1559, 887).append(schemaName).append(name).append(alias).append(temporary).append(dblink).toHashCode(); }
3.26
morf_TableReference_as_rdh
/** * Specifies the alias to use for the table. * * @param aliasName * the name of the alias * @return an updated {@link TableReference} (this will not be a new object) */ public TableReference as(String aliasName) { if (AliasedField.immutableDslEnabled()) { return new TableReference(this, aliasName...
3.26
morf_TableReference_field_rdh
/** * * @param fieldName * the name of the field * @return reference to a field on this table. */ public FieldReference field(String fieldName) { return FieldReference.field(this, fieldName).build(); }
3.26
morf_TableReference_setName_rdh
/** * * @param name * the name to set * @deprecated Do not modify {@link TableReference} instances. This will be removed very soon. */ @Deprecated public void setName(String name) { this.name = name; }
3.26
morf_Version2to4TransformingReader_processEscape_rdh
/** * * @param cbuf * The output buffer * @param off * the current root output * @param charsRead * the number of chars read from the input buffer * @param idx * The current scan index in the input buffer * @param sequenceLength * The length of the sequence we're replacing * @param escapedString ...
3.26
morf_Version2to4TransformingReader_characterReferenceToTransform_rdh
/** * Tests whether a given index in the buffer is a full null character reference. * Reads forward if required, but resets the position. */ private ReferenceInfo characterReferenceToTransform(char[] cbuf, int ampersandIndex, int remaining) throws IOException { char[] bufferToTest; ...
3.26
morf_Version2to4TransformingReader_parseReference_rdh
/** * Parse a section of the buffer into a character reference value. */ private int parseReference(char[] buffer, int off, int len, int radix) { String testString = new String(buffer, off, len); try {return Integer.parseInt(testString, radix); } catch (NumberFormatException nfe) { // no worrie...
3.26
morf_Version2to4TransformingReader_readVersion_rdh
/** * Tests whether a given input stream contains XML format 2, and therefore * should have the transform applied. * <p> * This is designed to match the known output format of * {@link XmlDataSetConsumer} which previously produced invalid XML. It is * deliberately brittle. There is no need for a more intelligent ...
3.26
morf_Version2to4TransformingReader_read_rdh
/** * * @see java.io.Reader#read(char[], int, int) */ @Override public int read(char[] cbuf, int off, int len) throws IOException {// We need to transform &#0; into \0... int charsRead; // if there's no temporary buffer from a previous call, read from the main source if (temporary.length == 0) { ...
3.26
morf_DatabaseTypeIdentifier_identifyFromMetaData_rdh
/** * Try to identify the database type from connection metadata. * * @return Database type, or null if none. */ public Optional<DatabaseType> identifyFromMetaData() { try { try (Connection connection = dataSource.getConnection()) { DatabaseMetaData metaData = connection.getMetaData(); ...
3.26
morf_H2MetaDataProvider_setAdditionalColumnMetadata_rdh
/** * H2 can (and must) provide the auto-increment start value from the column remarks. * * @see org.alfasoftware.morf.jdbc.DatabaseMetaDataProvider#setAdditionalColumnMetadata(RealName, ColumnBuilder, ResultSet) */ @Override protected ColumnBuilder setAdditionalColumnMetadata(RealName t...
3.26
morf_H2MetaDataProvider_isPrimaryKeyIndex_rdh
/** * H2 reports its primary key indexes as PRIMARY_KEY_49 or similar. * * @see org.alfasoftware.morf.jdbc.DatabaseMetaDataProvider#isPrimaryKeyIndex(RealName) */ @Override protected boolean isPrimaryKeyIndex(RealName indexName) { return indexName.getDbName().startsWith("PRIMARY_KEY"); }
3.26
morf_H2MetaDataProvider_isIgnoredTable_rdh
/** * * @see org.alfasoftware.morf.jdbc.DatabaseMetaDataProvider#isIgnoredTable(RealName) */ @Override protected boolean isIgnoredTable(RealName tableName) { // Ignore temporary tables return tableName.getDbName().startsWith(H2Dialect.TEMPORARY_TABLE_PREFIX); }
3.26
morf_AddColumn_getTableName_rdh
/** * * @return the name of the table to add the column to. */public String getTableName() { return tableName; }
3.26
morf_AddColumn_getNewColumnDefinition_rdh
/** * * @return {@link Column} - the definition of the new column. */ public Column getNewColumnDefinition() { return newColumnDefinition; }
3.26
morf_AddColumn_reverse_rdh
/** * * @see org.alfasoftware.morf.upgrade.SchemaChange#reverse(org.alfasoftware.morf.metadata.Schema) * @return a new {@link Schema} which results from the removal of the relevant table from <var>schema</var> */ @Override public Schema reverse(Schema metadata) { Table original = metadata.getTable(tableName); ...
3.26
morf_AddColumn_isApplied_rdh
/** * * @see org.alfasoftware.morf.upgrade.SchemaChange#isApplied(Schema, ConnectionResources) */ @Override public boolean isApplied(Schema schema, ConnectionResources database) { if (!schema.tableExists(tableName)) { return false; }Table table = schema.getTable(tableName); SchemaHomology homolo...
3.26
morf_AddColumn_apply_rdh
/** * * @see org.alfasoftware.morf.upgrade.SchemaChange#apply(org.alfasoftware.morf.metadata.Schema) * @return a new {@link Schema} which results from the addition of the new column to the relevant table in <var>schema</var> */ @Override public Schema apply(Schema schema) { Table original = schema.g...
3.26
morf_AddColumn_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_SpreadsheetDataSetConsumer_spreadsheetifyName_rdh
/** * Converts camel capped names to something we can show in a spreadsheet. * * @param name * Name to convert. * @return A human readable version of the name wtih camel caps replaced by spaces. */ private String spreadsheetifyName(String name) { ...
3.26
morf_SpreadsheetDataSetConsumer_createTitle_rdh
/** * Inserts a row at the top of the sheet with the given title * * @param sheet * add the title to * @param title * to add */ protected void createTitle(WritableSheet sheet, String title) { try { Label cell = new Label(0, 0, title); WritableFont headingFont = new WritableFont(Writabl...
3.26
morf_SpreadsheetDataSetConsumer_createIndex_rdh
/** * Create the index worksheet. * * <p>This also creates links back to the index in each of the worksheets.</p> */ public void createIndex() { WritableSheet sheet = workbook.createSheet(spreadsheetifyName("Index"), 0); createTitle(sheet, "Index"); try { // Create links for each worksheet, apar...
3.26
morf_SpreadsheetDataSetConsumer_table_rdh
/** * * @see org.alfasoftware.morf.dataset.DataSetConsumer#table(org.alfasoftware.morf.metadata.Table, java.lang.Iterable) */ @Overridepublic void table(Table table, Iterable<Record> records) { Integer maxSampleRows = DEFAULT_SAMPLE_ROWS; if (rowsPerTable.isPresent()) { maxSampleRows = rowsPerTable.g...
3.26
morf_SpreadsheetDataSetConsumer_open_rdh
/** * * @see org.alfasoftware.morf.dataset.DataSetConsumer#open() */ @Override public void open() { try { workbook = Workbook.createWorkbook(documentOutputStream); } catch (IOException e) { throw new RuntimeException("Error creating writable workbook", e); } }
3.26
morf_LoggingSqlScriptVisitor_beforeExecute_rdh
/** * {@inheritDoc } * * @see org.alfasoftware.morf.jdbc.SqlScriptExecutor.SqlScriptVisitor#beforeExecute(java.lang.String) */ @Override public void beforeExecute(String sql) { log.info(((logSchemaPositionPrefix() + "Executing [") + sql) + "]"); }
3.26
morf_LoggingSqlScriptVisitor_executionStart_rdh
/** * {@inheritDoc } * * @see org.alfasoftware.morf.jdbc.SqlScriptExecutor.SqlScriptVisitor#executionStart() */ @Overridepublic void executionStart() { log.info(logSchemaPositionPrefix() + "Starting SQL Script"); }
3.26
morf_LoggingSqlScriptVisitor_afterExecute_rdh
/** * {@inheritDoc } * * @see org.alfasoftware.morf.jdbc.SqlScriptExecutor.SqlScriptVisitor#afterExecute(java.lang.String, long) */ @Override public void afterExecute(String sql, long numberOfRowsUpdated) { log.info(((((logSchemaPositionPrefix() + "Completed [") + sql) + "] with [") + numberOfRowsUpdated) + "] ...
3.26
morf_LoggingSqlScriptVisitor_executionEnd_rdh
/** * {@inheritDoc } * * @see org.alfasoftware.morf.jdbc.SqlScriptExecutor.SqlScriptVisitor#executionEnd() */ @Override public void executionEnd() { log.info(logSchemaPositionPrefix() + "SQL Script Complete"); }
3.26
morf_AbstractSqlDialectTest_testSelectWithGroupByList_rdh
/** * Tests the group by in a select. */ @Test public void testSelectWithGroupByList() { SelectStatement stmt = new SelectStatement(new FieldReference(STRING_FIELD), count(field(STRING_FIELD)), countDistinct(field(STRING_FIELD))).from(new TableReference(ALTERNATE_TABLE)).groupBy(ImmutableList.of(field(STRING_FIELD), ...
3.26
morf_AbstractSqlDialectTest_shouldGenerateCorrectSqlForMathOperations8_rdh
/** * Test for proper SQL mathematics operation generation from DSL expressions. */ @Test public void shouldGenerateCorrectSqlForMathOperations8() { String result = testDialect.getSqlFrom(field("a").plus(field("b")).plus(field("c")).plus(field("d")).plus(field("e"))); assertEquals(expectedSqlForMathOperations8(), res...
3.26
morf_AbstractSqlDialectTest_m2_rdh
/** * Tests a select with multiple joins. */ @Test public void m2() { SelectStatement stmt = new SelectStatement().from(new TableReference(ALTERNATE_TABLE)).innerJoin(new TableReference(TEST_TABLE), eq(new FieldReference(new TableReference(ALTERNATE_TABLE), STRING_FIELD), new FieldReference(new TableReference(TEST_TA...
3.26
morf_AbstractSqlDialectTest_expectedSqlForMathOperations10_rdh
/** * * @return expected SQL for math operation 10 */ protected String expectedSqlForMathOperations10() { return "(a + b + (c / d) + e + 100 + f) / 5"; }
3.26
morf_AbstractSqlDialectTest_callPrepareStatementParameter_rdh
/** * Calls callPrepareStatementParameter with a mock {@link PreparedStatement} and returns * the mock for analysis. * * @param parameter * The SQL parameter * @param value * The value to set * @return The mocked {@link PreparedStatement} */ protected NamedParameterPreparedStatement callPrepareStatementPar...
3.26
morf_AbstractSqlDialectTest_testJoinNoCriteria_rdh
/** * Tests a join with no ON criteria. */ @Test public void testJoinNoCriteria() { SelectStatement testStatement = select().from(tableRef("TableOne")).crossJoin(tableRef("TableTwo")); assertEquals(testDialect.convertStatementToSQL(testStatement), expectedJoinOnEverything()); }
3.26
morf_AbstractSqlDialectTest_nullOrderForDirection_rdh
/** * A database platform may need to specify the null order by direction. * * <p>If a null order is not required for a SQL dialect descendant classes need to implement this method.</p> * * @param descending * the order direction * @return the null order for an SQL dialect */ protected String nullOrderForDire...
3.26
morf_AbstractSqlDialectTest_expectedSelectFirstOrderByNullsLastDesc_rdh
/** * * @return Expected SQL for {@link #testSelectOrderByTwoFields()} */ protected String expectedSelectFirstOrderByNullsLastDesc() { return ("SELECT stringField FROM " + tableName(ALTERNATE_TABLE)) + " ORDER BY stringField DESC NULLS LAST LIMIT 0,1"; }
3.26
morf_AbstractSqlDialectTest_testFloor_rdh
/** * Tests that FLOOR functionality builds the expected SQL string. */ @Test public void testFloor() { SelectStatement statement = new SelectStatement(floor(new FieldReference(FLOAT_FIELD))).from(new TableReference(TEST_TABLE)); String actual = testDialect.convertStatementToSQL(statement); assertEquals("Floor script...
3.26
morf_AbstractSqlDialectTest_matches_rdh
/** * {@inheritDoc } * * @see org.mockito.ArgumentMatcher#matches(java.lang.Object) */ @Override public boolean matches(final byte[] argument) {return Arrays.equals(argument, expectedBytes); }
3.26
morf_AbstractSqlDialectTest_testInsertFromSelectWithSomeDefaults_rdh
/** * Tests that an insert from a select works when some of the defaults are supplied */ @Test public void testInsertFromSelectWithSomeDefaults() { InsertStatement stmt = new InsertStatement().into(new TableReference(TEST_TABLE)).from(new TableReference(OTHER_TABLE)).withDefaults(new FieldLiteral(20010101).as(DATE_FI...
3.26
morf_AbstractSqlDialectTest_expectedSqlForMathOperations1_rdh
/** * * @return expected SQL for math operation 1 */ protected String expectedSqlForMathOperations1() { return "a / b + c"; }
3.26
morf_AbstractSqlDialectTest_testAddColumnNotNullable_rdh
/** * Test adding a non-nullable column. */ @Test public void testAddColumnNotNullable() { testAlterTableColumn(AlterationType.ADD, column("dateField_new", DataType.DATE).defaultValue("2010-01-01"), expectedAlterTableAddColumnNotNullableStatement()); }
3.26
morf_AbstractSqlDialectTest_testAddDecimalColumn_rdh
/** * Test adding a floating point column. */ @Test public void testAddDecimalColumn() { testAlterTableColumn(AlterationType.ADD, column("floatField_new", DataType.DECIMAL, 6, 3).nullable(), expectedAlterTableAddDecimalColumnStatement());}
3.26
morf_AbstractSqlDialectTest_testSelectWithLiterals_rdh
/** * Tests that selects which include field literals. */ @Test public void testSelectWithLiterals() { SelectStatement stmt = new SelectStatement(new FieldReference(STRING_FIELD), new FieldReference(INT_FIELD), new FieldReference(DATE_FIELD).as("aliasDate"), new FieldLiteral("SOME_STRING"), new FieldLiteral(1.23), ...
3.26
morf_AbstractSqlDialectTest_testAddStringColumnWithDefault_rdh
/** * Test adding a string column. */ @Test public void testAddStringColumnWithDefault() { testAlterTableColumn(AlterationType.ADD, column("stringField_with_default", DataType.STRING, 6).defaultValue("N"), expectedAlterTableAddStringColumnWithDefaultStatement());}
3.26
morf_AbstractSqlDialectTest_compareStatements_rdh
/** * Helper method to compare one statement to another. * * @param expected * The expected statement. * @param actual * Actual statement. */ @SuppressWarnings("unchecked") protected void compareStatements(String expected, Iterable<String> actual) { compareStatements(Arrays.asList(expected), actual); }
3.26
morf_AbstractSqlDialectTest_m34_rdh
/** * * @return The expected SQL for the {@link InsertStatement#useParallelDml(int)} directive. */ protected String m34() { return (("INSERT INTO " + tableName("Foo")) + " SELECT a, b FROM ") + tableName("Foo_1"); }
3.26
morf_AbstractSqlDialectTest_testAddDays_rdh
/** * Test that AddDays functionality behaves as expected. */ @Test public void testAddDays() { String result = testDialect.getSqlFrom(addDays(field("testField"), new FieldLiteral(-20))); assertEquals(expectedAddDays(), result); }
3.26
morf_AbstractSqlDialectTest_provideCustomHint_rdh
/** * This method can be overridden in specific dialects to test providing custom hints in each dialect * * @return a mock CustomHint or an overridden, more specific, CustomHint */ @SuppressWarnings("deprecation") protected CustomHint provideCustomHint() { return mock(CustomHint.class); }
3.26
morf_AbstractSqlDialectTest_testSelectWhereNotEqualTo_rdh
/** * Tests a select with not equals check. */ @Test public void testSelectWhereNotEqualTo() { SelectStatement stmt = new SelectStatement().from(new TableReference(TEST_TABLE)).where(neq(new FieldReference(INT_FIELD), 20090101)); String expectedSql = ("SELECT * FROM " + tableName(TEST_TABLE)) + " WHERE (intField <> ...
3.26
morf_AbstractSqlDialectTest_testAlterColumnRenamingAndChangingNullability_rdh
/** * Test renaming a column and changing it from nullable to not nullable. */ @Test public void testAlterColumnRenamingAndChangingNullability() { testAlterTableColumn(OTHER_TABLE, AlterationType.ALTER, getColumn(OTHER_TABLE, FLOAT_FIELD), column("blahField", DataType.DECIMAL, 20, 3).nullable(), expectedAlterColumnRe...
3.26
morf_AbstractSqlDialectTest_testInsertDateLiteral_rdh
/** * Tests an INSERT with a date literal. */ @Test public void testInsertDateLiteral() { Schema schema = schema(table("TableOne").columns(column("id", DataType.INTEGER), column("value", DataType.DATE))); InsertStatement testStatement = insert().into(tableRef("TableOne")).values(literal(3).as("id"), literal(new Loca...
3.26
morf_AbstractSqlDialectTest_stringLiteralPrefix_rdh
/** * On some databases our string literals need prefixing with N to be * correctly typed as a unicode string. * * @return prefix to insert before quoted string literal. */ protected String stringLiteralPrefix() { return ""; }
3.26
morf_AbstractSqlDialectTest_testRenameTempIndexStatements_rdh
/** * Tests that the syntax is correct for renaming an index. */ @SuppressWarnings("unchecked") @Testpublic void testRenameTempIndexStatements() { AlteredTable alteredTable = new AlteredTable(testTempTable, null, null, FluentIterable.from(testTempTable.indexes()).transform(Index::getName).filter(i -> !i.equals(TEM...
3.26
morf_AbstractSqlDialectTest_testSelectMultipleWhereScript_rdh
/** * Tests a select with multiple where clauses */ @Test public void testSelectMultipleWhereScript() { SelectStatement stmt = new SelectStatement().from(new TableReference(TEST_TABLE)).where(and(eq(new FieldReference(STRING_FIELD), "A0001"), greaterThan(new FieldReference(INT_FIELD), 20080101), lessThan(new FieldRef...
3.26
morf_AbstractSqlDialectTest_m19_rdh
/** * Test adding an index over a single column. */ @SuppressWarnings("unchecked")@Test public void m19() { Table table = metadata.getTable(TEST_TABLE); Index index = index("indexName").columns(table.columns().get(0).getName()); compareStatements(expectedAddIndexStatementsOnSingleColumn(), testDialect.addIndexStateme...
3.26
morf_AbstractSqlDialectTest_expectedLeftTrim_rdh
/** * * @return The expected SQL for a Left Trim */ protected String expectedLeftTrim() { return "SELECT LTRIM(field1) FROM " + tableName("schedule"); }
3.26
morf_AbstractSqlDialectTest_m6_rdh
/** * Tests that an insert from a select works when no defaults are supplied. */ @Test public void m6() { SelectStatement sourceStmt = new SelectStatement(new FieldReference("version"), new FieldReference(STRING_FIELD)).from(new TableReference(OTHER_TABLE)); InsertStatement stmt = new InsertStatement().into(new Table...
3.26
morf_AbstractSqlDialectTest_testAlterTableColumn_rdh
/** * Utility method for testing 'ALTER TABLE ... COLUMN ...' statements. */ private void testAlterTableColumn(AlterationType alterationType, Column newColumn, List<String> expectedStatements) { testAlterTableColumn(TEST_TABLE, alterationType, null, newColumn, expectedStatements); }
3.26
morf_AbstractSqlDialectTest_expectedSqlForMathOperations14_rdh
/** * * @return expected SQL for math operation 14 */ protected String expectedSqlForMathOperations14() { return "a + (b + c) / 2"; }
3.26
morf_AbstractSqlDialectTest_expectedGreatest_rdh
/** * * @return The expected SQL statement when performing the ANSI GREATEST call */ protected String expectedGreatest() { return "SELECT GREATEST(NULL, bob) FROM " + tableName("MyTable"); }
3.26
morf_AbstractSqlDialectTest_testTruncateTemporaryTableStatements_rdh
/** * Tests SQL for clearing tables. */ @SuppressWarnings("unchecked") @Test public void testTruncateTemporaryTableStatements() { compareStatements(expectedTruncateTempTableStatements(), testDialect.truncateTableStatements(testTempTable)); }
3.26
morf_AbstractSqlDialectTest_provideDatabaseType_rdh
/** * This method can be overridden in specific dialects to test DialectSpecificHint in each dialect * * @return a mock database type identifier value or an overridden, dialect specific, database type identfier */ protected String provideDatabaseType() { return "SOME_DATABASE_IDENTIFIER"; }
3.26
morf_AbstractSqlDialectTest_testDeleteUsingAliasedTable_rdh
/** * Tests a delete referring to an aliased table. */ @Test public void testDeleteUsingAliasedTable() { DeleteStatement v256 = new DeleteStatement(new TableReference("myDeleteTable").as("stageName")); String expectedSql = ("DELETE FROM " + tableName("myDeleteTable")) + " stageName"; assertEquals("Delete with alia...
3.26
morf_AbstractSqlDialectTest_getColumn_rdh
/** * Utility method to get a column from the 'Test' table based on its name. */ private Column getColumn(String tableName, String columnName) { for (Column column : metadata.getTable(tableName).columns()) { if (column.getName().equals(columnName)) { return column; } } return null; }
3.26
morf_AbstractSqlDialectTest_testInsertWithNullDefaults_rdh
/** * Test that an Insert statement is generated with a null value */ @Test public void testInsertWithNullDefaults() { InsertStatement stmt = new InsertStatement().into(new TableReference(TEST_TABLE)).from(new TableReference(OTHER_TABLE)).withDefaults(new NullFieldLiteral().as(DATE_FIELD), new NullFieldLiteral().as(...
3.26
morf_AbstractSqlDialectTest_testPreInsertWithPresetAutonumStatementsNotInsertingUnderAutonumLimit_rdh
/** * Tests the SQL statement that are run before a data insert. */ @SuppressWarnings("unchecked") @Test public void testPreInsertWithPresetAutonumStatementsNotInsertingUnderAutonumLimit() { compareStatements(expectedPreInsertStatementsNotInsertingUnderAutonumLimit(), testDialect.preInsertWithPresetAutonumStatements(...
3.26
morf_AbstractSqlDialectTest_testUpdateUsingAliasedTable_rdh
/** * Tests an update with arguments referring to an aliased table. */ @Test public void testUpdateUsingAliasedTable() { SelectStatement fieldOneSelect = new SelectStatement(new FieldReference(FLOAT_FIELD)).from(new TableReference(TEST_TABLE).as("stageName")).where(eq(new FieldReference(new TableReference(TEST_TAB...
3.26
morf_AbstractSqlDialectTest_testInsertWithIdAndVersion_rdh
/** * Tests that an insert from a select works when no defaults are supplied for the id or version columns. */ @Test public void testInsertWithIdAndVersion() { SelectStatement sourceStmt = new SelectStatement(new FieldReference(STRING_FIELD)).from(new TableReference(OTHER_TABLE)); InsertStatement stmt = new Insert...
3.26
morf_AbstractSqlDialectTest_expectedSqlForMathOperationsForExistingDataFix3_rdh
/** * * @return the expected SQL for math operation for existing data fix 3 */ protected String expectedSqlForMathOperationsForExistingDataFix3() {return "MAX(assetLocationDate * 100000 + assetLocationTime)"; }
3.26
morf_AbstractSqlDialectTest_testSpecifiedValueInsertWithTableInDifferentSchema_rdh
/** * Tests an insert statement where the value for each column (except the id) has been explicitly specified, */ @Test public void testSpecifiedValueInsertWithTableInDifferentSchema() { InsertStatement stmt = new InsertStatement().into(new TableReference("MYSCHEMA", TEST_TABLE)).values(new FieldLiteral("Escap'd").as...
3.26
morf_AbstractSqlDialectTest_testRenameTableStatements_rdh
/** * Tests that the syntax is correct for renaming a table. */ @SuppressWarnings("unchecked") @Test public void testRenameTableStatements() { Table fromTable = metadata.getTable(TEST_TABLE); Table renamed = table("Renamed").columns(idColumn(), versionColumn(), column(STRING_FIELD, DataType.STRING, 3).nullable(), col...
3.26
morf_AbstractSqlDialectTest_expectedSqlForMathOperations9_rdh
/** * * @return expected SQL for math operation 9 */ protected String expectedSqlForMathOperations9() { return "a + b + (c / d) + e + 100 + f / 5"; }
3.26
morf_AbstractSqlDialectTest_testCastToDecimal_rdh
/** * Tests the output of a cast to a decimal. */ @Test public void testCastToDecimal() { String result = testDialect.getSqlFrom(new Cast(new FieldReference("value"), DataType.DECIMAL, 10, 2)); assertEquals(expectedDecimalCast(), result); }
3.26
morf_AbstractSqlDialectTest_testInsertFromSelectWithTargetInDifferentSchema_rdh
/** * Tests that an insert from a select works when the target table is in a different schema. */ @Test public void testInsertFromSelectWithTargetInDifferentSchema() { SelectStatement sourceStmt = new SelectStatement(new FieldReference("id"), new FieldReference("version"), new FieldReference(STRING_FIELD), new Field...
3.26
morf_AbstractSqlDialectTest_testSelectWithGroupBy_rdh
/** * Tests the group by in a select. */@Test public void testSelectWithGroupBy() { SelectStatement stmt = new SelectStatement(new FieldReference(STRING_FIELD), count(literal(1)), countDistinct(literal(1))).from(new TableReference(ALTERNATE_TABLE)).groupBy(field(STRING_FIELD), field(INT_FIELD), field(FLOAT_FIELD)); ...
3.26
morf_AbstractSqlDialectTest_testSelectWithNestedEqualityCheck_rdh
/** * Tests that strange equality behaviour is maintained. */ @Test public void testSelectWithNestedEqualityCheck() { SelectStatement v146 = new SelectStatement(new FieldReference(STRING_FIELD)).from(new TableReference(TEST_TABLE)).where(eq(new FieldReference(BOOLEAN_FIELD), eq(new FieldReference(CHAR_FIELD), "Y")));...
3.26
morf_AbstractSqlDialectTest_testSelectSome_rdh
/** * Tests select statement with Some function. */ @Test public void testSelectSome() { SelectStatement statement = select(some(field(BOOLEAN_FIELD))).from(tableRef(TEST_TABLE)); assertEquals("Select scripts are not the same", expectedSelectSome(), testDialect.convertStatementToSQL(statement)); }
3.26
morf_AbstractSqlDialectTest_testSelectWhereGreaterThan_rdh
/** * Tests a select with a greater than clause. */ @Testpublic void testSelectWhereGreaterThan() { SelectStatement stmt = new SelectStatement().from(new TableReference(TEST_TABLE)).where(greaterThan(new FieldReference(INT_FIELD), 20090101)); String expectedSql = ("SELECT * FROM " + tableName(TEST_TABLE)) + " WHERE (...
3.26
morf_AbstractSqlDialectTest_testSelectMaximum_rdh
/** * Tests select statement with maximum function. */ @Testpublic void testSelectMaximum() { SelectStatement stmt = new SelectStatement(max(new FieldReference(INT_FIELD))).from(new TableReference(TEST_TABLE)); String expectedSql = "SELECT MAX(intField) FROM " + tableName(TEST_TABLE); assertEquals("Select scripts ...
3.26
morf_AbstractSqlDialectTest_m24_rdh
/** * * @return Expected SQL for {@link #testSelectOrderByNullsLastScript()} */ protected String m24() { return ("SELECT stringField FROM " + tableName(ALTERNATE_TABLE)) + " ORDER BY stringField NULLS LAST"; }
3.26
morf_AbstractSqlDialectTest_verifyBooleanPrepareStatementParameter_rdh
/** * Tests the logic used for transferring a boolean {@link Record} value to a * {@link PreparedStatement}. For overriding in specific DB tests * * @throws SQLException * when a database access error occurs */ protected void verifyBooleanPrepareStatementParameter() throws SQLException { final SqlParameter boo...
3.26