Class MsSqlUtilities
- java.lang.Object
-
- jetbrains.buildServer.serverSide.db.mssql.MsSqlUtilities
-
public final class MsSqlUtilities extends Object
Utilities specific to the MS SQL Server.
- Since:
- 10.0.3
- Author:
- Andrey Shcheglov <mailto:andrey.shcheglov@jetbrains.com>
-
-
Field Summary
Fields Modifier and Type Field Description static String
DRIVER_CLASS_NAME
MS SQL Server JDBC driver class name (""com.microsoft.sqlserver.jdbc.SQLServerDriver"").static AtomicBoolean
SERVER_TOO_OLD_LOGGED
Whether log message about MS SQL Server being too old for the JDBC driver currently used has already been issued.static int
TYPE_DATETIME
The internal type code representingDATETIME
.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Version
getDriverVersion(ClassLoader loader)
Returns the exact MS JDBC Driver version before a database connection is established and its metadata becomes available.static String
newMultiRowInsertWithSubquerySql(String tableName, List<TableFieldDef> fields, int bulkRows)
Builds a new multi-rowINSERT
SQL using theINSERT INTO ... SELECT
(INSERT
with sub-query) syntax (for Microsoft SQL Server 2005 (9.0) and earlier versions):
-
-
-
Field Detail
-
DRIVER_CLASS_NAME
@NotNull public static final String DRIVER_CLASS_NAME
MS SQL Server JDBC driver class name (""com.microsoft.sqlserver.jdbc.SQLServerDriver"").
- See Also:
- Constant Field Values
-
TYPE_DATETIME
public static final int TYPE_DATETIME
The internal type code representing
DATETIME
.- Since:
- 2017.1.4
- See Also:
- microsoft.sql.Types, Constant Field Values
-
SERVER_TOO_OLD_LOGGED
@NotNull public static final AtomicBoolean SERVER_TOO_OLD_LOGGED
Whether log message about MS SQL Server being too old for the JDBC driver currently used has already been issued. Applies to the driver version 6.0+ being used to access MS SQL Server 2005 or older.
- Since:
- 2017.1.4
- See Also:
- Wrong jdbc type for datetime column
-
-
Method Detail
-
getDriverVersion
@NotNull public static Version getDriverVersion(@NotNull ClassLoader loader) throws ClassNotFoundException
Returns the exact MS JDBC Driver version before a database connection is established and its metadata becomes available.
- Parameters:
loader
- the classloader that was used to load the JDBC driver class.- Returns:
- the exact MS JDBC Driver version.
- Throws:
ClassNotFoundException
- if MS JDBC Driver is not in the class path.
-
newMultiRowInsertWithSubquerySql
@NotNull public static String newMultiRowInsertWithSubquerySql(@NotNull String tableName, @NotNull List<TableFieldDef> fields, @Nonnegative int bulkRows)
Builds a new multi-row
INSERT
SQL using theINSERT INTO ... SELECT
(INSERT
with sub-query) syntax (for Microsoft SQL Server 2005 (9.0) and earlier versions):insert into downloaded_artifacts (target_build_id, source_build_id, download_timestamp, artifact_path) select ?, ?, ?, ? union all select ?, ?, ?, ? union all select ?, ?, ?, ?
- Parameters:
tableName
- the name of the table.fields
- the fields of the table which will be affected by the query.bulkRows
- the number of rows being inserted.- Returns:
- the SQL query built.
- Since:
- 2017.1.3
- See Also:
OracleUtilities.newMultiRowInsertWithSubquerySql(String, List, int, boolean)
-
-