Skip to content

Commit d35ae29

Browse files
authored
DSN parameter: support for "index_include_frozen" (#151)
* C2SQL conversion tests: new class fn for requests Introduce new ConnectedDBC class member function to validate the generated request; thus removing code duplication in tests and allowing for easier change of the request format when introducing new request settings. * use JSON keys defined in driver for unit testing Form the expected JSON request using the same defs as used in the driver. * introduce new "index_include_frozen" request param Introduce new request setting "to allow all queries inside one connection to include frozen indices. If [false], the user would have to manually mention this through INCLUDE FROZEN and FROZEN".
1 parent b58692e commit d35ae29

16 files changed

+213
-842
lines changed

driver/connect.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1308,6 +1308,10 @@ SQLRETURN config_dbc(esodbc_dbc_st *dbc, esodbc_dsn_attrs_st *attrs)
13081308
dbc->mfield_lenient = wstr2bool(&attrs->mfield_lenient);
13091309
INFOH(dbc, "multifield lenient: %s.",
13101310
dbc->mfield_lenient ? "true" : "false");
1311+
/* "index include frozen" param */
1312+
dbc->idx_inc_frozen = wstr2bool(&attrs->idx_inc_frozen);
1313+
INFOH(dbc, "index include frozen: %s.",
1314+
dbc->idx_inc_frozen ? "true" : "false");
13111315
/* auto escape pattern value argument */
13121316
dbc->auto_esc_pva = wstr2bool(&attrs->auto_esc_pva);
13131317
INFOH(dbc, "auto escape PVA: %s.", dbc->auto_esc_pva ? "true" : "false");

driver/defs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@
178178
#define ESODBC_DEF_VERSION_CHECKING ESODBC_DSN_VC_STRICT
179179
#define ESODBC_DEF_MFIELD_LENIENT "true"
180180
#define ESODBC_DEF_ESC_PVA "true"
181+
#define ESODBC_DEF_IDX_INC_FROZEN "false"
181182

182183
/*
183184
*

driver/dsn.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ int assign_dsn_attr(esodbc_dsn_attrs_st *attrs,
7979
{&MK_WSTR(ESODBC_DSN_VERSION_CHECKING), &attrs->version_checking},
8080
{&MK_WSTR(ESODBC_DSN_MFIELD_LENIENT), &attrs->mfield_lenient},
8181
{&MK_WSTR(ESODBC_DSN_ESC_PVA), &attrs->auto_esc_pva},
82+
{&MK_WSTR(ESODBC_DSN_IDX_INC_FROZEN), &attrs->idx_inc_frozen},
8283
{&MK_WSTR(ESODBC_DSN_TRACE_ENABLED), &attrs->trace_enabled},
8384
{&MK_WSTR(ESODBC_DSN_TRACE_FILE), &attrs->trace_file},
8485
{&MK_WSTR(ESODBC_DSN_TRACE_LEVEL), &attrs->trace_level},
@@ -412,6 +413,7 @@ long TEST_API write_00_list(esodbc_dsn_attrs_st *attrs,
412413
{&MK_WSTR(ESODBC_DSN_VERSION_CHECKING), &attrs->version_checking},
413414
{&MK_WSTR(ESODBC_DSN_MFIELD_LENIENT), &attrs->mfield_lenient},
414415
{&MK_WSTR(ESODBC_DSN_ESC_PVA), &attrs->auto_esc_pva},
416+
{&MK_WSTR(ESODBC_DSN_IDX_INC_FROZEN), &attrs->idx_inc_frozen},
415417
{&MK_WSTR(ESODBC_DSN_TRACE_ENABLED), &attrs->trace_enabled},
416418
{&MK_WSTR(ESODBC_DSN_TRACE_FILE), &attrs->trace_file},
417419
{&MK_WSTR(ESODBC_DSN_TRACE_LEVEL), &attrs->trace_level},
@@ -686,6 +688,11 @@ BOOL write_system_dsn(esodbc_dsn_attrs_st *new_attrs,
686688
&new_attrs->auto_esc_pva,
687689
old_attrs ? &old_attrs->auto_esc_pva : NULL
688690
},
691+
{
692+
&MK_WSTR(ESODBC_DSN_IDX_INC_FROZEN),
693+
&new_attrs->idx_inc_frozen,
694+
old_attrs ? &old_attrs->idx_inc_frozen : NULL
695+
},
689696
{
690697
&MK_WSTR(ESODBC_DSN_TRACE_ENABLED), &new_attrs->trace_enabled,
691698
old_attrs ? &old_attrs->trace_enabled : NULL
@@ -776,6 +783,7 @@ long TEST_API write_connection_string(esodbc_dsn_attrs_st *attrs,
776783
{&attrs->version_checking, &MK_WSTR(ESODBC_DSN_VERSION_CHECKING)},
777784
{&attrs->mfield_lenient, &MK_WSTR(ESODBC_DSN_MFIELD_LENIENT)},
778785
{&attrs->auto_esc_pva, &MK_WSTR(ESODBC_DSN_ESC_PVA)},
786+
{&attrs->idx_inc_frozen, &MK_WSTR(ESODBC_DSN_IDX_INC_FROZEN)},
779787
{&attrs->trace_enabled, &MK_WSTR(ESODBC_DSN_TRACE_ENABLED)},
780788
{&attrs->trace_file, &MK_WSTR(ESODBC_DSN_TRACE_FILE)},
781789
{&attrs->trace_level, &MK_WSTR(ESODBC_DSN_TRACE_LEVEL)},
@@ -872,6 +880,9 @@ void assign_dsn_defaults(esodbc_dsn_attrs_st *attrs)
872880
res |= assign_dsn_attr(attrs,
873881
&MK_WSTR(ESODBC_DSN_ESC_PVA),
874882
&MK_WSTR(ESODBC_DEF_ESC_PVA), /*overwrite?*/FALSE);
883+
res |= assign_dsn_attr(attrs,
884+
&MK_WSTR(ESODBC_DSN_IDX_INC_FROZEN),
885+
&MK_WSTR(ESODBC_DEF_IDX_INC_FROZEN), /*overwrite?*/FALSE);
875886

