Package org.apache.torque.adapter
Klasse MssqlAdapter
java.lang.Object
org.apache.torque.adapter.AbstractAdapter
org.apache.torque.adapter.MssqlAdapter
- Alle implementierten Schnittstellen:
Serializable
,Adapter
This is used to connect to a MSSQL database.
This is tested with the jtds driver from sourceforge.
- Version:
- $Id: MssqlAdapter.java 1848527 2018-12-09 16:27:22Z tv $
- Autor:
- Gonzalo Diethelm
- Siehe auch:
-
Feldübersicht
Von Schnittstelle geerbte Felder org.apache.torque.adapter.Adapter
ADAPTER_KEY, AUTODETECT_ADAPTER, DRIVER_KEY
-
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungboolean
Determines whether backslashes (\) should be escaped in explicit SQL strings.void
generateLimits
(Query query, long offset, int limit) Modify a query to add limit and offset values for MSSQL.getIDMethodSQL
(Object unused) Returns the last value from an identity column (available on a per-session basis from the global variable@@identity
).Returns the constant from theIDMethod
interface denoting which type of primary key generation method this type of RDBMS uses.Returns the clause which acquires a write lock on a row when doing a select.ignoreCase
(String in) This method is used to ignore case.void
lockTable
(Connection con, String table) Locks the specified table.boolean
Returns whether the database natively supports returning results starting at an offset position other than 0.toUpperCase
(String in) This method is used to ignore case.void
unlockTable
(Connection con, String table) Tries to unlock the specified table.boolean
Whether an escape clause in like should be used.Von Klasse geerbte Methoden org.apache.torque.adapter.AbstractAdapter
getStringDelimiter, ignoreCaseInOrderBy, setCapabilities, supportsNativeLimit, useGetGeneratedKeys, useIlike, useMinusForExcept
-
Konstruktordetails
-
MssqlAdapter
protected MssqlAdapter()Empty constructor.
-
-
Methodendetails
-
toUpperCase
This method is used to ignore case.- Angegeben von:
toUpperCase
in SchnittstelleAdapter
- Angegeben von:
toUpperCase
in KlasseAbstractAdapter
- Parameter:
in
- The string to transform to upper case.- Gibt zurück:
- The upper case string.
-
ignoreCase
This method is used to ignore case.- Angegeben von:
ignoreCase
in SchnittstelleAdapter
- Angegeben von:
ignoreCase
in KlasseAbstractAdapter
- Parameter:
in
- The string whose case to ignore.- Gibt zurück:
- The string in a case that can be ignored.
-
getIDMethodType
Beschreibung aus Klasse kopiert:AbstractAdapter
Returns the constant from theIDMethod
interface denoting which type of primary key generation method this type of RDBMS uses.- Angegeben von:
getIDMethodType
in SchnittstelleAdapter
- Angegeben von:
getIDMethodType
in KlasseAbstractAdapter
- Gibt zurück:
- IDMethod constant
- Siehe auch:
-
getIDMethodSQL
Returns the last value from an identity column (available on a per-session basis from the global variable@@identity
).- Angegeben von:
getIDMethodSQL
in SchnittstelleAdapter
- Angegeben von:
getIDMethodSQL
in KlasseAbstractAdapter
- Parameter:
unused
- Information used for key generation.- Gibt zurück:
- The most recently inserted database key.
- Siehe auch:
-
getUpdateLockClause
Returns the clause which acquires a write lock on a row when doing a select.- Angegeben von:
getUpdateLockClause
in SchnittstelleAdapter
- Setzt außer Kraft:
getUpdateLockClause
in KlasseAbstractAdapter
- Gibt zurück:
- the SQL clause to acquire a write lock. This implementation returns "WITH (UPDLOCK)";
-
lockTable
Locks the specified table.- Angegeben von:
lockTable
in SchnittstelleAdapter
- Angegeben von:
lockTable
in KlasseAbstractAdapter
- Parameter:
con
- The JDBC connection to use.table
- The name of the table to lock.- Löst aus:
SQLException
- No Statement could be created or executed.
-
unlockTable
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.- Angegeben von:
unlockTable
in SchnittstelleAdapter
- Angegeben von:
unlockTable
in KlasseAbstractAdapter
- Parameter:
con
- The JDBC connection to use.table
- The name of the table to unlock.- Löst aus:
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- Angegeben von:
supportsNativeOffset
in SchnittstelleAdapter
- Setzt außer Kraft:
supportsNativeOffset
in KlasseAbstractAdapter
- Gibt zurück:
- true if the database natively supports returning results starting at an offset position other than 0.
-
generateLimits
Modify a query to add limit and offset values for MSSQL.- Angegeben von:
generateLimits
in SchnittstelleAdapter
- Setzt außer Kraft:
generateLimits
in KlasseAbstractAdapter
- Parameter:
query
- The query to modifyoffset
- the offset Valuelimit
- the limit Value- Löst aus:
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.- Angegeben von:
escapeText
in SchnittstelleAdapter
- Setzt außer Kraft:
escapeText
in KlasseAbstractAdapter
- Gibt zurück:
- false
- Siehe auch:
-
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 returnstrue
.- Angegeben von:
useEscapeClauseForLike
in SchnittstelleAdapter
- Setzt außer Kraft:
useEscapeClauseForLike
in KlasseAbstractAdapter
- Gibt zurück:
- whether the escape clause should be appended or not.
-