Commit 73ff0958 authored by unknown's avatar unknown

Merge bk-internal:/home/bk/mysql-4.1/

into serg.mylan:/usr/home/serg/Abk/mysql-4.1

parents 66f2d8bf 541cef75
...@@ -45,7 +45,6 @@ use strict; ...@@ -45,7 +45,6 @@ use strict;
use Getopt::Long; use Getopt::Long;
my $insert_portion_size= 15; my $insert_portion_size= 15;
my $maximum_line_length= 2040;
my $error_prefix= "---- help parsing errors :"; my $error_prefix= "---- help parsing errors :";
my $path_to_lex_file= "../sql/lex.h"; my $path_to_lex_file= "../sql/lex.h";
...@@ -167,7 +166,6 @@ sub add_description ...@@ -167,7 +166,6 @@ sub add_description
print_error "double description for $topic_name\n"; print_error "double description for $topic_name\n";
} }
$topics{$topic_name}->{description}= $description; $topics{$topic_name}->{description}= $description;
$topics{$topic_name}->{line_of_description}= $cur_line;
add_topic_to_category($topic_name); add_topic_to_category($topic_name);
} }
...@@ -517,52 +515,21 @@ if (scalar(@topic_names)) ...@@ -517,52 +515,21 @@ if (scalar(@topic_names))
{ {
my $header= "insert into help_topic ". my $header= "insert into help_topic ".
"(help_topic_id,help_category_id,name,description,example) values "; "(help_topic_id,help_category_id,name,description,example) values ";
my $line_accumulator= $header;
my $lines_in_accumulator= 0;
my $actual_max_line_length= $maximum_line_length-2; # for ";\n"
my $topic_name; my $topic_name;
my $count= 0; my $count= 0;
foreach $topic_name (@topic_names) foreach $topic_name (@topic_names)
{ {
print_insert_header($count,$header);
my $topic= $topics{$topic_name}; my $topic= $topics{$topic_name};
my $line= "($count,"; print "($count,";
$line.= "$topic->{category}->{__id__},"; print "$topic->{category}->{__id__},";
$line.= "\"$topic_name\","; print "\"$topic_name\",";
$line.= "\"$topic->{description}\","; print "\"$topic->{description}\",";
$line.= "\"$topic->{example}\")"; print "\"$topic->{example}\")";
if ($lines_in_accumulator <= $insert_portion_size &&
length($line) + length($line_accumulator) < $actual_max_line_length)
{
if ($lines_in_accumulator ne 0)
{
$line_accumulator.= ",";
}
$line_accumulator.= $line;
$lines_in_accumulator++;
}
else
{
if (length($line) + length($header) >= $actual_max_line_length)
{
$cur_line= $topics{$topic_name}->{line_of_description};
print_error "too long record for topic \"$topic_name\" \n".
" please decrease its description or example!\n";
}
else
{
print "$line_accumulator;\n";
$line_accumulator= $header.$line;
$lines_in_accumulator= 1;
}
}
$topics{$topic_name}->{__id__}= $count; $topics{$topic_name}->{__id__}= $count;
$count++; $count++;
} }
if ($lines_in_accumulator ne 0) printf ";\n\n";
{
print "$line_accumulator;\n";
}
printf "\n";
} }
my @keywords_names= keys(%keywords); my @keywords_names= keys(%keywords);
......
...@@ -1828,6 +1828,63 @@ static void test_select() ...@@ -1828,6 +1828,63 @@ static void test_select()
mysql_stmt_close(stmt); mysql_stmt_close(stmt);
} }
/*
Test for BUG#3420 ("select id1,value1 from t where id=? or value=?"
returns all rows in the table)
*/
static void test_ps_conj_select()
{
MYSQL_STMT *stmt;
int rc;
MYSQL_BIND bind[2];
long int int_data;
char str_data[32];
unsigned long str_length;
myheader("test_ps_conj_select");
rc= mysql_query(mysql, "drop table if exists t1");
myquery(rc);
rc= mysql_query(mysql, "create table t1 (id1 int(11) NOT NULL default '0',"
"value2 varchar(100), value1 varchar(100))");
myquery(rc);
rc= mysql_query(mysql, "insert into t1 values (1,'hh','hh'),(2,'hh','hh'),"
"(1,'ii','ii'),(2,'ii','ii')");
myquery(rc);
strmov(query, "select id1,value1 from t1 where id1=? or value1=?");
stmt= mysql_simple_prepare(mysql, query);
check_stmt(stmt);
verify_param_count(stmt,2);
bind[0].buffer_type= MYSQL_TYPE_LONG;
bind[0].buffer= (char *)&int_data;
bind[0].is_null= 0;
bind[0].length= 0;
bind[1].buffer_type= MYSQL_TYPE_VAR_STRING;
bind[1].buffer= (char *)str_data;
bind[1].buffer_length= array_elements(str_data);
bind[1].is_null= 0;
bind[1].length= &str_length;
rc = mysql_bind_param(stmt,bind);
check_execute(stmt, rc);
int_data= 1;
strcpy(str_data, "hh");
str_length= strlen(str_data);
rc = mysql_execute(stmt);
check_execute(stmt, rc);
assert(my_process_stmt_result(stmt) == 3);
mysql_stmt_close(stmt);
}
/* /*
test BUG#1115 (incorrect string parameter value allocation) test BUG#1115 (incorrect string parameter value allocation)
*/ */
...@@ -9508,6 +9565,7 @@ int main(int argc, char **argv) ...@@ -9508,6 +9565,7 @@ int main(int argc, char **argv)
test_select_prepare(); /* prepare select - protocol_prep debug */ test_select_prepare(); /* prepare select - protocol_prep debug */
test_select(); /* simple select test */ test_select(); /* simple select test */
test_select_version(); /* select with variables */ test_select_version(); /* select with variables */
test_ps_conj_select(); /* prepare select with "where a=? or b=?" */
test_select_show_table();/* simple show prepare */ test_select_show_table();/* simple show prepare */
#if NOT_USED #if NOT_USED
/* /*
......
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