876887
/* default: no trace file */
877888
res |= assign_dsn_attr(attrs,

driver/dsn.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
#define ESODBC_DSN_VERSION_CHECKING "VersionChecking"
3939
#define ESODBC_DSN_MFIELD_LENIENT "MultiFieldLenient"
4040
#define ESODBC_DSN_ESC_PVA "AutoEscapePVA"
41+
#define ESODBC_DSN_IDX_INC_FROZEN "IndexIncludeFrozen"
4142
#define ESODBC_DSN_TRACE_ENABLED "TraceEnabled"
4243
#define ESODBC_DSN_TRACE_FILE "TraceFile"
4344
#define ESODBC_DSN_TRACE_LEVEL "TraceLevel"
@@ -79,10 +80,11 @@ typedef struct {
7980
wstr_st version_checking;
8081
wstr_st mfield_lenient;
8182
wstr_st auto_esc_pva;
83+
wstr_st idx_inc_frozen;
8284
wstr_st trace_enabled;
8385
wstr_st trace_file;
8486
wstr_st trace_level;
85-
#define ESODBC_DSN_ATTRS_COUNT 26
87+
#define ESODBC_DSN_ATTRS_COUNT 27
8688
SQLWCHAR buff[ESODBC_DSN_ATTRS_COUNT * ESODBC_DSN_MAX_ATTR_LEN];
8789
/* DSN reading/writing functions are passed a SQLSMALLINT lenght param */
8890
#if SHRT_MAX < ESODBC_DSN_ATTRS_COUNT * ESODBC_DSN_MAX_ATTR_LEN

driver/handles.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ typedef struct struct_dbc {
163163
ESODBC_FLTS_AUTO,
164164
} sci_floats; /* floats printing on conversion */
165165
BOOL mfield_lenient; /* 'field_multi_value_leniency' request param */
166+
BOOL idx_inc_frozen; /* 'field_multi_value_leniency' request param */
166167
BOOL auto_esc_pva; /* auto-escape PVA args in catalog functions */
167168

168169
esodbc_estype_st *es_types; /* array with ES types */

driver/queries.c

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2047,6 +2047,17 @@ static SQLRETURN serialize_params(esodbc_stmt_st *stmt, char *dest,
20472047
# undef JSON_KEY_VALUE
20482048
}
20492049

2050+
static inline size_t copy_bool_val(char *dest, BOOL val)
2051+
{
2052+
if (val) {
2053+
memcpy(dest, "true", sizeof("true") - 1);
2054+
return sizeof("true") - 1;
2055+
} else {
2056+
memcpy(dest, "false", sizeof("false") - 1);
2057+
return sizeof("false") - 1;
2058+
}
2059+
}
2060+
20502061
/*
20512062
* Build a serialized JSON object out of the statement.
20522063
* If resulting string fits into the given buff, the result is copied in it;
@@ -2108,6 +2119,9 @@ SQLRETURN TEST_API serialize_statement(esodbc_stmt_st *stmt, cstr_st *buff)
21082119
/* "field_multi_value_leniency": true/false */
21092120
bodylen += sizeof(JSON_KEY_MULTIVAL) - 1;
21102121
bodylen += /*false*/5;
2122+
/* "index_include_frozen": true/false */
2123+
bodylen += sizeof(JSON_KEY_IDX_FROZEN) - 1;
2124+
bodylen += /*false*/5;
21112125
/* "time_zone": "-05:45" */
21122126
bodylen += sizeof(JSON_KEY_TIMEZONE) - 1;
21132127
bodylen += tz_param.cnt;
@@ -2185,22 +2199,22 @@ SQLRETURN TEST_API serialize_statement(esodbc_stmt_st *stmt, cstr_st *buff)
21852199
/* "field_multi_value_leniency": true/false */
21862200
memcpy(body + pos, JSON_KEY_MULTIVAL, sizeof(JSON_KEY_MULTIVAL) - 1);
21872201
pos += sizeof(JSON_KEY_MULTIVAL) - 1;
2188-
if (dbc->mfield_lenient) {
2189-
memcpy(body + pos, "true", sizeof("true") - 1);
2190-
pos += sizeof("true") - 1;
2191-
} else {
2192-
memcpy(body + pos, "false", sizeof("false") - 1);
2193-
pos += sizeof("false") - 1;
2194-
}
2202+
pos += copy_bool_val(body + pos, dbc->mfield_lenient);
2203+
/* "index_include_frozen": true/false */
2204+
memcpy(body + pos, JSON_KEY_IDX_FROZEN,
2205+
sizeof(JSON_KEY_IDX_FROZEN) - 1);
2206+
pos += sizeof(JSON_KEY_IDX_FROZEN) - 1;
2207+
pos += copy_bool_val(body + pos, dbc->idx_inc_frozen);
21952208
/* "time_zone": "-05:45" */
21962209
memcpy(body + pos, JSON_KEY_TIMEZONE, sizeof(JSON_KEY_TIMEZONE) - 1);
21972210
pos += sizeof(JSON_KEY_TIMEZONE) - 1;
21982211
if (dbc->apply_tz) {
21992212
memcpy(body + pos, tz_param.str, tz_param.cnt);
22002213
pos += tz_param.cnt;
22012214
} else {
2202-
memcpy(body + pos, "\"Z\"", sizeof("\"Z\"") - 1);
2203-
pos += sizeof("\"Z\"") - 1;
2215+
memcpy(body + pos, JSON_VAL_TIMEZONE_Z,
2216+
sizeof(JSON_VAL_TIMEZONE_Z) - 1);
2217+
pos += sizeof(JSON_VAL_TIMEZONE_Z) - 1;
22042218
}
22052219

22062220
/* reset the page counter when the params change */

driver/queries.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,10 @@ SQLRETURN EsSQLRowCount(_In_ SQLHSTMT StatementHandle, _Out_ SQLLEN *RowCount);
140140
# define JSON_KEY_CLT_ID ", \"client_id\": \"odbc32\"" /* n-th k. */
141141
#endif /* _WIN64 */
142142
#define JSON_KEY_MULTIVAL ", \"field_multi_value_leniency\": " /* n-th */
143+
#define JSON_KEY_IDX_FROZEN ", \"index_include_frozen\": " /* n-th */
143144
#define JSON_KEY_TIMEZONE ", \"time_zone\": " /* n-th key */
144145

146+
#define JSON_VAL_TIMEZONE_Z "\"Z\""
147+
145148

146149
#endif /* __QUERIES_H__ */

test/connected_dbc.cc

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,44 @@ void ConnectedDBC::assertState(const SQLWCHAR *state)
163163
assertState(SQL_HANDLE_STMT, state);
164164
}
165165

166+
void ConnectedDBC::assertRequest(const char *params, const char *tz)
167+
{
168+
const static char *answ_templ = "{"
169+
JSON_KEY_QUERY "\"%s\""
170+
JSON_KEY_PARAMS "%s"
171+
JSON_KEY_MULTIVAL ESODBC_DEF_MFIELD_LENIENT
172+
JSON_KEY_IDX_FROZEN ESODBC_DEF_IDX_INC_FROZEN
173+
JSON_KEY_TIMEZONE "%s%s%s"
174+
JSON_KEY_VAL_MODE
175+
JSON_KEY_CLT_ID
176+
"}";
177+
char expect[1024];
178+
int n;
179+
180+
cstr_st actual = {NULL, 0};
181+
ret = serialize_statement((esodbc_stmt_st *)stmt, &actual);
182+
ASSERT_TRUE(SQL_SUCCEEDED(ret));
183+
184+
if (tz) {
185+
n = snprintf(expect, sizeof(expect), answ_templ, test_name, params,
186+
"\"", tz, "\"");
187+
} else {
188+
n = snprintf(expect, sizeof(expect), answ_templ, test_name, params,
189+
"", JSON_VAL_TIMEZONE_Z, "");
190+
}
191+
ASSERT_LT(actual.cnt, sizeof(expect));
192+
ASSERT_EQ(n, actual.cnt);
193+
ASSERT_EQ(strncmp(expect, (char *)actual.str, n), 0);
194+
195+
free(actual.str);
196+
197+
}
198+
199+
void ConnectedDBC::assertRequest(const char *params)
200+
{
201+
assertRequest(params, NULL);
202+
}
203+
166204
void ConnectedDBC::prepareStatement()
167205
{
168206
test_name =

test/connected_dbc.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ class ConnectedDBC {
5151
void assertState(const SQLWCHAR *state);
5252
void assertState(SQLSMALLINT htype, const SQLWCHAR *state);
5353

54+
void assertRequest(const char *params, const char *tz);
55+
void assertRequest(const char *params);
56+
5457
// use the test name as SQL (for faster logs lookup)
5558
void prepareStatement();
5659
// use an actual SQL statement (if it might be processed)

test/test_conversion_c2sql_boolean.cc

Lines changed: 9 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,6 @@
99

1010
#include <string.h>
1111

12-
#ifdef _WIN64
13-
# define CLIENT_ID "\"client_id\": \"odbc64\""
14-
#else /* _WIN64 */
15-
# define CLIENT_ID "\"client_id\": \"odbc32\""
16-
#endif /* _WIN64 */
17-
1812
namespace test {
1913

2014
class ConvertC2SQL_Boolean : public ::testing::Test, public ConnectedDBC {
@@ -32,16 +26,7 @@ TEST_F(ConvertC2SQL_Boolean, CStr2Boolean) /* note: test name used in test */
3226
sizeof(val) - /*\0*/1, &osize);
3327
ASSERT_TRUE(SQL_SUCCEEDED(ret));
3428

35-
cstr_st buff = {NULL, 0};
36-
ret = serialize_statement((esodbc_stmt_st *)stmt, &buff);
37-
ASSERT_TRUE(SQL_SUCCEEDED(ret));
38-
39-
cstr_st expect = CSTR_INIT("{\"query\": \"CStr2Boolean\", "
40-
"\"params\": [{\"type\": \"BOOLEAN\", \"value\": true}], "
41-
"\"field_multi_value_leniency\": true, \"time_zone\": \"Z\", "
42-
"\"mode\": \"ODBC\", " CLIENT_ID "}");
43-
44-
ASSERT_CSTREQ(buff, expect);
29+
assertRequest("[{\"type\": \"BOOLEAN\", \"value\": true}]");
4530
}
4631

4732
TEST_F(ConvertC2SQL_Boolean, WStr2Boolean) /* note: test name used in test */
@@ -54,16 +39,7 @@ TEST_F(ConvertC2SQL_Boolean, WStr2Boolean) /* note: test name used in test */
5439
ESODBC_SQL_BOOLEAN, /*size*/0, /*decdigits*/0, val, 0, &osize);
5540
ASSERT_TRUE(SQL_SUCCEEDED(ret));
5641

57-
cstr_st buff = {NULL, 0};
58-
ret = serialize_statement((esodbc_stmt_st *)stmt, &buff);
59-
ASSERT_TRUE(SQL_SUCCEEDED(ret));
60-
61-
cstr_st expect = CSTR_INIT("{\"query\": \"WStr2Boolean\", "
62-
"\"params\": [{\"type\": \"BOOLEAN\", \"value\": false}], "
63-
"\"field_multi_value_leniency\": true, \"time_zone\": \"Z\", "
64-
"\"mode\": \"ODBC\", " CLIENT_ID "}");
65-
66-
ASSERT_CSTREQ(buff, expect);
42+
assertRequest("[{\"type\": \"BOOLEAN\", \"value\": false}]");
6743
}
6844

6945
TEST_F(ConvertC2SQL_Boolean, Smallint2Boolean) /* note: name used in test */
@@ -76,16 +52,7 @@ TEST_F(ConvertC2SQL_Boolean, Smallint2Boolean) /* note: name used in test */
7652
/*IndLen*/NULL);
7753
ASSERT_TRUE(SQL_SUCCEEDED(ret));
7854

