Commit 44aea416 authored by jani@ua141d10.elisa.omakaista.fi's avatar jani@ua141d10.elisa.omakaista.fi

Merge ua141d10.elisa.omakaista.fi:/home/my/bk/mysql-4.1

into  ua141d10.elisa.omakaista.fi:/home/my/bk/mysql-5.0-tmp
parents 3612707c 5150bd8f
......@@ -518,6 +518,13 @@ int main(int argc, char **argv)
free_defaults(argv_to_free);
return(1); /* purecov: deadcode */
}
if (mysql_query(sock, "set @@character_set_database=binary;"))
{
db_error(sock); /* We shall countinue here, if --force was given */
return(1);
}
if (lock_tables)
lock_table(sock, argc, argv);
for (; *argv != NULL; argv++)
......
......@@ -173,6 +173,7 @@ our $exe_mysql_client_test;
our $exe_mysqld;
our $exe_mysqlcheck; # Called from test case
our $exe_mysqldump; # Called from test case
our $exe_mysqlimport; # Called from test case
our $exe_mysqlshow; # Called from test case
our $exe_mysql_fix_system_tables;
our $exe_mysqltest;
......@@ -923,6 +924,7 @@ sub executable_setup () {
}
$exe_mysqlcheck= mtr_exe_exists("$path_client_bindir/mysqlcheck");
$exe_mysqldump= mtr_exe_exists("$path_client_bindir/mysqldump");
$exe_mysqlimport= mtr_exe_exists("$path_client_bindir/mysqlimport");
$exe_mysqlshow= mtr_exe_exists("$path_client_bindir/mysqlshow");
$exe_mysqlbinlog= mtr_exe_exists("$path_client_bindir/mysqlbinlog");
$exe_mysqladmin= mtr_exe_exists("$path_client_bindir/mysqladmin");
......@@ -2399,6 +2401,14 @@ sub run_mysqltest ($) {
$cmdline_mysqldump .=
" --debug=d:t:A,$opt_vardir/log/mysqldump.trace";
}
my $cmdline_mysqlimport= "$exe_mysqlimport -uroot " .
"--port=$master->[0]->{'path_myport'} " .
"--socket=$master->[0]->{'path_mysock'} --password=";
if ( $opt_debug )
{
$cmdline_mysqlimport .=
" --debug=d:t:A,$opt_vardir/log/mysqlimport.trace";
}
my $cmdline_mysqlshow= "$exe_mysqlshow -uroot " .
"--port=$master->[0]->{'path_myport'} " .
......@@ -2452,6 +2462,7 @@ sub run_mysqltest ($) {
$ENV{'MYSQL'}= $cmdline_mysql;
$ENV{'MYSQL_CHECK'}= $cmdline_mysqlcheck;
$ENV{'MYSQL_DUMP'}= $cmdline_mysqldump;
$ENV{'MYSQL_IMPORT'}= $cmdline_mysqlimport;
$ENV{'MYSQL_SHOW'}= $cmdline_mysqlshow;
$ENV{'MYSQL_BINLOG'}= $cmdline_mysqlbinlog;
$ENV{'MYSQL_FIX_SYSTEM_TABLES'}= $cmdline_mysql_fix_system_tables;
......
......@@ -629,6 +629,11 @@ if [ x$SOURCE_DIST = x1 ] ; then
else
MYSQL_DUMP="$BASEDIR/client/mysqldump"
fi
if [ -f "$BASEDIR/client/.libs/mysqlimport" ] ; then
MYSQL_IMPORT="$BASEDIR/client/.libs/mysqlimport"
else
MYSQL_IMPORT="$BASEDIR/client/mysqlimport"
fi
if [ -f "$BASEDIR/client/.libs/mysqlshow" ] ; then
MYSQL_SHOW="$BASEDIR/client/.libs/mysqlshow"
else
......@@ -705,6 +710,7 @@ else
MYSQL_CHECK="$CLIENT_BINDIR/mysqlcheck"
MYSQL_DUMP="$CLIENT_BINDIR/mysqldump"
MYSQL_SHOW="$CLIENT_BINDIR/mysqlshow"
MYSQL_IMPORT="$CLIENT_BINDIR/mysqlimport"
MYSQL_BINLOG="$CLIENT_BINDIR/mysqlbinlog"
MYSQLADMIN="$CLIENT_BINDIR/mysqladmin"
WAIT_PID="$CLIENT_BINDIR/mysql_waitpid"
......@@ -792,9 +798,10 @@ MYSQL_CHECK="$MYSQL_CHECK --no-defaults -uroot --socket=$MASTER_MYSOCK --passwor
MYSQL_DUMP="$MYSQL_DUMP --no-defaults -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLDUMP_OPT"
MYSQL_SHOW="$MYSQL_SHOW -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLSHOW_OPT"
MYSQL_BINLOG="$MYSQL_BINLOG --no-defaults --local-load=$MYSQL_TMP_DIR --character-sets-dir=$CHARSETSDIR $EXTRA_MYSQLBINLOG_OPT"
MYSQL_IMPORT="$MYSQL_IMPORT -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLDUMP_OPT"
MYSQL_FIX_SYSTEM_TABLES="$MYSQL_FIX_SYSTEM_TABLES --no-defaults --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD --basedir=$BASEDIR --bindir=$CLIENT_BINDIR --verbose"
MYSQL="$MYSQL --no-defaults --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD"
export MYSQL MYSQL_CHECK MYSQL_DUMP MYSQL_SHOW MYSQL_BINLOG MYSQL_FIX_SYSTEM_TABLES
export MYSQL MYSQL_CHECK MYSQL_DUMP MYSQL_SHOW MYSQL_BINLOG MYSQL_FIX_SYSTEM_TABLES MYSQL_IMPORT
export CLIENT_BINDIR MYSQL_CLIENT_TEST CHARSETSDIR MYSQL_MY_PRINT_DEFAULTS
export NDB_TOOLS_DIR
export NDB_MGM
......
......@@ -688,3 +688,9 @@ alter table t1 add primary key pti(pt);
ERROR 42000: BLOB/TEXT column 'pt' used in key specification without a key length
alter table t1 add primary key pti(pt(20));
drop table t1;
select (asWKT(geomfromwkb((0x000000000140240000000000004024000000000000))));
(asWKT(geomfromwkb((0x000000000140240000000000004024000000000000))))
POINT(10 10)
select (asWKT(geomfromwkb((0x010100000000000000000024400000000000002440))));
(asWKT(geomfromwkb((0x010100000000000000000024400000000000002440))))
POINT(10 10)
......@@ -1677,6 +1677,16 @@ insert into t2 (a, b) values (NULL, NULL),(10, NULL),(NULL, "twenty"),(30, "thir
</database>
</mysqldump>
drop table t1, t2;
create table t1 (a text character set utf8, b text character set latin1);
insert t1 values (0x4F736E616272C3BC636B, 0x4BF66C6E);
select * from t1;
a b
Osnabrck Kln
test.t1: Records: 1 Deleted: 0 Skipped: 0 Warnings: 0
select * from t1;
a b
Osnabrck Kln
drop table t1;
create table t1(a int);
create view v1 as select * from t1;
......
......@@ -372,6 +372,9 @@ insert into t1 values (pointfromtext('point(1,1)'));
drop table t1;
select (asWKT(geomfromwkb((0x000000000140240000000000004024000000000000))));
select (asWKT(geomfromwkb((0x010100000000000000000024400000000000002440))));
# End of 4.1 tests
#
......
......@@ -697,6 +697,18 @@ insert into t2 (a, b) values (NULL, NULL),(10, NULL),(NULL, "twenty"),(30, "thir
--exec $MYSQL_DUMP --skip-comments --xml --no-create-info test
drop table t1, t2;
#
# BUG #12123
#
create table t1 (a text character set utf8, b text character set latin1);
insert t1 values (0x4F736E616272C3BC636B, 0x4BF66C6E);
select * from t1;
--exec $MYSQL_DUMP --tab=$MYSQL_TEST_DIR/var/tmp/ test
--exec $MYSQL test < $MYSQL_TEST_DIR/var/tmp/t1.sql
--exec $MYSQL_IMPORT test $MYSQL_TEST_DIR/var/tmp/t1.txt
select * from t1;
drop table t1;
# End of 4.1 tests
#
......
......@@ -7041,8 +7041,7 @@ void Field_blob::get_key_image(char *buff, uint length, imagetype type)
return;
}
get_ptr(&blob);
gobj= Geometry::create_from_wkb(&buffer,
blob + SRID_SIZE, blob_length - SRID_SIZE);
gobj= Geometry::construct(&buffer, blob, blob_length);
if (gobj->get_mbr(&mbr, &dummy))
bzero(buff, SIZEOF_STORED_DOUBLE*4);
else
......@@ -7371,8 +7370,7 @@ void Field_geom::get_key_image(char *buff, uint length, imagetype type)
return;
}
get_ptr(&blob);
gobj= Geometry::create_from_wkb(&buffer,
blob + SRID_SIZE, blob_length - SRID_SIZE);
gobj= Geometry::construct(&buffer, blob, blob_length);
if (gobj->get_mbr(&mbr, &dummy))
bzero(buff, SIZEOF_STORED_DOUBLE*4);
else
......@@ -7453,7 +7451,7 @@ int Field_geom::store(const char *from, uint length, CHARSET_INFO *cs)
uint32 wkb_type;
if (length < SRID_SIZE + WKB_HEADER_SIZE + SIZEOF_STORED_DOUBLE*2)
goto err;
wkb_type= uint4korr(from + WKB_HEADER_SIZE);
wkb_type= uint4korr(from + SRID_SIZE + 1);
if (wkb_type < (uint32) Geometry::wkb_point ||
wkb_type > (uint32) Geometry::wkb_end)
goto err;
......
......@@ -81,8 +81,7 @@ String *Item_func_geometry_from_wkb::val_str(String *str)
str->q_append(srid);
if ((null_value=
(args[0]->null_value ||
!Geometry::create_from_wkb(&buffer, wkb->ptr(), wkb->length()) ||
str->append(*wkb))))
!Geometry::create_from_wkb(&buffer, wkb->ptr(), wkb->length(), str))))
return 0;
return str;
}
......@@ -99,8 +98,7 @@ String *Item_func_as_wkt::val_str(String *str)
if ((null_value=
(args[0]->null_value ||
!(geom= Geometry::create_from_wkb(&buffer, swkb->ptr() + SRID_SIZE,
swkb->length() - SRID_SIZE)))))
!(geom= Geometry::construct(&buffer, swkb->ptr(), swkb->length())))))
return 0;
str->length(0);
......@@ -126,8 +124,7 @@ String *Item_func_as_wkb::val_str(String *str)
if ((null_value=
(args[0]->null_value ||
!(Geometry::create_from_wkb(&buffer, swkb->ptr() + SRID_SIZE,
swkb->length() - SRID_SIZE)))))
!(Geometry::construct(&buffer, swkb->ptr(), swkb->length())))))
return 0;
str->copy(swkb->ptr() + SRID_SIZE, swkb->length() - SRID_SIZE,
......@@ -145,8 +142,7 @@ String *Item_func_geometry_type::val_str(String *str)
if ((null_value=
(args[0]->null_value ||
!(geom= Geometry::create_from_wkb(&buffer, swkb->ptr() + SRID_SIZE,
swkb->length() - SRID_SIZE)))))
!(geom= Geometry::construct(&buffer, swkb->ptr(), swkb->length())))))
return 0;
/* String will not move */
str->copy(geom->get_class_info()->m_name.str,
......@@ -167,8 +163,7 @@ String *Item_func_envelope::val_str(String *str)
if ((null_value=
args[0]->null_value ||
!(geom= Geometry::create_from_wkb(&buffer, swkb->ptr() + SRID_SIZE,
swkb->length() - SRID_SIZE))))
!(geom= Geometry::construct(&buffer, swkb->ptr(), swkb->length()))))
return 0;
srid= uint4korr(swkb->ptr());
......@@ -191,8 +186,7 @@ String *Item_func_centroid::val_str(String *str)
uint32 srid;
if ((null_value= args[0]->null_value ||
!(geom= Geometry::create_from_wkb(&buffer, swkb->ptr() + SRID_SIZE,
swkb->length() - SRID_SIZE))))
!(geom= Geometry::construct(&buffer, swkb->ptr(), swkb->length()))))
return 0;
str->set_charset(&my_charset_bin);
......@@ -221,8 +215,7 @@ String *Item_func_spatial_decomp::val_str(String *str)
if ((null_value=
(args[0]->null_value ||
!(geom= Geometry::create_from_wkb(&buffer, swkb->ptr() + SRID_SIZE,
swkb->length() - SRID_SIZE)))))
!(geom= Geometry::construct(&buffer, swkb->ptr(), swkb->length())))))
return 0;
srid= uint4korr(swkb->ptr());
......@@ -270,8 +263,7 @@ String *Item_func_spatial_decomp_n::val_str(String *str)
if ((null_value=
(args[0]->null_value || args[1]->null_value ||
!(geom= Geometry::create_from_wkb(&buffer, swkb->ptr() + SRID_SIZE,
swkb->length() - SRID_SIZE)))))
!(geom= Geometry::construct(&buffer, swkb->ptr(), swkb->length())))))
return 0;
str->set_charset(&my_charset_bin);
......@@ -478,10 +470,8 @@ longlong Item_func_spatial_rel::val_int()
if ((null_value=
(args[0]->null_value ||
args[1]->null_value ||
!(g1= Geometry::create_from_wkb(&buffer1, res1->ptr() + SRID_SIZE,
res1->length() - SRID_SIZE)) ||
!(g2= Geometry::create_from_wkb(&buffer2, res2->ptr() + SRID_SIZE,
res2->length() - SRID_SIZE)) ||
!(g1= Geometry::construct(&buffer1, res1->ptr(), res1->length())) ||
!(g2= Geometry::construct(&buffer2, res2->ptr(), res2->length())) ||
g1->get_mbr(&mbr1, &dummy) ||
g2->get_mbr(&mbr2, &dummy))))
return 0;
......@@ -546,8 +536,7 @@ longlong Item_func_isclosed::val_int()
null_value= (!swkb ||
args[0]->null_value ||
!(geom=
Geometry::create_from_wkb(&buffer, swkb->ptr() + SRID_SIZE,
swkb->length() - SRID_SIZE)) ||
Geometry::construct(&buffer, swkb->ptr(), swkb->length())) ||
geom->is_closed(&isclosed));
return (longlong) isclosed;
......@@ -569,9 +558,7 @@ longlong Item_func_dimension::val_int()
null_value= (!swkb ||
args[0]->null_value ||
!(geom= Geometry::create_from_wkb(&buffer,
swkb->ptr() + SRID_SIZE,
swkb->length() - SRID_SIZE)) ||
!(geom= Geometry::construct(&buffer, swkb->ptr(), swkb->length())) ||
geom->dimension(&dim, &dummy));
return (longlong) dim;
}
......@@ -586,9 +573,8 @@ longlong Item_func_numinteriorring::val_int()
Geometry *geom;
null_value= (!swkb ||
!(geom= Geometry::create_from_wkb(&buffer,
swkb->ptr() + SRID_SIZE,
swkb->length() - SRID_SIZE)) ||
!(geom= Geometry::construct(&buffer,
swkb->ptr(), swkb->length())) ||
geom->num_interior_ring(&num));
return (longlong) num;
}
......@@ -603,9 +589,8 @@ longlong Item_func_numgeometries::val_int()
Geometry *geom;
null_value= (!swkb ||
!(geom= Geometry::create_from_wkb(&buffer,
swkb->ptr() + SRID_SIZE,
swkb->length() - SRID_SIZE)) ||
!(geom= Geometry::construct(&buffer,
swkb->ptr(), swkb->length())) ||
geom->num_geometries(&num));
return (longlong) num;
}
......@@ -621,9 +606,8 @@ longlong Item_func_numpoints::val_int()
null_value= (!swkb ||
args[0]->null_value ||
!(geom= Geometry::create_from_wkb(&buffer,
swkb->ptr() + SRID_SIZE,
swkb->length() - SRID_SIZE)) ||
!(geom= Geometry::construct(&buffer,
swkb->ptr(), swkb->length())) ||
geom->num_points(&num));
return (longlong) num;
}
......@@ -638,9 +622,8 @@ double Item_func_x::val_real()
Geometry *geom;
null_value= (!swkb ||
!(geom= Geometry::create_from_wkb(&buffer,
swkb->ptr() + SRID_SIZE,
swkb->length() - SRID_SIZE)) ||
!(geom= Geometry::construct(&buffer,
swkb->ptr(), swkb->length())) ||
geom->get_x(&res));
return res;
}
......@@ -655,9 +638,8 @@ double Item_func_y::val_real()
Geometry *geom;
null_value= (!swkb ||
!(geom= Geometry::create_from_wkb(&buffer,
swkb->ptr() + SRID_SIZE,
swkb->length() - SRID_SIZE)) ||
!(geom= Geometry::construct(&buffer,
swkb->ptr(), swkb->length())) ||
geom->get_y(&res));
return res;
}
......@@ -673,9 +655,8 @@ double Item_func_area::val_real()
const char *dummy;
null_value= (!swkb ||
!(geom= Geometry::create_from_wkb(&buffer,
swkb->ptr() + SRID_SIZE,
swkb->length() - SRID_SIZE)) ||
!(geom= Geometry::construct(&buffer,
swkb->ptr(), swkb->length())) ||
geom->area(&res, &dummy));
return res;
}
......@@ -689,9 +670,8 @@ double Item_func_glength::val_real()
Geometry *geom;
null_value= (!swkb ||
!(geom= Geometry::create_from_wkb(&buffer,
swkb->ptr() + SRID_SIZE,
swkb->length() - SRID_SIZE)) ||
!(geom= Geometry::construct(&buffer,
swkb->ptr(), swkb->length())) ||
geom->length(&res));
return res;
}
......@@ -703,9 +683,8 @@ longlong Item_func_srid::val_int()
Geometry_buffer buffer;
null_value= (!swkb ||
!Geometry::create_from_wkb(&buffer,
swkb->ptr() + SRID_SIZE,
swkb->length() - SRID_SIZE));
!Geometry::construct(&buffer,
swkb->ptr(), swkb->length()));
if (null_value)
return 0;
......
This diff is collapsed.
......@@ -207,6 +207,10 @@ public:
virtual const Class_info *get_class_info() const=0;
virtual uint32 get_data_size() const=0;
virtual bool init_from_wkt(Gis_read_stream *trs, String *wkb)=0;
/* returns the length of the wkb that was read */
virtual uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo,
String *res)=0;
virtual bool get_data_as_wkt(String *txt, const char **end) const=0;
virtual bool get_mbr(MBR *mbr, const char **end) const=0;
virtual bool dimension(uint32 *dim, const char **end) const=0;
......@@ -236,11 +240,13 @@ public:
return my_reinterpret_cast(Geometry *)(buffer);
}
static Geometry *create_from_wkb(Geometry_buffer *buffer,
const char *data, uint32 data_len);
static Geometry *construct(Geometry_buffer *buffer,
const char *data, uint32 data_len);
static Geometry *create_from_wkt(Geometry_buffer *buffer,
Gis_read_stream *trs, String *wkt,
bool init_stream=1);
static int Geometry::create_from_wkb(Geometry_buffer *buffer,
const char *wkb, uint32 len, String *res);
int as_wkt(String *wkt, const char **end)
{
uint32 len= get_class_info()->m_name.length;
......@@ -254,7 +260,7 @@ public:
return 0;
}
inline void init_from_wkb(const char *data, uint32 data_len)
inline void set_data_ptr(const char *data, uint32 data_len)
{
m_data= data;
m_data_end= data + data_len;
......@@ -298,6 +304,7 @@ class Gis_point: public Geometry
public:
uint32 get_data_size() const;
bool init_from_wkt(Gis_read_stream *trs, String *wkb);
uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res);
bool get_data_as_wkt(String *txt, const char **end) const;
bool get_mbr(MBR *mbr, const char **end) const;
......@@ -344,6 +351,7 @@ class Gis_line_string: public Geometry
public:
uint32 get_data_size() const;
bool init_from_wkt(Gis_read_stream *trs, String *wkb);
uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res);
bool get_data_as_wkt(String *txt, const char **end) const;
bool get_mbr(MBR *mbr, const char **end) const;
int length(double *len) const;
......@@ -369,6 +377,7 @@ class Gis_polygon: public Geometry
public:
uint32 get_data_size() const;
bool init_from_wkt(Gis_read_stream *trs, String *wkb);
uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res);
bool get_data_as_wkt(String *txt, const char **end) const;
bool get_mbr(MBR *mbr, const char **end) const;
int area(double *ar, const char **end) const;
......@@ -394,6 +403,7 @@ class Gis_multi_point: public Geometry
public:
uint32 get_data_size() const;
bool init_from_wkt(Gis_read_stream *trs, String *wkb);
uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res);
bool get_data_as_wkt(String *txt, const char **end) const;
bool get_mbr(MBR *mbr, const char **end) const;
int num_geometries(uint32 *num) const;
......@@ -415,6 +425,7 @@ class Gis_multi_line_string: public Geometry
public:
uint32 get_data_size() const;
bool init_from_wkt(Gis_read_stream *trs, String *wkb);
uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res);
bool get_data_as_wkt(String *txt, const char **end) const;
bool get_mbr(MBR *mbr, const char **end) const;
int num_geometries(uint32 *num) const;
......@@ -438,6 +449,7 @@ class Gis_multi_polygon: public Geometry
public:
uint32 get_data_size() const;
bool init_from_wkt(Gis_read_stream *trs, String *wkb);
uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res);
bool get_data_as_wkt(String *txt, const char **end) const;
bool get_mbr(MBR *mbr, const char **end) const;
int num_geometries(uint32 *num) const;
......@@ -461,6 +473,7 @@ class Gis_geometry_collection: public Geometry
public:
uint32 get_data_size() const;
bool init_from_wkt(Gis_read_stream *trs, String *wkb);
uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res);
bool get_data_as_wkt(String *txt, const char **end) const;
bool get_mbr(MBR *mbr, const char **end) const;
int num_geometries(uint32 *num) const;
......
......@@ -33,7 +33,7 @@ sort_buffer_size = 2M
read_buffer_size = 2M
read_rnd_buffer_size = 8M
myisam_sort_buffer_size = 64M
thread_cache = 8
thread_cache_size = 8
query_cache_size = 32M
# Try number of CPU's*2 for thread_concurrency
thread_concurrency = 8
......
......@@ -128,7 +128,7 @@ join_buffer_size = 8M
# the amount of thread creations needed if you have a lot of new
# connections. (Normally this doesn't give a notable performance
# improvement if you have a good thread implementation.)
thread_cache = 8
thread_cache_size = 8
# This permits the application to give the threads system a hint for the
# desired number of threads that should be run at the same time. This
......
......@@ -33,7 +33,7 @@ sort_buffer_size = 1M
read_buffer_size = 1M
read_rnd_buffer_size = 4M
myisam_sort_buffer_size = 64M
thread_cache = 8
thread_cache_size = 8
query_cache_size= 16M
# Try number of CPU's*2 for thread_concurrency
thread_concurrency = 8
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment