Date: Tuesday, January 17, 2006 @ 18:12:25
Author: marc
Path: /cvsroot/carob/odbsequoia/src
Modified: simpletest.c (1.8 -> 1.9)
Added missing copyright header. Moved print_diags() at bottom for clarity.
--------------+
simpletest.c | 119 ++++++++++++++++++++++++++++++++++-----------------------
1 files changed, 71 insertions(+), 48 deletions(-)
Index: odbsequoia/src/simpletest.c
diff -u odbsequoia/src/simpletest.c:1.8 odbsequoia/src/simpletest.c:1.9
--- odbsequoia/src/simpletest.c:1.8 Tue Jan 17 16:02:38 2006
+++ odbsequoia/src/simpletest.c Tue Jan 17 18:12:25 2006
@@ -1,3 +1,24 @@
+/*
+ * Sequoia: Database clustering technology.
+ * Copyright (C) 2006 Continuent, Inc.
+ * Contact: [EMAIL PROTECTED]
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Initial developer(s): Marc Herbert
+ * Contributor(s):
+ */
+
#include <sql.h>
#include <sqlucode.h>
@@ -15,54 +36,8 @@
SQLSMALLINT * ignoredLenPtr = (SQLSMALLINT *) 0;
SQLSMALLINT ignoredRecNum = 5243;
-
-void print_diags(int pc, SQLSMALLINT hdletype, SQLHANDLE hdle)
-{
- SQLINTEGER irec, recmax;
- SQLSMALLINT statesize, msgsize;
- SQLCHAR state[12]; // twice what needed because of this under-estimating
bug:
- //
<http://permalink.gmane.org/gmane.comp.db.unixodbc.devel/1760>
- SQLINTEGER nativecode;
- SQLCHAR msg[201];
-
-
- SQLGetDiagField(hdletype, hdle, ignoredRecNum, SQL_DIAG_NUMBER, &recmax,
- ignoredBufLen, ignoredLenPtr);
-
- for (irec = 1; irec <= recmax; irec++) {
-
- SQLGetDiagRec(hdletype, hdle,
- irec, state, &nativecode, msg, 200, &msgsize);
-
- printf ("step %d: sqlstate: %s, ", pc, state);
- printf ("native errr: %ld, ", nativecode);
- printf ("%s, ", msg);
- printf ("msgsize: %d\n", msgsize);
-
- // cleanup
- strcpy ((char *)state, "nop"); statesize = -1000; nativecode = -1000;
- strcpy((char *)msg, "nop"); msgsize = -1000 ;
-
- // get the same thing through SQLGetDiagField thrice
- SQLGetDiagField(hdletype, hdle, irec, SQL_DIAG_SQLSTATE,
- state, 12*sizeof(SQLCHAR), &statesize);
-
- SQLGetDiagField(hdletype, hdle, irec, SQL_DIAG_NATIVE,
- &nativecode, ignoredBufLen, ignoredLenPtr );
-
- SQLGetDiagField(hdletype, hdle, irec, SQL_DIAG_MESSAGE_TEXT,
- msg, 201, &msgsize);
-
-
- printf ("same diags but through SQLGetDiagField:\n");
- printf ("step %d: sqlstate: %s, ", pc, state);
- printf ("statesize: %d\n", statesize);
- printf ("native errr: %ld, ", nativecode);
- printf ("%s, ", msg);
- printf ("msgsize: %d\n", msgsize);
-
- }
-}
+// forward
+void print_diags(int pc, SQLSMALLINT hdletype, SQLHANDLE hdle);
// can you spell: "functional language" ?
#define EXEC_AND_DIAGS(call, type, hdle, cont) \
@@ -139,6 +114,54 @@
}
+void print_diags(int pc, SQLSMALLINT hdletype, SQLHANDLE hdle)
+{
+ SQLINTEGER irec, recmax;
+ SQLSMALLINT statesize, msgsize;
+ SQLCHAR state[12]; // twice what needed because of this under-estimating
bug:
+ //
<http://permalink.gmane.org/gmane.comp.db.unixodbc.devel/1760>
+ SQLINTEGER nativecode;
+ SQLCHAR msg[201];
+
+
+ SQLGetDiagField(hdletype, hdle, ignoredRecNum, SQL_DIAG_NUMBER, &recmax,
+ ignoredBufLen, ignoredLenPtr);
+
+ for (irec = 1; irec <= recmax; irec++) {
+
+ SQLGetDiagRec(hdletype, hdle,
+ irec, state, &nativecode, msg, 200, &msgsize);
+
+ printf ("step %d: sqlstate: %s, ", pc, state);
+ printf ("native errr: %ld, ", nativecode);
+ printf ("%s, ", msg);
+ printf ("msgsize: %d\n", msgsize);
+
+ // cleanup
+ strcpy ((char *)state, "nop"); statesize = -1000; nativecode = -1000;
+ strcpy((char *)msg, "nop"); msgsize = -1000 ;
+
+ // get the same thing through SQLGetDiagField thrice
+ SQLGetDiagField(hdletype, hdle, irec, SQL_DIAG_SQLSTATE,
+ state, 12*sizeof(SQLCHAR), &statesize);
+
+ SQLGetDiagField(hdletype, hdle, irec, SQL_DIAG_NATIVE,
+ &nativecode, ignoredBufLen, ignoredLenPtr );
+
+ SQLGetDiagField(hdletype, hdle, irec, SQL_DIAG_MESSAGE_TEXT,
+ msg, 201, &msgsize);
+
+
+ printf ("same diags but through SQLGetDiagField:\n");
+ printf ("step %d: sqlstate: %s, ", pc, state);
+ printf ("statesize: %d\n", statesize);
+ printf ("native errr: %ld, ", nativecode);
+ printf ("%s, ", msg);
+ printf ("msgsize: %d\n", msgsize);
+
+ }
+}
+
/*
_______________________________________________
Carob-commits mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/carob-commits