~ubuntu-branches/ubuntu/maverick/myodbc/maverick

« back to all changes in this revision

Viewing changes to test/my_bulk.c

  • Committer: Bazaar Package Importer
  • Author(s): Steve Langasek
  • Date: 2009-05-10 03:07:47 UTC
  • mfrom: (8.1.1 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090510030747-pvy1kyun4743gws8
Tags: 3.51.19r646-1
* New upstream release
  - fix build failure with current libmysqlclient.  Closes: #521185.
* Fix lintian warnings about ignoring errors in postinst, config scripts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
130
130
 
131
131
 
132
132
/**
133
 
 @todo This test demonstrates an egregious bug. There is logic in
134
 
 insert_pk_fields() that is just wrong.
135
 
*/
136
 
DECLARE_TEST(t_mul_pkdel1)
137
 
{
138
 
  SQLINTEGER nData;
139
 
  SQLLEN nlen;
140
 
  SQLROWSETSIZE pcrow;
141
 
 
142
 
  ok_sql(hstmt, "DROP TABLE IF EXISTS t_mul_pkdel1");
143
 
  ok_sql(hstmt, "CREATE TABLE t_mul_pkdel1 (a INT NOT NULL, b INT,"
144
 
         "c VARCHAR(30) NOT NULL, PRIMARY KEY(a, c))");
145
 
  ok_sql(hstmt, "INSERT INTO t_mul_pkdel1 VALUES (100,10,'MySQL1'),"
146
 
         "(200,20,'MySQL2'),(300,20,'MySQL3'),(400,20,'MySQL4')");
147
 
 
148
 
  ok_stmt(hstmt, SQLFreeStmt(hstmt, SQL_CLOSE));
149
 
 
150
 
  ok_stmt(hstmt, SQLSetCursorName(hstmt, (SQLCHAR *)"venu", SQL_NTS));
151
 
 
152
 
  ok_sql(hstmt, "SELECT a FROM t_mul_pkdel1");
153
 
 
154
 
  ok_stmt(hstmt, SQLBindCol(hstmt, 1, SQL_C_LONG, &nData, 0, NULL));
155
 
 
156
 
  ok_stmt(hstmt, SQLExtendedFetch(hstmt, SQL_FETCH_NEXT, 1, &pcrow, NULL));
157
 
  ok_stmt(hstmt, SQLSetPos(hstmt, 1, SQL_POSITION, SQL_LOCK_NO_CHANGE));
158
 
 
159
 
  ok_stmt(hstmt, SQLSetPos(hstmt, 1, SQL_DELETE, SQL_LOCK_NO_CHANGE));
160
 
  ok_stmt(hstmt, SQLRowCount(hstmt, &nlen));
161
 
  is_num(nlen, 1);
162
 
 
163
 
  ok_stmt(hstmt, SQLFreeStmt(hstmt, SQL_UNBIND));
164
 
  ok_stmt(hstmt, SQLFreeStmt(hstmt, SQL_CLOSE));
165
 
 
166
 
  ok_sql(hstmt, "SELECT * FROM t_mul_pkdel1");
167
 
 
168
 
  is_num(myrowcount(hstmt), 3);
169
 
 
170
 
  ok_stmt(hstmt, SQLFreeStmt(hstmt, SQL_CLOSE));
171
 
 
172
 
  ok_sql(hstmt, "DROP TABLE IF EXISTS t_mul_pkdel1");
173
 
 
174
 
  return OK;
175
 
}
176
 
 
177
 
 
178
 
/**
179
133
  Bug #24306: SQLBulkOperations always uses indicator varables' values from
180
134
  the first record
181
135
*/
300
254
 
301
255
  ok_stmt(hstmt, SQLBulkOperations(hstmt, SQL_ADD));
302
256
 
 
257
  /* Remove SQL_ATTR_ROW_BIND_OFFSET_PTR */
 
258
  ok_stmt(hstmt, SQLSetStmtAttr(hstmt, SQL_ATTR_ROW_BIND_OFFSET_PTR,
 
259
                                NULL, 0));
 
260
 
303
261
  ok_stmt(hstmt, SQLFreeStmt(hstmt, SQL_UNBIND));
304
262
  ok_stmt(hstmt, SQLFreeStmt(hstmt, SQL_CLOSE));
305
263
 
337
295
BEGIN_TESTS
338
296
  ADD_TEST(t_bulk_insert)
339
297
  ADD_TEST(t_mul_pkdel)
340
 
  ADD_TEST(t_mul_pkdel1)
341
298
  ADD_TEST(t_bulk_insert_indicator)
342
299
  ADD_TEST(t_bulk_insert_rows)
343
300
END_TESTS