Line data Source code
1 : /*
2 : * Try usage of callbacks to get errors and messages from library.
3 : */
4 : #include "common.h"
5 :
6 : #include <bkpublic.h>
7 :
8 : #define ALL_TESTS \
9 : TEST(ct_callback) \
10 : TEST(ct_res_info) \
11 : TEST(ct_results) \
12 : TEST(ct_cancel) \
13 : TEST(ct_send) \
14 : TEST(ct_cmd_drop) \
15 : TEST(ct_results_error) \
16 : TEST(cs_config) \
17 : TEST(blk_init) \
18 : TEST(blk_bind) \
19 : TEST(cs_loc_alloc) \
20 : TEST(cs_loc_drop) \
21 : TEST(cs_locale) \
22 : TEST(ct_dynamic) \
23 : TEST(ct_connect) \
24 : TEST(ct_command) \
25 : TEST(ct_cursor) \
26 : TEST(ct_con_props) \
27 : TEST(ct_cmd_props) \
28 : TEST(cs_convert) \
29 : TEST(cs_dt_info)
30 :
31 : /* forward declare all tests */
32 : #undef TEST
33 : #define TEST(name) static void test_ ## name(void);
34 : ALL_TESTS
35 :
36 : static CS_CONTEXT *ctx;
37 : static CS_CONNECTION *conn;
38 : static CS_COMMAND *cmd;
39 :
40 10 : TEST_MAIN()
41 : {
42 10 : bool verbose = true;
43 :
44 10 : printf("%s: Testing message callbacks\n", __FILE__);
45 : if (verbose) {
46 10 : printf("Trying login\n");
47 : }
48 10 : check_call(try_ctlogin, (&ctx, &conn, &cmd, verbose));
49 :
50 10 : check_call(cs_config, (ctx, CS_SET, CS_MESSAGE_CB, (CS_VOID*) cslibmsg_cb, CS_UNUSED, NULL));
51 :
52 : /* set different callback for the connection */
53 10 : check_call(ct_callback, (NULL, conn, CS_SET, CS_CLIENTMSG_CB, (CS_VOID*) clientmsg_cb2));
54 :
55 : /* call all tests */
56 : #undef TEST
57 : #define TEST(name) test_ ## name();
58 10 : ALL_TESTS
59 :
60 : if (verbose) {
61 10 : printf("Trying logout\n");
62 : }
63 10 : check_call(try_ctlogout, (ctx, conn, cmd, verbose));
64 :
65 : if (verbose) {
66 10 : printf("Test succeeded\n");
67 : }
68 10 : return 0;
69 : }
70 :
71 : static void
72 10 : test_ct_callback(void)
73 : {
74 : void *ptr;
75 :
76 : /* this should fail, context or connection should be not NULL */
77 10 : check_fail(ct_callback, (NULL, NULL, CS_SET, CS_SERVERMSG_CB, servermsg_cb));
78 10 : check_last_message(CTMSG_NONE, 0, NULL);
79 :
80 : /* this should fail, context and connection cannot be both not NULL */
81 10 : check_fail(ct_callback, (ctx, conn, CS_SET, CS_SERVERMSG_CB, servermsg_cb));
82 10 : check_last_message(CTMSG_CLIENT2, 0x01010133, NULL);
83 :
84 : /* this should fail, invalid action */
85 10 : check_fail(ct_callback, (ctx, NULL, 3, CS_SERVERMSG_CB, servermsg_cb));
86 10 : check_last_message(CTMSG_CLIENT, 0x01010105, "action");
87 :
88 : /* this should fail, invalid action */
89 10 : check_fail(ct_callback, (NULL, conn, 3, CS_SERVERMSG_CB, servermsg_cb));
90 10 : check_last_message(CTMSG_CLIENT2, 0x01010105, "action");
91 :
92 : /* this should fail, invalid type */
93 10 : check_fail(ct_callback, (ctx, NULL, CS_SET, 20, servermsg_cb));
94 10 : check_last_message(CTMSG_CLIENT, 0x01010105, "type");
95 :
96 : /* this should fail, invalid type */
97 10 : check_fail(ct_callback, (NULL, conn, CS_SET, 20, servermsg_cb));
98 10 : check_last_message(CTMSG_CLIENT2, 0x01010105, "type");
99 :
100 : /* NULL func getting it */
101 10 : check_fail(ct_callback, (NULL, conn, CS_GET, CS_CLIENTMSG_CB, NULL));
102 10 : check_last_message(CTMSG_CLIENT2, 0x01010103, "The parameter func cannot be NULL");
103 :
104 10 : check_fail(ct_callback, (NULL, conn, CS_GET, CS_SERVERMSG_CB, NULL));
105 10 : check_last_message(CTMSG_CLIENT2, 0x01010103, "The parameter func cannot be NULL");
106 :
107 : /* invalid type with action CS_GET */
108 10 : check_fail(ct_callback, (NULL, conn, CS_GET, 20, NULL));
109 10 : check_last_message(CTMSG_CLIENT2, 0x01010105, "An illegal value of 20 given for parameter type");
110 :
111 10 : ptr = (char*)0 + 123;
112 10 : check_fail(ct_callback, (NULL, conn, CS_GET, 20, &ptr));
113 10 : check_last_message(CTMSG_CLIENT2, 0x01010105, "An illegal value of 20 given for parameter type");
114 10 : if (ptr != (char*)0 + 123) {
115 0 : fprintf(stderr, "Invalid pointer %p\n", ptr);
116 0 : exit(1);
117 : }
118 10 : }
119 :
120 : static void
121 10 : test_ct_res_info(void)
122 : {
123 : CS_RETCODE ret;
124 : CS_INT result_type;
125 : CS_INT num_cols;
126 : CS_INT count;
127 :
128 10 : check_call(ct_command, (cmd, CS_LANG_CMD, "SELECT 'hi' AS greeting", CS_NULLTERM, CS_UNUSED));
129 10 : check_call(ct_send, (cmd));
130 :
131 10 : while ((ret = ct_results(cmd, &result_type)) == CS_SUCCEED) {
132 20 : switch (result_type) {
133 : case CS_CMD_SUCCEED:
134 : case CS_CMD_DONE:
135 : break;
136 10 : case CS_ROW_RESULT:
137 : /* this should fail, invalid number */
138 10 : check_fail(ct_res_info, (cmd, 1234, &num_cols, CS_UNUSED, NULL));
139 10 : check_last_message(CTMSG_CLIENT2, 0x01010105, "operation");
140 :
141 30 : while ((ret = ct_fetch(cmd, CS_UNUSED, CS_UNUSED, CS_UNUSED, &count)) == CS_SUCCEED)
142 10 : continue;
143 :
144 10 : if (ret != CS_END_DATA) {
145 0 : fprintf(stderr, "ct_fetch() unexpected return %d.\n", (int) ret);
146 0 : exit(1);
147 : }
148 : break;
149 0 : default:
150 0 : fprintf(stderr, "ct_results() unexpected result_type %d.\n", (int) result_type);
151 0 : exit(1);
152 : }
153 : }
154 10 : if (ret != CS_END_RESULTS) {
155 0 : fprintf(stderr, "ct_results() unexpected return %d.\n", (int) ret);
156 0 : exit(1);
157 : }
158 10 : }
159 :
160 : static void
161 90 : check_results(CS_INT expected_type)
162 : {
163 : CS_INT result_type;
164 :
165 90 : check_call(ct_results, (cmd, &result_type));
166 90 : if (result_type != expected_type) {
167 0 : fprintf(stderr, "ct_results() unexpected result_type %d, expected %d.\n", (int) result_type, (int) expected_type);
168 0 : exit(1);
169 : }
170 90 : }
171 :
172 : static void
173 70 : check_fetch(CS_RETCODE expected_ret)
174 : {
175 : CS_RETCODE ret;
176 : CS_INT count;
177 :
178 70 : ret = ct_fetch(cmd, CS_UNUSED, CS_UNUSED, CS_UNUSED, &count);
179 70 : if (ret != expected_ret) {
180 0 : fprintf(stderr, "ct_fetch() unexpected return %d, expected %d.\n", (int) ret, (int) expected_ret);
181 0 : exit(1);
182 : }
183 70 : }
184 :
185 : static void
186 10 : test_ct_results(void)
187 : {
188 : CS_RETCODE ret;
189 : CS_INT result_type;
190 :
191 10 : check_call(ct_command, (cmd, CS_LANG_CMD, "SELECT 1 UNION ALL SELECT 2 SELECT 3 WHERE 1 = 0 SELECT 4",
192 : CS_NULLTERM, CS_UNUSED));
193 10 : check_call(ct_send, (cmd));
194 :
195 10 : check_results(CS_ROW_RESULT);
196 :
197 : /* this should fail, rows are not fetched */
198 10 : check_fail(ct_results, (cmd, &result_type));
199 10 : check_last_message(CTMSG_CLIENT2, 0x010101a3, "fetchable results");
200 :
201 : /* this should fail, not all rows are fetched */
202 10 : check_fetch(CS_SUCCEED);
203 10 : check_fail(ct_results, (cmd, &result_type));
204 10 : check_last_message(CTMSG_CLIENT2, 0x010101a3, "fetchable results");
205 :
206 10 : check_fetch(CS_SUCCEED);
207 10 : check_fetch(CS_END_DATA);
208 10 : check_results(CS_CMD_DONE);
209 :
210 : /* empty result set, no rows to fetch */
211 10 : check_results(CS_ROW_RESULT);
212 10 : check_results(CS_CMD_DONE);
213 :
214 10 : check_results(CS_ROW_RESULT);
215 10 : check_fetch(CS_SUCCEED);
216 10 : check_fetch(CS_END_DATA);
217 10 : check_results(CS_CMD_DONE);
218 :
219 10 : ret = ct_results(cmd, &result_type);
220 10 : if (ret != CS_END_RESULTS) {
221 0 : fprintf(stderr, "ct_results() unexpected return %d.\n", (int) ret);
222 0 : exit(1);
223 : }
224 10 : }
225 :
226 : static void
227 10 : test_ct_cancel(void)
228 : {
229 : CS_RETCODE ret;
230 : CS_INT result_type;
231 :
232 10 : check_call(ct_command, (cmd, CS_LANG_CMD, "SELECT 1 UNION ALL SELECT 2", CS_NULLTERM, CS_UNUSED));
233 10 : check_call(ct_send, (cmd));
234 10 : check_results(CS_ROW_RESULT);
235 :
236 10 : check_call(ct_cancel, (NULL, cmd, CS_CANCEL_ALL));
237 :
238 : /* this should fail, command is idle after a cancel */
239 10 : check_fail(ct_fetch, (cmd, CS_UNUSED, CS_UNUSED, CS_UNUSED, NULL));
240 10 : check_last_message(CTMSG_CLIENT2, 0x0101019b, "idle");
241 :
242 : /* a new command can be sent after a cancel */
243 10 : check_call(ct_command, (cmd, CS_LANG_CMD, "SELECT 3", CS_NULLTERM, CS_UNUSED));
244 10 : check_call(ct_send, (cmd));
245 10 : check_results(CS_ROW_RESULT);
246 10 : check_fetch(CS_SUCCEED);
247 10 : check_fetch(CS_END_DATA);
248 10 : check_results(CS_CMD_DONE);
249 :
250 10 : ret = ct_results(cmd, &result_type);
251 10 : if (ret != CS_END_RESULTS) {
252 0 : fprintf(stderr, "ct_results() unexpected return %d.\n", (int) ret);
253 0 : exit(1);
254 : }
255 10 : }
256 :
257 : static void
258 10 : test_ct_send(void)
259 : {
260 : /* reset command to idle state */
261 10 : check_call(ct_cmd_drop, (cmd));
262 10 : check_call(ct_cmd_alloc, (conn, &cmd));
263 :
264 : /* this should fail, invalid command state */
265 10 : check_fail(ct_send, (cmd));
266 10 : check_last_message(CTMSG_CLIENT2, 0x0101019b, "idle");
267 10 : }
268 :
269 : static void
270 10 : test_ct_cmd_drop(void)
271 : {
272 : CS_INT result_type;
273 : CS_INT count;
274 : CS_RETCODE ret;
275 :
276 : /* command sent, results not read yet, results are discarded */
277 10 : check_call(ct_command, (cmd, CS_LANG_CMD, "SELECT 'hi' AS greeting", CS_NULLTERM, CS_UNUSED));
278 10 : check_call(ct_send, (cmd));
279 10 : check_call(ct_cmd_drop, (cmd));
280 10 : check_call(ct_cmd_alloc, (conn, &cmd));
281 10 : check_call(run_command, (cmd, "DECLARE @n INT"));
282 :
283 : /* rows pending */
284 10 : check_call(ct_command, (cmd, CS_LANG_CMD, "SELECT 'hi' AS greeting", CS_NULLTERM, CS_UNUSED));
285 10 : check_call(ct_send, (cmd));
286 10 : check_call(ct_results, (cmd, &result_type));
287 10 : check_call(ct_cmd_drop, (cmd));
288 10 : check_call(ct_cmd_alloc, (conn, &cmd));
289 10 : check_call(run_command, (cmd, "DECLARE @n INT"));
290 :
291 : /* a command with nothing left to read does not affect results of another one */
292 : {
293 : CS_COMMAND *other;
294 :
295 10 : check_call(ct_cmd_alloc, (conn, &other));
296 10 : check_call(ct_command, (other, CS_LANG_CMD, "DECLARE @n INT", CS_NULLTERM, CS_UNUSED));
297 10 : check_call(ct_send, (other));
298 10 : check_call(ct_results, (other, &result_type));
299 10 : check_call(ct_results, (other, &result_type));
300 10 : check_call(ct_command, (cmd, CS_LANG_CMD, "SELECT 'hi' AS greeting", CS_NULLTERM, CS_UNUSED));
301 10 : check_call(ct_send, (cmd));
302 10 : check_call(ct_cmd_drop, (other));
303 10 : check_call(ct_results, (cmd, &result_type));
304 10 : if (result_type != CS_ROW_RESULT) {
305 0 : fprintf(stderr, "ct_results() unexpected result_type %d.\n", (int) result_type);
306 0 : exit(1);
307 : }
308 20 : while ((ret = ct_fetch(cmd, CS_UNUSED, CS_UNUSED, CS_UNUSED, &count)) == CS_SUCCEED)
309 10 : continue;
310 10 : if (ret != CS_END_DATA) {
311 0 : fprintf(stderr, "ct_fetch() unexpected return %d.\n", (int) ret);
312 0 : exit(1);
313 : }
314 20 : while ((ret = ct_results(cmd, &result_type)) == CS_SUCCEED)
315 10 : continue;
316 10 : if (ret != CS_END_RESULTS) {
317 0 : fprintf(stderr, "ct_results() unexpected return %d.\n", (int) ret);
318 0 : exit(1);
319 : }
320 : }
321 10 : }
322 :
323 : static void
324 10 : test_ct_results_error(void)
325 : {
326 : CS_RETCODE ret;
327 : CS_INT result_type;
328 : CS_INT count;
329 10 : int failures = 0;
330 :
331 10 : check_call(run_command, (cmd, "SET ARITHABORT ON"));
332 :
333 : /* the query fails while computing the first row */
334 10 : check_call(ct_command, (cmd, CS_LANG_CMD, "SELECT 100 / (1 - 1) AS x", CS_NULLTERM, CS_UNUSED));
335 10 : check_call(ct_send, (cmd));
336 40 : while ((ret = ct_results(cmd, &result_type)) == CS_SUCCEED) {
337 20 : switch (result_type) {
338 10 : case CS_CMD_FAIL:
339 10 : ++failures;
340 10 : break;
341 : case CS_CMD_DONE:
342 : break;
343 0 : case CS_ROW_RESULT:
344 0 : fprintf(stderr, "ct_results() unexpected CS_ROW_RESULT.\n");
345 0 : exit(1);
346 0 : default:
347 0 : fprintf(stderr, "ct_results() unexpected result_type %d.\n", (int) result_type);
348 0 : exit(1);
349 : }
350 : }
351 10 : if (ret != CS_END_RESULTS) {
352 0 : fprintf(stderr, "ct_results() unexpected return %d.\n", (int) ret);
353 0 : exit(1);
354 : }
355 10 : if (failures != 1) {
356 0 : fprintf(stderr, "expected a CS_CMD_FAIL from ct_results, got %d\n", failures);
357 0 : exit(1);
358 : }
359 :
360 : /* a query without rows is still reported as a result set */
361 10 : check_call(ct_command, (cmd, CS_LANG_CMD, "SELECT 1 AS x WHERE 1 = 0", CS_NULLTERM, CS_UNUSED));
362 10 : check_call(ct_send, (cmd));
363 10 : check_call(ct_results, (cmd, &result_type));
364 10 : if (result_type != CS_ROW_RESULT) {
365 0 : fprintf(stderr, "ct_results() unexpected result_type %d.\n", (int) result_type);
366 0 : exit(1);
367 : }
368 10 : ret = ct_fetch(cmd, CS_UNUSED, CS_UNUSED, CS_UNUSED, &count);
369 10 : if (ret != CS_END_DATA) {
370 0 : fprintf(stderr, "ct_fetch() unexpected return %d.\n", (int) ret);
371 0 : exit(1);
372 : }
373 10 : check_call(ct_results, (cmd, &result_type));
374 10 : if (result_type != CS_CMD_DONE) {
375 0 : fprintf(stderr, "ct_results() unexpected result_type %d.\n", (int) result_type);
376 0 : exit(1);
377 : }
378 10 : ret = ct_results(cmd, &result_type);
379 10 : if (ret != CS_END_RESULTS) {
380 0 : fprintf(stderr, "ct_results() unexpected return %d.\n", (int) ret);
381 0 : exit(1);
382 : }
383 10 : }
384 :
385 : static void
386 10 : test_cs_config(void)
387 : {
388 : /* a set of invalid, not accepted values */
389 : static const CS_INT invalid_values[] = {
390 : -1,
391 : -5,
392 : -200,
393 : CS_WILDCARD,
394 : CS_NO_LIMIT,
395 : CS_UNUSED,
396 : 0 /* terminator */
397 : };
398 : const CS_INT *p_invalid;
399 : CS_INT out_len;
400 : char out_buf[8];
401 :
402 10 : check_call(cs_config, (ctx, CS_SET, CS_USERDATA, (CS_VOID *)"test", CS_NULLTERM, NULL));
403 :
404 : /* check that value written does not have the NUL terminator */
405 10 : strcpy(out_buf, "123456");
406 10 : check_call(cs_config, (ctx, CS_GET, CS_USERDATA, (CS_VOID *)out_buf, 8, NULL));
407 10 : if (strcmp(out_buf, "test56") != 0) {
408 0 : fprintf(stderr, "Wrong output buffer '%s'\n", out_buf);
409 0 : exit(1);
410 : }
411 :
412 10 : check_call(cs_config, (ctx, CS_SET, CS_USERDATA, (CS_VOID *)"test123", 4, NULL));
413 :
414 : /* check that value written does not have more characters */
415 10 : strcpy(out_buf, "123456");
416 10 : check_call(cs_config, (ctx, CS_GET, CS_USERDATA, (CS_VOID *)out_buf, 8, NULL));
417 10 : if (strcmp(out_buf, "test56") != 0) {
418 0 : fprintf(stderr, "Wrong output buffer '%s'\n", out_buf);
419 0 : exit(1);
420 : }
421 :
422 60 : for (p_invalid = invalid_values; *p_invalid != 0; ++p_invalid) {
423 60 : check_fail(cs_config, (ctx, CS_SET, CS_USERDATA, (CS_VOID *)"test", *p_invalid, NULL));
424 60 : check_last_message(CTMSG_CSLIB, 0x02010106, "buflen");
425 : }
426 :
427 : /* wrong action */
428 10 : check_fail(cs_config, (ctx, 1000, CS_USERDATA, (CS_VOID *)"test", 4, NULL));
429 10 : check_last_message(CTMSG_CSLIB, 0x02010106, "action");
430 :
431 : /* wrong property */
432 10 : check_fail(cs_config, (ctx, CS_SET, 100000, NULL, CS_UNUSED, NULL));
433 10 : check_last_message(CTMSG_CSLIB, 0x02010106, "property");
434 :
435 : /* read exactly expected bytes */
436 10 : check_call(cs_config, (ctx, CS_GET, CS_USERDATA, (CS_VOID *)out_buf, 4, NULL));
437 :
438 : /* wrong buflen getting value */
439 10 : out_len = -123;
440 10 : check_fail(cs_config, (ctx, CS_GET, CS_USERDATA, (CS_VOID *)out_buf, CS_NULLTERM, &out_len));
441 10 : check_last_message(CTMSG_CSLIB, 0x02010106, "buflen");
442 10 : if (out_len != -123) {
443 0 : fprintf(stderr, "Wrong buffer length returned\n");
444 0 : exit(1);
445 : }
446 :
447 : /* shorter buffer */
448 10 : out_len = -123;
449 10 : strcpy(out_buf, "123456");
450 10 : check_fail(cs_config, (ctx, CS_GET, CS_USERDATA, (CS_VOID *)out_buf, 2, &out_len));
451 10 : check_last_message(CTMSG_CSLIB, 0x02010102, " 2 bytes");
452 10 : if (out_len != 4) {
453 0 : fprintf(stderr, "Wrong buffer length returned\n");
454 0 : exit(1);
455 : }
456 10 : if (strcmp(out_buf, "123456") != 0) {
457 0 : fprintf(stderr, "Wrong buffer returned\n");
458 0 : exit(1);
459 : }
460 10 : }
461 :
462 : static void
463 10 : test_blk_init(void)
464 : {
465 : CS_BLKDESC *blkdesc;
466 10 : check_call(blk_alloc, (conn, BLK_VERSION_100, &blkdesc));
467 :
468 : /* invalid direction */
469 10 : check_fail(blk_init, (blkdesc, 100, "testname", CS_NULLTERM));
470 10 : check_last_message(CTMSG_CLIENT2, 0x0101010f, "CS_BLK_IN or CS_BLK_OUT");
471 :
472 : /* invalid tablename */
473 10 : check_fail(blk_init, (blkdesc, CS_BLK_IN, NULL, CS_NULLTERM));
474 10 : check_last_message(CTMSG_CLIENT2, 0x01010106, "tblname cannot be NULL");
475 :
476 : /* invalid tablename length */
477 10 : check_fail(blk_init, (blkdesc, CS_BLK_IN, "testname", -4));
478 10 : check_last_message(CTMSG_CLIENT2, 0x01010104, "tblnamelen has an illegal value of -4");
479 :
480 10 : check_call(blk_drop, (blkdesc));
481 10 : }
482 :
483 : static void
484 10 : test_blk_bind(void)
485 : {
486 : CS_BLKDESC *blkdesc;
487 : CS_DATAFMT datafmt;
488 10 : CS_INT value = 1234;
489 10 : CS_INT datalen = sizeof(value);
490 :
491 10 : check_call(run_command, (cmd, "CREATE TABLE #blk_bind_errors(i INT NOT NULL)"));
492 10 : check_call(blk_alloc, (conn, BLK_VERSION_100, &blkdesc));
493 10 : check_call(blk_init, (blkdesc, CS_BLK_IN, "#blk_bind_errors", CS_NULLTERM));
494 :
495 10 : memset(&datafmt, 0, sizeof(datafmt));
496 10 : datafmt.count = 1;
497 :
498 : /* type which cannot be converted */
499 10 : datafmt.datatype = CS_USHORT_TYPE;
500 10 : datafmt.maxlength = sizeof(value);
501 10 : check_fail(blk_bind, (blkdesc, 1, &datafmt, &value, &datalen, NULL));
502 10 : check_last_message(CTMSG_CLIENT2, 0x0101010a, "cannot be bound to a program variable of type 24");
503 :
504 : /* bind state is not changed by the failure, a valid bind works */
505 10 : datafmt.datatype = CS_INT_TYPE;
506 10 : check_call(blk_bind, (blkdesc, 1, &datafmt, &value, &datalen, NULL));
507 10 : check_call(blk_rowxfer, (blkdesc));
508 10 : check_call(blk_done, (blkdesc, CS_BLK_ALL, NULL));
509 :
510 10 : check_call(blk_drop, (blkdesc));
511 10 : check_call(run_command, (cmd, "DROP TABLE #blk_bind_errors"));
512 10 : }
513 :
514 : static void
515 10 : test_cs_loc_alloc(void)
516 : {
517 : /* no context or locale */
518 10 : check_fail(cs_loc_alloc, (NULL, NULL));
519 10 : check_last_message(CTMSG_NONE, 0, NULL);
520 :
521 : /* no locale */
522 10 : check_fail(cs_loc_alloc, (ctx, NULL));
523 10 : check_last_message(CTMSG_CSLIB, 0x02010104, " loc_pointer cannot be NULL");
524 10 : }
525 :
526 : static void
527 10 : test_cs_loc_drop(void)
528 : {
529 : /* no context or locale */
530 10 : check_fail(cs_loc_drop, (NULL, NULL));
531 10 : check_last_message(CTMSG_NONE, 0, NULL);
532 :
533 : /* no locale */
534 10 : check_fail(cs_loc_drop, (ctx, NULL));
535 10 : check_last_message(CTMSG_CSLIB, 0x02010104, " locale cannot be NULL");
536 10 : }
537 :
538 : static void
539 10 : test_cs_locale(void)
540 : {
541 : CS_LOCALE *locale;
542 :
543 10 : check_call(cs_loc_alloc, (ctx, &locale));
544 :
545 10 : check_call(cs_locale, (ctx, CS_SET, locale, CS_SYB_CHARSET, "utf8", 4, NULL));
546 :
547 : /* no context */
548 10 : check_fail(cs_locale, (NULL, CS_SET, locale, CS_SYB_CHARSET, "utf8", 4, NULL));
549 10 : check_last_message(CTMSG_NONE, 0, NULL);
550 :
551 : /* no locale */
552 10 : check_fail(cs_locale, (ctx, CS_SET, NULL, CS_SYB_CHARSET, "utf8", 4, NULL));
553 10 : check_last_message(CTMSG_CSLIB, 0x02010104, " locale cannot be NULL");
554 :
555 : /* wrong action */
556 10 : check_fail(cs_locale, (ctx, 1000, locale, CS_SYB_CHARSET, "utf8", 4, NULL));
557 10 : check_last_message(CTMSG_CSLIB, 0x02010106, " 1000 was given for parameter action");
558 :
559 : /* wrong type */
560 10 : check_fail(cs_locale, (ctx, CS_SET, locale, 1000, "utf8", 4, NULL));
561 10 : check_last_message(CTMSG_CSLIB, 0x02010106, " 1000 was given for parameter type");
562 :
563 : /* wrong length */
564 10 : check_fail(cs_locale, (ctx, CS_SET, locale, CS_SYB_CHARSET, "utf8", -4, NULL));
565 10 : check_last_message(CTMSG_CSLIB, 0x02010106, " -4 was given for parameter buflen");
566 :
567 10 : check_call(cs_loc_drop, (ctx, locale));
568 10 : }
569 :
570 : static void
571 10 : test_ct_dynamic(void)
572 : {
573 : /* wrong type */
574 10 : check_fail(ct_dynamic, (cmd, 10000, "test", CS_NULLTERM, "query", CS_NULLTERM));
575 10 : check_last_message(CTMSG_CLIENT2, 0x01010105, " 10000 given for parameter type");
576 :
577 : /* wrong id length */
578 10 : check_fail(ct_dynamic, (cmd, CS_PREPARE, "test", -5, "query", CS_NULLTERM));
579 10 : check_last_message(CTMSG_CLIENT2, 0x01010105, " -5 given for parameter idlen");
580 :
581 : /* wrong query length */
582 10 : check_fail(ct_dynamic, (cmd, CS_PREPARE, "test", CS_NULLTERM, "query", -6));
583 10 : check_last_message(CTMSG_CLIENT2, 0x01010105, " -6 given for parameter buflen");
584 :
585 : /* wrong id and query length */
586 10 : check_fail(ct_dynamic, (cmd, CS_PREPARE, "test", -5, "query", -6));
587 10 : check_last_message(CTMSG_CLIENT2, 0x01010105, " -5 given for parameter idlen");
588 :
589 : /* id not existing */
590 10 : check_fail(ct_dynamic, (cmd, CS_DEALLOC, "notexisting", CS_NULLTERM, NULL, CS_UNUSED));
591 10 : check_last_message(CTMSG_CLIENT2, 0x01010187, " specified id does not exist ");
592 :
593 : /* wrong id length */
594 10 : check_fail(ct_dynamic, (cmd, CS_DEALLOC, "notexisting", -7, NULL, CS_UNUSED));
595 10 : check_last_message(CTMSG_CLIENT2, 0x01010105, " -7 given for parameter idlen");
596 10 : }
597 :
598 : static void
599 10 : test_ct_connect(void)
600 : {
601 : CS_CONNECTION *conn;
602 :
603 10 : check_call(ct_con_alloc, (ctx, &conn));
604 :
605 : /* wrong server name length */
606 10 : check_fail(ct_connect, (conn, "test", -5));
607 10 : check_last_message(CTMSG_CLIENT, 0x01010105, " -5 given for parameter snamelen");
608 :
609 10 : check_call(ct_con_drop, (conn));
610 10 : }
611 :
612 : static void
613 10 : test_ct_command(void)
614 : {
615 : /* wrong query length, CS_UNUSED, this was behaving differently */
616 10 : check_fail(ct_command, (cmd, CS_LANG_CMD, "test", CS_UNUSED, CS_UNUSED));
617 10 : check_last_message(CTMSG_CLIENT2, 0x01010105, " given for parameter buflen");
618 :
619 : /* wrong query length */
620 10 : check_fail(ct_command, (cmd, CS_LANG_CMD, "test", -7, CS_UNUSED));
621 10 : check_last_message(CTMSG_CLIENT2, 0x01010105, " -7 given for parameter buflen");
622 :
623 : /* wrong query length, RPC */
624 10 : check_fail(ct_command, (cmd, CS_RPC_CMD, "test", -3, CS_UNUSED));
625 10 : check_last_message(CTMSG_CLIENT2, 0x01010105, " -3 given for parameter buflen");
626 10 : }
627 :
628 : static void
629 10 : test_ct_cursor(void)
630 : {
631 : /* wrong name length */
632 10 : check_fail(ct_cursor, (cmd, CS_CURSOR_DECLARE, "test", -4, "query", CS_NULLTERM, CS_UNUSED));
633 10 : check_last_message(CTMSG_CLIENT2, 0x01010105, " -4 given for parameter namelen");
634 :
635 : /* wrong query length */
636 10 : check_fail(ct_cursor, (cmd, CS_CURSOR_DECLARE, "test", CS_NULLTERM, "query", -3, CS_UNUSED));
637 10 : check_last_message(CTMSG_CLIENT2, 0x01010105, " -3 given for parameter tlen");
638 :
639 : /* wrong name and query length */
640 10 : check_fail(ct_cursor, (cmd, CS_CURSOR_DECLARE, "test", -11, "query", -3, CS_UNUSED));
641 10 : check_last_message(CTMSG_CLIENT2, 0x01010105, " -11 given for parameter namelen");
642 :
643 : /* name present without cursor, priority to name */
644 10 : check_fail(ct_cursor, (cmd, CS_CURSOR_ROWS, "name", CS_NULLTERM, NULL, CS_UNUSED, (CS_INT) 1));
645 10 : check_last_message(CTMSG_CLIENT2, 0x01010108, "The name parameter must be NULL");
646 :
647 : /* no cursor */
648 10 : check_fail(ct_cursor, (cmd, CS_CURSOR_ROWS, NULL, CS_UNUSED, NULL, CS_UNUSED, (CS_INT) 1));
649 10 : check_last_message(CTMSG_CLIENT2, 0x01010112, "A cursor must be declared before this command type can be initialized");
650 :
651 10 : check_fail(ct_cursor, (cmd, CS_CURSOR_CLOSE, NULL, CS_UNUSED, NULL, CS_UNUSED, CS_DEALLOC));
652 10 : check_last_message(CTMSG_CLIENT2, 0x010101ab, "A cursor must be opened before this command type can be initialized.");
653 :
654 10 : check_fail(ct_cursor, (cmd, CS_CURSOR_DEALLOC, NULL, CS_UNUSED, NULL, CS_UNUSED, CS_UNUSED));
655 10 : check_last_message(CTMSG_CLIENT2, 0x01010112, "A cursor must be declared before this command type can be initialized");
656 :
657 : /* declare the cursor to allow following commands */
658 10 : check_call(ct_cursor, (cmd, CS_CURSOR_DECLARE, "test", CS_NULLTERM, "query", CS_NULLTERM, CS_UNUSED));
659 :
660 : /* name present */
661 10 : check_fail(ct_cursor, (cmd, CS_CURSOR_ROWS, "name", CS_NULLTERM, "text", CS_NULLTERM, (CS_INT) 1));
662 10 : check_last_message(CTMSG_CLIENT2, 0x01010108, "The name parameter must be NULL");
663 :
664 : /* invalid name length */
665 10 : check_fail(ct_cursor, (cmd, CS_CURSOR_ROWS, NULL, CS_NULLTERM, "text", CS_NULLTERM, (CS_INT) 1));
666 10 : check_last_message(CTMSG_CLIENT2, 0x01010109, "The namelen parameter must be set to CS_UNUSED");
667 :
668 10 : check_fail(ct_cursor, (cmd, CS_CURSOR_ROWS, NULL, CS_UNUSED, "text", CS_NULLTERM, (CS_INT) 1));
669 10 : check_last_message(CTMSG_CLIENT2, 0x01010108, "The text parameter must be NULL");
670 :
671 10 : check_fail(ct_cursor, (cmd, CS_CURSOR_ROWS, NULL, CS_UNUSED, NULL, CS_NULLTERM, (CS_INT) 1));
672 10 : check_last_message(CTMSG_CLIENT2, 0x01010109, "The tlen parameter must be set to CS_UNUSED");
673 :
674 : /* name present */
675 10 : check_fail(ct_cursor, (cmd, CS_CURSOR_OPEN, "name", CS_NULLTERM, "text", CS_NULLTERM, CS_UNUSED));
676 10 : check_last_message(CTMSG_CLIENT2, 0x01010108, "The name parameter must be NULL");
677 :
678 : /* name length present */
679 10 : check_fail(ct_cursor, (cmd, CS_CURSOR_OPEN, NULL, CS_NULLTERM, "text", CS_NULLTERM, CS_UNUSED));
680 10 : check_last_message(CTMSG_CLIENT2, 0x01010109, "The namelen parameter must be set to CS_UNUSED");
681 :
682 : /* text present */
683 10 : check_fail(ct_cursor, (cmd, CS_CURSOR_OPEN, NULL, CS_UNUSED, "text", CS_NULLTERM, CS_UNUSED));
684 10 : check_last_message(CTMSG_CLIENT2, 0x01010108, "The text parameter must be NULL");
685 :
686 : /* text length present */
687 10 : check_fail(ct_cursor, (cmd, CS_CURSOR_OPEN, NULL, CS_UNUSED, NULL, CS_NULLTERM, CS_UNUSED));
688 10 : check_last_message(CTMSG_CLIENT2, 0x01010109, "The tlen parameter must be set to CS_UNUSED");
689 :
690 : /* name, name length, text, text length all present */
691 10 : check_fail(ct_cursor, (cmd, CS_CURSOR_CLOSE, "name", CS_NULLTERM, "text", CS_NULLTERM, CS_DEALLOC));
692 10 : check_last_message(CTMSG_CLIENT2, 0x01010108, "The name parameter must be NULL");
693 :
694 : /* name length present */
695 10 : check_fail(ct_cursor, (cmd, CS_CURSOR_CLOSE, NULL, CS_NULLTERM, "text", CS_NULLTERM, CS_DEALLOC));
696 10 : check_last_message(CTMSG_CLIENT2, 0x01010109, "The namelen parameter must be set to CS_UNUSED");
697 :
698 : /* text present */
699 10 : check_fail(ct_cursor, (cmd, CS_CURSOR_CLOSE, NULL, CS_UNUSED, "text", CS_NULLTERM, CS_DEALLOC));
700 10 : check_last_message(CTMSG_CLIENT2, 0x01010108, "The text parameter must be NULL");
701 :
702 : /* text length present */
703 10 : check_fail(ct_cursor, (cmd, CS_CURSOR_CLOSE, NULL, CS_UNUSED, NULL, CS_NULLTERM, CS_DEALLOC));
704 10 : check_last_message(CTMSG_CLIENT2, 0x01010109, "The tlen parameter must be set to CS_UNUSED");
705 :
706 : /* name, name length, text, text length all present */
707 10 : check_fail(ct_cursor, (cmd, CS_CURSOR_DEALLOC, "name", CS_NULLTERM, "text", CS_NULLTERM, CS_UNUSED));
708 10 : check_last_message(CTMSG_CLIENT2, 0x01010108, "The name parameter must be NULL");
709 :
710 : /* name length present */
711 10 : check_fail(ct_cursor, (cmd, CS_CURSOR_DEALLOC, NULL, CS_NULLTERM, "text", CS_NULLTERM, CS_UNUSED));
712 10 : check_last_message(CTMSG_CLIENT2, 0x01010109, "The namelen parameter must be set to CS_UNUSED");
713 :
714 : /* text present */
715 10 : check_fail(ct_cursor, (cmd, CS_CURSOR_DEALLOC, NULL, CS_UNUSED, "text", CS_NULLTERM, CS_UNUSED));
716 10 : check_last_message(CTMSG_CLIENT2, 0x01010108, "The text parameter must be NULL");
717 :
718 : /* text length present */
719 10 : check_fail(ct_cursor, (cmd, CS_CURSOR_DEALLOC, NULL, CS_UNUSED, NULL, CS_NULLTERM, CS_UNUSED));
720 10 : check_last_message(CTMSG_CLIENT2, 0x01010109, "The tlen parameter must be set to CS_UNUSED");
721 :
722 10 : }
723 :
724 : static void
725 10 : test_ct_con_props(void)
726 : {
727 : CS_CONNECTION *conn;
728 :
729 10 : check_call(ct_con_alloc, (ctx, &conn));
730 :
731 : /* wrong buffer length */
732 10 : check_fail(ct_con_props, (conn, CS_SET, CS_APPNAME, "app", -3, NULL));
733 10 : check_last_message(CTMSG_CLIENT, 0x01010105, " -3 given for parameter buflen");
734 :
735 : /* wrong buffer length, CS_UNUSED, it had a different behaviour */
736 10 : check_fail(ct_con_props, (conn, CS_SET, CS_APPNAME, "app", CS_UNUSED, NULL));
737 10 : check_last_message(CTMSG_CLIENT, 0x01010105, " given for parameter buflen");
738 :
739 10 : check_call(ct_con_drop, (conn));
740 :
741 10 : check_fail(ct_con_props, (NULL, CS_SET, CS_APPNAME, "app", 3, NULL));
742 10 : check_last_message(CTMSG_NONE, 0, NULL);
743 10 : }
744 :
745 : static void
746 10 : test_ct_cmd_props(void)
747 : {
748 : CS_INT props_value;
749 :
750 : /* wrong buffer length */
751 10 : check_fail(ct_cmd_props, (cmd, CS_GET, CS_CUR_STATUS, &props_value, sizeof(CS_INT), NULL));
752 10 : check_last_message(CTMSG_CLIENT2, 0x01010109, "The buflen parameter must be set to CS_UNUSED");
753 10 : }
754 :
755 : static void
756 10 : test_cs_convert(void)
757 : {
758 : CS_INT retlen;
759 : char outbuf[64];
760 : typedef struct format_test
761 : {
762 : CS_INT datatype;
763 : CS_INT format;
764 : bool success;
765 : } format_test;
766 :
767 : static const format_test format_tests[] = {
768 : {CS_CHAR_TYPE, CS_FMT_UNUSED, true},
769 : {CS_CHAR_TYPE, CS_FMT_NULLTERM, true},
770 : {CS_CHAR_TYPE, CS_FMT_PADNULL, true},
771 : {CS_CHAR_TYPE, CS_FMT_PADBLANK, true},
772 : {CS_CHAR_TYPE, CS_FMT_JUSTIFY_RT, false},
773 : {CS_CHAR_TYPE, CS_FMT_STRIPBLANKS, false},
774 : #if 0
775 : /* supported by Sybase, not FreeTDS currently */
776 : {CS_CHAR_TYPE, CS_FMT_SAFESTR, true},
777 : {CS_CHAR_TYPE, CS_FMT_SUBS_ILL_CHAR, true},
778 : #endif
779 :
780 : {CS_BINARY_TYPE, CS_FMT_UNUSED, true},
781 : {CS_BINARY_TYPE, CS_FMT_NULLTERM, false},
782 : {CS_BINARY_TYPE, CS_FMT_PADNULL, true},
783 : {CS_BINARY_TYPE, CS_FMT_PADBLANK, false},
784 : {CS_BINARY_TYPE, CS_FMT_JUSTIFY_RT, false},
785 : {CS_BINARY_TYPE, CS_FMT_STRIPBLANKS, false},
786 : {CS_BINARY_TYPE, CS_FMT_SAFESTR, false},
787 : {CS_BINARY_TYPE, CS_FMT_SUBS_ILL_CHAR, false},
788 :
789 : {-1, -1, false},
790 : };
791 : const format_test *p_format_test;
792 10 : CS_NUMERIC num = { 1, 1, {0, 1,} };
793 :
794 : CS_DATAFMT destfmt, srcfmt;
795 :
796 10 : memset(&srcfmt, 0, sizeof(srcfmt));
797 10 : memset(&destfmt, 0, sizeof(destfmt));
798 :
799 : /* destdata == NULL */
800 10 : check_fail(cs_convert, (ctx, &srcfmt, "src", &destfmt, NULL, &retlen));
801 10 : check_last_message(CTMSG_CSLIB, 0x2010104, "The parameter destdata cannot be NULL");
802 :
803 : /* destfmt == NULL */
804 10 : check_fail(cs_convert, (ctx, &srcfmt, "src", NULL, outbuf, &retlen));
805 10 : check_last_message(CTMSG_CSLIB, 0x2010104, "The parameter destfmt cannot be NULL");
806 :
807 : /* destdata == NULL && destfmt == NULL */
808 10 : check_fail(cs_convert, (ctx, &srcfmt, "src", NULL, NULL, &retlen));
809 10 : check_last_message(CTMSG_CSLIB, 0x2010104, "The parameter destfmt cannot be NULL");
810 :
811 : /* invalid source type */
812 10 : srcfmt.datatype = 1234;
813 10 : check_fail(cs_convert, (ctx, &srcfmt, "src", &destfmt, outbuf, &retlen));
814 10 : check_last_message(CTMSG_CSLIB, 0x2010110, "Conversion between 1234 and 0 datatypes is not supported");
815 10 : srcfmt.datatype = 0;
816 :
817 : /* invalid destination type */
818 10 : destfmt.datatype = 1234;
819 10 : check_fail(cs_convert, (ctx, &srcfmt, "src", &destfmt, outbuf, &retlen));
820 10 : check_last_message(CTMSG_CSLIB, 0x2010110, "Conversion between 0 and 1234 datatypes is not supported");
821 10 : destfmt.datatype = 0;
822 :
823 : /* not fixed and maxlength == 0 */
824 10 : check_call(cs_convert, (ctx, &srcfmt, "src", &destfmt, outbuf, &retlen));
825 :
826 : /* not fixed and maxlength <= 0 */
827 10 : destfmt.maxlength = -1;
828 10 : check_fail(cs_convert, (ctx, &srcfmt, "src", &destfmt, outbuf, &retlen));
829 10 : check_last_message(CTMSG_CSLIB, 0x2010112,
830 : "An illegal value of -1 was placed in the maxlength field of the CS_DATAFMT structure");
831 10 : destfmt.maxlength = 0;
832 :
833 : /* invalid formats */
834 150 : for (p_format_test = format_tests; p_format_test->datatype >= 0; ++p_format_test) {
835 140 : destfmt.datatype = p_format_test->datatype;
836 140 : destfmt.format = p_format_test->format;
837 140 : destfmt.maxlength = 20;
838 140 : srcfmt.maxlength = 4;
839 140 : if (p_format_test->success) {
840 60 : check_call(cs_convert, (ctx, &srcfmt, "3234", &destfmt, outbuf, &retlen));
841 : } else {
842 80 : check_fail(cs_convert, (ctx, &srcfmt, "3234", &destfmt, outbuf, &retlen));
843 80 : check_last_message(CTMSG_CSLIB, 0x2010112, "was placed in the format field of the CS_DATAFMT structure");
844 : }
845 : }
846 10 : destfmt.format = CS_FMT_UNUSED;
847 10 : destfmt.maxlength = 0;
848 10 : srcfmt.maxlength = 0;
849 :
850 : /* test invalid scale/precision for numeric */
851 10 : destfmt.datatype = CS_NUMERIC_TYPE;
852 10 : destfmt.precision = 1;
853 10 : check_call(cs_convert, (ctx, &srcfmt, &num, &destfmt, outbuf, &retlen));
854 :
855 10 : destfmt.precision = 0;
856 10 : check_fail(cs_convert, (ctx, &srcfmt, &num, &destfmt, outbuf, &retlen));
857 10 : check_last_message(CTMSG_CSLIB, 0x2010112, "was placed in the precision field of the CS_DATAFMT structure");
858 :
859 10 : destfmt.precision = 78;
860 10 : check_fail(cs_convert, (ctx, &srcfmt, &num, &destfmt, outbuf, &retlen));
861 10 : check_last_message(CTMSG_CSLIB, 0x2010112, "was placed in the precision field of the CS_DATAFMT structure");
862 :
863 10 : destfmt.precision = 30;
864 10 : destfmt.scale = -1;
865 10 : check_fail(cs_convert, (ctx, &srcfmt, &num, &destfmt, outbuf, &retlen));
866 10 : check_last_message(CTMSG_CSLIB, 0x2010112, "was placed in the scale field of the CS_DATAFMT structure");
867 :
868 10 : destfmt.scale = 0;
869 10 : check_call(cs_convert, (ctx, &srcfmt, &num, &destfmt, outbuf, &retlen));
870 :
871 10 : destfmt.scale = 30;
872 10 : check_call(cs_convert, (ctx, &srcfmt, &num, &destfmt, outbuf, &retlen));
873 :
874 10 : destfmt.scale = 31;
875 10 : check_fail(cs_convert, (ctx, &srcfmt, &num, &destfmt, outbuf, &retlen));
876 10 : check_last_message(CTMSG_CSLIB, 0x2010112, "was placed in the scale field of the CS_DATAFMT structure");
877 10 : }
878 :
879 : static void
880 10 : test_cs_dt_info(void)
881 : {
882 : CS_LOCALE *locale;
883 10 : CS_INT i_value = CS_DATES_SHORT;
884 : CS_INT len;
885 :
886 10 : check_call(cs_loc_alloc, (ctx, &locale));
887 :
888 10 : check_call(cs_dt_info, (ctx, CS_SET, locale, CS_DT_CONVFMT, CS_UNUSED, &i_value, sizeof(i_value), NULL));
889 :
890 : /* no context */
891 10 : check_fail(cs_dt_info, (NULL, CS_SET, locale, CS_DT_CONVFMT, CS_UNUSED, &i_value, sizeof(i_value), NULL));
892 10 : check_last_message(CTMSG_NONE, 0, NULL);
893 :
894 : /* wrong action */
895 10 : check_fail(cs_dt_info, (ctx, 1000, locale, CS_DT_CONVFMT, CS_UNUSED, &i_value, sizeof(i_value), NULL));
896 10 : check_last_message(CTMSG_CSLIB, 0x02010106, " 1000 was given for parameter action");
897 :
898 : /* wrong type, set */
899 10 : check_fail(cs_dt_info, (ctx, CS_SET, locale, 1000, CS_UNUSED, &i_value, sizeof(i_value), NULL));
900 10 : check_last_message(CTMSG_CSLIB, 0x02010106, " 1000 was given for parameter type");
901 :
902 : /* wrong type, get */
903 10 : len = sizeof(i_value);
904 10 : check_fail(cs_dt_info, (ctx, CS_GET, locale, 1000, CS_UNUSED, &i_value, sizeof(i_value), &len));
905 10 : check_last_message(CTMSG_CSLIB, 0x02010106, " 1000 was given for parameter type");
906 :
907 : /* wrong length */
908 10 : check_fail(cs_dt_info, (ctx, CS_SET, locale, CS_DT_CONVFMT, CS_UNUSED, &i_value, -4, NULL));
909 10 : check_last_message(CTMSG_CSLIB, 0x02010106, " -4 was given for parameter buflen");
910 :
911 : /* CS_NULLTERM as length is not accepted */
912 10 : check_fail(cs_dt_info, (ctx, CS_SET, locale, CS_DT_CONVFMT, CS_UNUSED, &i_value, CS_NULLTERM, NULL));
913 10 : check_last_message(CTMSG_CSLIB, 0x02010106, " -9 was given for parameter buflen");
914 :
915 : /* any other length seems accepted */
916 10 : check_call(cs_dt_info, (ctx, CS_SET, locale, CS_DT_CONVFMT, CS_UNUSED, &i_value, 0, NULL));
917 10 : check_call(cs_dt_info, (ctx, CS_SET, locale, CS_DT_CONVFMT, CS_UNUSED, &i_value, 1, NULL));
918 10 : check_call(cs_dt_info, (ctx, CS_SET, locale, CS_DT_CONVFMT, CS_UNUSED, &i_value, 100, NULL));
919 :
920 : /* invalid values are also accepted */
921 10 : i_value = -10000;
922 10 : check_call(cs_dt_info, (ctx, CS_SET, locale, CS_DT_CONVFMT, CS_UNUSED, &i_value, sizeof(i_value), NULL));
923 :
924 10 : check_call(cs_loc_drop, (ctx, locale));
925 10 : }
|