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

Merge jamppa@bk-internal.mysql.com:/home/bk/mysql-5.0

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