Class MssqlAdapter

    • Constructor Detail

      • MssqlAdapter

        protected MssqlAdapter()
        Empty constructor.
    • Method Detail

      • toUpperCase

        public String toUpperCase​(String in)
        This method is used to ignore case.
        Specified by:
        toUpperCase in interface Adapter
        Specified by:
        toUpperCase in class AbstractAdapter
        Parameters:
        in - The string to transform to upper case.
        Returns:
        The upper case string.
      • ignoreCase

        public String ignoreCase​(String in)
        This method is used to ignore case.
        Specified by:
        ignoreCase in interface Adapter
        Specified by:
        ignoreCase in class AbstractAdapter
        Parameters:
        in - The string whose case to ignore.
        Returns:
        The string in a case that can be ignored.
      • getUpdateLockClause

        public String getUpdateLockClause()
        Returns the clause which acquires a write lock on a row when doing a select.
        Specified by:
        getUpdateLockClause in interface Adapter
        Overrides:
        getUpdateLockClause in class AbstractAdapter
        Returns:
        the SQL clause to acquire a write lock. This implementation returns "WITH (UPDLOCK)";
      • unlockTable

        public void unlockTable​(Connection con,
                                String table)
                         throws SQLException
        Tries to unlock the specified table. This implementation does nothing as tables in MSSQL are unlocked when a commit or rollback is issued. This has unintended side effects, as well as we do not know whether to use commit or rollback. The lock will go away automatically when the transaction is ended.
        Specified by:
        unlockTable in interface Adapter
        Specified by:
        unlockTable in class AbstractAdapter
        Parameters:
        con - The JDBC connection to use.
        table - The name of the table to unlock.
        Throws:
        SQLException - No Statement could be created or executed.
      • supportsNativeOffset

        public boolean supportsNativeOffset()
        Returns whether the database natively supports returning results starting at an offset position other than 0. Return false for MSSQL
        Specified by:
        supportsNativeOffset in interface Adapter
        Overrides:
        supportsNativeOffset in class AbstractAdapter
        Returns:
        true if the database natively supports returning results starting at an offset position other than 0.
      • generateLimits

        public void generateLimits​(Query query,
                                   long offset,
                                   int limit)
                            throws TorqueException
        Modify a query to add limit and offset values for MSSQL.
        Specified by:
        generateLimits in interface Adapter
        Overrides:
        generateLimits in class AbstractAdapter
        Parameters:
        query - The query to modify
        offset - the offset Value
        limit - the limit Value
        Throws:
        TorqueException - if any error occurs when building the query
      • escapeText

        public boolean escapeText()
        Determines whether backslashes (\) should be escaped in explicit SQL strings. If true is returned, a BACKSLASH will be changed to "\\". If false is returned, a BACKSLASH will be left as "\". Sybase (and MSSQL) doesn't define a default escape character, so false is returned.
        Specified by:
        escapeText in interface Adapter
        Overrides:
        escapeText in class AbstractAdapter
        Returns:
        false
        See Also:
        Adapter.escapeText()
      • useEscapeClauseForLike

        public boolean useEscapeClauseForLike()
        Whether an escape clause in like should be used. Example : select * from AUTHOR where AUTHOR.NAME like '\_%' ESCAPE '\'; MSSQL needs this, so this implementation always returns true.
        Specified by:
        useEscapeClauseForLike in interface Adapter
        Overrides:
        useEscapeClauseForLike in class AbstractAdapter
        Returns:
        whether the escape clause should be appended or not.