79-
cstr_st buff = {NULL, 0};
80-
ret = serialize_statement((esodbc_stmt_st *)stmt, &buff);
81-
ASSERT_TRUE(SQL_SUCCEEDED(ret));
82-
83-
cstr_st expect = CSTR_INIT("{\"query\": \"Smallint2Boolean\", "
84-
"\"params\": [{\"type\": \"BOOLEAN\", \"value\": true}], "
85-
"\"field_multi_value_leniency\": true, \"time_zone\": \"Z\", "
86-
"\"mode\": \"ODBC\", " CLIENT_ID "}");
87-
88-
ASSERT_CSTREQ(buff, expect);
55+
assertRequest("[{\"type\": \"BOOLEAN\", \"value\": true}]");
8956
}
9057

9158
TEST_F(ConvertC2SQL_Boolean, UShort2Boolean) /* note: name used in test */
@@ -98,16 +65,7 @@ TEST_F(ConvertC2SQL_Boolean, UShort2Boolean) /* note: name used in test */
9865
/*IndLen*/NULL);
9966
ASSERT_TRUE(SQL_SUCCEEDED(ret));
10067

101-
cstr_st buff = {NULL, 0};
102-
ret = serialize_statement((esodbc_stmt_st *)stmt, &buff);
103-
ASSERT_TRUE(SQL_SUCCEEDED(ret));
104-
105-
cstr_st expect = CSTR_INIT("{\"query\": \"UShort2Boolean\", "
106-
"\"params\": [{\"type\": \"BOOLEAN\", \"value\": false}], "
107-
"\"field_multi_value_leniency\": true, \"time_zone\": \"Z\", "
108-
"\"mode\": \"ODBC\", " CLIENT_ID "}");
109-
110-
ASSERT_CSTREQ(buff, expect);
68+
assertRequest("[{\"type\": \"BOOLEAN\", \"value\": false}]");
11169
}
11270

