use of com.microsoft.sqlserver.testframework.sqlType.SqlDate in project mssql-jdbc by Microsoft.
the class Utils method types.
/**
* @return
*/
public static ArrayList<SqlType> types() {
if (null == types) {
types = new ArrayList<>();
types.add(new SqlInt());
types.add(new SqlSmallInt());
types.add(new SqlTinyInt());
types.add(new SqlBit());
types.add(new SqlDateTime());
types.add(new SqlSmallDateTime());
types.add(new SqlDecimal());
types.add(new SqlNumeric());
types.add(new SqlReal());
types.add(new SqlFloat());
types.add(new SqlMoney());
types.add(new SqlSmallMoney());
types.add(new SqlVarChar());
types.add(new SqlChar());
// types.add(new SqlText());
types.add(new SqlBinary());
types.add(new SqlVarBinary());
// types.add(new SqlImage());
// types.add(new SqlTimestamp());
types.add(new SqlNVarChar());
types.add(new SqlNChar());
// types.add(new SqlNText());
// types.add(new SqlGuid());
types.add(new SqlBigInt());
// types.add(new SqlVariant(this));
// 9.0 types
types.add(new SqlVarCharMax());
types.add(new SqlNVarCharMax());
types.add(new SqlVarBinaryMax());
// types.add(new SqlXml());
// 10.0 types
types.add(new SqlDate());
types.add(new SqlDateTime2());
types.add(new SqlTime());
types.add(new SqlDateTimeOffset());
}
return types;
}
use of com.microsoft.sqlserver.testframework.sqlType.SqlDate in project mssql-jdbc by Microsoft.
the class TVPWithSqlVariantTest method testDate.
/**
* Test with date value
*
* @throws SQLException
* @throws SQLTimeoutException
*/
@Test
public void testDate() throws SQLException {
SqlDate sqlDate = new SqlDate();
Date date = (Date) sqlDate.createdata();
tvp = new SQLServerDataTable();
tvp.addColumnMetadata("c1", microsoft.sql.Types.SQL_VARIANT);
tvp.addRow(date);
pstmt = (SQLServerPreparedStatement) connection.prepareStatement("INSERT INTO " + destTable + " select * from ? ;");
pstmt.setStructured(1, tvpName, tvp);
pstmt.execute();
if (null != pstmt) {
pstmt.close();
}
rs = (SQLServerResultSet) stmt.executeQuery("SELECT * FROM " + destTable);
while (rs.next()) {
// TODO: GetDate has issues
assertEquals(rs.getString(1), "" + date);
}
}
Aggregations