mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
Cleaned up udf_example.cc and mysql_fix_privilege_tables
This commit is contained in:
@@ -1106,7 +1106,7 @@ changequote([, ])dnl
|
|||||||
AC_DEFUN(AC_SYS_LARGEFILE,
|
AC_DEFUN(AC_SYS_LARGEFILE,
|
||||||
[AC_REQUIRE([AC_CANONICAL_HOST])
|
[AC_REQUIRE([AC_CANONICAL_HOST])
|
||||||
AC_ARG_ENABLE(largefile,
|
AC_ARG_ENABLE(largefile,
|
||||||
[ --disable-large-files Omit support for large files])
|
[ --disable-largefile Omit support for large files])
|
||||||
if test "$enable_largefile" != no; then
|
if test "$enable_largefile" != no; then
|
||||||
AC_CHECK_TOOL(GETCONF, getconf)
|
AC_CHECK_TOOL(GETCONF, getconf)
|
||||||
AC_SYS_LARGEFILE_FLAGS(CFLAGS)
|
AC_SYS_LARGEFILE_FLAGS(CFLAGS)
|
||||||
|
@@ -3,8 +3,8 @@
|
|||||||
echo "This scripts updates the mysql.user, mysql.db, mysql.host and the"
|
echo "This scripts updates the mysql.user, mysql.db, mysql.host and the"
|
||||||
echo "mysql.func table to MySQL 3.22.14 and above."
|
echo "mysql.func table to MySQL 3.22.14 and above."
|
||||||
echo ""
|
echo ""
|
||||||
echo "This is needed if you want to use the new GRANT functions or"
|
echo "This is needed if you want to use the new GRANT functions,"
|
||||||
echo "want to use the more secure passwords."
|
echo "CREATE AGGREAGATE FUNCTION or want to use the more secure passwords in 3.23"
|
||||||
echo ""
|
echo ""
|
||||||
echo "If you get Access denied errors, you should run this script again"
|
echo "If you get Access denied errors, you should run this script again"
|
||||||
echo "and give the MySQL root user password as a argument!"
|
echo "and give the MySQL root user password as a argument!"
|
||||||
@@ -15,13 +15,12 @@ host="localhost"
|
|||||||
# Fix old password format, add File_priv and func table
|
# Fix old password format, add File_priv and func table
|
||||||
echo ""
|
echo ""
|
||||||
echo "If your tables are already up to date or partially up to date you will"
|
echo "If your tables are already up to date or partially up to date you will"
|
||||||
echo "get some warnings about 'Duplicated column name' or"
|
echo "get some warnings about 'Duplicated column name'. You can safely ignore these!"
|
||||||
echo "'Table 'func' already exists'. You can safely ignore these!"
|
|
||||||
|
|
||||||
@bindir@/mysql -f --user=root --password="$root_password" --host="$host" mysql <<END_OF_DATA
|
@bindir@/mysql -f --user=root --password="$root_password" --host="$host" mysql <<END_OF_DATA
|
||||||
alter table user change password password char(16) NOT NULL;
|
alter table user change password password char(16) NOT NULL;
|
||||||
alter table user add File_priv enum('N','Y') NOT NULL;
|
alter table user add File_priv enum('N','Y') NOT NULL;
|
||||||
CREATE TABLE func (
|
CREATE TABLE if not exists func (
|
||||||
name char(64) DEFAULT '' NOT NULL,
|
name char(64) DEFAULT '' NOT NULL,
|
||||||
ret tinyint(1) DEFAULT '0' NOT NULL,
|
ret tinyint(1) DEFAULT '0' NOT NULL,
|
||||||
dl char(128) DEFAULT '' NOT NULL,
|
dl char(128) DEFAULT '' NOT NULL,
|
||||||
@@ -64,7 +63,7 @@ fi
|
|||||||
echo "Creating the new table and column privilege tables"
|
echo "Creating the new table and column privilege tables"
|
||||||
|
|
||||||
@bindir@/mysql -f --user=root --password="$root_password" --host="$host" mysql <<END_OF_DATA
|
@bindir@/mysql -f --user=root --password="$root_password" --host="$host" mysql <<END_OF_DATA
|
||||||
CREATE TABLE tables_priv (
|
CREATE TABLE IF NOT EXISTS tables_priv (
|
||||||
Host char(60) DEFAULT '' NOT NULL,
|
Host char(60) DEFAULT '' NOT NULL,
|
||||||
Db char(60) DEFAULT '' NOT NULL,
|
Db char(60) DEFAULT '' NOT NULL,
|
||||||
User char(16) DEFAULT '' NOT NULL,
|
User char(16) DEFAULT '' NOT NULL,
|
||||||
@@ -75,7 +74,7 @@ CREATE TABLE tables_priv (
|
|||||||
Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL,
|
Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL,
|
||||||
PRIMARY KEY (Host,Db,User,Table_name)
|
PRIMARY KEY (Host,Db,User,Table_name)
|
||||||
);
|
);
|
||||||
CREATE TABLE columns_priv (
|
CREATE TABLE IF NOT EXISTS columns_priv (
|
||||||
Host char(60) DEFAULT '' NOT NULL,
|
Host char(60) DEFAULT '' NOT NULL,
|
||||||
Db char(60) DEFAULT '' NOT NULL,
|
Db char(60) DEFAULT '' NOT NULL,
|
||||||
User char(16) DEFAULT '' NOT NULL,
|
User char(16) DEFAULT '' NOT NULL,
|
||||||
|
@@ -66,7 +66,7 @@
|
|||||||
** You can easily get all switches right by doing:
|
** You can easily get all switches right by doing:
|
||||||
** cd sql ; make udf_example.o
|
** cd sql ; make udf_example.o
|
||||||
** Take the compile line that make writes, remove the '-c' near the end of
|
** 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
|
** The resulting library (udf_example.so) should be copied to some dir
|
||||||
** searched by ld. (/usr/lib ?)
|
** searched by ld. (/usr/lib ?)
|
||||||
**
|
**
|
||||||
@@ -97,6 +97,13 @@
|
|||||||
** Active function will be reloaded on every restart of server
|
** Active function will be reloaded on every restart of server
|
||||||
** (if --skip-grant-tables is not given)
|
** (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
|
#ifdef STANDARD
|
||||||
@@ -128,6 +135,11 @@ my_bool sequence_init(UDF_INIT *initid, UDF_ARGS *args, char *message);
|
|||||||
void sequence_deinit(UDF_INIT *initid);
|
void sequence_deinit(UDF_INIT *initid);
|
||||||
long long sequence(UDF_INIT *initid, UDF_ARGS *args, char *is_null,
|
long long sequence(UDF_INIT *initid, UDF_ARGS *args, char *is_null,
|
||||||
char *error);
|
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);
|
*res_length=(ulong) (strmov(result,hp->h_name) - result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
#endif // defined(HAVE_GETHOSTBYADDR_R) && defined(HAVE_SOLARIS_STYLE_GETHOST)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Syntax for the new aggregate commands are:
|
** 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>)
|
** (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
|
struct avgcost_data
|
||||||
{
|
{
|
||||||
@@ -810,7 +816,7 @@ avgcost_init( UDF_INIT* initid, UDF_ARGS* args, char* message )
|
|||||||
return 1;
|
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(
|
strcpy(
|
||||||
message,
|
message,
|
||||||
@@ -917,5 +923,4 @@ avgcost( UDF_INIT* initid, UDF_ARGS* args, char* is_null, char* error )
|
|||||||
return data->totalprice/double(data->totalquantity);
|
return data->totalprice/double(data->totalquantity);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // defined(HAVE_GETHOSTBYADDR_R) && defined(HAVE_SOLARIS_STYLE_GETHOST)
|
|
||||||
#endif /* HAVE_DLOPEN */
|
#endif /* HAVE_DLOPEN */
|
||||||
|
Reference in New Issue
Block a user