Hi,For MySQL database connection it is impossible to select a port number to connect to.
The patch (svn.diff) in attachment fixes this in a backwards compatible way. with kind regards Wim Crols
Index: mysql_wrap.cpp =================================================================== --- mysql_wrap.cpp (revision 6114) +++ mysql_wrap.cpp (working copy) @@ -1,6 +1,6 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 1.3.37 + * Version 1.3.39 * * This file is not intended to be easily readable and contains a number of * coding conventions designed to improve portability and efficiency. Do not make @@ -2178,7 +2178,7 @@ /* -------- TYPES TABLE (END) -------- */ -#define SWIGVERSION 0x010337 +#define SWIGVERSION 0x010339 #define SWIG_VERSION SWIGVERSION @@ -2462,13 +2462,14 @@ mysql_db(const char* host, const char* user, const char* password, - const char* db_name) { + const char* db_name, + unsigned int port=0) { db=mysql_init(0); if (!db) { error("failed to create MYSQL structure"); return; } - if (!mysql_real_connect(db,host,user,password,db_name,0,0,0)) { + if (!mysql_real_connect(db,host,user,password,db_name,port,0,0)) { error("connect to database failed: error %i: %s", mysql_errno(db),mysql_error(db)); return; @@ -19581,11 +19582,12 @@ } -static octave_value_list _wrap_new_mysql_db (const octave_value_list& args, int nargout) { +static octave_value_list _wrap_new_mysql_db__SWIG_0 (const octave_value_list& args, int nargout) { char *arg1 = (char *) 0 ; char *arg2 = (char *) 0 ; char *arg3 = (char *) 0 ; char *arg4 = (char *) 0 ; + unsigned int arg5 ; int res1 ; char *buf1 = 0 ; int alloc1 = 0 ; @@ -19598,11 +19600,75 @@ int res4 ; char *buf4 = 0 ; int alloc4 = 0 ; + unsigned int val5 ; + int ecode5 = 0 ; octave_value_list _out; octave_value_list *_outp=&_out; octave_value _outv; mysql_db *result = 0 ; + if (!SWIG_check_num_args("new_mysql_db",args.length(),5,5,0)) { + SWIG_fail; + } + res1 = SWIG_AsCharPtrAndSize(args(0), &buf1, NULL, &alloc1); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_mysql_db" "', argument " "1"" of type '" "char const *""'"); + } + arg1 = (char *)(buf1); + res2 = SWIG_AsCharPtrAndSize(args(1), &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_mysql_db" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = (char *)(buf2); + res3 = SWIG_AsCharPtrAndSize(args(2), &buf3, NULL, &alloc3); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "new_mysql_db" "', argument " "3"" of type '" "char const *""'"); + } + arg3 = (char *)(buf3); + res4 = SWIG_AsCharPtrAndSize(args(3), &buf4, NULL, &alloc4); + if (!SWIG_IsOK(res4)) { + SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "new_mysql_db" "', argument " "4"" of type '" "char const *""'"); + } + arg4 = (char *)(buf4); + ecode5 = SWIG_AsVal_unsigned_SS_int(args(4), &val5); + if (!SWIG_IsOK(ecode5)) { + SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "new_mysql_db" "', argument " "5"" of type '" "unsigned int""'"); + } + arg5 = (unsigned int)(val5); + result = (mysql_db *)new mysql_db((char const *)arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,arg5); + _outv = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_mysql_db, 1 | 0 ); + if (_outv.is_defined()) _outp = SWIG_Octave_AppendOutput(_outp, _outv); + if (alloc1 == SWIG_NEWOBJ) delete[] buf1; + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + if (alloc4 == SWIG_NEWOBJ) delete[] buf4; +fail: + return _out; +} + + +static octave_value_list _wrap_new_mysql_db__SWIG_1 (const octave_value_list& args, int nargout) { + char *arg1 = (char *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + char *arg4 = (char *) 0 ; + int res1 ; + char *buf1 = 0 ; + int alloc1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int res3 ; + char *buf3 = 0 ; + int alloc3 = 0 ; + int res4 ; + char *buf4 = 0 ; + int alloc4 = 0 ; + octave_value_list _out; + octave_value_list *_outp=&_out; + octave_value _outv; + mysql_db *result = 0 ; + if (!SWIG_check_num_args("new_mysql_db",args.length(),4,4,0)) { SWIG_fail; } @@ -19638,6 +19704,64 @@ } +static octave_value_list _wrap_new_mysql_db (const octave_value_list& args, int nargout) { + int argc = args.length(); + octave_value_ref argv[5]={ + octave_value_ref(args,0),octave_value_ref(args,1),octave_value_ref(args,2),octave_value_ref(args,3),octave_value_ref(args,4) + }; + + if (argc == 4) { + int _v; + int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0); + _v = SWIG_CheckState(res); + if (_v) { + int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0); + _v = SWIG_CheckState(res); + if (_v) { + int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0); + _v = SWIG_CheckState(res); + if (_v) { + int res = SWIG_AsCharPtrAndSize(argv[3], 0, NULL, 0); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_new_mysql_db__SWIG_1(args, nargout); + } + } + } + } + } + if (argc == 5) { + int _v; + int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0); + _v = SWIG_CheckState(res); + if (_v) { + int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0); + _v = SWIG_CheckState(res); + if (_v) { + int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0); + _v = SWIG_CheckState(res); + if (_v) { + int res = SWIG_AsCharPtrAndSize(argv[3], 0, NULL, 0); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_unsigned_SS_int(argv[4], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_new_mysql_db__SWIG_0(args, nargout); + } + } + } + } + } + } + + error("No matching function for overload"); + return octave_value_list(); +} + + static octave_value_list _wrap_delete_mysql_db (const octave_value_list& args, int nargout) { mysql_db *arg1 = (mysql_db *) 0 ; void *argp1 = 0 ; Index: mysql.i =================================================================== --- mysql.i (revision 6114) +++ mysql.i (working copy) @@ -64,13 +64,14 @@ mysql_db(const char* host, const char* user, const char* password, - const char* db_name) { + const char* db_name, + unsigned int port=0) { db=mysql_init(0); if (!db) { error("failed to create MYSQL structure"); return; } - if (!mysql_real_connect(db,host,user,password,db_name,0,0,0)) { + if (!mysql_real_connect(db,host,user,password,db_name,port,0,0)) { error("connect to database failed: error %i: %s", mysql_errno(db),mysql_error(db)); return;
------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________ Octave-dev mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/octave-dev