11371
TEST_F(ConvertC2SQL_Boolean, LongLong2Boolean) /* note: name used in test */
@@ -120,16 +78,7 @@ TEST_F(ConvertC2SQL_Boolean, LongLong2Boolean) /* note: name used in test */
12078
/*IndLen*/NULL);
12179
ASSERT_TRUE(SQL_SUCCEEDED(ret));
12280

123-
cstr_st buff = {NULL, 0};
124-
ret = serialize_statement((esodbc_stmt_st *)stmt, &buff);
125-
ASSERT_TRUE(SQL_SUCCEEDED(ret));
126-
127-
cstr_st expect = CSTR_INIT("{\"query\": \"LongLong2Boolean\", "
128-
"\"params\": [{\"type\": \"BOOLEAN\", \"value\": true}], "
129-
"\"field_multi_value_leniency\": true, \"time_zone\": \"Z\", "
130-
"\"mode\": \"ODBC\", " CLIENT_ID "}");
131-
132-
ASSERT_CSTREQ(buff, expect);
81+
assertRequest("[{\"type\": \"BOOLEAN\", \"value\": true}]");
13382
}
13483

13584
TEST_F(ConvertC2SQL_Boolean, Float2Boolean) /* note: name used in test */
@@ -142,16 +91,7 @@ TEST_F(ConvertC2SQL_Boolean, Float2Boolean) /* note: name used in test */
14291
/*IndLen*/NULL);
14392
ASSERT_TRUE(SQL_SUCCEEDED(ret));
14493

