Commit d2115f04 authored by unknown's avatar unknown

Merge mysql.com:/extern/mysql/5.0/bug17476/mysql-5.0

into  mysql.com:/extern/mysql/5.1/generic/mysql-5.1-new


mysql-test/mysql-test-run.pl:
  Auto merged
mysql-test/mysql-test-run.sh:
  Auto merged
mysql-test/r/grant2.result:
  Auto merged
mysql-test/r/sp.result:
  Auto merged
mysql-test/t/grant2.test:
  Auto merged
mysql-test/t/skip_grants.test:
  Auto merged
mysql-test/t/sp.test:
  Auto merged
scripts/make_binary_distribution.sh:
  Auto merged
sql/field_conv.cc:
  Auto merged
sql/item.h:
  Auto merged
sql/item_timefunc.cc:
  Auto merged
sql/sql_udf.cc:
  Auto merged
VC++Files/mysql.sln:
  Manual merge (use local).
configure.in:
  Manual merge.
sql/table.cc:
  Manual merge.
parents ea35b4e5 38e47d49
# Microsoft Developer Studio Project File - Name="gen_lex_hash" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=gen_lex_hash - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "gen_lex_hash.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "gen_lex_hash.mak" CFG="gen_lex_hash - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "gen_lex_hash - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "gen_lex_hash - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "gen_lex_hash - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "gen_lex_hash___Win32_Release"
# PROP BASE Intermediate_Dir "gen_lex_hash___Win32_Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "gen_lex_hash___Win32_Release"
# PROP Intermediate_Dir "gen_lex_hash___Win32_Release"
# PROP Target_Dir ""
MTL=midl.exe
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x419 /d "NDEBUG"
# ADD RSC /l 0x419 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
!ELSEIF "$(CFG)" == "gen_lex_hash - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
MTL=midl.exe
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x419 /d "_DEBUG"
# ADD RSC /l 0x419 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "gen_lex_hash - Win32 Release"
# Name "gen_lex_hash - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project
<?xml version="1.0" encoding="windows-1251"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="gen_lex_hash"
ProjectGUID="{D593B5D1-8EFC-44FE-9937-A5AAD1E619A1}"
SccProjectName=""
SccLocalPath="">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\Debug/gen_lex_hash.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="Ws2_32.lib"
OutputFile="../sql/gen_lex_hash.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="../lib_release"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\Debug/gen_lex_hash.pdb"
SubSystem="1"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\Debug/gen_lex_hash.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1049"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory=".\gen_lex_hash___Win32_Release"
IntermediateDirectory=".\gen_lex_hash___Win32_Release"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="../include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
StringPooling="TRUE"
RuntimeLibrary="0"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\gen_lex_hash___Win32_Release/gen_lex_hash.pch"
AssemblerListingLocation=".\gen_lex_hash___Win32_Release/"
ObjectFile=".\gen_lex_hash___Win32_Release/"
ProgramDataBaseFileName=".\gen_lex_hash___Win32_Release/"
WarningLevel="3"
SuppressStartupBanner="TRUE"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="Ws2_32.lib"
OutputFile="../sql/gen_lex_hash.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="../lib_release"
ProgramDatabaseFile=".\gen_lex_hash___Win32_Release/gen_lex_hash.pdb"
SubSystem="1"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\gen_lex_hash___Win32_Release/gen_lex_hash.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1049"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
<File
RelativePath=".\gen_lex_hash.cpp">
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl">
</Filter>
<Filter
Name="Resource Files"
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
This directory contains a test suite for mysql daemon. To run
This directory contains a test suite for the MySQL daemon. To run
the currently existing test cases, simply execute ./mysql-test-run in
this directory. It will fire up the newly built mysqld and test it.
If you want to run a test with a running MySQL server use the --extern
option to mysql-test-run. Please note that in this mode the test suite
expects user to specify test names to run. Otherwise it falls back to the
normal "non-extern" behaviour. The reason is that some tests
could not run with external server. Here is the sample command
to test "alias" and "analyze" tests on external server:
mysql-test-run --extern alias analyze
To match your setup you might also need to provide --socket, --user and
other relevant options.
Note that you do not have to have to do make install, and you could
actually have a co-existing MySQL installation - the tests will not
Note that you do not have to have to do "make install", and you could
actually have a co-existing MySQL installation. The tests will not
conflict with it.
All tests must pass. If one or more of them fail on your system, please
read the following manual section of how to report the problem:
read the following manual section for instructions on how to report the
problem:
http://dev.mysql.com/doc/mysql/en/mysql-test-suite.html
If you want to use an already running MySQL server for specific tests,
use the --extern option to mysql-test-run. Please note that in this mode,
the test suite expects you to provide the names of the tests to run.
For example, here is the command to run the "alias" and "analyze" tests
with an external server:
mysql-test-run --extern alias analyze
To match your setup, you might also need to provide --socket, --user, and
other relevant options.
With no test cases named on the command line, mysql-test-run falls back
to the normal "non-extern" behavior. The reason for this is that some
tests cannot run with an external server.
You can create your own test cases. To create a test case:
You can create your own test cases. To create a test case, create a new
file in the t subdirectory using a text editor. The file should have a .test
extension. For example:
xemacs t/test_case_name.test
in the file, put a set of SQL commands that will create some tables,
load test data, run some queries to manipulate it.
In the file, put a set of SQL statements that create some tables,
load test data, and run some queries to manipulate it.
We would appreciate if the test tables were called t1, t2, t3 ... (to not
We would appreciate it if you name your test tables t1, t2, t3 ... (to not
conflict too much with existing tables).
Your test should begin by dropping the tables you are going to create and
end by dropping them again. This will ensure that one can run the test
over and over again.
end by dropping them again. This ensures that you can run the test over
and over again.
If you are using mysqltest commands (like result file names) in your
test case you should do create the result file as follows:
test case, you should create the result file as follows:
mysql-test-run --record test_case_name
......@@ -47,8 +53,8 @@ You can create your own test cases. To create a test case:
mysqltest --record < t/test_case_name.test
If you only have a simple test cases consistent of SQL commands and comments
you can create the test case one of the following ways:
If you only have a simple test cases consisting of SQL statements and
comments, you can create the test case in one of the following ways:
mysql-test-run --record test_case_name
......@@ -57,11 +63,11 @@ You can create your own test cases. To create a test case:
mysqltest --record --record-file=r/test_case_name.result < t/test_case_name.test
When this is done, take a look at r/test_case_name.result
- If the result is wrong, you have found a bug; In this case you should
- If the result is incorrect, you have found a bug. In this case, you should
edit the test result to the correct results so that we can verify
that the bug is corrected in future releases.
To submit your test case, put your .test file and .result file(s) into
a tar.gz archive, add a README that explains the problem, ftp the
archive to ftp://support.mysql.com/pub/mysql/secret/ and send a mail
archive to ftp://support.mysql.com/pub/mysql/secret/ and send a mail
to bugs@lists.mysql.com
To be able to see the level of coverage with the current test suite,
do the following:
- make sure gcov is installed
- compile with BUILD/compile-pentium-gcov ( if your machine is not pentium, hack
this script, or just live with the pentium-specific stuff)
- ./mysql-test-run -gcov
- to see the level of coverage for a given source file:
- Make sure gcov is installed
- Compile the MySQL distribution with BUILD/compile-pentium-gcov (if your
machine does not have a pentium CPU, hack this script, or just live with
the pentium-specific stuff)
- In the mysql-test directory, run this command: ./mysql-test-run -gcov
- To see the level of coverage for a given source file:
grep source_file_name /tmp/gcov.out
- to see which lines are not yet covered, look at source_file_name.gcov in the source tree. Then think hard about a test case that will cover those
lines, and write one!
- To see which lines are not yet covered, look at source_file_name.gcov in
the source tree. Then think hard about a test case that will cover those
lines, and write one!
......@@ -198,6 +198,7 @@ our $opt_big_test= 0; # Send --big-test to mysqltest
our @opt_extra_mysqld_opt;
our $opt_comment;
our $opt_compress;
our $opt_ssl;
our $opt_skip_ssl;
......@@ -669,6 +670,14 @@ sub command_line_setup () {
print '#' x 78, "\n\n";
}
if ( $opt_comment )
{
print "\n";
print '#' x 78, "\n";
print "# $opt_comment\n";
print '#' x 78, "\n\n";
}
foreach my $arg ( @ARGV )
{
if ( $arg =~ /^--skip-/ )
......@@ -3256,6 +3265,7 @@ Options for coverage, profiling etc
Misc options
comment=STR Write STR to the output
verbose Verbose output from this script
script-debug Debug this script itself
timer Show test case execution time
......
......@@ -603,7 +603,14 @@ while test $# -gt 0; do
FAST_START=1
;;
--use-old-data)
USE_OLD_DATA=1;
USE_OLD_DATA=1
;;
--comment=*)
TMP=`$ECHO "$1" | $SED -e "s;--comment=;;"`
echo
echo '############################################'
echo "# $TMP"
echo '############################################'
;;
-- ) shift; break ;;
--* ) $ECHO "Unrecognized option: $1"; exit 1 ;;
......
......@@ -141,3 +141,22 @@ t1 CREATE TABLE `t1` (
`a` binary(1) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (col1 binary(4));
insert into t1 values ('a'),('a ');
select hex(col1) from t1;
hex(col1)
61000000
61200000
alter table t1 modify col1 binary(10);
select hex(col1) from t1;
hex(col1)
61000000000000000000
61200000000000000000
insert into t1 values ('b'),('b ');
select hex(col1) from t1;
hex(col1)
61000000000000000000
61200000000000000000
62000000000000000000
62200000000000000000
drop table t1;
......@@ -348,7 +348,7 @@ INSERT INTO mysql.db (host, db, user, select_priv) VALUES
('%','TESTDB','mysqltest_1','Y');
FLUSH PRIVILEGES;
create database TEStdb;
ERROR 42000: Access denied for user 'mysqltest_1'@'%' to database 'TEStdb'
Got one of the listed errors
delete from mysql.user;
delete from mysql.db where host='%' and user='mysqltest_1' and db='TESTDB';
insert into mysql.user select * from t1;
......
......@@ -677,6 +677,11 @@ select t1.b from v1a;
ERROR 42S22: Unknown column 't1.b' in 'field list'
select * from v1a join v1b on t1.b = t2.b;
ERROR 42S22: Unknown column 't1.b' in 'on clause'
select * from information_schema.statistics join information_schema.columns
using(table_name,column_name) where table_name='user';
TABLE_NAME COLUMN_NAME TABLE_CATALOG TABLE_SCHEMA NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT TABLE_CATALOG TABLE_SCHEMA ORDINAL_POSITION COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT
user Host NULL mysql 0 mysql PRIMARY 1 A NULL NULL NULL BTREE NULL mysql 1 NO char 20 60 NULL NULL utf8 utf8_bin char(60) PRI select,insert,update,references
user User NULL mysql 0 mysql PRIMARY 2 A 5 NULL NULL BTREE NULL mysql 2 NO char 5 16 NULL NULL utf8 utf8_bin char(16) PRI select,insert,update,references
drop table t1;
drop table t2;
drop table t3;
......
......@@ -12,3 +12,6 @@ create table t1 (a int);
create definer='user'@'host' sql security definer view v1 as select * from t1;
drop view v1;
drop table t1;
drop function if exists f1;
Warnings:
Note 1305 FUNCTION f1 does not exist
......@@ -4778,4 +4778,23 @@ Handler
Inner
drop procedure bug15011|
drop table t3|
drop procedure if exists bug17476|
create table t3 ( d date )|
insert into t3 values
( '2005-01-01' ), ( '2005-01-02' ), ( '2005-01-03' ),
( '2005-01-04' ), ( '2005-02-01' ), ( '2005-02-02' )|
create procedure bug17476(pDateFormat varchar(10))
select date_format(t3.d, pDateFormat), count(*)
from t3
group by date_format(t3.d, pDateFormat)|
call bug17476('%Y-%m')|
date_format(t3.d, pDateFormat) count(*)
2005-01 4
2005-02 2
call bug17476('%Y-%m')|
date_format(t3.d, pDateFormat) count(*)
2005-01 4
2005-02 2
drop table t3|
drop procedure bug17476|
drop table t1,t2;
......@@ -89,3 +89,15 @@ show create table t1;
drop table t1;
# End of 4.1 tests
#
# Bug#16857
#
create table t1 (col1 binary(4));
insert into t1 values ('a'),('a ');
select hex(col1) from t1;
alter table t1 modify col1 binary(10);
select hex(col1) from t1;
insert into t1 values ('b'),('b ');
select hex(col1) from t1;
drop table t1;
......@@ -449,7 +449,8 @@ connect (con1,localhost,mysqltest_1,password,TESTDB);
# The user mysqltest_1 should only be allowed access to
# database TESTDB, not TEStdb
--error 1044
# On system with "lowercase names" we get error "1007: Can't create db..."
--error 1044, 1007
create database TEStdb;
# Clean-up
......
......@@ -523,6 +523,12 @@ select t1.b from v1a;
-- error 1054
select * from v1a join v1b on t1.b = t2.b;
#
# Bug #17523 natural join and information_schema
#
select * from information_schema.statistics join information_schema.columns
using(table_name,column_name) where table_name='user';
drop table t1;
drop table t2;
drop table t3;
......
......@@ -30,3 +30,6 @@ create table t1 (a int);
create definer='user'@'host' sql security definer view v1 as select * from t1;
drop view v1;
drop table t1;
# BUG#17595: DROP FUNCTION IF EXISTS f1 crashes server
drop function if exists f1;
......@@ -5620,6 +5620,31 @@ drop procedure bug15011|
drop table t3|
#
# BUG#17476: Stored procedure not returning data when it is called first
# time per connection
#
--disable_warnings
drop procedure if exists bug17476|
--enable_warnings
create table t3 ( d date )|
insert into t3 values
( '2005-01-01' ), ( '2005-01-02' ), ( '2005-01-03' ),
( '2005-01-04' ), ( '2005-02-01' ), ( '2005-02-02' )|
create procedure bug17476(pDateFormat varchar(10))
select date_format(t3.d, pDateFormat), count(*)
from t3
group by date_format(t3.d, pDateFormat)|
call bug17476('%Y-%m')|
call bug17476('%Y-%m')|
drop table t3|
drop procedure bug17476|
#
# BUG#NNNN: New bug synopsis
#
......
......@@ -378,6 +378,16 @@ static void do_cut_string_complex(Copy_field *copy)
static void do_expand_binary(Copy_field *copy)
{
CHARSET_INFO *cs= copy->from_field->charset();
memcpy(copy->to_ptr,copy->from_ptr,copy->from_length);
cs->cset->fill(cs, copy->to_ptr+copy->from_length,
copy->to_length-copy->from_length, '\0');
}
static void do_expand_string(Copy_field *copy)
{
CHARSET_INFO *cs= copy->from_field->charset();
......@@ -582,7 +592,13 @@ void (*Copy_field::get_copy_func(Field *to,Field *from))(Copy_field*)
return (from->charset()->mbmaxlen == 1 ?
do_cut_string : do_cut_string_complex);
else if (to_length > from_length)
return do_expand_string;
{
if ((to->flags & BINARY_FLAG) != 0)
return do_expand_binary;
else
return do_expand_string;
}
}
else if (to->real_type() != from->real_type() ||
to_length != from_length ||
......
......@@ -1629,7 +1629,6 @@ class Item_string :public Item
str_value.length(), collation.collation);
}
Item *safe_charset_converter(CHARSET_INFO *tocs);
String *const_string() { return &str_value; }
inline void append(char *str, uint length) { str_value.append(str, length); }
void print(String *str);
// to prevent drop fixed flag (no need parent cleanup call)
......
......@@ -1656,9 +1656,15 @@ longlong Item_func_sec_to_time::val_int()
void Item_func_date_format::fix_length_and_dec()
{
/*
Must use this_item() in case it's a local SP variable
(for ->max_length and ->str_value)
*/
Item *arg1= args[1]->this_item();
decimals=0;
collation.set(&my_charset_bin);
if (args[1]->type() == STRING_ITEM)
if (arg1->type() == STRING_ITEM)
{ // Optimize the normal case
fixed_length=1;
......@@ -1666,13 +1672,13 @@ void Item_func_date_format::fix_length_and_dec()
The result is a binary string (no reason to use collation->mbmaxlen
This is becasue make_date_time() only returns binary strings
*/
max_length= format_length(((Item_string*) args[1])->const_string());
max_length= format_length(&arg1->str_value);
}
else
{
fixed_length=0;
/* The result is a binary string (no reason to use collation->mbmaxlen */
max_length=min(args[1]->max_length,MAX_BLOB_WIDTH) * 10;
max_length=min(arg1->max_length, MAX_BLOB_WIDTH) * 10;
set_if_smaller(max_length,MAX_BLOB_WIDTH);
}
maybe_null=1; // If wrong date
......@@ -1682,6 +1688,7 @@ void Item_func_date_format::fix_length_and_dec()
bool Item_func_date_format::eq(const Item *item, bool binary_cmp) const
{
Item_func_date_format *item_func;
if (item->type() != FUNC_ITEM)
return 0;
if (func_name() != ((Item_func*) item)->func_name())
......
......@@ -233,7 +233,7 @@ static int net_data_is_ready(my_socket sd)
/* Windows uses an _array_ of 64 fd's as default, so it's safe */
if (sd >= FD_SETSIZE)
return -1;
#define NET_DATA_IS_READY_CAN_RETURN_MINUS_ONE
#define NET_DATA_IS_READY_CAN_RETURN_MINUS_ONE
#endif
FD_ZERO(&sfds);
......
......@@ -284,6 +284,10 @@ static void del_udf(udf_func *udf)
void free_udf(udf_func *udf)
{
DBUG_ENTER("free_udf");
if (!initialized)
DBUG_VOID_RETURN;
rw_wrlock(&THR_LOCK_udf);
if (!--udf->usage_count)
{
......@@ -308,6 +312,9 @@ udf_func *find_udf(const char *name,uint length,bool mark_used)
udf_func *udf=0;
DBUG_ENTER("find_udf");
if (!initialized)
DBUG_RETURN(NULL);
/* TODO: This should be changed to reader locks someday! */
if (mark_used)
rw_wrlock(&THR_LOCK_udf); /* Called during fix_fields */
......
......@@ -3336,8 +3336,15 @@ const char *Natural_join_column::db_name()
if (view_field)
return table_ref->view_db.str;
/*
Test that TABLE_LIST::db is the same as st_table_share::db to
ensure consistency. An exception are I_S schema tables, which
are inconsistent in this respect.
*/
DBUG_ASSERT(!strcmp(table_ref->db,
table_ref->table->s->db.str));
table_ref->table->s->db.str) ||
(table_ref->schema_table &&
table_ref->table->s->db.str[0] == 0));
return table_ref->db;
}
......@@ -3539,7 +3546,15 @@ const char *Field_iterator_table_ref::db_name()
else if (table_ref->is_natural_join)
return natural_join_it.column_ref()->db_name();
DBUG_ASSERT(!strcmp(table_ref->db, table_ref->table->s->db.str));
/*
Test that TABLE_LIST::db is the same as st_table_share::db to
ensure consistency. An exception are I_S schema tables, which
are inconsistent in this respect.
*/
DBUG_ASSERT(!strcmp(table_ref->db, table_ref->table->s->db.str) ||
(table_ref->schema_table &&
table_ref->table->s->db.str[0] == 0));
return table_ref->db;
}
......
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