Skip to content

Commit

Permalink
db/driver: fix MySQL driver compilation warnings (#3344)
Browse files Browse the repository at this point in the history
configure: improve MySQL detection, print version
  • Loading branch information
nilason committed Feb 15, 2024
1 parent bc850a0 commit f4334e4
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 10 deletions.
9 changes: 6 additions & 3 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -12133,6 +12133,9 @@ fi
fi

if test "$MYSQLD_CONFIG" != "" ; then
mysql_version=`"$MYSQLD_CONFIG" --version`
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: using MySQL/MariaDB version \"$mysql_version\"" >&5
printf "%s\n" "using MySQL/MariaDB version \"$mysql_version\"" >&6; }
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
Expand All @@ -12146,10 +12149,10 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
ac_fn_cxx_check_func "$LINENO" "mysql_server_init" "ac_cv_func_mysql_server_init"
if test "x$ac_cv_func_mysql_server_init" = xyes
then :

{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: libmysqld found" >&5
printf "%s\n" "libmysqld found" >&6; }
else $as_nop
MYSQLDLIB="";
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: libmysqld not found" >&5
MYSQLDLIB=""; { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: libmysqld not found" >&5
printf "%s\n" "$as_me: WARNING: libmysqld not found" >&2;}
fi

Expand Down
7 changes: 5 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1287,13 +1287,16 @@ if test -n "$USE_MYSQL"; then
fi

if test "$MYSQLD_CONFIG" != "" ; then
mysql_version=`"$MYSQLD_CONFIG" --version`
AC_MSG_RESULT([using MySQL/MariaDB version "$mysql_version"])
AC_LANG_PUSH([C++])
ac_save_libs="$LIBS"
MYSQLDLIB=`"$MYSQLD_CONFIG" --libmysqld-libs`

LIBS="$MYSQLDLIB $LIBS"
AC_CHECK_FUNC(mysql_server_init,,[MYSQLDLIB="";
AC_MSG_WARN([libmysqld not found])] )
AC_CHECK_FUNC(mysql_server_init,
AC_MSG_RESULT([libmysqld found]),
[MYSQLDLIB=""; AC_MSG_WARN([libmysqld not found])])
LIBS=$ac_save_libs
AC_LANG_POP([C++])
fi
Expand Down
2 changes: 1 addition & 1 deletion db/drivers/mysql/driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include "globals.h"
#include "proto.h"

int db__driver_init(int argc, char *argv[])
int db__driver_init(int argc UNUSED, char *argv[] UNUSED)
{
init_error();
return DB_OK;
Expand Down
3 changes: 1 addition & 2 deletions db/drivers/mysql/fetch.c
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,7 @@ int db__driver_fetch(dbCursor *cn, int position, int *more)
return DB_OK;
}

int db__driver_get_num_rows(cn)
dbCursor *cn;
int db__driver_get_num_rows(dbCursor *cn)
{
cursor *c;
dbToken token;
Expand Down
4 changes: 2 additions & 2 deletions db/drivers/mysql/listtab.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "globals.h"
#include "proto.h"

int db__driver_list_tables(dbString **tlist, int *tcount, int system)
int db__driver_list_tables(dbString **tlist, int *tcount, int system UNUSED)
{
int i;
dbString *list;
Expand All @@ -32,7 +32,7 @@ int db__driver_list_tables(dbString **tlist, int *tcount, int system)
res = mysql_list_tables(connection, NULL);

if (res == NULL) {
db_d_append_error("%s\%s", _("Unable get list of tables:"),
db_d_append_error("%s\n%s", _("Unable get list of tables:"),
mysql_error(connection));
db_d_report_error();
return DB_FAILED;
Expand Down

0 comments on commit f4334e4

Please sign in to comment.