145-
cstr_st buff = {NULL, 0};
146-
ret = serialize_statement((esodbc_stmt_st *)stmt, &buff);
147-
ASSERT_TRUE(SQL_SUCCEEDED(ret));
148-
149-
cstr_st expect = CSTR_INIT("{\"query\": \"Float2Boolean\", "
150-
"\"params\": [{\"type\": \"BOOLEAN\", \"value\": true}], "
151-
"\"field_multi_value_leniency\": true, \"time_zone\": \"Z\", "
152-
"\"mode\": \"ODBC\", " CLIENT_ID "}");
153-
154-
ASSERT_CSTREQ(buff, expect);
94+
assertRequest("[{\"type\": \"BOOLEAN\", \"value\": true}]");
15595
}
15696

15797
TEST_F(ConvertC2SQL_Boolean, Double2Boolean) /* note: name used in test */
@@ -164,16 +104,7 @@ TEST_F(ConvertC2SQL_Boolean, Double2Boolean) /* note: name used in test */
164104
/*IndLen*/NULL);
165105
ASSERT_TRUE(SQL_SUCCEEDED(ret));
166106

167-
cstr_st buff = {NULL, 0};
168-
ret = serialize_statement((esodbc_stmt_st *)stmt, &buff);
169-
ASSERT_TRUE(SQL_SUCCEEDED(ret));
170-
171-
cstr_st expect = CSTR_INIT("{\"query\": \"Double2Boolean\", "
172-
"\"params\": [{\"type\": \"BOOLEAN\", \"value\": true}], "
173-
"\"field_multi_value_leniency\": true, \"time_zone\": \"Z\", "
174-
"\"mode\": \"ODBC\", " CLIENT_ID "}");
175-
176-
ASSERT_CSTREQ(buff, expect);
107+
assertRequest("[{\"type\": \"BOOLEAN\", \"value\": true}]");
177108
}
178109

