Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
0acca0ab
Commit
0acca0ab
authored
Aug 27, 2003
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into narttu.mysql.fi:/my/mysql-4.1
parents
6e2da8d1
29e3c42a
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
67 additions
and
36 deletions
+67
-36
BUILD/FINISH.sh
BUILD/FINISH.sh
+6
-2
BUILD/cleanup
BUILD/cleanup
+8
-0
scripts/mysql_fix_privilege_tables.sql
scripts/mysql_fix_privilege_tables.sql
+12
-0
sql/item_sum.cc
sql/item_sum.cc
+2
-2
sql/item_sum.h
sql/item_sum.h
+2
-1
sql/slave.cc
sql/slave.cc
+3
-2
sql/sql_udf.cc
sql/sql_udf.cc
+7
-4
sql/sql_udf.h
sql/sql_udf.h
+8
-17
sql/sql_yacc.yy
sql/sql_yacc.yy
+2
-0
sql/udf_example.cc
sql/udf_example.cc
+17
-8
No files found.
BUILD/FINISH.sh
View file @
0acca0ab
...
...
@@ -23,12 +23,16 @@ autoconf || (echo \"Can't execute autoconf\" && exit 1)
if [ -d gemini ]
then
(cd gemini && aclocal && autoheader && aclocal && automake && autoconf)
fi
fi
"
if
[
-z
"
$just_clean
"
]
then
commands
=
"
$commands
CFLAGS=
\"
$cflags
\"
CXX=
\"
$CXX
\"
CXXFLAGS=
\"
$cxxflags
\"
CXXLDFLAGS=
\"
$CXXLDFLAGS
\"
\
$configure
"
fi
if
[
-z
"
$just_configure
"
]
if
[
-z
"
$just_configure
"
-a
-z
"
$just_clean
"
]
then
commands
=
"
$commands
...
...
BUILD/cleanup
0 → 100755
View file @
0acca0ab
#! /bin/sh
path
=
`
dirname
$0
`
.
"
$path
/SETUP.sh"
just_clean
=
1
;
.
"
$path
/FINISH.sh"
scripts/mysql_fix_privilege_tables.sql
View file @
0acca0ab
-- This script converts any old privilege tables to privilege tables suitable
-- for MySQL 4.0.
-- You can safely ignore all 'Duplicate column' and 'Unknown column' errors"
-- as this just means that your tables where already up to date.
-- This script is safe to run even if your tables are already up to date!
-- On unix, you should use the mysql_fix_privilege_tables script to execute
-- this sql script.
-- On windows you should do 'mysql --force < mysql_fix_privilege_tables.sql'
USE
mysql
;
ALTER
TABLE
user
type
=
MyISAM
;
ALTER
TABLE
db
type
=
MyISAM
;
ALTER
TABLE
host
type
=
MyISAM
;
...
...
sql/item_sum.cc
View file @
0acca0ab
...
...
@@ -1353,10 +1353,10 @@ longlong Item_sum_count_distinct::val_int()
#ifdef HAVE_DLOPEN
bool
Item_udf_sum
::
reset
()
bool
Item_udf_sum
::
clear
()
{
DBUG_ENTER
(
"Item_udf_sum::reset"
);
udf
.
reset
(
&
null_value
);
udf
.
clear
(
);
DBUG_RETURN
(
0
);
}
...
...
sql/item_sum.h
View file @
0acca0ab
...
...
@@ -509,7 +509,8 @@ class Item_udf_sum : public Item_sum
enum
Sumfunctype
sum_func
()
const
{
return
UDF_SUM_FUNC
;
}
virtual
bool
have_field_update
(
void
)
const
{
return
0
;
}
bool
reset
();
bool
reset
()
{
return
0
;
}
/* TO BE FIXED */
bool
clear
();
bool
add
();
void
reset_field
()
{};
void
update_field
(
int
offset_arg
)
{};
...
...
sql/slave.cc
View file @
0acca0ab
...
...
@@ -2303,9 +2303,10 @@ server_errno=%d)",
return
packet_error
;
}
if
(
len
==
1
)
/* Check if eof packet */
if
(
len
<
8
&&
mysql
->
net
.
read_pos
[
0
]
==
254
)
{
sql_print_error
(
"Slave: received
0 length
packet from server, apparent\
sql_print_error
(
"Slave: received
end
packet from server, apparent\
master shutdown: %s"
,
mysql_error
(
mysql
));
return
packet_error
;
...
...
sql/sql_udf.cc
View file @
0acca0ab
...
...
@@ -92,10 +92,13 @@ static void init_syms(udf_func *tmp)
tmp
->
func_deinit
=
dlsym
(
tmp
->
dlhandle
,
nm
);
if
(
tmp
->
type
==
UDFTYPE_AGGREGATE
)
{
(
void
)
strmov
(
end
,
"_
reset
"
);
tmp
->
func_
reset
=
dlsym
(
tmp
->
dlhandle
,
nm
);
(
void
)
strmov
(
end
,
"_
clear
"
);
tmp
->
func_
clear
=
dlsym
(
tmp
->
dlhandle
,
nm
);
(
void
)
strmov
(
end
,
"_add"
);
tmp
->
func_add
=
dlsym
(
tmp
->
dlhandle
,
nm
);
/* Give error if _clear and _add doesn't exists */
if
(
!
tmp
->
func_clear
||
!
tmp
->
func_add
)
tmp
->
func
=
0
;
}
}
...
...
@@ -417,7 +420,7 @@ int mysql_create_function(THD *thd,udf_func *udf)
u_d
->
func
=
udf
->
func
;
u_d
->
func_init
=
udf
->
func_init
;
u_d
->
func_deinit
=
udf
->
func_deinit
;
u_d
->
func_
reset
=
udf
->
func_reset
;
u_d
->
func_
clear
=
udf
->
func_clear
;
u_d
->
func_add
=
udf
->
func_add
;
/* create entry in mysql/func table */
...
...
@@ -429,7 +432,7 @@ int mysql_create_function(THD *thd,udf_func *udf)
if
(
!
(
table
=
open_ltable
(
thd
,
&
tables
,
TL_WRITE
)))
goto
err
;
restore_record
(
table
,
default_values
);
//
Get d
efault values for fields
restore_record
(
table
,
default_values
);
//
D
efault values for fields
table
->
field
[
0
]
->
store
(
u_d
->
name
.
str
,
u_d
->
name
.
length
,
system_charset_info
);
table
->
field
[
1
]
->
store
((
longlong
)
u_d
->
returns
);
table
->
field
[
2
]
->
store
(
u_d
->
dl
,(
uint
)
strlen
(
u_d
->
dl
),
system_charset_info
);
...
...
sql/sql_udf.h
View file @
0acca0ab
...
...
@@ -33,7 +33,7 @@ typedef struct st_udf_func
void
*
func
;
void
*
func_init
;
void
*
func_deinit
;
void
*
func_
reset
;
void
*
func_
clear
;
void
*
func_add
;
ulong
usage_count
;
}
udf_func
;
...
...
@@ -49,7 +49,7 @@ class udf_handler :public Sql_alloc
UDF_ARGS
f_args
;
UDF_INIT
initid
;
char
*
num_buffer
;
uchar
error
;
uchar
error
,
is_null
;
bool
initialized
;
Item
**
args
;
...
...
@@ -57,7 +57,7 @@ class udf_handler :public Sql_alloc
table_map
used_tables_cache
;
bool
const_item_cache
;
udf_handler
(
udf_func
*
udf_arg
)
:
u_d
(
udf_arg
),
buffers
(
0
),
error
(
0
),
initialized
(
0
)
i
s_null
(
0
),
i
nitialized
(
0
)
{}
~
udf_handler
();
const
char
*
name
()
const
{
return
u_d
?
u_d
->
name
.
str
:
"?"
;
}
...
...
@@ -73,7 +73,6 @@ class udf_handler :public Sql_alloc
*
null_value
=
1
;
return
0.0
;
}
uchar
is_null
=
0
;
double
(
*
func
)(
UDF_INIT
*
,
UDF_ARGS
*
,
uchar
*
,
uchar
*
)
=
(
double
(
*
)(
UDF_INIT
*
,
UDF_ARGS
*
,
uchar
*
,
uchar
*
))
u_d
->
func
;
double
tmp
=
func
(
&
initid
,
&
f_args
,
&
is_null
,
&
error
);
...
...
@@ -92,7 +91,6 @@ class udf_handler :public Sql_alloc
*
null_value
=
1
;
return
LL
(
0
);
}
uchar
is_null
=
0
;
longlong
(
*
func
)(
UDF_INIT
*
,
UDF_ARGS
*
,
uchar
*
,
uchar
*
)
=
(
longlong
(
*
)(
UDF_INIT
*
,
UDF_ARGS
*
,
uchar
*
,
uchar
*
))
u_d
->
func
;
longlong
tmp
=
func
(
&
initid
,
&
f_args
,
&
is_null
,
&
error
);
...
...
@@ -104,22 +102,15 @@ class udf_handler :public Sql_alloc
*
null_value
=
0
;
return
tmp
;
}
void
reset
(
my_bool
*
null_value
)
void
clear
(
)
{
uchar
is_null
=
0
;
if
(
get_arguments
())
{
*
null_value
=
1
;
return
;
}
void
(
*
func
)(
UDF_INIT
*
,
UDF_ARGS
*
,
uchar
*
,
uchar
*
)
=
(
void
(
*
)(
UDF_INIT
*
,
UDF_ARGS
*
,
uchar
*
,
uchar
*
))
u_d
->
func_reset
;
func
(
&
initid
,
&
f_args
,
&
is_null
,
&
error
);
*
null_value
=
(
my_bool
)
(
is_null
||
error
);
is_null
=
0
;
void
(
*
func
)(
UDF_INIT
*
,
uchar
*
,
uchar
*
)
=
(
void
(
*
)(
UDF_INIT
*
,
uchar
*
,
uchar
*
))
u_d
->
func_clear
;
func
(
&
initid
,
&
is_null
,
&
error
);
}
void
add
(
my_bool
*
null_value
)
{
uchar
is_null
=
0
;
if
(
get_arguments
())
{
*
null_value
=
1
;
...
...
sql/sql_yacc.yy
View file @
0acca0ab
...
...
@@ -4409,6 +4409,7 @@ keyword:
| DYNAMIC_SYM {}
| END {}
| ENUM {}
| ERRORS {}
| ESCAPE_SYM {}
| EVENTS_SYM {}
| EXECUTE_SYM {}
...
...
@@ -4546,6 +4547,7 @@ keyword:
| USE_FRM {}
| VARIABLES {}
| VALUE_SYM {}
| WARNINGS {}
| WORK_SYM {}
| X509_SYM {}
| YEAR_SYM {}
...
...
sql/udf_example.cc
View file @
0acca0ab
...
...
@@ -149,6 +149,7 @@ longlong sequence(UDF_INIT *initid, UDF_ARGS *args, char *is_null,
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_clear
(
UDF_INIT
*
initid
,
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
);
}
...
...
@@ -902,21 +903,29 @@ avgcost_deinit( UDF_INIT* initid )
delete
initid
->
ptr
;
}
/* This is only for MySQL 4.0 compability */
void
avgcost_reset
(
UDF_INIT
*
initid
,
UDF_ARGS
*
args
,
char
*
is_null
,
char
*
message
)
avgcost_reset
(
UDF_INIT
*
initid
,
UDF_ARGS
*
args
,
char
*
is_null
,
char
*
message
)
{
struct
avgcost_data
*
data
=
(
struct
avgcost_data
*
)
initid
->
ptr
;
data
->
totalprice
=
0.0
;
data
->
totalquantity
=
0
;
data
->
count
=
0
;
avgcost_clear
(
initid
,
is_null
,
message
);
avgcost_add
(
initid
,
args
,
is_null
,
message
);
}
*
is_null
=
0
;
avgcost_add
(
initid
,
args
,
is_null
,
message
);
/* This is needed to get things to work in MySQL 4.1.1 and above */
void
avgcost_clear
(
UDF_INIT
*
initid
,
char
*
is_null
,
char
*
message
)
{
struct
avgcost_data
*
data
=
(
struct
avgcost_data
*
)
initid
->
ptr
;
data
->
totalprice
=
0.0
;
data
->
totalquantity
=
0
;
data
->
count
=
0
;
}
void
avgcost_add
(
UDF_INIT
*
initid
,
UDF_ARGS
*
args
,
char
*
is_null
,
char
*
message
)
avgcost_add
(
UDF_INIT
*
initid
,
UDF_ARGS
*
args
,
char
*
is_null
,
char
*
message
)
{
if
(
args
->
args
[
0
]
&&
args
->
args
[
1
])
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment