Skip to content

Commit

Permalink
Merge pull request #168 from v-afrafi/lobs_tests
Browse files Browse the repository at this point in the history
Lobs tests
  • Loading branch information
v-nisidh authored Mar 10, 2017
2 parents 89bf9f8 + 4d6baa0 commit 171c8e8
Show file tree
Hide file tree
Showing 34 changed files with 1,729 additions and 59 deletions.
593 changes: 593 additions & 0 deletions src/test/java/com/microsoft/sqlserver/jdbc/unit/lobs/lobsTest.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
/**
/*
* Microsoft JDBC Driver for SQL Server
*
* Copyright(c) 2016 Microsoft Corporation All rights reserved.
*
* This program is made available under the terms of the MIT License. See the LICENSE file in the project root for more information.
*/
package com.microsoft.sqlserver.testframework;

Expand All @@ -9,7 +13,7 @@
import java.sql.SQLException;

/**
* @author v-afrafi
* Wrapper class CallableStatement
*
*/
public class DBCallableStatement extends AbstractParentWrapper{
Expand Down Expand Up @@ -66,4 +70,4 @@ public void registerOutParameter(int index, int sqltype) throws SQLException

}

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/*
* Microsoft JDBC Driver for SQL Server
*
* Copyright(c) 2016 Microsoft Corporation All rights reserved.
*
* This program is made available under the terms of the MIT License. See the LICENSE file in the project root for more information.
*/
package com.microsoft.sqlserver.testframework;

import java.util.BitSet;

public class DBCoercion {
Class type = null;
protected BitSet flags = new BitSet();
protected String name = null;
// Flags

public static final int GET = 1;
public static final int UPDATE = 2;
public static final int SET = 3;
public static final int SETOBJECT = 4;
public static final int REG = 5;
public static final int GETPARAM = 6;
public static final int UPDATEOBJECT = 7;
public static final int ALL = 8;

public static final int STREAM = 9;
public static final int CHAR = 10;
public static final int NCHAR = 11;
public static final int ASCII = 12;

/**
*
* @param type
*/
public DBCoercion(Class type) {
this(type, new int[] {GET});
}

/**
*
* @param type
* @param tempflags
*/
public DBCoercion(Class type,
int[] tempflags) {
name = type.toString();
type = type;
for (int i = 0; i < tempflags.length; i++)
flags.set(tempflags[i]);
}

/**
* @return type
*/
public Class type() {
return type;
}

/**
* @return
*/
public BitSet flags() {
return flags;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Microsoft JDBC Driver for SQL Server
*
* Copyright(c) 2016 Microsoft Corporation All rights reserved.
*
* This program is made available under the terms of the MIT License. See the LICENSE file in the project root for more information.
*/
package com.microsoft.sqlserver.testframework;

import java.util.ArrayList;

/**
* DBCoercions
*
*/
public class DBCoercions extends DBItems {

/**
* constructor
*/
public DBCoercions() {
coercionsList = new ArrayList<DBCoercion>();
}

public DBCoercions(DBCoercion coercion) {
this.add(coercion);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
/**
* This class holds data for Column. Think about encrypted columns. <B>createCMK code should not add here.</B>
*/
class DBColumn {
public class DBColumn {

/*
* TODO: add nullable, defaultValue, alwaysEncrypted
Expand All @@ -35,7 +35,7 @@ class DBColumn {
/**
* @return the columnName
*/
String getColumnName() {
public String getColumnName() {
return columnName;
}

Expand All @@ -51,7 +51,7 @@ void setColumnName(String columnName) {
*
* @return SqlType for the column
*/
SqlType getSqlType() {
public SqlType getSqlType() {
return sqlType;
}

Expand Down Expand Up @@ -93,4 +93,4 @@ Object getRowValue(int row) {
return columnValues.get(row);
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import java.sql.DatabaseMetaData;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

import com.microsoft.sqlserver.jdbc.SQLServerConnection;
import com.microsoft.sqlserver.jdbc.SQLServerException;
Expand Down Expand Up @@ -116,6 +115,26 @@ public DBPreparedStatement prepareStatement(String query) throws SQLException {
return dbpstmt.prepareStatement(query);
}

/**
*
* @param query
* @param type
* @param concurrency
* @return
* @throws SQLException
*/
public DBPreparedStatement prepareStatement(String query,
int type,
int concurrency) throws SQLException {
// Static for fast-forward, limited settings
if ((type == ResultSet.TYPE_FORWARD_ONLY || type == ResultSet.TYPE_SCROLL_INSENSITIVE))
concurrency = ResultSet.CONCUR_READ_ONLY;

DBPreparedStatement dbpstmt = new DBPreparedStatement(this);

return dbpstmt.prepareStatement(query, type, concurrency);
}

/**
* close connection
*/
Expand Down Expand Up @@ -188,6 +207,7 @@ public DBCallableStatement prepareCall(String query) throws SQLException {

/**
* Retrieve server version
*
* @return server version
* @throws Exception
*/
Expand Down Expand Up @@ -225,4 +245,4 @@ public double getServerVersion() throws Exception {
return serverversion;
}

}
}
Loading

0 comments on commit 171c8e8

Please sign in to comment.