179110
TEST_F(ConvertC2SQL_Boolean, Numeric2Boolean) /* note: name used in test */
@@ -191,16 +122,7 @@ TEST_F(ConvertC2SQL_Boolean, Numeric2Boolean) /* note: name used in test */
191122
/*IndLen*/NULL);
192123
ASSERT_TRUE(SQL_SUCCEEDED(ret));
193124

194-
cstr_st buff = {NULL, 0};
195-
ret = serialize_statement((esodbc_stmt_st *)stmt, &buff);
196-
ASSERT_TRUE(SQL_SUCCEEDED(ret));
197-
198-
cstr_st expect = CSTR_INIT("{\"query\": \"Numeric2Boolean\", "
199-
"\"params\": [{\"type\": \"BOOLEAN\", \"value\": true}], "
200-
"\"field_multi_value_leniency\": true, \"time_zone\": \"Z\", "
201-
"\"mode\": \"ODBC\", " CLIENT_ID "}");
202-
203-
ASSERT_CSTREQ(buff, expect);
125+
assertRequest("[{\"type\": \"BOOLEAN\", \"value\": true}]");
204126
}
205127

206128
TEST_F(ConvertC2SQL_Boolean, Binary2Boolean) /* note: name used in test */
@@ -214,16 +136,7 @@ TEST_F(ConvertC2SQL_Boolean, Binary2Boolean) /* note: name used in test */
214136
&indlen);
215137
ASSERT_TRUE(SQL_SUCCEEDED(ret));
216138

217-
cstr_st buff = {NULL, 0};
218-
ret = serialize_statement((esodbc_stmt_st *)stmt, &buff);
219-
ASSERT_TRUE(SQL_SUCCEEDED(ret));
220-
221-
cstr_st expect = CSTR_INIT("{\"query\": \"Binary2Boolean\", "
222-
"\"params\": [{\"type\": \"BOOLEAN\", \"value\": false}], "
223-
"\"field_multi_value_leniency\": true, \"time_zone\": \"Z\", "
224-
"\"mode\": \"ODBC\", " CLIENT_ID "}");
225-
226-
ASSERT_CSTREQ(buff, expect);
139+
assertRequest("[{\"type\": \"BOOLEAN\", \"value\": false}]");
227140
}
228141

229142
TEST_F(ConvertC2SQL_Boolean, Binary2Boolean_fail_22003)

0 commit comments

Comments
 (0)