summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authormonty@tik.mysql.fi <>2001-09-27 21:35:35 +0300
committermonty@tik.mysql.fi <>2001-09-27 21:35:35 +0300
commit99b58a5aa9ae729d95b00650b8360820bafe3887 (patch)
tree32b769f8a9d6a3831b07c0b6cd0ba3e710035209 /sql
parentdf1045ee3c5c25eb62fb1cb8a065fa1bf0d8b902 (diff)
downloadmariadb-git-99b58a5aa9ae729d95b00650b8360820bafe3887.tar.gz
Cleaned up udf_example.cc and mysql_fix_privilege_tables
Diffstat (limited to 'sql')
-rw-r--r--sql/udf_example.cc25
1 files changed, 15 insertions, 10 deletions
diff --git a/sql/udf_example.cc b/sql/udf_example.cc
index bf3aa3d0074..a91db5ee1cc 100644
--- a/sql/udf_example.cc
+++ b/sql/udf_example.cc
@@ -66,7 +66,7 @@
** You can easily get all switches right by doing:
** cd sql ; make udf_example.o
** Take the compile line that make writes, remove the '-c' near the end of
-** the line and add -o udf_example.so to the end of the compile line.
+** the line and add -shared -o udf_example.so to the end of the compile line.
** The resulting library (udf_example.so) should be copied to some dir
** searched by ld. (/usr/lib ?)
**
@@ -97,6 +97,13 @@
** Active function will be reloaded on every restart of server
** (if --skip-grant-tables is not given)
**
+** If you ge problems with undefined symbols when loading the shared
+** library, you should verify that mysqld is compiled with the -rdynamic
+** option.
+**
+** If you can't get AGGREGATES to work, check that you have the column
+** 'type' in the mysql.func table. If not, run 'mysql_fix_privilege_tables'.
+**
*/
#ifdef STANDARD
@@ -128,6 +135,11 @@ my_bool sequence_init(UDF_INIT *initid, UDF_ARGS *args, char *message);
void sequence_deinit(UDF_INIT *initid);
long long sequence(UDF_INIT *initid, UDF_ARGS *args, char *is_null,
char *error);
+my_bool avgcost_init( UDF_INIT* initid, UDF_ARGS* args, char* message );
+void avgcost_deinit( UDF_INIT* initid );
+void avgcost_reset( UDF_INIT* initid, UDF_ARGS* args, char* is_null, char *error );
+void avgcost_add( UDF_INIT* initid, UDF_ARGS* args, char* is_null, char *error );
+double avgcost( UDF_INIT* initid, UDF_ARGS* args, char* is_null, char *error );
}
@@ -766,6 +778,7 @@ char *reverse_lookup(UDF_INIT *initid, UDF_ARGS *args, char *result,
*res_length=(ulong) (strmov(result,hp->h_name) - result);
return result;
}
+#endif // defined(HAVE_GETHOSTBYADDR_R) && defined(HAVE_SOLARIS_STYLE_GETHOST)
/*
** Syntax for the new aggregate commands are:
@@ -777,13 +790,6 @@ char *reverse_lookup(UDF_INIT *initid, UDF_ARGS *args, char *result,
** (this example is provided by Andreas F. Bobak <bobak@relog.ch>)
*/
-extern "C" {
-my_bool avgcost_init( UDF_INIT* initid, UDF_ARGS* args, char* message );
-void avgcost_deinit( UDF_INIT* initid );
-void avgcost_reset( UDF_INIT* initid, UDF_ARGS* args, char* is_null, char *error );
-void avgcost_add( UDF_INIT* initid, UDF_ARGS* args, char* is_null, char *error );
-double avgcost( UDF_INIT* initid, UDF_ARGS* args, char* is_null, char *error );
-}
struct avgcost_data
{
@@ -810,7 +816,7 @@ avgcost_init( UDF_INIT* initid, UDF_ARGS* args, char* message )
return 1;
}
- if ((args->arg_type[0] != INT_RESULT) && (args->arg_type[1] != REAL_RESULT) )
+ if ((args->arg_type[0] != INT_RESULT) || (args->arg_type[1] != REAL_RESULT) )
{
strcpy(
message,
@@ -917,5 +923,4 @@ avgcost( UDF_INIT* initid, UDF_ARGS* args, char* is_null, char* error )
return data->totalprice/double(data->totalquantity);
}
-#endif // defined(HAVE_GETHOSTBYADDR_R) && defined(HAVE_SOLARIS_STYLE_GETHOST)
#endif /* HAVE_DLOPEN */