I have database procedure with input/output parameters defined as:
CREATE DBPROC spTest(INOUT strVal VARCHAR(50), OUT outVal VARCHAR(50)) AS
strVal = strVal || 'ending'; outVal = strVal;

I try to call this procedure in the C-code below (error handling is omitted for the sake of brevity) with the strValue='beginning'. The program is working fine except for the first parameter that is not changed. Since the second output parameter has the correct value ‘beginningending’ procedure is executed well. Besides I attach generated log-file with correct server reply (it contains both parameter values that are equal to ‘beginningending’). Could anybody explain what I did wrong in my program?

SQLDBC_IRuntime *runtime;
SQLDBC_Environment *environment;
SQLDBC_Connection *conn;
SQLDBC_ConnectProperties *conn_prop;
SQLDBC_PreparedStatement *stmt;
SQLDBC_Retcode rc;
char errorText[200];
int b,c;
char buf[100], buf2[100];
void *addr[2];

ConnectArgsT connectArgs;
parseArgs (&connectArgs, argc, argv);

runtime = ClientRuntime_GetClientRuntime(errorText, sizeof(errorText));
environment = SQLDBC_Environment_new_SQLDBC_Environment(runtime);

conn = SQLDBC_Environment_createConnection(environment);
conn_prop = SQLDBC_ConnectProperties_new_SQLDBC_ConnectProperties();

SQLDBC_ConnectProperties_setProperty(conn_prop, "SQL", "1");
SQLDBC_ConnectProperties_setProperty(conn_prop, "PACKET", "1");
SQLDBC_ConnectProperties_setProperty(conn_prop, "TIMESTAMP", "1");
SQLDBC_ConnectProperties_setProperty(conn_prop, "FILENAME", "\"c:\\temp\\inout.txt\"");
SQLDBC_Environment_setTraceOptions(environment, conn_prop);

//CREATE DBPROC spTest(INOUT strVal VARCHAR(50), OUT outVal VARCHAR(50)) AS "
//strVal = strVal || 'ending'; outVal = strVal;"

rc = SQLDBC_Connection_connectASCII(conn, connectArgs.host, connectArgs.dbname, connectArgs.username, connectArgs.password, conn_prop); printf("Sucessfull connected to %s as user %s\n", connectArgs.dbname, connectArgs.username);

stmt = SQLDBC_Connection_createPreparedStatement(conn);
rc = SQLDBC_PreparedStatement_prepareNTS(stmt, convertToUCS2("CALL spTest(:strVal, :outVal)"), SQLDBC_StringEncodingType_Encoding_UCS2Swapped);

SQLDBC_PreparedStatement_setBatchSize(stmt, 1);

b = sizeof(buf);
memset(buf, 0, b);
strcpy(buf, "beginning");
addr[0] = buf;

rc = SQLDBC_PreparedStatement_bindParameterAddr(stmt, 1, SQLDBC_HOSTTYPE_ASCII, addr, &b, strlen(buf), SQLDBC_FALSE);

c = sizeof(buf2);
memset(buf2, 0, c);
addr[1] = buf2;

rc = SQLDBC_PreparedStatement_bindParameterAddr(stmt, 2, SQLDBC_HOSTTYPE_ASCII, addr + 1, &c, sizeof(buf2), SQLDBC_FALSE);

rc = SQLDBC_PreparedStatement_executeASCII(stmt);

printf("%s, %s\n", buf, buf2);

SQLDBC_Environment_releaseConnection(environment, conn);
SQLDBC_Environment_delete_SQLDBC_Environment(environment);

