Skip to content

Commit d999b73

Browse files
committed
odbc: Minor improvements for bcp test
Simplify queries to cleanup tables. Check return setting SQL_COPT_SS_BCP attribute. Avoid truncation for DATETIME2, more compatible with MS driver. Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
1 parent f42360d commit d999b73

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/odbc/unittests/bcp.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ static int tds_version;
6060
static void
6161
cleanup(void)
6262
{
63-
odbc_command("if exists (select 1 from sysobjects where type = 'U' and name = 'all_types_bcp_unittest') drop table all_types_bcp_unittest");
64-
odbc_command("if exists (select 1 from sysobjects where type = 'U' and name = 'special_types_bcp_unittest') drop table special_types_bcp_unittest");
63+
odbc_command("if object_id('all_types_bcp_unittest') is not null drop table all_types_bcp_unittest");
64+
odbc_command("if object_id('special_types_bcp_unittest') is not null drop table special_types_bcp_unittest");
6565
}
6666

6767
static void
@@ -238,7 +238,7 @@ test_bind(int prefixlen)
238238
static void
239239
set_attr(void)
240240
{
241-
SQLSetConnectAttr(odbc_conn, SQL_COPT_SS_BCP, (SQLPOINTER)SQL_BCP_ON, 0);
241+
CHKSetConnectAttr(SQL_COPT_SS_BCP, (SQLPOINTER)SQL_BCP_ON, 0, "S");
242242
}
243243

244244
static void
@@ -357,7 +357,7 @@ special_inserts(void)
357357
timestamp.hour = 15;
358358
timestamp.minute = 26;
359359
timestamp.second = 53;
360-
timestamp.fraction = 589793238;
360+
timestamp.fraction = 589793000;
361361
memset(&numeric, 0, sizeof(numeric));
362362
numeric.precision = 19;
363363
numeric.scale = 6;

0 commit comments

Comments
 (0)