1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-25 04:43:33 +00:00

Make buildable with newer MySQL clients -- 4 and 5 -- but keep

compatible with the 3 -- mysql_error now returns `const char *', and
there is no mysql_connect any more. Default to MySQL-4.x for now. Bump
PORTREVISION.

Reported by:	Robert Andrews
This commit is contained in:
Mikhail Teterin 2004-11-11 18:06:27 +00:00
parent 3a81a7dc36
commit d9de5588ed
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=121401
4 changed files with 23 additions and 9 deletions

View File

@ -7,7 +7,7 @@
PORTNAME= ${TCL_NODOT}-sql
PORTVERSION= 20000114
PORTREVISION= 3
PORTREVISION= 4
CATEGORIES= databases ${TCL_NODOT}
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
MASTER_SITE_SUBDIR= tcl-sql
@ -17,7 +17,7 @@ EXTRACT_SUFX= .tgz
MAINTAINER= mi@aldan.algebra.com
COMMENT= TCL module for accessing MySQL databases
LIB_DEPENDS= mysqlclient:${PORTSDIR}/databases/mysql323-client
LIB_DEPENDS= mysqlclient:${PORTSDIR}/databases/mysql41-client
BUILD_DEPENDS= tclsh${TCL_VERSION}:${PORTSDIR}/lang/${TCL_NODOT}
TCL_VERSION?= 8.4 # Only this needs changing to switch TCL-version

View File

@ -1,4 +1,4 @@
TCL_VERSION?= tcl8.3
TCL_VERSION?= tcl8.4
TCL_NODOT?= ${TCL_VERSION:S/.//}
SHLIB_NAME?= libTclMySQL.so.1

View File

@ -5,8 +5,12 @@ be slightly different. The patch gets rid of a lot of sprintf and will
make your scripts faster, especially when fetching multiple rows of the
same queries.
In modern MySQL mysql_error() returns a const-pointer, so getErrorMsg()
had to be changed. However, since we are using TCL_STATIC anyway, we can
just cast its result back down to plain char*
--- sql.cc Fri Aug 13 15:28:56 1999
+++ sql.cc Thu Apr 1 17:04:56 2004
+++ sql.cc Wed Nov 10 17:40:19 2004
@@ -12,24 +12,11 @@
-const char* HANDLE_PREFIX = "sql";
@ -41,12 +45,12 @@ same queries.
@@ -38,3 +25,3 @@
// An error occured.
- Tcl_SetResult(interp, conn->getErrorMsg(), TCL_VOLATILE);
+ Tcl_SetResult(interp, conn->getErrorMsg(), TCL_STATIC);
+ Tcl_SetResult(interp, (char *)conn->getErrorMsg(), TCL_STATIC);
return TCL_ERROR;
@@ -47,3 +34,3 @@
// An error occured.
- Tcl_SetResult(interp, conn->getErrorMsg(), TCL_VOLATILE);
+ Tcl_SetResult(interp, conn->getErrorMsg(), TCL_STATIC);
+ Tcl_SetResult(interp, (char *)conn->getErrorMsg(), TCL_STATIC);
return TCL_ERROR;
@@ -60,9 +47,9 @@
int queryCmd(Tcl_Interp *interp, Sql_interface *conn, char *cmd) {
@ -55,7 +59,7 @@ same queries.
if ((handle = conn->query(cmd)) < 0) {
// An error occured.
- Tcl_SetResult(interp, conn->getErrorMsg(), TCL_VOLATILE);
+ Tcl_SetResult(interp, conn->getErrorMsg(), TCL_STATIC);
+ Tcl_SetResult(interp, (char *)conn->getErrorMsg(), TCL_STATIC);
return TCL_ERROR;
}
- sprintf(interp->result, "%s%d", RESULT_PREFIX, handle);
@ -149,7 +153,7 @@ same queries.
+ }
+ connid = mgr->connect(objc-2, argv);
+ if (connid < 0) {
+ Tcl_SetResult(interp, mgr->getErrorMsg(), TCL_STATIC);
+ Tcl_SetResult(interp, (char *)mgr->getErrorMsg(), TCL_STATIC);
return TCL_ERROR;
}
- char errormsg[16];

View File

@ -1,5 +1,15 @@
--- sql-mysql.cc Wed Jan 12 20:50:03 2000
+++ sql-mysql.cc Tue Nov 26 19:48:56 2002
+++ sql-mysql.cc Wed Nov 10 17:40:19 2004
@@ -19,7 +19,7 @@
// -------------------------------------------------------------
-char *
+const char *
Sql_mysql::getErrorMsg() {
- char *msg = mysql_error(&mysql);
+ const char *msg = mysql_error(&mysql);
if (*msg == '\0') {
return errormsg;
@@ -72,5 +72,5 @@
// -------------------------------------------------------------
int