return 0;

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/ <html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body><PRE><PLAINTEXT>SQLDBC 7.6.0 BUILD 027-123-124-939 May 3 2006 14:20:49
--- THREAD 1C8 --- 2006-07-25 15:29:15.437000 ---
2006-07-25 15:29:15.437000
2006-07-25 15:29:15.437000 2006-07-25 15:29:15.437000 [0x008B2060]
2006-07-25 15:29:15.437000 SERVERNODE: 'r55s'
2006-07-25 15:29:15.437000 SERVERDB  : 'UHOTELDB'
2006-07-25 15:29:15.437000 USER      : 'SCOTT'
2006-07-25 15:29:15.437000 CONNECT PROPERTIES: (4)
2006-07-25 15:29:15.437000   KEY: 'SQL' VALUE: '1'
2006-07-25 15:29:15.437000   KEY: 'PACKET' VALUE: '1'
2006-07-25 15:29:15.437000   KEY: 'TIMESTAMP' VALUE: '1'
2006-07-25 15:29:15.437000   KEY: 'FILENAME' VALUE: '"c:\temp\inout.txt"'
2006-07-25 15:29:15.437000 CONNECT COMMAND: 'CONNECT ? IDENTIFIED BY ? SQLMODE INTERNAL'
2006-07-25 15:29:15.500000 SESSION ID: 1
2006-07-25 15:29:15.500000 <Packet> ascii full swap ODB-70700 (transfer len 2888)
2006-07-25 15:29:15.500000       1 Segment(s) (2856 of 130784 bytes)
2006-07-25 15:29:15.500000    return Segment 1 at 0 (2856 of 130784 bytes)
2006-07-25 15:29:15.500000         RC: 0  00000  (Pos 0) Function 213
2006-07-25 15:29:15.500000         4 parts:
2006-07-25 15:29:15.500000 feature Part 1 Arguments (2 of 130728 bytes) (Segment at 0) 2006-07-25 15:29:15.500000 0 05 01 |..| 2006-07-25 15:29:15.500000 user_info_returned Part 1 Arguments (18 of 130704 bytes) (Segment at 0) 2006-07-25 15:29:15.500000 0 03 44 42 41 03 44 42 41 08 52 45 53 4f 55 52 43 |.DBA.DBA.RESOURC| 2006-07-25 15:29:15.500000 10 45 00 |E.| 2006-07-25 15:29:15.500000 conv_tables_returned Part 2 Arguments (512 of 130664 bytes) (Segment at 0) 2006-07-25 15:29:15.500000 0 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f |................| 2006-07-25 15:29:15.500000 10 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f |................| 2006-07-25 15:29:15.500000 20 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f | !"#$%&'()*+,-./| 2006-07-25 15:29:15.500000 30 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f |0123456789:;<=>?| 2006-07-25 15:29:15.500000 40 40 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f |@abcdefghijklmno| 2006-07-25 15:29:15.500000 50 70 71 72 73 74 75 76 77 78 79 7a 5b 5c 5d 5e 5f |pqrstuvwxyz[\]^_| 2006-07-25 15:29:15.500000 60 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f |`abcdefghijklmno| 2006-07-25 15:29:15.500000 70 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f |pqrstuvwxyz{|}~| 2006-07-25 15:29:15.500000 80 80 81 82 83 84 85 86 87 88 89 8a 8b 8c 8d 8e 8f |€ÂÂ‚ƒ„…†‡ˆ‰Š‹ŒŽÂ| 2006-07-25 15:29:15.500000 90 90 91 92 93 94 95 96 97 98 99 9a 9b 9c 9d 9e 9f |Â‘’“”•–—˜™š›œžŸÂ| 2006-07-25 15:29:15.500000 a0 a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab ac ad ae af | Â¡Â¢Â£Â¤Â¥Â¦Â§Â¨Â©ÂªÂ«Â¬Â­Â®Â¯Â| 2006-07-25 15:29:15.500000 b0 b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd be bf |°Â±Â²Â³Â´ÂµÂ¶Â·Â¸Â¹ÂºÂ»Â¼Â½Â¾Â¿Â| 2006-07-25 15:29:15.500000 c0 e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 ea eb ec ed ee ef | Ã¡Ã¢Ã£Ã¤Ã¥Ã¦Ã§Ã¨Ã©ÃªÃ«Ã¬Ã­Ã®Ã¯Ã| 2006-07-25 15:29:15.500000 d0 f0 f1 f2 f3 f4 f5 f6 d7 f8 f9 fa fb fc fd fe df |°Ã±Ã²Ã³Ã´ÃµÃ¶Ã—øùúûüýþßÃ| 2006-07-25 15:29:15.500000 e0 e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 ea eb ec ed ee ef | Ã¡Ã¢Ã£Ã¤Ã¥Ã¦Ã§Ã¨Ã©ÃªÃ«Ã¬Ã­Ã®Ã¯Ã| 2006-07-25 15:29:15.500000 f0 f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb fc fd fe ff |°Ã±Ã²Ã³Ã´ÃµÃ¶Ã·Ã¸Ã¹ÃºÃ»Ã¼Ã½Ã¾Ã¿Ã| 2006-07-25 15:29:15.500000 100 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f |................| 2006-07-25 15:29:15.500000 110 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f |................| 2006-07-25 15:29:15.500000 120 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f | !"#$%&'()*+,-./| 2006-07-25 15:29:15.500000 130 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f |0123456789:;<=>?| 2006-07-25 15:29:15.500000 140 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f |@ABCDEFGHIJKLMNO| 2006-07-25 15:29:15.500000 150 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f |PQRSTUVWXYZ[\]^_| 2006-07-25 15:29:15.500000 160 60 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f |`ABCDEFGHIJKLMNO| 2006-07-25 15:29:15.500000 170 50 51 52 53 54 55 56 57 58 59 5a 7b 7c 7d 7e 7f |PQRSTUVWXYZ{|}~| 2006-07-25 15:29:15.500000 180 80 81 82 83 84 85 86 87 88 89 8a 8b 8c 8d 8e 8f |€ÂÂ‚ƒ„…†‡ˆ‰Š‹ŒŽÂ| 2006-07-25 15:29:15.500000 190 90 91 92 93 94 95 96 97 98 99 9a 9b 9c 9d 9e 9f |Â‘’“”•–—˜™š›œžŸÂ| 2006-07-25 15:29:15.500000 1a0 a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab ac ad ae af | Â¡Â¢Â£Â¤Â¥Â¦Â§Â¨Â©ÂªÂ«Â¬Â­Â®Â¯Â| 2006-07-25 15:29:15.500000 1b0 b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd be bf |°Â±Â²Â³Â´ÂµÂ¶Â·Â¸Â¹ÂºÂ»Â¼Â½Â¾Â¿Â| 2006-07-25 15:29:15.500000 1c0 c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 ca cb cc cd ce cf |€ÃÃ‚ÃÄÅÆÇÈÉÊËÌÍÎÏÃ| 2006-07-25 15:29:15.500000 1d0 d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 da db dc dd de df |Ã‘ÒÓÔÕÖרÙÚÛÜÝÞßÃ| 2006-07-25 15:29:15.500000 1e0 c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 ca cb cc cd ce cf |€ÃÃ‚ÃÄÅÆÇÈÉÊËÌÍÎÏÃ| 2006-07-25 15:29:15.500000 1f0 d0 d1 d2 d3 d4 d5 d6 f7 d8 d9 da db dc dd de ff |Ã‘ÒÓÔÕÖ÷ØÙÚÛÜÝÞÿÃ| 2006-07-25 15:29:15.500000 session_info_returned Part 1 Arguments (2208 of 130136 bytes) (Segment at 0) 2006-07-25 15:29:15.500000 0 01 00 00 7d 81 09 44 44 2d 4d 4f 4e 2d 59 59 20 |...}Â.DD-MON-YY | 2006-07-25 15:29:15.500000 10 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 2006-07-25 15:29:15.500000 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 2006-07-25 15:29:15.500000 30 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 2006-07-25 15:29:15.500000 40 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 2006-07-25 15:29:15.500000 50 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 2006-07-25 15:29:15.500000 60 20 20 20 20 20 20 20 20 20 20 0c 10 0e 05 04 2d | .....-| 2006-07-25 15:29:15.500000 70 15 05 04 2d 1a 05 00 00 00 00 00 00 00 00 00 00 |...-............| 2006-07-25 15:29:15.500000 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 2006-07-25 15:29:15.500000 90 00 00 00 00 00 00 00 00 00 00 00 00 00 45 4e 47 |.............ENG| 2006-07-25 15:29:15.500000 a0 20 20 20 45 4e 47 20 20 20 02 2e 2c 20 20 00 00 | ENG .., ..| 2006-07-25 15:29:15.500000 b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 2006-07-25 15:29:15.500000 c0 45 4e 47 09 09 00 4a 61 6e 75 61 72 79 20 20 20 |ENG...January | 2006-07-25 15:29:15.500000 d0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 07 00 | ..| 2006-07-25 15:29:15.500000 e0 46 65 62 72 75 61 72 79 20 20 20 20 20 20 20 20 |February | 2006-07-25 15:29:15.500000 f0 20 20 20 20 20 20 20 20 08 00 4d 61 72 63 68 20 | ..March | 2006-07-25 15:29:15.500000 100 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 2006-07-25 15:29:15.500000 110 20 20 05 00 41 70 72 69 6c 20 20 20 20 20 20 20 | ..April | 2006-07-25 15:29:15.500000 120 20 20 20 20 20 20 20 20 20 20 20 20 05 00 4d 61 | ..Ma| 2006-07-25 15:29:15.500000 130 79 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |y | 2006-07-25 15:29:15.500000 140 20 20 20 20 20 20 03 00 4a 75 6e 65 20 20 20 20 | ..June | 2006-07-25 15:29:15.500000 150 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 2006-07-25 15:29:15.500000 160 04 00 4a 75 6c 79 20 20 20 20 20 20 20 20 20 20 |..July | 2006-07-25 15:29:15.500000 170 20 20 20 20 20 20 20 20 20 20 04 00 41 75 67 75 | ..Augu| 2006-07-25 15:29:15.515000 180 73 74 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |st | 2006-07-25 15:29:15.515000 190 20 20 20 20 06 00 53 65 70 74 65 6d 62 65 72 20 | ..September | 2006-07-25 15:29:15.515000 1a0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 09 00 | ..| 2006-07-25 15:29:15.515000 1b0 4f 63 74 6f 62 65 72 20 20 20 20 20 20 20 20 20 |October | 2006-07-25 15:29:15.515000 1c0 20 20 20 20 20 20 20 20 07 00 4e 6f 76 65 6d 62 | ..Novemb| 2006-07-25 15:29:15.515000 1d0 65 72 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |er | 2006-07-25 15:29:15.515000 1e0 20 20 08 00 44 65 63 65 6d 62 65 72 20 20 20 20 | ..December | 2006-07-25 15:29:15.515000 1f0 20 20 20 20 20 20 20 20 20 20 20 20 08 00 4d 6f | ..Mo| 2006-07-25 15:29:15.515000 200 6e 64 61 79 20 20 20 20 20 20 20 20 20 20 20 20 |nday | 2006-07-25 15:29:15.515000 210 20 20 20 20 20 20 06 00 54 75 65 73 64 61 79 20 | ..Tuesday | 2006-07-25 15:29:15.515000 220 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 2006-07-25 15:29:15.515000 230 07 00 57 65 64 6e 65 73 64 61 79 20 20 20 20 20 |..Wednesday | 2006-07-25 15:29:15.515000 240 20 20 20 20 20 20 20 20 20 20 09 00 54 68 75 72 | ..Thur| 2006-07-25 15:29:15.515000 250 73 64 61 79 20 20 20 20 20 20 20 20 20 20 20 20 |sday | 2006-07-25 15:29:15.515000 260 20 20 20 20 08 00 46 72 69 64 61 79 20 20 20 20 | ..Friday | 2006-07-25 15:29:15.515000 270 20 20 20 20 20 20 20 20 20 20 20 20 20 20 06 00 | ..| 2006-07-25 15:29:15.515000 280 53 61 74 75 72 64 61 79 20 20 20 20 20 20 20 20 |Saturday | 2006-07-25 15:29:15.515000 290 20 20 20 20 20 20 20 20 08 00 53 75 6e 64 61 79 | ..Sunday| 2006-07-25 15:29:15.515000 2a0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 2006-07-25 15:29:15.515000 2b0 20 20 06 00 5a 65 72 6f 20 20 20 20 20 20 20 20 | ..Zero | 2006-07-25 15:29:15.515000 2c0 04 00 5a 65 72 6f 65 74 68 20 20 20 20 20 07 00 |..Zeroeth ..| 2006-07-25 15:29:15.515000 2d0 4f 6e 65 20 20 20 20 20 20 20 20 20 03 00 46 69 |One ..Fi| 2006-07-25 15:29:15.515000 2e0 72 73 74 20 20 20 20 20 20 20 05 00 54 77 6f 20 |rst ..Two | 2006-07-25 15:29:15.515000 2f0 20 20 20 20 20 20 20 20 03 00 53 65 63 6f 6e 64 | ..Second| 2006-07-25 15:29:15.515000 300 20 20 20 20 20 20 06 00 54 68 72 65 65 20 20 20 | ..Three | 2006-07-25 15:29:15.515000 310 20 20 20 20 05 00 54 68 69 72 64 20 20 20 20 20 | ..Third | 2006-07-25 15:29:15.515000 320 20 20 05 00 46 6f 75 72 20 20 20 20 20 20 20 20 | ..Four | 2006-07-25 15:29:15.515000 330 04 00 46 6f 75 72 74 68 20 20 20 20 20 20 06 00 |..Fourth ..| 2006-07-25 15:29:15.515000 340 46 69 76 65 20 20 20 20 20 20 20 20 04 00 46 69 |Five ..Fi| 2006-07-25 15:29:15.515000 350 66 74 68 20 20 20 20 20 20 20 05 00 53 69 78 20 |fth ..Six | 2006-07-25 15:29:15.515000 360 20 20 20 20 20 20 20 20 03 00 53 69 78 74 68 20 | ..Sixth | 2006-07-25 15:29:15.515000 370 20 20 20 20 20 20 05 00 53 65 76 65 6e 20 20 20 | ..Seven | 2006-07-25 15:29:15.515000 380 20 20 20 20 05 00 53 65 76 65 6e 74 68 20 20 20 | ..Seventh | 2006-07-25 15:29:15.515000 390 20 20 07 00 45 69 67 68 74 20 20 20 20 20 20 20 | ..Eight | 2006-07-25 15:29:15.515000 3a0 05 00 45 69 67 68 74 68 20 20 20 20 20 20 06 00 |..Eighth ..| 2006-07-25 15:29:15.515000 3b0 4e 69 6e 65 20 20 20 20 20 20 20 20 04 00 4e 69 |Nine ..Ni| 2006-07-25 15:29:15.515000 3c0 6e 74 68 20 20 20 20 20 20 20 05 00 54 65 6e 20 |nth ..Ten | 2006-07-25 15:29:15.515000 3d0 20 20 20 20 20 20 20 20 03 00 54 65 6e 74 68 20 | ..Tenth | 2006-07-25 15:29:15.515000 3e0 20 20 20 20 20 20 05 00 45 6c 65 76 65 6e 20 20 | ..Eleven | 2006-07-25 15:29:15.515000 3f0 20 20 20 20 06 00 45 6c 65 76 65 6e 74 68 20 20 | ..Eleventh | 2006-07-25 15:29:15.515000 400 20 20 08 00 54 77 65 6c 76 65 20 20 20 20 20 20 | ..Twelve | 2006-07-25 15:29:15.515000 410 06 00 54 77 65 6c 66 74 68 20 20 20 20 20 07 00 |..Twelfth ..| 2006-07-25 15:29:15.515000 420 54 68 69 72 74 65 65 6e 20 20 20 20 08 00 54 68 |Thirteen ..Th| 2006-07-25 15:29:15.515000 430 69 72 74 65 65 6e 74 68 20 20 0a 00 46 6f 75 72 |irteenth ..Four| 2006-07-25 15:29:15.515000 440 74 65 65 6e 20 20 20 20 08 00 46 6f 75 72 74 65 |teen ..Fourte| 2006-07-25 15:29:15.515000 450 65 6e 74 68 20 20 0a 00 46 69 66 74 65 65 6e 20 |enth ..Fifteen | 2006-07-25 15:29:15.515000 460 20 20 20 20 07 00 46 69 66 74 65 65 6e 74 68 20 | ..Fifteenth | 2006-07-25 15:29:15.515000 470 20 20 09 00 53 69 78 74 65 65 6e 20 20 20 20 20 | ..Sixteen | 2006-07-25 15:29:15.515000 480 07 00 53 69 78 74 65 65 6e 74 68 20 20 20 09 00 |..Sixteenth ..| 2006-07-25 15:29:15.515000 490 53 65 76 65 6e 74 65 65 6e 20 20 20 09 00 53 65 |Seventeen ..Se| 2006-07-25 15:29:15.515000 4a0 76 65 6e 74 65 65 6e 74 68 20 0b 00 45 69 67 68 |venteenth ..Eigh| 2006-07-25 15:29:15.515000 4b0 74 65 65 6e 20 20 20 20 08 00 45 69 67 68 74 65 |teen ..Eighte| 2006-07-25 15:29:15.515000 4c0 65 6e 74 68 20 20 0a 00 4e 69 6e 65 74 65 65 6e |enth ..Nineteen| 2006-07-25 15:29:15.515000 4d0 20 20 20 20 08 00 4e 69 6e 65 74 65 65 6e 74 68 | ..Nineteenth| 2006-07-25 15:29:15.515000 4e0 20 20 0a 00 54 77 65 6e 74 79 20 20 20 20 20 20 | ..Twenty | 2006-07-25 15:29:15.515000 4f0 06 00 54 77 65 6e 74 69 65 74 68 20 20 20 09 00 |..Twentieth ..| 2006-07-25 15:29:15.515000 500 54 68 69 72 74 79 20 20 20 20 20 20 06 00 54 68 |Thirty ..Th| 2006-07-25 15:29:15.515000 510 69 72 74 69 65 74 68 20 20 20 09 00 46 6f 75 72 |irtieth ..Four| 2006-07-25 15:29:15.515000 520 74 79 20 20 20 20 20 20 06 00 46 6f 75 72 74 69 |ty ..Fourti| 2006-07-25 15:29:15.515000 530 65 74 68 20 20 20 09 00 46 69 66 74 79 20 20 20 |eth ..Fifty | 2006-07-25 15:29:15.515000 540 20 20 20 20 05 00 46 69 66 74 69 65 74 68 20 20 | ..Fiftieth | 2006-07-25 15:29:15.515000 550 20 20 08 00 53 69 78 74 79 20 20 20 20 20 20 20 | ..Sixty | 2006-07-25 15:29:15.515000 560 05 00 53 69 78 74 69 65 74 68 20 20 20 20 08 00 |..Sixtieth ..| 2006-07-25 15:29:15.515000 570 53 65 76 65 6e 74 79 20 20 20 20 20 07 00 53 65 |Seventy ..Se| 2006-07-25 15:29:15.515000 580 76 65 6e 74 69 65 74 68 20 20 0a 00 45 69 67 68 |ventieth ..Eigh| 2006-07-25 15:29:15.515000 590 74 79 20 20 20 20 20 20 06 00 45 69 67 68 74 69 |ty ..Eighti| 2006-07-25 15:29:15.515000 5a0 65 74 68 20 20 20 09 00 4e 69 6e 65 74 79 20 20 |eth ..Ninety | 2006-07-25 15:29:15.515000 5b0 20 20 20 20 06 00 4e 69 6e 65 74 69 65 74 68 20 | ..Ninetieth | 2006-07-25 15:29:15.515000 5c0 20 20 09 00 00 00 00 00 00 00 00 00 00 00 00 00 | ..............| 2006-07-25 15:29:15.515000 5d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 2006-07-25 15:29:15.515000 5e0 2d 20 20 20 20 20 20 20 20 20 20 20 01 00 2d 20 |- ..- | 2006-07-25 15:29:15.515000 5f0 20 20 20 20 20 20 20 20 20 20 01 00 20 48 75 6e | .. Hun| 2006-07-25 15:29:15.515000 600 64 72 65 64 20 20 20 20 09 00 20 48 75 6e 64 72 |dred .. Hundr| 2006-07-25 15:29:15.515000 610 65 64 74 68 20 20 0b 00 20 54 68 6f 75 73 61 6e |edth .. Thousan| 2006-07-25 15:29:15.515000 620 64 20 20 20 0a 00 20 54 68 6f 75 73 61 6e 64 74 |d .. Thousandt| 2006-07-25 15:29:15.515000 630 68 20 0c 00 20 4d 69 6c 6c 69 6f 6e 20 20 20 20 |h .. Million | 2006-07-25 15:29:15.515000 640 09 00 20 4d 69 6c 6c 69 6f 6e 74 68 20 20 0b 00 |.. Millionth ..| 2006-07-25 15:29:15.515000 650 20 4d 69 6c 6c 69 6f 6e 73 20 20 20 0a 00 20 4d | Millions .. M| 2006-07-25 15:29:15.515000 660 69 6c 6c 69 6f 6e 74 68 20 20 0b 00 4a 61 6e 75 |illionth ..Janu| 2006-07-25 15:29:15.515000 670 61 72 79 20 20 20 20 20 07 00 46 65 62 72 75 61 |ary ..Februa| 2006-07-25 15:29:15.515000 680 72 79 20 20 20 20 08 00 4d 61 72 63 68 20 20 20 |ry ..March | 2006-07-25 15:29:15.515000 690 20 20 20 20 05 00 41 70 72 69 6c 20 20 20 20 20 | ..April | 2006-07-25 15:29:15.515000 6a0 20 20 05 00 4d 61 79 20 20 20 20 20 20 20 20 20 | ..May | 2006-07-25 15:29:15.515000 6b0 03 00 4a 75 6e 65 20 20 20 20 20 20 20 20 04 00 |..June ..| 2006-07-25 15:29:15.515000 6c0 4a 75 6c 79 20 20 20 20 20 20 20 20 04 00 41 75 |July ..Au| 2006-07-25 15:29:15.515000 6d0 67 75 73 74 20 20 20 20 20 20 06 00 53 65 70 74 |gust ..Sept| 2006-07-25 15:29:15.515000 6e0 65 6d 62 65 72 20 20 20 09 00 4f 63 74 6f 62 65 |ember ..Octobe| 2006-07-25 15:29:15.515000 6f0 72 20 20 20 20 20 07 00 4e 6f 76 65 6d 62 65 72 |r ..November| 2006-07-25 15:29:15.515000 700 20 20 20 20 08 00 44 65 63 65 6d 62 65 72 20 20 | ..December | 2006-07-25 15:29:15.515000 710 20 20 08 00 4d 6f 6e 64 61 79 20 20 20 20 20 20 | ..Monday | 2006-07-25 15:29:15.515000 720 06 00 54 75 65 73 64 61 79 20 20 20 20 20 07 00 |..Tuesday ..| 2006-07-25 15:29:15.515000 730 57 65 64 6e 65 73 64 61 79 20 20 20 09 00 54 68 |Wednesday ..Th| 2006-07-25 15:29:15.515000 740 75 72 73 64 61 79 20 20 20 20 08 00 46 72 69 64 |ursday ..Frid| 2006-07-25 15:29:15.515000 750 61 79 20 20 20 20 20 20 06 00 53 61 74 75 72 64 |ay ..Saturd| 2006-07-25 15:29:15.515000 760 61 79 20 20 20 20 08 00 53 75 6e 64 61 79 20 20 |ay ..Sunday | 2006-07-25 15:29:15.515000 770 20 20 20 20 06 00 49 20 20 20 20 20 20 20 20 20 | ..I | 2006-07-25 15:29:15.515000 780 20 20 01 00 49 69 20 20 20 20 20 20 20 20 20 20 | ..Ii | 2006-07-25 15:29:15.515000 790 02 00 49 69 69 20 20 20 20 20 20 20 20 20 03 00 |..Iii ..| 2006-07-25 15:29:15.515000 7a0 49 76 20 20 20 20 20 20 20 20 20 20 02 00 56 20 |Iv ..V | 2006-07-25 15:29:15.515000 7b0 20 20 20 20 20 20 20 20 20 20 01 00 56 69 20 20 | ..Vi | 2006-07-25 15:29:15.515000 7c0 20 20 20 20 20 20 20 20 02 00 56 69 69 20 20 20 | ..Vii | 2006-07-25 15:29:15.515000 7d0 20 20 20 20 20 20 03 00 56 69 69 69 20 20 20 20 | ..Viii | 2006-07-25 15:29:15.515000 7e0 20 20 20 20 04 00 49 78 20 20 20 20 20 20 20 20 | ..Ix | 2006-07-25 15:29:15.515000 7f0 20 20 02 00 58 20 20 20 20 20 20 20 20 20 20 20 | ..X | 2006-07-25 15:29:15.515000 800 01 00 58 69 20 20 20 20 20 20 20 20 20 20 02 00 |..Xi ..| 2006-07-25 15:29:15.515000 810 58 69 69 20 20 20 20 20 20 20 20 20 03 00 41 2e |Xii ..A.| 2006-07-25 15:29:15.515000 820 6d 2e 20 20 20 20 20 20 20 20 04 00 50 2e 6d 2e |m. ..P.m.| 2006-07-25 15:29:15.515000 830 20 20 20 20 20 20 20 20 04 00 41 6d 20 20 20 20 | ..Am | 2006-07-25 15:29:15.515000 840 20 20 20 20 20 20 02 00 50 6d 20 20 20 20 20 20 | ..Pm | 2006-07-25 15:29:15.515000 850 20 20 20 20 02 00 41 2e 64 2e 20 20 20 20 20 20 | ..A.d. | 2006-07-25 15:29:15.515000 860 20 20 04 00 42 2e 63 2e 20 20 20 20 20 20 20 20 | ..B.c. | 2006-07-25 15:29:15.515000 870 04 00 41 64 20 20 20 20 20 20 20 20 20 20 02 00 |..Ad ..| 2006-07-25 15:29:15.515000 880 42 63 20 20 20 20 20 20 20 20 20 20 02 00 00 00 |Bc ....| 2006-07-25 15:29:15.515000 890 00 c4 81 92 00 00 00 00 37 30 36 30 30 00 00 00 |.„Á’Â....70600...|
2006-07-25 15:29:15.515000 </Packet>
2006-07-25 15:29:15.515000
2006-07-25 15:29:15.515000 SCROLLABLE CURSORS ARE DISABLED
2006-07-25 15:29:15.515000 OK
2006-07-25 15:29:15.515000
2006-07-25 15:29:15.515000 ::PARSE 'SQLCURS_2' 2006-07-25 15:29:15.515000 [0x008B33B0]
2006-07-25 15:29:15.515000 SQL COMMAND:'CALL spTest(:strVal, :outVal)'
2006-07-25 15:29:15.515000 ENCODING : UCS2 big endian (native)
2006-07-25 15:29:15.515000 <Packet> unicode_swap full swap ODB-70700 (transfer len 152)
2006-07-25 15:29:15.515000       1 Segment(s) (120 of 130784 bytes)
2006-07-25 15:29:15.515000    cmd Segment 1 at 0 (120 of 130784 bytes)
2006-07-25 15:29:15.515000 messtype: parse sqlmode: internal producer: user
2006-07-25 15:29:15.515000         Options: with info mass cmd
2006-07-25 15:29:15.515000         1 parts:
2006-07-25 15:29:15.515000 command Part 1 Arguments (58 of 130728 bytes) (Segment at 0) 2006-07-25 15:29:15.515000 0 43 00 41 00 4c 00 4c 00 20 00 73 00 70 00 54 00 |C.A.L.L. .s.p.T.| 2006-07-25 15:29:15.515000 10 65 00 73 00 74 00 28 00 3a 00 73 00 74 00 72 00 |e.s.t.(.:.s.t.r.| 2006-07-25 15:29:15.515000 20 56 00 61 00 6c 00 2c 00 20 00 3a 00 6f 00 75 00 |V.a.l.,. .:.o.u.| 2006-07-25 15:29:15.515000 30 74 00 56 00 61 00 6c 00 29 00 |t.V.a.l.).|
2006-07-25 15:29:15.515000 </Packet>
2006-07-25 15:29:15.515000
2006-07-25 15:29:15.515000 <Packet> unicode_swap full swap ODB-70700 (transfer len 192)
2006-07-25 15:29:15.515000       1 Segment(s) (160 of 130784 bytes)
2006-07-25 15:29:15.515000    return Segment 1 at 0 (160 of 130784 bytes)
2006-07-25 15:29:15.515000         RC: 0  00000  (Pos 0) Function 34
2006-07-25 15:29:15.515000         3 parts:
2006-07-25 15:29:15.515000 columnnames Part 2 Arguments (26 of 130728 bytes) (Segment at 0) 2006-07-25 15:29:15.515000 0 0c 53 00 54 00 52 00 56 00 41 00 4c 00 0c 4f 00 |.S.T.R.V.A.L..O.| 2006-07-25 15:29:15.515000 10 55 00 54 00 56 00 41 00 4c 00 |U.T.V.A.L.| 2006-07-25 15:29:15.515000 shortinfo Part 2 Arguments (24 of 130680 bytes) (Segment at 0) 2006-07-25 15:29:15.515000 0 02 02 18 00 32 00 65 00 01 00 00 00 02 01 18 00 |....2.e.........| 2006-07-25 15:29:15.515000 10 32 00 65 00 66 00 00 00 |2.e.f...| 2006-07-25 15:29:15.515000 parsid Part 1 Arguments (12 of 130640 bytes) (Segment at 0) 2006-07-25 15:29:15.515000 0 00 00 7d 81 00 00 07 02 12 00 3c 00 |..}Â......<.|
2006-07-25 15:29:15.515000 </Packet>
2006-07-25 15:29:15.515000
2006-07-25 15:29:15.515000 PARSE ID: 00007D81 00000702 12003C00 [1]
2006-07-25 15:29:15.515000 PARAMETERS:
2006-07-25 15:29:15.515000 I   T              L    P   IO    N
2006-07-25 15:29:15.515000 1   CHAR UNICODE   50   0   INOUT 'STRVAL'
2006-07-25 15:29:15.515000 2   CHAR UNICODE   50   0   OUT   'OUTVAL'
2006-07-25 15:29:15.515000
2006-07-25 15:29:15.515000 ::BIND PARAMADDR 2006-07-25 15:29:15.515000 [0x008B33B0] 2006-07-25 15:29:15.515000 I T AT L I D P 2006-07-25 15:29:15.515000 1 ASCII A 9 0x0012FCE0 0x0012FBEC 0x00000000
2006-07-25 15:29:15.515000
2006-07-25 15:29:15.515000 ::BIND PARAMADDR 2006-07-25 15:29:15.515000 [0x008B33B0] 2006-07-25 15:29:15.515000 I T AT L I D P 2006-07-25 15:29:15.515000 2 ASCII A 100 0x0012FCD4 0x0012FBF0 0x00000000
2006-07-25 15:29:15.515000
2006-07-25 15:29:15.515000 ::EXECUTE 'SQLCURS_2' 2006-07-25 15:29:15.515000 [0x008B33B0]
2006-07-25 15:29:15.515000 PARSE ID: 00007D81 00000702 12003C00 [1]
2006-07-25 15:29:15.515000 SQL COMMAND: 'CALL spTest(:strVal, :outVal)'
2006-07-25 15:29:15.515000 ENCODING : UCS2 big endian (native)
2006-07-25 15:29:15.515000 INPUT PARAMETERS:
2006-07-25 15:29:15.515000 APPLICATION
2006-07-25 15:29:15.515000 I   T          AT L          I           DATA
2006-07-25 15:29:15.515000 1 ASCII A 9 100 'beginning' 2006-07-25 15:29:15.515000 <Packet> unicode_swap full swap ODB-70700 (transfer len 224)
2006-07-25 15:29:15.515000       1 Segment(s) (192 of 130784 bytes)
2006-07-25 15:29:15.515000    cmd Segment 1 at 0 (192 of 130784 bytes)
2006-07-25 15:29:15.515000 messtype: execute sqlmode: internal producer: user
2006-07-25 15:29:15.515000         Options:
2006-07-25 15:29:15.515000         2 parts:
2006-07-25 15:29:15.515000 parsid Part 1 Arguments (12 of 130728 bytes) (Segment at 0) 2006-07-25 15:29:15.515000 0 00 00 7d 81 00 00 07 02 12 00 3c 00 |..}Â......<.| 2006-07-25 15:29:15.515000 data Part 1 Arguments (101 of 130696 bytes) (Segment at 0) 2006-07-25 15:29:15.515000 0 01 62 00 65 00 67 00 69 00 6e 00 6e 00 69 00 6e |.b.e.g.i.n.n.i.n| 2006-07-25 15:29:15.515000 10 00 67 00 20 00 20 00 20 00 20 00 20 00 20 00 20 |.g. . . . . . . | 2006-07-25 15:29:15.515000 20 00 20 00 20 00 20 00 20 00 20 00 20 00 20 00 20 |. . . . . . . . | 2006-07-25 15:29:15.515000 30 00 20 00 20 00 20 00 20 00 20 00 20 00 20 00 20 |. . . . . . . . | 2006-07-25 15:29:15.515000 40 00 20 00 20 00 20 00 20 00 20 00 20 00 20 00 20 |. . . . . . . . | 2006-07-25 15:29:15.515000 50 00 20 00 20 00 20 00 20 00 20 00 20 00 20 00 20 |. . . . . . . . | 2006-07-25 15:29:15.515000 60 00 20 00 20 00 |. . .|
2006-07-25 15:29:15.515000 </Packet>
2006-07-25 15:29:15.515000
2006-07-25 15:29:15.515000 <Packet> unicode_swap full swap ODB-70700 (transfer len 320)
2006-07-25 15:29:15.515000       1 Segment(s) (288 of 130784 bytes)
2006-07-25 15:29:15.515000    return Segment 1 at 0 (288 of 130784 bytes)
2006-07-25 15:29:15.515000         RC: 0  00000  (Pos 0) Function 34
2006-07-25 15:29:15.515000         2 parts:
2006-07-25 15:29:15.515000 data Part 1 Arguments (202 of 130728 bytes) (Segment at 0) 2006-07-25 15:29:15.515000 0 01 62 00 65 00 67 00 69 00 6e 00 6e 00 69 00 6e |.b.e.g.i.n.n.i.n| 2006-07-25 15:29:15.515000 10 00 67 00 65 00 6e 00 64 00 69 00 6e 00 67 00 20 |.g.e.n.d.i.n.g. | 2006-07-25 15:29:15.515000 20 00 20 00 20 00 20 00 20 00 20 00 20 00 20 00 20 |. . . . . . . . | 2006-07-25 15:29:15.515000 30 00 20 00 20 00 20 00 20 00 20 00 20 00 20 00 20 |. . . . . . . . | 2006-07-25 15:29:15.515000 40 00 20 00 20 00 20 00 20 00 20 00 20 00 20 00 20 |. . . . . . . . | 2006-07-25 15:29:15.515000 50 00 20 00 20 00 20 00 20 00 20 00 20 00 20 00 20 |. . . . . . . . | 2006-07-25 15:29:15.515000 60 00 20 00 20 00 01 62 00 65 00 67 00 69 00 6e 00 |. . ..b.e.g.i.n.| 2006-07-25 15:29:15.515000 70 6e 00 69 00 6e 00 67 00 65 00 6e 00 64 00 69 00 |n.i.n.g.e.n.d.i.| 2006-07-25 15:29:15.515000 80 6e 00 67 00 20 00 20 00 20 00 20 00 20 00 20 00 |n.g. . . . . . .| 2006-07-25 15:29:15.515000 90 20 00 20 00 20 00 20 00 20 00 20 00 20 00 20 00 | . . . . . . . .| 2006-07-25 15:29:15.515000 a0 20 00 20 00 20 00 20 00 20 00 20 00 20 00 20 00 | . . . . . . . .| 2006-07-25 15:29:15.515000 b0 20 00 20 00 20 00 20 00 20 00 20 00 20 00 20 00 | . . . . . . . .| 2006-07-25 15:29:15.515000 c0 20 00 20 00 20 00 20 00 20 00 | . . . . .| 2006-07-25 15:29:15.515000 resultcount Part 1 Arguments (7 of 130504 bytes) (Segment at 0) 2006-07-25 15:29:15.515000 0 00 c1 10 00 00 00 00 |.Ã.....|
2006-07-25 15:29:15.515000 </Packet>
2006-07-25 15:29:15.515000
2006-07-25 15:29:15.515000 OUTPUT PARAMETERS:
2006-07-25 15:29:15.515000 APPLICATION
2006-07-25 15:29:15.515000 I   T          AT L          I           DATA
2006-07-25 15:29:15.515000 1 ASCII A 9 50 'beginning' *** TRUNCATED *** 2006-07-25 15:29:15.515000 2 ASCII A 100 50 'beginningending '
2006-07-25 15:29:15.515000
2006-07-25 15:29:15.515000 ::CLOSE CONNECTION 2006-07-25 15:29:15.515000 [0x008B2060]
2006-07-25 15:29:15.515000
2006-07-25 15:29:15.515000 ::EXECUTE DBS 'SQLCURS_1' 2006-07-25 15:29:15.515000 [0x008B2FB8]
2006-07-25 15:29:15.515000 SQL COMMAND : 'ROLLBACK WORK RELEASE'
2006-07-25 15:29:15.515000 <Packet> ascii full swap ODB-70700 (transfer len 144)
2006-07-25 15:29:15.515000       1 Segment(s) (112 of 130784 bytes)
2006-07-25 15:29:15.515000    cmd Segment 1 at 0 (112 of 130784 bytes)
2006-07-25 15:29:15.515000 messtype: dbs sqlmode: internal producer: user
2006-07-25 15:29:15.515000         Options: with info
2006-07-25 15:29:15.515000         2 parts:
2006-07-25 15:29:15.515000 command Part 1 Arguments (21 of 130728 bytes) (Segment at 0) 2006-07-25 15:29:15.515000 0 52 4f 4c 4c 42 41 43 4b 20 57 4f 52 4b 20 52 45 |ROLLBACK WORK RE| 2006-07-25 15:29:15.515000 10 4c 45 41 53 45 |LEASE| 2006-07-25 15:29:15.515000 resulttablename Part 1 Arguments (9 of 130688 bytes) (Segment at 0) 2006-07-25 15:29:15.515000 0 53 51 4c 43 55 52 53 5f 31 |SQLCURS_1|
2006-07-25 15:29:15.515000 </Packet>
2006-07-25 15:29:15.515000
2006-07-25 15:29:15.515000 <Packet> ascii full swap ODB-70700 (transfer len 72)
2006-07-25 15:29:15.515000       1 Segment(s) (40 of 130784 bytes)
2006-07-25 15:29:15.515000    return Segment 1 at 0 (40 of 130784 bytes)
2006-07-25 15:29:15.515000         RC: 0  00000  (Pos 0) Function 242
2006-07-25 15:29:15.515000         0 parts:
2006-07-25 15:29:15.515000 </Packet>
2006-07-25 15:29:15.515000

