Class MSSQLServerDBDefinition

  • All Implemented Interfaces:
    Serializable
    Direct Known Subclasses:
    MSSQLServer2012DBDefinition

    public class MSSQLServerDBDefinition
    extends DBDefinition
    Defines the features of the Microsoft SQL Server database that differ from the standard database.

    This DBDefinition is automatically included in MSSQLServerDB instances, and you should not need to use it directly.

    Author:
    Gregory Graham
    See Also:
    Serialized Form
    • Constructor Detail

      • MSSQLServerDBDefinition

        public MSSQLServerDBDefinition()
    • Method Detail

      • getDateFormattedForQuery

        public String getDateFormattedForQuery​(Date date)
        Description copied from class: DBDefinition
        Transforms the Date instance into a SQL snippet that can be used as a date in a query.

        For instance the date might be transformed into a string like " DATETIME('2013-03-23 00:00:00') "

        Specified by:
        getDateFormattedForQuery in class DBDefinition
        Parameters:
        date - date
        Returns:
        the date formatted as a string that the database will correctly interpret as a date.
      • getDatePartsFormattedForQuery

        public String getDatePartsFormattedForQuery​(String years,
                                                    String months,
                                                    String days,
                                                    String hours,
                                                    String minutes,
                                                    String seconds,
                                                    String subsecond,
                                                    String timeZoneSign,
                                                    String timeZoneHourOffset,
                                                    String timeZoneMinuteOffSet)
        Description copied from class: DBDefinition
        Transforms the specific parts of a date from their SQL snippets into a SQL snippet that can be used as a date in a query.

        For instance the date parts might be transformed into a string like " DATETIME('2013-03-23 00:00:00') "

        Specified by:
        getDatePartsFormattedForQuery in class DBDefinition
        Parameters:
        years - the sql representing the years part of the date
        months - the sql representing the months (1-12) part of the date
        days - the sql representing the days (0-31) part of the date
        hours - the sql representing the hours (0-24) part of the date
        minutes - the sql representing the minutes (0-60) part of the date
        seconds - the sql representing the seconds (0-59) part of the date
        subsecond - the sql representing the subsecond (0.0-0.9999) part of the date, precision is based on the database's limitations
        timeZoneSign - + or -
        timeZoneHourOffset - the sql representing the minutes (0-59) part of the date's time zone
        timeZoneMinuteOffSet - the sql representing the hours (0-13) part of the date's time zone
        Returns:
        the date formatted as a string that the database will be correctly interpret as a date.
      • doColumnTransformForSelect

        public String doColumnTransformForSelect​(QueryableDatatype<?> qdt,
                                                 String selectableName)
        Description copied from class: DBDefinition
        Perform necessary transformations on the stored value to make it readable by Java.

        Primarily used on Spatial types, this method allows a data type unknown to JDBC to be transformed into the necessary type (usually a String) to be read by Java and DBvolution.

        Overrides:
        doColumnTransformForSelect in class DBDefinition
        Parameters:
        qdt - the DBV value to be stored
        selectableName - the selectable value
        Returns:
        SQL
      • formatTableName

        public String formatTableName​(DBRow table)
        Description copied from class: DBDefinition
        Formats the table name correctly for this database.

        Used wherever a table alias is inappropriate, for instance UPDATE statements.

        Overrides:
        formatTableName in class DBDefinition
        Parameters:
        table - table
        Returns:
        a string of the table name formatted for this database definition
      • formatNameForDatabase

        protected String formatNameForDatabase​(String sqlObjectName)
        Description copied from class: DBDefinition
        Apply standard object name transformations required by the database.

        This methods helps support database specific naming rules by allowing post-processing of the object names to conform to the rules.

        Overrides:
        formatNameForDatabase in class DBDefinition
        Parameters:
        sqlObjectName - the Java object name to be transformed into a database object name.
        Returns:
        the object name formatted for use with this database
      • endSQLStatement

        public String endSQLStatement()
        Description copied from class: DBDefinition
        Returns the default ending of an SQL statement for this database.
        Overrides:
        endSQLStatement in class DBDefinition
        Returns:
        ";" or equivalent.
      • beginStringValue

        public String beginStringValue()
        Description copied from class: DBDefinition
        Returns the standard beginning of a string value in the database.

        The default method returns "'", that is a single quote.

        Overrides:
        beginStringValue in class DBDefinition
        Returns:
        the formatting required at the beginning of a string value.
      • getLimitRowsSubClauseAfterWhereClause

        public String getLimitRowsSubClauseAfterWhereClause​(QueryState state,
                                                            QueryOptions options)
        Description copied from class: DBDefinition
        Provides an opportunity for the definition to insert a row limiting statement after the query for example MySQL/MariaDB use SELECT ... FROM ... WHERE ... LIMIT 10 ; Based on the example for MySQL/MariaDB this method should return " LIMIT 10 " If the database does not support row limiting this method should throw an exception when rowLimit is not null If the database does not limit rows after the where clause this method should return ""
        Overrides:
        getLimitRowsSubClauseAfterWhereClause in class DBDefinition
        Parameters:
        state - the current query state
        options - options
        Returns:
        the row limiting sub-clause or ""
      • doSubstringTransform

        public String doSubstringTransform​(String originalString,
                                           String start,
                                           String length)
        Description copied from class: DBDefinition
        Transforms the arguments into a SQL snippet that produces a substring of the originalString from the start for length characters.
        Overrides:
        doSubstringTransform in class DBDefinition
        Parameters:
        originalString - originalString
        start - start
        length - length
        Returns:
        an expression that will produce an appropriate substring of the originalString.
      • getStringLengthFunctionName

        public String getStringLengthFunctionName()
        Description copied from class: DBDefinition
        Returns the function name of the function used to determine the number of characters in the value.

        DBvolution tries to ensure that the character length of a value is equal to the character length of an equivalent Java String.

        That is to say: DBV.charlength() === java.lang.String.length()

        Overrides:
        getStringLengthFunctionName in class DBDefinition
        Returns:
        "LOWER"
      • doStringEqualsTransform

        public String doStringEqualsTransform​(String firstSQLExpression,
                                              String secondSQLExpression)
        SQLServer follows the standard, unlike anyone else, and pads the short string with spaces before comparing.

        This effectively means strings are trimmed during comparisons whether you like it or not.

        While this seems useful, in fact it prevents checking for incorrect strings and breaks the industrial standard.

        Overrides:
        doStringEqualsTransform in class DBDefinition
        Parameters:
        firstSQLExpression - the first string value to compare
        secondSQLExpression - the second string value to compare

        Support DBvolution at Patreon

        Returns:
        SQL
      • doTrimFunction

        public String doTrimFunction​(String enclosedValue)
        Description copied from class: DBDefinition
        Wraps the provided SQL snippet in a statement that performs trims all spaces from the left and right of the value of the snippet.
        Overrides:
        doTrimFunction in class DBDefinition
        Parameters:
        enclosedValue - enclosedValue
        Returns:
        SQL snippet
      • doPositionInStringTransform

        public String doPositionInStringTransform​(String originalString,
                                                  String stringToFind)
        Description copied from class: DBDefinition
        Transforms an SQL snippet into an SQL snippet that provides the index of the string to find.
        Overrides:
        doPositionInStringTransform in class DBDefinition
        Parameters:
        originalString - originalString
        stringToFind - stringToFind
        Returns:
        a SQL snippet that will produce the index of the find string.
      • getIfNullFunctionName

        public String getIfNullFunctionName()
        Description copied from class: DBDefinition
        Provides the function name of the COALESCE, IFNULL, or NVL function.

        This provides the function name for this database that transforms a NULL into another value.

        Overrides:
        getIfNullFunctionName in class DBDefinition
        Returns:
        "COALESCE"
      • supportsDegreesFunction

        public boolean supportsDegreesFunction()
        MSSQLserver only supports integer degrees, and that's not good enough.

        Support DBvolution at Patreon

        Overrides:
        supportsDegreesFunction in class DBDefinition
        Returns:
        false
      • doStringLengthTransform

        public String doStringLengthTransform​(String enclosedValue)
        Wraps the provided SQL snippet in a statement that the length of the value of the snippet.
        Overrides:
        doStringLengthTransform in class DBDefinition
        Parameters:
        enclosedValue - enclosedValue

        Support DBvolution at Patreon

        Returns:
        SQL snippet
      • getColumnAutoIncrementSuffix

        public String getColumnAutoIncrementSuffix()
        Description copied from class: DBDefinition
        Returns the suffix added to a column definition to support auto-incrementing a column.
        Overrides:
        getColumnAutoIncrementSuffix in class DBDefinition
        Returns:
        " GENERATED BY DEFAULT AS IDENTITY "
      • prefersLargeObjectsReadAsBase64CharacterStream

        public boolean prefersLargeObjectsReadAsBase64CharacterStream​(DBLargeObject<?> lob)
        Description copied from class: DBDefinition
        Indicates whether the database requires LargeObjects to be encoded as Base64 CLOBS using the CharacterStream method to read the value.
        Overrides:
        prefersLargeObjectsReadAsBase64CharacterStream in class DBDefinition
        Parameters:
        lob - the DBLargeObject which we are querying about.
        Returns:
        the default implementation returns FALSE.
      • getCurrentDateOnlyFunctionName

        protected String getCurrentDateOnlyFunctionName()
        Description copied from class: DBDefinition
        Defines the function used to get the current date (excluding time) from the database.
        Overrides:
        getCurrentDateOnlyFunctionName in class DBDefinition
        Returns:
        the default implementation returns " CURRENT_DATE "
      • doBooleanToIntegerTransform

        public String doBooleanToIntegerTransform​(String booleanExpression)
        Description copied from class: DBDefinition
        Transforms a bit expression into an integer expression.

        Used to allow comparison of bit columns in some databases.

        Overrides:
        doBooleanToIntegerTransform in class DBDefinition
        Parameters:
        booleanExpression - bitExpression
        Returns:
        the transformation necessary to transform bitExpression into an integer expression in the SQL.
      • doDateAddSecondsTransform

        public String doDateAddSecondsTransform​(String dateValue,
                                                String numberOfSeconds)
        Description copied from class: DBDefinition
        Does the required transformation to produce an SQL snippet that adds numberOfSeconds seconds to the dateValue.
        Overrides:
        doDateAddSecondsTransform in class DBDefinition
        Parameters:
        dateValue - dateValue
        numberOfSeconds - numberOfSeconds
        Returns:
        an SQL snippet
      • doDateAddMinutesTransform

        public String doDateAddMinutesTransform​(String dateValue,
                                                String numberOfMinutes)
        Description copied from class: DBDefinition
        Does the required transformation to produce an SQL snippet that adds numberOfMinutes minutes to the dateValue.
        Overrides:
        doDateAddMinutesTransform in class DBDefinition
        Parameters:
        dateValue - dateValue
        numberOfMinutes - numberOfMinutes
        Returns:
        an SQL snippet
      • doDateAddDaysTransform

        public String doDateAddDaysTransform​(String dateValue,
                                             String numberOfDays)
        Description copied from class: DBDefinition
        Does the required transformation to produce an SQL snippet that adds numberOfdays days to the dateValue.
        Overrides:
        doDateAddDaysTransform in class DBDefinition
        Parameters:
        dateValue - dateValue
        numberOfDays - numberOfDays
        Returns:
        an SQL snippet
      • doDateAddHoursTransform

        public String doDateAddHoursTransform​(String dateValue,
                                              String numberOfHours)
        Description copied from class: DBDefinition
        Does the required transformation to produce an SQL snippet that adds numberOfHours hours to the dateValue.
        Overrides:
        doDateAddHoursTransform in class DBDefinition
        Parameters:
        dateValue - dateValue
        numberOfHours - numberOfHours
        Returns:
        an SQL snippet
      • doDateAddWeeksTransform

        public String doDateAddWeeksTransform​(String dateValue,
                                              String numberOfWeeks)
        Description copied from class: DBDefinition
        Does the required transformation to produce an SQL snippet that adds numberOfWeeks weeks to the dateValue.
        Overrides:
        doDateAddWeeksTransform in class DBDefinition
        Parameters:
        dateValue - dateValue
        numberOfWeeks - numberOfWeeks
        Returns:
        an SQL snippet
      • doDateAddMonthsTransform

        public String doDateAddMonthsTransform​(String dateValue,
                                               String numberOfMonths)
        Description copied from class: DBDefinition
        Does the required transformation to produce an SQL snippet that adds numberOfMonths months to the dateValue.
        Overrides:
        doDateAddMonthsTransform in class DBDefinition
        Parameters:
        dateValue - dateValue
        numberOfMonths - numberOfMonths
        Returns:
        an SQL snippet
      • doDateAddYearsTransform

        public String doDateAddYearsTransform​(String dateValue,
                                              String numberOfYears)
        Description copied from class: DBDefinition
        Does the required transformation to produce an SQL snippet that adds numberOfYears years to the dateValue.
        Overrides:
        doDateAddYearsTransform in class DBDefinition
        Parameters:
        dateValue - dateValue
        numberOfYears - numberOfYears
        Returns:
        an SQL snippet
      • doInstantAddSecondsTransform

        public String doInstantAddSecondsTransform​(String dateValue,
                                                   String numberOfSeconds)
        Description copied from class: DBDefinition
        Does the required transformation to produce an SQL snippet that adds numberOfSeconds seconds to the dateValue.
        Overrides:
        doInstantAddSecondsTransform in class DBDefinition
        Parameters:
        dateValue - dateValue
        numberOfSeconds - numberOfSeconds
        Returns:
        an SQL snippet
      • doInstantAddMinutesTransform

        public String doInstantAddMinutesTransform​(String dateValue,
                                                   String numberOfMinutes)
        Description copied from class: DBDefinition
        Does the required transformation to produce an SQL snippet that adds numberOfMinutes minutes to the dateValue.
        Overrides:
        doInstantAddMinutesTransform in class DBDefinition
        Parameters:
        dateValue - dateValue
        numberOfMinutes - numberOfMinutes
        Returns:
        an SQL snippet
      • doInstantAddDaysTransform

        public String doInstantAddDaysTransform​(String dateValue,
                                                String numberOfDays)
        Description copied from class: DBDefinition
        Does the required transformation to produce an SQL snippet that adds numberOfdays days to the dateValue.
        Overrides:
        doInstantAddDaysTransform in class DBDefinition
        Parameters:
        dateValue - dateValue
        numberOfDays - numberOfDays
        Returns:
        an SQL snippet
      • doInstantAddHoursTransform

        public String doInstantAddHoursTransform​(String dateValue,
                                                 String numberOfHours)
        Description copied from class: DBDefinition
        Does the required transformation to produce an SQL snippet that adds numberOfHours hours to the dateValue.
        Overrides:
        doInstantAddHoursTransform in class DBDefinition
        Parameters:
        dateValue - dateValue
        numberOfHours - numberOfHours
        Returns:
        an SQL snippet
      • doInstantAddWeeksTransform

        public String doInstantAddWeeksTransform​(String dateValue,
                                                 String numberOfWeeks)
        Description copied from class: DBDefinition
        Does the required transformation to produce an SQL snippet that adds numberOfWeeks weeks to the dateValue.
        Overrides:
        doInstantAddWeeksTransform in class DBDefinition
        Parameters:
        dateValue - dateValue
        numberOfWeeks - numberOfWeeks
        Returns:
        an SQL snippet
      • doInstantAddMonthsTransform

        public String doInstantAddMonthsTransform​(String dateValue,
                                                  String numberOfMonths)
        Description copied from class: DBDefinition
        Does the required transformation to produce an SQL snippet that adds numberOfMonths months to the dateValue.
        Overrides:
        doInstantAddMonthsTransform in class DBDefinition
        Parameters:
        dateValue - dateValue
        numberOfMonths - numberOfMonths
        Returns:
        an SQL snippet
      • doInstantAddYearsTransform

        public String doInstantAddYearsTransform​(String dateValue,
                                                 String numberOfYears)
        Description copied from class: DBDefinition
        Does the required transformation to produce an SQL snippet that adds numberOfYears years to the dateValue.
        Overrides:
        doInstantAddYearsTransform in class DBDefinition
        Parameters:
        dateValue - dateValue
        numberOfYears - numberOfYears
        Returns:
        an SQL snippet
      • doDayDifferenceTransform

        public String doDayDifferenceTransform​(String dateValue,
                                               String otherDateValue)
        Description copied from class: DBDefinition
        Convert the 2 SQL date values into a difference in days.
        Overrides:
        doDayDifferenceTransform in class DBDefinition
        Parameters:
        dateValue - dateValue
        otherDateValue - otherDateValue
        Returns:
        SQL
      • doWeekDifferenceTransform

        public String doWeekDifferenceTransform​(String dateValue,
                                                String otherDateValue)
        Description copied from class: DBDefinition
        Convert the 2 SQL date values into a difference in days.
        Overrides:
        doWeekDifferenceTransform in class DBDefinition
        Parameters:
        dateValue - dateValue
        otherDateValue - otherDateValue
        Returns:
        SQL
      • doMonthDifferenceTransform

        public String doMonthDifferenceTransform​(String dateValue,
                                                 String otherDateValue)
        Description copied from class: DBDefinition
        Convert the 2 SQL date values into a difference in months.
        Overrides:
        doMonthDifferenceTransform in class DBDefinition
        Parameters:
        dateValue - dateValue
        otherDateValue - otherDateValue
        Returns:
        SQL
      • doYearDifferenceTransform

        public String doYearDifferenceTransform​(String dateValue,
                                                String otherDateValue)
        Description copied from class: DBDefinition
        Convert the 2 SQL date values into a difference in years.
        Overrides:
        doYearDifferenceTransform in class DBDefinition
        Parameters:
        dateValue - dateValue
        otherDateValue - otherDateValue
        Returns:
        SQL
      • doHourDifferenceTransform

        public String doHourDifferenceTransform​(String dateValue,
                                                String otherDateValue)
        Description copied from class: DBDefinition
        Convert the 2 SQL date values into a difference in hours.
        Overrides:
        doHourDifferenceTransform in class DBDefinition
        Parameters:
        dateValue - dateValue
        otherDateValue - otherDateValue
        Returns:
        SQL
      • doMinuteDifferenceTransform

        public String doMinuteDifferenceTransform​(String dateValue,
                                                  String otherDateValue)
        Description copied from class: DBDefinition
        Convert the 2 SQL date values into a difference in minutes.
        Overrides:
        doMinuteDifferenceTransform in class DBDefinition
        Parameters:
        dateValue - dateValue
        otherDateValue - otherDateValue
        Returns:
        SQL
      • doSecondDifferenceTransform

        public String doSecondDifferenceTransform​(String dateValue,
                                                  String otherDateValue)
        Description copied from class: DBDefinition
        Convert the 2 SQL date values into a difference in whole seconds.
        Overrides:
        doSecondDifferenceTransform in class DBDefinition
        Parameters:
        dateValue - dateValue
        otherDateValue - otherDateValue
        Returns:
        SQL
      • doTruncTransform

        public String doTruncTransform​(String realNumberExpression,
                                       String numberOfDecimalPlacesExpression)
        Description copied from class: DBDefinition
        Transforms 2 SQL snippets that represent a real number and a integer into a real number with the decimal places reduced to the integer.

        0 decimal places transforms the real number into an integer.

        Overrides:
        doTruncTransform in class DBDefinition
        Parameters:
        realNumberExpression - realNumberExpression
        numberOfDecimalPlacesExpression - numberOfDecimalPlacesExpression
        Returns:
        an expression that reduces the realNumberExpression to only the number of decimal places in numberOfDecimalPlacesExpression.
      • doYearTransform

        public String doYearTransform​(String dateExpression)
        Description copied from class: DBDefinition
        Transforms a SQL snippet that is assumed to be a date into an SQL snippet that provides the year part of the date.
        Overrides:
        doYearTransform in class DBDefinition
        Parameters:
        dateExpression - dateExpression
        Returns:
        a SQL snippet that will produce the year of the supplied date.
      • doMonthTransform

        public String doMonthTransform​(String dateExpression)
        Description copied from class: DBDefinition
        Transforms a SQL snippet that is assumed to be a date into an SQL snippet that provides the month part of the date.
        Overrides:
        doMonthTransform in class DBDefinition
        Parameters:
        dateExpression - dateExpression
        Returns:
        a SQL snippet that will produce the month of the supplied date.
      • doDayTransform

        public String doDayTransform​(String dateExpression)
        Description copied from class: DBDefinition
        Transforms a SQL snippet that is assumed to be a date into an SQL snippet that provides the day part of the date.

        Day in this sense is the number of the day within the month: that is the 23 part of Monday 25th of August 2014

        Overrides:
        doDayTransform in class DBDefinition
        Parameters:
        dateExpression - dateExpression
        Returns:
        a SQL snippet that will produce the day of the supplied date.
      • doHourTransform

        public String doHourTransform​(String dateExpression)
        Description copied from class: DBDefinition
        Transforms a SQL snippet that is assumed to be a date into an SQL snippet that provides the hour part of the date.
        Overrides:
        doHourTransform in class DBDefinition
        Parameters:
        dateExpression - dateExpression
        Returns:
        a SQL snippet that will produce the hour of the supplied date.
      • doMinuteTransform

        public String doMinuteTransform​(String dateExpression)
        Description copied from class: DBDefinition
        Transforms a SQL snippet that is assumed to be a date into an SQL snippet that provides the minute part of the date.
        Overrides:
        doMinuteTransform in class DBDefinition
        Parameters:
        dateExpression - dateExpression
        Returns:
        a SQL snippet that will produce the minute of the supplied date.
      • doSecondAndSubsecondTransform

        public String doSecondAndSubsecondTransform​(String dateExpression)
        Description copied from class: DBDefinition
        Transforms a SQL snippet that is assumed to be a date into an SQL snippet that provides the second part of the date.
        Overrides:
        doSecondAndSubsecondTransform in class DBDefinition
        Parameters:
        dateExpression - dateExpression
        Returns:
        a SQL snippet that will produce the second of the supplied date.
      • doSubsecondTransform

        public String doSubsecondTransform​(String dateExpression)
        Description copied from class: DBDefinition
        Returns the partial second value from the date.

        This should return the most detailed possible value less than a second for the date expression provided. It should always return a value less than 1s.

        Overrides:
        doSubsecondTransform in class DBDefinition
        Parameters:
        dateExpression - the date from which to get the subsecond part of.
        Returns:
        SQL
      • doInstantYearTransform

        public String doInstantYearTransform​(String dateExpression)
        Description copied from class: DBDefinition
        Transforms a SQL snippet that is assumed to be a date into an SQL snippet that provides the year part of the date.
        Overrides:
        doInstantYearTransform in class DBDefinition
        Parameters:
        dateExpression - dateExpression
        Returns:
        a SQL snippet that will produce the year of the supplied date.
      • doInstantMonthTransform

        public String doInstantMonthTransform​(String dateExpression)
        Description copied from class: DBDefinition
        Transforms a SQL snippet that is assumed to be a date into an SQL snippet that provides the month part of the date.
        Overrides:
        doInstantMonthTransform in class DBDefinition
        Parameters:
        dateExpression - dateExpression
        Returns:
        a SQL snippet that will produce the month of the supplied date.
      • doInstantDayTransform

        public String doInstantDayTransform​(String dateExpression)
        Description copied from class: DBDefinition
        Transforms a SQL snippet that is assumed to be a date into an SQL snippet that provides the day part of the date.

        Day in this sense is the number of the day within the month: that is the 23 part of Monday 25th of August 2014

        Overrides:
        doInstantDayTransform in class DBDefinition
        Parameters:
        dateExpression - dateExpression
        Returns:
        a SQL snippet that will produce the day of the supplied date.
      • doInstantHourTransform

        public String doInstantHourTransform​(String dateExpression)
        Description copied from class: DBDefinition
        Transforms a SQL snippet that is assumed to be a date into an SQL snippet that provides the hour part of the date.
        Overrides:
        doInstantHourTransform in class DBDefinition
        Parameters:
        dateExpression - dateExpression
        Returns:
        a SQL snippet that will produce the hour of the supplied date.
      • doInstantMinuteTransform

        public String doInstantMinuteTransform​(String dateExpression)
        Description copied from class: DBDefinition
        Transforms a SQL snippet that is assumed to be a date into an SQL snippet that provides the minute part of the date.
        Overrides:
        doInstantMinuteTransform in class DBDefinition
        Parameters:
        dateExpression - dateExpression
        Returns:
        a SQL snippet that will produce the minute of the supplied date.
      • doInstantSecondTransform

        public String doInstantSecondTransform​(String dateExpression)
        Description copied from class: DBDefinition
        Transforms a SQL snippet that is assumed to be a date into an SQL snippet that provides the second part of the date.
        Overrides:
        doInstantSecondTransform in class DBDefinition
        Parameters:
        dateExpression - dateExpression
        Returns:
        a SQL snippet that will produce the second of the supplied date.
      • doInstantSubsecondTransform

        public String doInstantSubsecondTransform​(String dateExpression)
        Description copied from class: DBDefinition
        Returns the partial second value from the date.

        This should return the most detailed possible value less than a second for the date expression provided. It should always return a value less than 1s.

        Overrides:
        doInstantSubsecondTransform in class DBDefinition
        Parameters:
        dateExpression - the date from which to get the subsecond part of.
        Returns:
        SQL
      • supportsComparingBooleanResults

        public boolean supportsComparingBooleanResults()
        Description copied from class: DBDefinition
        Indicates whether the database supports statements that compares to boolean values using EQUALS, NOT EQUALS, etc.

        If the database supports statements that resolve to "true = true", this method will return TRUE.

        Internally this method is used to allow DBvolution to alter the SQL for MS SQLServer so that DBBoolean columns can be compared like with other databases.

        Overrides:
        supportsComparingBooleanResults in class DBDefinition
        Returns:
        TRUE if this database can compare boolean values, FALSE otherwise.
      • supportsLeastOfNatively

        protected boolean supportsLeastOfNatively()
        MS SQLServer does not support the LEASTOF operation natively.

        Support DBvolution at Patreon

        Overrides:
        supportsLeastOfNatively in class DBDefinition
        Returns:
        FALSE
      • supportsGreatestOfNatively

        protected boolean supportsGreatestOfNatively()
        MS SQLServer does not support the GREATESTOF operation natively.

        Support DBvolution at Patreon

        Overrides:
        supportsGreatestOfNatively in class DBDefinition
        Returns:
        FALSE
      • supportsPurelyFunctionalGroupByColumns

        public boolean supportsPurelyFunctionalGroupByColumns()
        MS SQLServer does not support the grouping by columns that do not access table data.

        Support DBvolution at Patreon

        Overrides:
        supportsPurelyFunctionalGroupByColumns in class DBDefinition
        Returns:
        FALSE
      • doNumberToStringTransformUnsafe

        protected String doNumberToStringTransformUnsafe​(String numberExpression)
        Transforms a SQL snippet of a number expression into a character expression for this database.
        Overrides:
        doNumberToStringTransformUnsafe in class DBDefinition
        Parameters:
        numberExpression - numberExpression

        Support DBvolution at Patreon

        Returns:
        a String of the SQL required to transform the number supplied into a character or String type.
      • doIntegerToStringTransformUnsafe

        protected String doIntegerToStringTransformUnsafe​(String numberExpression)
        Transforms a SQL snippet of a integer expression into a character expression for this database.
        Overrides:
        doIntegerToStringTransformUnsafe in class DBDefinition
        Parameters:
        numberExpression - numberExpression

        Support DBvolution at Patreon

        Returns:
        a String of the SQL required to transform the number supplied into a character or String type.
      • beginWithClause

        public String beginWithClause()
        Description copied from class: DBDefinition
        The beginning of the WITH variant supported by this database.
        Overrides:
        beginWithClause in class DBDefinition
        Returns:
        "WITH RECURSIVE" by default.
      • getCurrentZonedDateTimeFunction

        protected String getCurrentZonedDateTimeFunction()
        Defines the function used to get the current timestamp from the database.
        Overrides:
        getCurrentZonedDateTimeFunction in class DBDefinition
        Returns:
        the default implementation returns " CURRENT_TIMESTAMP "
      • getCurrentDateTimeFunction

        protected String getCurrentDateTimeFunction()
        Description copied from class: DBDefinition
        Defines the function used to get the current timestamp from the database.
        Overrides:
        getCurrentDateTimeFunction in class DBDefinition
        Returns:
        the default implementation returns " CURRENT_TIMESTAMP "
      • doDayOfWeekTransform

        public String doDayOfWeekTransform​(String dateSQL)
        Description copied from class: DBDefinition
        Extracts the weekday from the date provided as a number from 1 to 7.

        Provides access to the day of the week as a number from 1 for Sunday to 7 for Saturday.

        Specified by:
        doDayOfWeekTransform in class DBDefinition
        Parameters:
        dateSQL - the date to get the day of the week for.
        Returns:
        a number between 1 and 7 for the weekday.
      • doInstantDayOfWeekTransform

        public String doInstantDayOfWeekTransform​(String dateSQL)
        Description copied from class: DBDefinition
        Extracts the weekday from the date provided as a number from 1 to 7.

        Provides access to the day of the week as a number from 1 for Sunday to 7 for Saturday.

        Specified by:
        doInstantDayOfWeekTransform in class DBDefinition
        Parameters:
        dateSQL - the date to get the day of the week for.
        Returns:
        a number between 1 and 7 for the weekday.
      • doRoundTransform

        public String doRoundTransform​(String toSQLString)
        Description copied from class: DBDefinition
        Generate the SQL to apply rounding to the Number expressions
        Overrides:
        doRoundTransform in class DBDefinition
        Parameters:
        toSQLString - the number value
        Returns:
        SQL
      • doRoundWithDecimalPlacesTransform

        public String doRoundWithDecimalPlacesTransform​(String number,
                                                        String decimalPlaces)
        Description copied from class: DBDefinition
        Generate the SQL to apply rounding to the Number expressions with the specified number of decimal places.
        Overrides:
        doRoundWithDecimalPlacesTransform in class DBDefinition
        Parameters:
        number - the number value
        decimalPlaces - the number value of the decimal places required.
        Returns:
        SQL
      • supportsArraysNatively

        public boolean supportsArraysNatively()
        Description copied from class: DBDefinition
        Indicates if the database supports ARRAYs natively and the functionality has been implemented.
        Overrides:
        supportsArraysNatively in class DBDefinition
        Returns:
        TRUE by default.
      • supportsHyperbolicFunctionsNatively

        public boolean supportsHyperbolicFunctionsNatively()
        Description copied from class: DBDefinition
        Indicates that this database supports hyperbolic functions natively.
        Overrides:
        supportsHyperbolicFunctionsNatively in class DBDefinition
        Returns:
        TRUE by default.
      • doStringToNumberTransform

        public String doStringToNumberTransform​(String stringResultContainingANumber)
        Description copied from class: DBDefinition
        Provide SQL to interpret the String value as a number.

        Full of ways to fail this is.

        Overrides:
        doStringToNumberTransform in class DBDefinition
        Parameters:
        stringResultContainingANumber - a number value to be coerced to string
        Returns:
        SQL that converts the string value into number.
      • transformToStorableType

        public DBExpression transformToStorableType​(DBExpression columnExpression)
        Description copied from class: DBDefinition
        Transform a datatype not supported by the database into a type that the database does support.

        Used mostly to turn Booleans into numbers.

        By default this method just returns the input DBExpression.

        Overrides:
        transformToStorableType in class DBDefinition
        Parameters:
        columnExpression - a column expression that might need to change type for this database
        Returns:
        The DBExpression as a DBExpression supported by the database.
      • transformToSortableType

        public DBExpression transformToSortableType​(DBExpression columnExpression)
        Description copied from class: DBDefinition
        Transform a datatype not supported by the database into a type that the database does support.

        Used mostly to turn Booleans into numbers.

        By default this method just returns the input DBExpression.

        Overrides:
        transformToSortableType in class DBDefinition
        Parameters:
        columnExpression - a column expression that might need to change type for this database
        Returns:
        The DBExpression as a DBExpression supported by the database.
      • doPoint2DEqualsTransform

        public String doPoint2DEqualsTransform​(String firstPoint,
                                               String secondPoint)
        Description copied from class: DBDefinition
        Provide the SQL to compare 2 Point2Ds
        Overrides:
        doPoint2DEqualsTransform in class DBDefinition
        Parameters:
        firstPoint - a point2d value to compare
        secondPoint - a point2d value to compare
        Returns:
        SQL
      • doPoint2DGetXTransform

        public String doPoint2DGetXTransform​(String point2D)
        Description copied from class: DBDefinition
        Provide the SQL to return the X coordinate of the Point2D
        Overrides:
        doPoint2DGetXTransform in class DBDefinition
        Parameters:
        point2D - a point2d value
        Returns:
        SQL
      • doPoint2DGetYTransform

        public String doPoint2DGetYTransform​(String point2D)
        Description copied from class: DBDefinition
        Provide the SQL to return the Y coordinate of the Point2D
        Overrides:
        doPoint2DGetYTransform in class DBDefinition
        Parameters:
        point2D - a point2d value
        Returns:
        SQL
      • doPoint2DMeasurableDimensionsTransform

        public String doPoint2DMeasurableDimensionsTransform​(String point2D)
        Description copied from class: DBDefinition
        Provide the SQL to return the dimension of the Point2D

        Point is a 0-dimensional objects for this purpose.

        Overrides:
        doPoint2DMeasurableDimensionsTransform in class DBDefinition
        Parameters:
        point2D - a point2d value
        Returns:
        SQL
      • doPoint2DGetBoundingBoxTransform

        public String doPoint2DGetBoundingBoxTransform​(String point2D)
        Description copied from class: DBDefinition
        Provide the SQL to derive the Polygon2D representing the Bounding Box of the Point2D.
        Overrides:
        doPoint2DGetBoundingBoxTransform in class DBDefinition
        Parameters:
        point2D - a point2d value
        Returns:
        SQL
      • doPoint2DAsTextTransform

        public String doPoint2DAsTextTransform​(String point2DString)
        Description copied from class: DBDefinition
        Provide the SQL to derive the WKT version of the Point2D.
        Overrides:
        doPoint2DAsTextTransform in class DBDefinition
        Parameters:
        point2DString - a point2d value
        Returns:
        SQL
      • doLine2DAsTextTransform

        public String doLine2DAsTextTransform​(String line2DSQL)
        Description copied from class: DBDefinition
        Provide the SQL to derive the WKT version of the Line2D.
        Overrides:
        doLine2DAsTextTransform in class DBDefinition
        Parameters:
        line2DSQL - a line2d value
        Returns:
        SQL
      • doLine2DGetMinYTransform

        public String doLine2DGetMinYTransform​(String toSQLString)
        Description copied from class: DBDefinition
        Generate the SQL that will return the smallest Y value within the Line2D expression.
        Overrides:
        doLine2DGetMinYTransform in class DBDefinition
        Parameters:
        toSQLString - the line2d value
        Returns:
        SQL
      • doLine2DGetMaxYTransform

        public String doLine2DGetMaxYTransform​(String toSQLString)
        Description copied from class: DBDefinition
        Generate the SQL that will return the largest Y value within the Line2D expression.
        Overrides:
        doLine2DGetMaxYTransform in class DBDefinition
        Parameters:
        toSQLString - the line2 value
        Returns:
        SQL
      • doLine2DGetMinXTransform

        public String doLine2DGetMinXTransform​(String toSQLString)
        Description copied from class: DBDefinition
        Generate the SQL that will return the smallest X value within the Line2D expression.
        Overrides:
        doLine2DGetMinXTransform in class DBDefinition
        Parameters:
        toSQLString - the line2d value
        Returns:
        SQL
      • doLine2DGetMaxXTransform

        public String doLine2DGetMaxXTransform​(String toSQLString)
        Description copied from class: DBDefinition
        Generate the SQL that will return the largest X value within the Line2D expression.
        Overrides:
        doLine2DGetMaxXTransform in class DBDefinition
        Parameters:
        toSQLString - the line2d value
        Returns:
        SQL
      • doLine2DMeasurableDimensionsTransform

        public String doLine2DMeasurableDimensionsTransform​(String toSQLString)
        Description copied from class: DBDefinition
        Create the SQL required to get the dimension of this Line2D SQL.
        Overrides:
        doLine2DMeasurableDimensionsTransform in class DBDefinition
        Parameters:
        toSQLString - the line2d value
        Returns:
        the dimension (probably 1)
      • doLine2DEqualsTransform

        public String doLine2DEqualsTransform​(String toSQLString,
                                              String toSQLString0)
        Description copied from class: DBDefinition
        Transform the 2 Line2D SQL snippets into an EQUALS comparison of the 2
        Overrides:
        doLine2DEqualsTransform in class DBDefinition
        Parameters:
        toSQLString - the first line2d value to compare
        toSQLString0 - the second line2d value to compare
        Returns:
        SQL
      • doLine2DIntersectsLine2DTransform

        public String doLine2DIntersectsLine2DTransform​(String firstLine,
                                                        String secondLine)
        Description copied from class: DBDefinition
        Generates the SQL required to find whether the 2 lines cross at any point.
        Overrides:
        doLine2DIntersectsLine2DTransform in class DBDefinition
        Parameters:
        firstLine - the first line2d value to compare
        secondLine - the second line2d value to compare
        Returns:
        an SQL expression that will evaluate to TRUE FALSE or NULL, depending on whether the lines cross at any point.
      • doLine2DIntersectionPointWithLine2DTransform

        public String doLine2DIntersectionPointWithLine2DTransform​(String firstLine,
                                                                   String secondLine)
        Description copied from class: DBDefinition
        Generate the SQL required to find the intersection point of the 2 line segment SQL expressions.
        Overrides:
        doLine2DIntersectionPointWithLine2DTransform in class DBDefinition
        Parameters:
        firstLine - the first line2d to compare
        secondLine - the second line2d to compare
        Returns:
        an SQL expression that will evaluate to the intersection point of the 2 line segments or NULL.
      • doLine2DAllIntersectionPointsWithLine2DTransform

        public String doLine2DAllIntersectionPointsWithLine2DTransform​(String firstGeometry,
                                                                       String secondGeometry)
        Description copied from class: DBDefinition
        Generate the SQL required to find the complete set of all points of intersection between the tow 2 lines.
        Overrides:
        doLine2DAllIntersectionPointsWithLine2DTransform in class DBDefinition
        Parameters:
        firstGeometry - the first line2d to compare
        secondGeometry - the second line2d to compare
        Returns:
        an SQL expression that will evaluate to the intersection point of the 2 line segments or NULL.
      • transformLineStringIntoDatabaseLine2DFormat

        public String transformLineStringIntoDatabaseLine2DFormat​(com.vividsolutions.jts.geom.LineString line)
        Description copied from class: DBDefinition
        Provide the SQL that correctly represents this LineString in this database.
        Overrides:
        transformLineStringIntoDatabaseLine2DFormat in class DBDefinition
        Parameters:
        line - a linestring to transform in to a Line2D value
        Returns:
        SQL
      • transformPoint2DIntoDatabaseFormat

        public String transformPoint2DIntoDatabaseFormat​(com.vividsolutions.jts.geom.Point point)
        Description copied from class: DBDefinition
        Provide the SQL that correctly represents this Point2D in this database.
        Overrides:
        transformPoint2DIntoDatabaseFormat in class DBDefinition
        Parameters:
        point - a point to be turned into an SQL point2d value.
        Returns:
        SQL
      • transformPolygonIntoDatabasePolygon2DFormat

        public String transformPolygonIntoDatabasePolygon2DFormat​(com.vividsolutions.jts.geom.Polygon polygon2DInWKTFormat)
        Description copied from class: DBDefinition
        Generate the SQL that will transform a WKT version of a Polygon2D into the database's version of a Polygon2D.
        Overrides:
        transformPolygonIntoDatabasePolygon2DFormat in class DBDefinition
        Parameters:
        polygon2DInWKTFormat - the polygon2d value
        Returns:
        SQL
      • transformCoordinateArrayToDatabasePolygon2DFormat

        public String transformCoordinateArrayToDatabasePolygon2DFormat​(List<String> coordinateSQL)
        Description copied from class: DBDefinition
        Override this method to provide the SQL that will create a database Polygon2D value from the list of presumed coordinates.

        Coordinates are a series of number values that are presumed to be pairs of X and Y values. That is to say the list is a list number values with no formatting other than that required to express the values as numbers.

        Overrides:
        transformCoordinateArrayToDatabasePolygon2DFormat in class DBDefinition
        Parameters:
        coordinateSQL - lots of numbers
        Returns:
        a polygon2d value
      • doPolygon2DAsTextTransform

        public String doPolygon2DAsTextTransform​(String polygonSQL)
        Description copied from class: DBDefinition
        Generates the SQL to convert the polygon to the standard text version of a polygon.
        Overrides:
        doPolygon2DAsTextTransform in class DBDefinition
        Parameters:
        polygonSQL - the polygon2d value
        Returns:
        SQL
      • doPolygon2DIntersectionTransform

        public String doPolygon2DIntersectionTransform​(String firstGeometry,
                                                       String secondGeometry)
        Description copied from class: DBDefinition
        Creates a Polygon2D representing the intersection of the Polygon2Ds.
        Overrides:
        doPolygon2DIntersectionTransform in class DBDefinition
        Parameters:
        firstGeometry - the first polygon2d value
        secondGeometry - the second polygon2d value
        Returns:
        SQL that represents a polygon of the intersection, null if there is no intersection.
      • doPolygon2DOverlapsTransform

        public String doPolygon2DOverlapsTransform​(String firstGeometry,
                                                   String secondGeometry)
        Description copied from class: DBDefinition
        Test whether the 2 polygons intersect but not contained or within.
        Overrides:
        doPolygon2DOverlapsTransform in class DBDefinition
        Parameters:
        firstGeometry - the first polygon2d value to compare
        secondGeometry - the second polygon2d value to compare
        Returns:
        SQL that is TRUE if the polygons have intersecting and non-intersecting parts.
      • doPolygon2DIntersectsTransform

        public String doPolygon2DIntersectsTransform​(String firstGeometry,
                                                     String secondGeometry)
        Description copied from class: DBDefinition
        Test whether the 2 polygons intersect.
        Overrides:
        doPolygon2DIntersectsTransform in class DBDefinition
        Parameters:
        firstGeometry - the first polygon2d value to compare
        secondGeometry - the second polygon2d value to compare
        Returns:
        SQL that returns TRUE if they intersect.
      • doPolygon2DTouchesTransform

        public String doPolygon2DTouchesTransform​(String firstGeometry,
                                                  String secondGeometry)
        Description copied from class: DBDefinition
        Tests whether the polygons touch.

        Checks that a) the polygons have at least on point in common and b) that their interiors do not overlap.

        Overrides:
        doPolygon2DTouchesTransform in class DBDefinition
        Parameters:
        firstGeometry - the first polygon2d value to compare
        secondGeometry - the second polygon2d value to compare
        Returns:
        SQL snippet
      • doPolygon2DGetAreaTransform

        public String doPolygon2DGetAreaTransform​(String toSQLString)
        Description copied from class: DBDefinition
        Retrieve the area of the polygon.
        Overrides:
        doPolygon2DGetAreaTransform in class DBDefinition
        Parameters:
        toSQLString - a polygon2D value
        Returns:
        SQL that will return the area of the Polygon2D
      • doPolygon2DGetBoundingBoxTransform

        public String doPolygon2DGetBoundingBoxTransform​(String toSQLString)
        Description copied from class: DBDefinition
        Create a simple four sided bounding for the polygon.
        Overrides:
        doPolygon2DGetBoundingBoxTransform in class DBDefinition
        Parameters:
        toSQLString - a polygon2D value
        Returns:
        the SQL required to create a bounding box for the polygon.
      • doPolygon2DEqualsTransform

        public String doPolygon2DEqualsTransform​(String firstGeometry,
                                                 String secondGeometry)
        Description copied from class: DBDefinition
        Compare 2 polygons with EQUALS.
        Overrides:
        doPolygon2DEqualsTransform in class DBDefinition
        Parameters:
        firstGeometry - the first polygon2d value to compare
        secondGeometry - the second polygon2d value to compare
        Returns:
        SQL
      • doPolygon2DContainsPolygon2DTransform

        public String doPolygon2DContainsPolygon2DTransform​(String firstGeometry,
                                                            String secondGeometry)
        Test whether the first polygon completely contains the second polygon.
        Overrides:
        doPolygon2DContainsPolygon2DTransform in class DBDefinition
        Parameters:
        firstGeometry - the first polygon2d value to compare
        secondGeometry - the second polygon2d value to compare

        Support DBvolution at Patreon

        Returns:
        SQL that is TRUE if the first polygon contains the second.
      • doPolygon2DContainsPoint2DTransform

        public String doPolygon2DContainsPoint2DTransform​(String polygon2DSQL,
                                                          String point2DSQL)
        Description copied from class: DBDefinition
        Generates the SQL to determine whether the first (polygon) argument contains the second point argument.
        Overrides:
        doPolygon2DContainsPoint2DTransform in class DBDefinition
        Parameters:
        polygon2DSQL - the polygon2d to compare with
        point2DSQL - the point2d value that might be inside the polygon2d
        Returns:
        SQL
      • doPolygon2DMeasurableDimensionsTransform

        public String doPolygon2DMeasurableDimensionsTransform​(String polygon2DSQL)
        Returns the dimension of the polygon.

        This will be "2"

        Overrides:
        doPolygon2DMeasurableDimensionsTransform in class DBDefinition
        Parameters:
        polygon2DSQL - a polygon2d value

        Support DBvolution at Patreon

        Returns:
        "2" unless something has gone horribly wrong.
      • doPolygon2DGetExteriorRingTransform

        public String doPolygon2DGetExteriorRingTransform​(String polygon2DSQL)
        Description copied from class: DBDefinition
        Defines the transformation require to transform an SQL Polygon2D into a linestring representing the exterior ring of the polygon.
        Overrides:
        doPolygon2DGetExteriorRingTransform in class DBDefinition
        Parameters:
        polygon2DSQL - a polygon2D value
        Returns:
        SQL
      • doPolygon2DGetMaxXTransform

        public String doPolygon2DGetMaxXTransform​(String polygon2DSQL)
        Description copied from class: DBDefinition
        Generate the SQL that will return the largest X value within the Polygon2D expression.
        Overrides:
        doPolygon2DGetMaxXTransform in class DBDefinition
        Parameters:
        polygon2DSQL - the polygon2d value
        Returns:
        SQL
      • doPolygon2DGetMinXTransform

        public String doPolygon2DGetMinXTransform​(String polygon2DSQL)
        Description copied from class: DBDefinition
        Generate the SQL that will return the smallest X value within the Polygon2D expression.
        Overrides:
        doPolygon2DGetMinXTransform in class DBDefinition
        Parameters:
        polygon2DSQL - the polygon2d value
        Returns:
        SQL
      • doPolygon2DGetMaxYTransform

        public String doPolygon2DGetMaxYTransform​(String polygon2DSQL)
        Description copied from class: DBDefinition
        Generate the SQL that will return the largest X value within the Polygon2D expression.
        Overrides:
        doPolygon2DGetMaxYTransform in class DBDefinition
        Parameters:
        polygon2DSQL - the polygon2d value
        Returns:
        SQL
      • doPolygon2DGetMinYTransform

        public String doPolygon2DGetMinYTransform​(String polygon2DSQL)
        Description copied from class: DBDefinition
        Generate the SQL that will return the smallest Y value within the Polygon2D expression.
        Overrides:
        doPolygon2DGetMinYTransform in class DBDefinition
        Parameters:
        polygon2DSQL - the polygon2d value
        Returns:
        SQL
      • transformDatabaseLineSegment2DValueToJTSLineSegment

        public com.vividsolutions.jts.geom.LineSegment transformDatabaseLineSegment2DValueToJTSLineSegment​(String lineSegmentAsSQL)
                                                                                                    throws com.vividsolutions.jts.io.ParseException
        Description copied from class: DBDefinition
        Convert the String object returned by the database into a JTS LineSegment object.
        Overrides:
        transformDatabaseLineSegment2DValueToJTSLineSegment in class DBDefinition
        Parameters:
        lineSegmentAsSQL - the database linesegment2d value to create a JTS LineSegment with
        Returns:
        a JTS LineSegment derived from the database's response, may be null.
        Throws:
        com.vividsolutions.jts.io.ParseException - malformed WKT will throw an exception
      • transformLineSegmentIntoDatabaseLineSegment2DFormat

        public String transformLineSegmentIntoDatabaseLineSegment2DFormat​(com.vividsolutions.jts.geom.LineSegment lineSegment)
        Description copied from class: DBDefinition
        Convert the JTS LineSegment object into a SQL expression that the database will accept as a line segment.

        By default, creates a WKT representation

        Overrides:
        transformLineSegmentIntoDatabaseLineSegment2DFormat in class DBDefinition
        Parameters:
        lineSegment - the LineSegment to convert to database format.
        Returns:
        an SQL expression that can be interpreted by the database as a line segment.
      • doLineSegment2DGetMaxXTransform

        public String doLineSegment2DGetMaxXTransform​(String toSQLString)
        Description copied from class: DBDefinition
        Generate the SQL required to find the largest X value in the line segment SQL expression.
        Overrides:
        doLineSegment2DGetMaxXTransform in class DBDefinition
        Parameters:
        toSQLString - the LineSegment2D value
        Returns:
        SQL
      • doLineSegment2DGetMinXTransform

        public String doLineSegment2DGetMinXTransform​(String toSQLString)
        Description copied from class: DBDefinition
        Generate the SQL required to find the smallest X value in the line segment SQL expression.
        Overrides:
        doLineSegment2DGetMinXTransform in class DBDefinition
        Parameters:
        toSQLString - the LineSegment2D value
        Returns:
        SQL
      • doLineSegment2DGetMaxYTransform

        public String doLineSegment2DGetMaxYTransform​(String toSQLString)
        Description copied from class: DBDefinition
        Generate the SQL required to find the largest Y value in the line segment SQL expression.
        Overrides:
        doLineSegment2DGetMaxYTransform in class DBDefinition
        Parameters:
        toSQLString - the LineSegment2D value
        Returns:
        SQL
      • doLineSegment2DGetMinYTransform

        public String doLineSegment2DGetMinYTransform​(String toSQLString)
        Description copied from class: DBDefinition
        Generate the SQL required to find the smallest Y value in the line segment SQL expression.
        Overrides:
        doLineSegment2DGetMinYTransform in class DBDefinition
        Parameters:
        toSQLString - the LineSegment2D value
        Returns:
        SQL
      • doLineSegment2DGetBoundingBoxTransform

        public String doLineSegment2DGetBoundingBoxTransform​(String toSQLString)
        Description copied from class: DBDefinition
        Generate the SQL required to the rectangular boundary that fully encloses the line segment SQL expression.
        Overrides:
        doLineSegment2DGetBoundingBoxTransform in class DBDefinition
        Parameters:
        toSQLString - the LineSegment2D value
        Returns:
        SQL
      • doLineSegment2DDimensionTransform

        public String doLineSegment2DDimensionTransform​(String toSQLString)
        Description copied from class: DBDefinition
        Generate the SQL required to find the dimension of the line segment SQL expression.
        Overrides:
        doLineSegment2DDimensionTransform in class DBDefinition
        Parameters:
        toSQLString - the LineSegment2D value
        Returns:
        SQL
      • doLineSegment2DNotEqualsTransform

        public String doLineSegment2DNotEqualsTransform​(String toSQLString,
                                                        String toSQLString0)
        Description copied from class: DBDefinition
        Generate the SQL required to find whether the 2 line segment SQL expressions are NOT equal.
        Overrides:
        doLineSegment2DNotEqualsTransform in class DBDefinition
        Parameters:
        toSQLString - the first LineSegment2D value
        toSQLString0 - the second LineSegment2D value
        Returns:
        SQL
      • doLineSegment2DEqualsTransform

        public String doLineSegment2DEqualsTransform​(String toSQLString,
                                                     String toSQLString0)
        Description copied from class: DBDefinition
        Generate the SQL required to find whether the 2 line segment SQL expressions are equal.
        Overrides:
        doLineSegment2DEqualsTransform in class DBDefinition
        Parameters:
        toSQLString - the first LineSegment2D value
        toSQLString0 - the second LineSegment2D value
        Returns:
        SQL
      • doLineSegment2DAsTextTransform

        public String doLineSegment2DAsTextTransform​(String toSQLString)
        Description copied from class: DBDefinition
        Generate the SQL required to convert the line segment SQL expression into the WKT string format.
        Overrides:
        doLineSegment2DAsTextTransform in class DBDefinition
        Parameters:
        toSQLString - the LineSegment2D value
        Returns:
        SQL
      • doLineSegment2DIntersectionPointWithLineSegment2DTransform

        public String doLineSegment2DIntersectionPointWithLineSegment2DTransform​(String firstLineSegment,
                                                                                 String secondLineSegment)
        Description copied from class: DBDefinition
        Generate the SQL required to find the intersection point of the 2 line segment SQL expressions.
        Overrides:
        doLineSegment2DIntersectionPointWithLineSegment2DTransform in class DBDefinition
        Parameters:
        firstLineSegment - the first LineSegment2D value
        secondLineSegment - the second LineSegment2D value
        Returns:
        an SQL expression that will evaluate to the intersection point of the 2 line segments or NULL.
      • transformMultiPoint2DToDatabaseMultiPoint2DValue

        public String transformMultiPoint2DToDatabaseMultiPoint2DValue​(com.vividsolutions.jts.geom.MultiPoint points)
        Description copied from class: DBDefinition
        Provide the SQL that correctly represents this MultiPoint2D value in this database.
        Overrides:
        transformMultiPoint2DToDatabaseMultiPoint2DValue in class DBDefinition
        Parameters:
        points - the MultiPoint2D value
        Returns:
        SQL
      • transformDatabaseMultiPoint2DValueToJTSMultiPoint

        public com.vividsolutions.jts.geom.MultiPoint transformDatabaseMultiPoint2DValueToJTSMultiPoint​(String pointsAsString)
                                                                                                 throws com.vividsolutions.jts.io.ParseException
        Description copied from class: DBDefinition
        Convert the database's string representation of a MultiPoint2D value into a MultiPoint..
        Overrides:
        transformDatabaseMultiPoint2DValueToJTSMultiPoint in class DBDefinition
        Parameters:
        pointsAsString - the MultiPoint2D value to create a JTS MultiPoint with.
        Returns:
        the MultiPoint2D as a JTS MultiPoint instance
        Throws:
        com.vividsolutions.jts.io.ParseException - malformed WKT values will throw an exception
      • doMultiPoint2DEqualsTransform

        public String doMultiPoint2DEqualsTransform​(String first,
                                                    String second)
        Description copied from class: DBDefinition
        Provide the SQL to compare 2 MultiPoint2Ds using the equivalent of EQUALS.
        Overrides:
        doMultiPoint2DEqualsTransform in class DBDefinition
        Parameters:
        first - the first MultiPoint2D value to compare
        second - the second MultiPoint2D value to compare
        Returns:
        SQL
      • doMultiPoint2DGetPointAtIndexTransform

        public String doMultiPoint2DGetPointAtIndexTransform​(String first,
                                                             String index)
        Description copied from class: DBDefinition
        Provide the SQL to get point at the supplied index within the MultiPoint2D
        Overrides:
        doMultiPoint2DGetPointAtIndexTransform in class DBDefinition
        Parameters:
        first - the first MultiPoint2D value to retrieve a point from.
        index - the index at which the required point is at.
        Returns:
        SQL
      • doMultiPoint2DGetBoundingBoxTransform

        public String doMultiPoint2DGetBoundingBoxTransform​(String first)
        Description copied from class: DBDefinition
        Provides the SQL the derive the bounding box containing all the points in the MultiPoint2D value.
        Overrides:
        doMultiPoint2DGetBoundingBoxTransform in class DBDefinition
        Parameters:
        first - the MultiPoint2D value
        Returns:
        SQL
      • doMultiPoint2DAsTextTransform

        public String doMultiPoint2DAsTextTransform​(String first)
        Description copied from class: DBDefinition
        Provides the SQL the transform the MultiPoint2D value into a WKT value.
        Overrides:
        doMultiPoint2DAsTextTransform in class DBDefinition
        Parameters:
        first - the MultiPoint2D value
        Returns:
        SQL
      • doMultiPoint2DGetMinYTransform

        public String doMultiPoint2DGetMinYTransform​(String first)
        Description copied from class: DBDefinition
        Provides the SQL that will derive the smallest Y value of all the points in the MultiPoint2D value
        Overrides:
        doMultiPoint2DGetMinYTransform in class DBDefinition
        Parameters:
        first - the MultiPoint2D value
        Returns:
        SQL
      • doMultiPoint2DGetMinXTransform

        public String doMultiPoint2DGetMinXTransform​(String first)
        Description copied from class: DBDefinition
        Provides the SQL that will derive the smallest X value of all the points in the MultiPoint2D value
        Overrides:
        doMultiPoint2DGetMinXTransform in class DBDefinition
        Parameters:
        first - the MultiPoint2D value
        Returns:
        SQL
      • doMultiPoint2DGetMaxYTransform

        public String doMultiPoint2DGetMaxYTransform​(String first)
        Description copied from class: DBDefinition
        Provides the SQL that will derive the largest Y value of all the points in the MultiPoint2D value
        Overrides:
        doMultiPoint2DGetMaxYTransform in class DBDefinition
        Parameters:
        first - the MultiPoint2D value
        Returns:
        SQL
      • doMultiPoint2DGetMaxXTransform

        public String doMultiPoint2DGetMaxXTransform​(String first)
        Description copied from class: DBDefinition
        Provides the SQL that will derive the largest X value of all the points in the MultiPoint2D value
        Overrides:
        doMultiPoint2DGetMaxXTransform in class DBDefinition
        Parameters:
        first - the MultiPoint2D value
        Returns:
        SQL
      • getTrueValue

        public String getTrueValue()
        Description copied from class: DBDefinition
        The value used for TRUE boolean values.

        The default method returns " TRUE ".

        Overrides:
        getTrueValue in class DBDefinition
        Returns:
        " TRUE "
      • getFalseValue

        public String getFalseValue()
        Description copied from class: DBDefinition
        The value used for FALSE boolean values.

        The default method returns " FALSE ".

        Overrides:
        getFalseValue in class DBDefinition
        Returns:
        " FALSE "
      • getRoundUpFunctionName

        public String getRoundUpFunctionName()
        Return the function name for the RoundUp function.

        For MS SQLServer this method returns ceiling

        Support DBvolution at Patreon

        Overrides:
        getRoundUpFunctionName in class DBDefinition
        Returns:
        the name of the function to use when rounding numbers up
      • getNaturalLogFunctionName

        public String getNaturalLogFunctionName()
        Return the function name for the Natural Logarithm function.

        For SQLServer this method returns log

        Support DBvolution at Patreon

        Overrides:
        getNaturalLogFunctionName in class DBDefinition
        Returns:
        the name of the function to use when rounding numbers up
      • getLogBase10FunctionName

        public String getLogBase10FunctionName()
        Return the function name for the Logarithm Base10 function.

        By default this method returns log10

        Support DBvolution at Patreon

        Overrides:
        getLogBase10FunctionName in class DBDefinition
        Returns:
        the name of the function to use when rounding numbers up
      • doRandomNumberTransform

        public String doRandomNumberTransform()
        Returns the required code to generate a random number.

        For each call of this method a new random number is generated.

        This method DOES NOT use the SQLServer built-in function as it does not produce a different result for different rows in a single query.

        Support DBvolution at Patreon

        Overrides:
        doRandomNumberTransform in class DBDefinition
        Returns:
        random number generating code