summaryrefslogtreecommitdiff
blob: 64289472265ab0b4c63ad3f3d109952ab36b7e07 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
diff -urN tcl-sql.old/sql-mysql.cc tcl-sql/sql-mysql.cc
--- tcl-sql.old/sql-mysql.cc	2000-01-12 20:50:03.000000000 -0500
+++ tcl-sql/sql-mysql.cc	2004-08-08 13:15:15.820828056 -0400
@@ -1,3 +1,4 @@
+#define USE_OLD_FUNCTIONS
 #include "tcl.h"
 #include "sql-mysql.h"
 
@@ -20,7 +21,7 @@
 // -------------------------------------------------------------
 char *
 Sql_mysql::getErrorMsg() {
-	char *msg = mysql_error(&mysql);
+	char *msg = (char *)mysql_error(&mysql);
 	if (*msg == '\0') {
 		return errormsg;
 	} else {
@@ -71,7 +72,7 @@
 
 // -------------------------------------------------------------
 int
-Sql_mysql::numRows(int resHandle=0) {
+Sql_mysql::numRows(int resHandle) {
 	if (!results[resHandle]) { return -1; }
 	return(mysql_num_rows(results[resHandle]));
 }
@@ -109,7 +110,7 @@
 
 // -------------------------------------------------------------
 void
-Sql_mysql::endquery(int resHandle=0) {
+Sql_mysql::endquery(int resHandle) {
 	if (!results[resHandle]) return;
 	mysql_free_result(results[resHandle]);
 	results[resHandle] = NULL;
@@ -120,7 +121,7 @@
 // Note: A new Sql_row is allocated. Has to be freed by calling
 // party.
 Sql_row *
-Sql_mysql::fetchrow(int resHandle=0) {
+Sql_mysql::fetchrow(int resHandle) {
 
 	if (!results[resHandle]) {
 		sprintf(errormsg, "Result handle [%d] not in use.\n", resHandle);
diff -urN tcl-sql.old/sql.cc tcl-sql/sql.cc
--- tcl-sql.old/sql.cc	2000-01-12 20:53:23.000000000 -0500
+++ tcl-sql/sql.cc	2004-08-08 13:12:57.058923072 -0400
@@ -122,7 +122,7 @@
 
 // -------------------------------------------------------------
 //
-int SqlCmd(ClientData clientData, Tcl_Interp *interp, int argc, char **argv) 
+int SqlCmd(ClientData clientData, Tcl_Interp *interp, int argc, const char **argv) 
 {
 	if (argc == 1) {
 		Tcl_SetResult(interp, "Usage: sql command ?handle?", TCL_STATIC);
@@ -137,7 +137,7 @@
 
 	// -----------------------------------
 	if (strcmp(argv[1], "connect")==0) {
-		c = mgr->connect(argc-2, argv+2);
+		c = mgr->connect(argc-2, (char **)(argv+2));
 		if (c < 0) {
 			char *basemsg = "Unable to Connect: ";
 			char *errmsg = mgr->getErrorMsg();
@@ -160,7 +160,7 @@
 		if (argc <= 2) {
 			Tcl_SetResult(interp, "Usage:\nsql command handle", TCL_STATIC);
 			return TCL_ERROR;
-		} else if ((connid = stripPrefix(argv[2], HANDLE_PREFIX)) < 0) {
+		} else if ((connid = stripPrefix((char *)argv[2], HANDLE_PREFIX)) < 0) {
 			Tcl_AppendResult(interp, "sql: Invalid handle: ", argv[2], NULL);
 			return TCL_ERROR;
 		} else if (!mgr->inUse(connid)) {
@@ -172,19 +172,19 @@
 
 		// take care of the command:
 		if (strcmp(argv[1], "exec") == 0) {
-			res = execCmd(interp, conn, argv[3]);
+			res = execCmd(interp, conn, (char *)argv[3]);
 		} else if (strcmp(argv[1], "query") == 0) {
-			res = queryCmd(interp, conn, argv[3]);
+			res = queryCmd(interp, conn, (char *)argv[3]);
 		} else if (strcmp(argv[1], "endquery") == 0) {
-			res = endqueryCmd(interp, conn, argv[3]);
+			res = endqueryCmd(interp, conn, (char *)argv[3]);
 		} else if (strcmp(argv[1], "fetchrow") == 0) {
-			res = fetchrowCmd(interp, conn, argv[3]);
+			res = fetchrowCmd(interp, conn, (char *)argv[3]);
 		} else if (strcmp(argv[1], "numrows") == 0) {
-			res = numrowsCmd(interp, conn, argv[3]);
+			res = numrowsCmd(interp, conn, (char *)argv[3]);
 		} else if (strcmp(argv[1], "disconnect") == 0) {
 			res = disconnectCmd(interp, mgr, connid);
 		} else if (strcmp(argv[1], "selectdb")==0) {
-			res = selectdbCmd(interp, conn, argv[3]);
+			res = selectdbCmd(interp, conn, (char *)argv[3]);
 		} else {
 			Tcl_AppendResult(interp, "sql: unknown sql command: ", argv[1], NULL);
 			return TCL_ERROR;