#include <SQLDBC_C.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>

typedef struct ConnectArgsT {
        char * username;
        char * password;
        char * dbname;
        char * host;
} ConnectArgsT;

typedef struct tagTIMESTAMP_STRUCT {
        short year;
        unsigned short month;
        unsigned short day;
        unsigned short hour;
        unsigned short minute;
        unsigned short second;
        unsigned int fraction;
} TIMESTAMP_STRUCT;

static void parseArgs (ConnectArgsT * connectArgs, int argc, char **argv);
static void usage();

static char *convertToUCS2(char *src)
{
        int i;
        short *s;
        size_t len = strlen(src);
        wchar_t *w=(wchar_t*)calloc(len, sizeof(wchar_t));
        size_t nc = mbstowcs(w, src, len);
        if ((size_t)-1 == nc) {
                fprintf(stderr, "Conversion to UCS2 failed. Execution 
stopped.\n");
                exit(1);
        }
        s=(SQLDBC_Int2*)calloc(nc+1, sizeof(SQLDBC_Int2));
        for(i=0; i<nc; i++) {
                s[i] = w[i];
        }
        free(w);

        return (char*)s;
};

int TestInOut(int argc, char *argv[])
{
        SQLDBC_IRuntime *runtime;
        SQLDBC_Environment *environment;
        SQLDBC_Connection *conn;
        SQLDBC_ConnectProperties *conn_prop;
        SQLDBC_PreparedStatement *stmt;
        SQLDBC_Retcode rc;
        char errorText[200];
        int b,c;
        char buf[100], buf2[100];
        void *addr[2];

        ConnectArgsT connectArgs;
        parseArgs (&connectArgs, argc, argv);

        runtime = ClientRuntime_GetClientRuntime(errorText, sizeof(errorText));
        if (!runtime) {
fprintf(stderr, "Getting instance of the ClientRuntime failed %s", errorText);
                return (1);
        }
        environment = SQLDBC_Environment_new_SQLDBC_Environment(runtime);

        conn = SQLDBC_Environment_createConnection(environment);
        conn_prop = SQLDBC_ConnectProperties_new_SQLDBC_ConnectProperties();

        SQLDBC_ConnectProperties_setProperty(conn_prop, "SQL", "1");
        SQLDBC_ConnectProperties_setProperty(conn_prop, "PACKET", "1");
        SQLDBC_ConnectProperties_setProperty(conn_prop, "TIMESTAMP", "1");
SQLDBC_ConnectProperties_setProperty(conn_prop, "FILENAME", "\"c:\\temp\\inout.txt\"");
        SQLDBC_Environment_setTraceOptions(environment, conn_prop);

//CREATE DBPROC spTest(INOUT strVal VARCHAR(50), OUT outVal VARCHAR(50)) AS " +
   //   strVal = strVal || 'ending'; outVal = strVal;"

rc = SQLDBC_Connection_connectASCII(conn, connectArgs.host, connectArgs.dbname, connectArgs.username, connectArgs.password, conn_prop);
        if(SQLDBC_OK != rc) {
                SQLDBC_ErrorHndl *herror = SQLDBC_Connection_getError(conn);
fprintf(stderr, "Connecting to the database failed %s", SQLDBC_ErrorHndl_getErrorText(herror));
                return (1);
        }
printf("Sucessfull connected to %s as user %s\n", connectArgs.dbname, connectArgs.username);

        stmt = SQLDBC_Connection_createPreparedStatement(conn);
rc = SQLDBC_PreparedStatement_prepareNTS(stmt, convertToUCS2("CALL spTest(:strVal, :outVal)"),
                SQLDBC_StringEncodingType_Encoding_UCS2Swapped);

        if(SQLDBC_OK != rc) {
                SQLDBC_ErrorHndl *herror = 
SQLDBC_PreparedStatement_getError(stmt);
fprintf(stderr, "Statement preparing failed %s", SQLDBC_ErrorHndl_getErrorText(herror));
                return (1);
        }

        SQLDBC_PreparedStatement_setBatchSize(stmt, 1);

        b = sizeof(buf);
        memset(buf, 0, b);
        strcpy(buf, "beginning");
        addr[0] = buf;

rc = SQLDBC_PreparedStatement_bindParameterAddr(stmt, 1, SQLDBC_HOSTTYPE_ASCII, addr, &b, strlen(buf), SQLDBC_FALSE);

        if(SQLDBC_OK != rc) {
                SQLDBC_ErrorHndl *herror = 
SQLDBC_PreparedStatement_getError(stmt);
fprintf(stderr, "Parameter binding failed %s", SQLDBC_ErrorHndl_getErrorText(herror));
                return (1);
        }

        c = sizeof(buf2);
        memset(buf2, 0, c);
        addr[1] = buf2;

rc = SQLDBC_PreparedStatement_bindParameterAddr(stmt, 2, SQLDBC_HOSTTYPE_ASCII, addr + 1, &c, sizeof(buf2), SQLDBC_FALSE);

        if(SQLDBC_OK != rc) {
                SQLDBC_ErrorHndl *herror = 
SQLDBC_PreparedStatement_getError(stmt);
fprintf(stderr, "Parameter binding failed %s", SQLDBC_ErrorHndl_getErrorText(herror));
                return (1);
        }

        rc = SQLDBC_PreparedStatement_executeASCII(stmt);

        if(SQLDBC_OK != rc) {
                SQLDBC_ErrorHndl *herror = 
SQLDBC_PreparedStatement_getError(stmt);
fprintf(stderr, "Execution failed %s", SQLDBC_ErrorHndl_getErrorText(herror));
                return (1);
        }

        printf("%s, %s\n", buf, buf2);

        SQLDBC_Environment_releaseConnection(environment, conn);
        SQLDBC_Environment_delete_SQLDBC_Environment(environment);

        return 0;
}

void main(int argc, char *argv[])
{
        TestInOut(argc, argv);
        return;
}

static void parseArgs (ConnectArgsT * connectArgs, int argc, char **argv)
{
        /*
        * setting defaults for demo database
        */
        connectArgs->username = (char*)"MONA";
        connectArgs->password = (char*)"RED";
        connectArgs->dbname = (char*)"HOTELDB";
        connectArgs->host = (char*)"localhost";
        /*
        * use values from command line
        */
        if (argc > 4) {
                connectArgs->host = argv [4];
        }
        if (argc > 3) {
                connectArgs->dbname = argv [3];
        }
        if (argc > 2) {
                connectArgs->password = argv [2];
        }
        if (argc > 1) {
if (!strcmp(argv[1], "-h") || !strcmp(argv[1], "-?") || !strcmp(argv[1], "/?")) {
                        usage();
                }
                connectArgs->username = argv[1];
        }
}

static void usage()
{
fprintf(stderr, "Usage: HelloWorld [<user name> [<password> [<database name> [<server name>]]]]\n");
        fprintf(stderr, "\n   Arguments:\n\n");
fprintf(stderr, " <user name> The name of the database user. Default 'MONA'\n"); fprintf(stderr, " <password> The password of the database user. Default 'RED'\n"); fprintf(stderr, " <database name> The database name to connect to. Default 'HOTELDB'\n"); fprintf(stderr, " <server name> The hostname or IP adress of the datase server. Default 'localhost'\n");
        exit(1);
}


-- 
MaxDB Discussion Mailing List
For list archives: http://lists.mysql.com/maxdb
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to