Commit 04467af6 authored by unknown's avatar unknown

Merge sanja.is.com.ua:/home/bell/mysql/mysql-4.0

into sanja.is.com.ua:/home/bell/mysql/work-qc-4.0

parents 73bfaf02 66f426c0
......@@ -16394,7 +16394,7 @@ to restart @code{mysqld} with @code{--skip-grant-tables} to run
* Privilege changes:: When Privilege Changes Take Effect
* Default privileges:: Setting Up the Initial MySQL Privileges
* Adding users:: Adding New Users to MySQL
* User resources::
* User resources:: Limiting user resources
* Passwords:: Setting Up Passwords
* Password security:: Keeping Your Password Secure
* Secure connections:: Using Secure Connections
......@@ -19104,6 +19104,8 @@ memory. This command will not remove any queries from the cache, unlike
@item @code{TABLES WITH READ LOCK} @tab Closes all open tables and locks all tables for all databases with a read until one executes @code{UNLOCK TABLES}. This is very convenient way to get backups if you have a filesystem, like Veritas,that can take snapshots in time.
@item @code{STATUS} @tab Resets most status variables to zero. This is something one should only use when debugging a query.
@item @code{USER_RESOURCES} @tab Resets all user resources to zero. This will enalbe blocked users to login again. @xref{User resources}.
@end multitable
You can also access each of the commands shown above with the @code{mysqladmin}
......@@ -49696,7 +49698,8 @@ Optimised queries of type:
@item
@code{LOAD DATA FROM MASTER} ``auto-magically'' sets up a slave.
@item
Renamed @code{safe_mysqld} to @code{mysqld_safe}.
Renamed @code{safe_mysqld} to @code{mysqld_safe} to make this name more
in line with other MySQL scripts/commands.
@item
Added support for symbolic links to @code{MyISAM} tables. Symlink handling is
now enabled by default for Windows.
......@@ -43,6 +43,7 @@ static struct option long_options[] =
#ifndef DBUG_OFF
{"debug", optional_argument, 0, '#'},
#endif
{"database", required_argument, 0, 'd'},
{"help", no_argument, 0, '?'},
{"host", required_argument, 0, 'h'},
{"offset", required_argument, 0, 'o'},
......@@ -59,6 +60,8 @@ static struct option long_options[] =
void sql_print_error(const char *format,...);
static bool one_database = 0;
static const char* database;
static bool short_form = 0;
static ulonglong offset = 0;
static const char* host = "localhost";
......@@ -103,7 +106,7 @@ static void die(const char* fmt, ...)
static void print_version()
{
printf("%s Ver 1.8 for %s at %s\n",my_progname,SYSTEM_TYPE, MACHINE_TYPE);
printf("%s Ver 1.9 for %s at %s\n",my_progname,SYSTEM_TYPE, MACHINE_TYPE);
}
......@@ -127,6 +130,7 @@ the mysql command line client\n\n");
-?, --help Display this help and exit\n\
-s, --short-form Just show the queries, no extra info\n\
-o, --offset=N Skip the first N entries\n\
-d, --database=database List entries for just this database (local log only)\n\
-h, --host=server Get the binlog from server\n\
-P, --port=port Use port to connect to the remote server\n\
-u, --user=username Connect to the remote server as username\n\
......@@ -173,7 +177,7 @@ static int parse_args(int *argc, char*** argv)
int c, opt_index = 0;
result_file = stdout;
while((c = getopt_long(*argc, *argv, "so:#::h:j:u:p:P:r:t:?V", long_options,
while((c = getopt_long(*argc, *argv, "so:#::d:h:j:u:p:P:r:t:?V", long_options,
&opt_index)) != EOF)
{
switch(c)
......@@ -183,6 +187,11 @@ static int parse_args(int *argc, char*** argv)
DBUG_PUSH(optarg ? optarg : default_dbug_option);
break;
#endif
case 'd':
one_database = 1;
database = my_strdup(optarg, MYF(0));
break;
case 's':
short_form = 1;
break;
......@@ -473,6 +482,37 @@ Could not read entry at offset %s : Error in log format or read error",
}
if (rec_count >= offset)
{
// see if we should skip this event (only care about queries for now)
if (one_database)
{
if (ev->get_type_code() == QUERY_EVENT)
{
//const char * log_dbname = ev->get_db();
const char * log_dbname = ((Query_log_event*)ev)->db;
//printf("entry: %llu, database: %s\n", rec_count, log_dbname);
if ((log_dbname != NULL) && (strcmp(log_dbname, database)))
{
//printf("skipping, %s is not %s\n", log_dbname, database);
rec_count++;
delete ev;
continue; // next
}
#ifndef DBUG_OFF
else
{
printf("no skip\n");
}
#endif
}
#ifndef DBUG_OFF
else
{
const char * query_type = ev->get_type_str();
printf("not query -- %s\n", query_type);
}
#endif
}
if (!short_form)
fprintf(result_file, "# at %s\n",llstr(old_off,llbuff));
......
drop table if exists t1;
create table t1 (id int auto_increment primary key not null, mydate date not null);
insert into t1 values (0,"2002-05-01"),(0,"2002-05-01"),(0,"2002-05-01");
flush tables;
select * from t1 where isnull(to_days(mydate));
id mydate
drop table t1;
......@@ -115,6 +115,10 @@ d d
SELECT * from t1 WHERE t1.d IS NULL;
d
0000-00-00
SELECT * FROM t1 WHERE 1/0 IS NULL;
d
2001-08-01
0000-00-00
DROP TABLE t1,t2;
CREATE TABLE t1 (
Document_ID varchar(50) NOT NULL default '',
......
......@@ -146,3 +146,28 @@ t1 CREATE TABLE `t1` (
KEY `b` (`b`)
) TYPE=MyISAM
drop table t1;
create table t1 (a decimal(9,2), b decimal (9,0), e double(9,2), f double(5,0), h float(3,2), i float(3,0));
show columns from t1;
Field Type Null Key Default Extra
a decimal(9,2) YES NULL
b decimal(9,0) YES NULL
e double(9,2) YES NULL
f double(5,0) YES NULL
h float(3,2) YES NULL
i float(3,0) YES NULL
drop table t1;
create table t1 (c decimal, d double, f float, r real);
show columns from t1;
Field Type Null Key Default Extra
c decimal(10,0) YES NULL
d double YES NULL
f float YES NULL
r double YES NULL
drop table t1;
create table t1 (c decimal(3,3), d double(3,3), f float(3,3));
show columns from t1;
Field Type Null Key Default Extra
c decimal(4,3) YES NULL
d double(4,3) YES NULL
f float(4,3) YES NULL
drop table t1;
......@@ -57,3 +57,24 @@ select * from t1 where dt='2001-08-14 00:00:00' and dt = if(id=1,'2001-08-14 00
id dt
1 2001-08-14 00:00:00
drop table t1;
CREATE TABLE `t1` (
`date` datetime NOT NULL default '0000-00-00 00:00:00',
`numfacture` int(6) unsigned NOT NULL default '0',
`expedition` datetime NOT NULL default '0000-00-00 00:00:00',
PRIMARY KEY (`numfacture`),
KEY `date` (`date`),
KEY `expedition` (`expedition`)
) TYPE=MyISAM;
INSERT INTO t1 (expedition) VALUES ('0001-00-00 00:00:00');
SELECT * FROM t1 WHERE expedition='0001-00-00 00:00:00';
date numfacture expedition
0000-00-00 00:00:00 0 0001-00-00 00:00:00
INSERT INTO t1 (numfacture,expedition) VALUES ('1212','0001-00-00 00:00:00');
SELECT * FROM t1 WHERE expedition='0001-00-00 00:00:00';
date numfacture expedition
0000-00-00 00:00:00 0 0001-00-00 00:00:00
0000-00-00 00:00:00 1212 0001-00-00 00:00:00
EXPLAIN SELECT * FROM t1 WHERE expedition='0001-00-00 00:00:00';
table type possible_keys key key_len ref rows Extra
t1 ref expedition expedition 8 const 1 where used
drop table t1;
......@@ -150,3 +150,159 @@ select * from t1 where minvalue<=-1 and maxvalue>=-1 and datatype_id=16;
id datatype_id minvalue maxvalue valuename forecolor backcolor
143 16 -4.9000000000 -0.1000000000 NULL 15774720
drop table t1;
create table t1 (a decimal(10,2));
insert into t1 values ("0.0"),("-0.0"),("+0.0"),("01.0"),("+01.0"),("-01.0");
insert into t1 values ("-.1"),("+.1"),(".1");
insert into t1 values ("00000000000001"),("+0000000000001"),("-0000000000001");
insert into t1 values ("+111111111.11"),("111111111.11"),("-11111111.11");
insert into t1 values ("-111111111.11"),("+1111111111.11"),("1111111111.11");
select * from t1;
a
0.00
-0.00
+0.00
01.00
+01.00
-01.00
-0.10
+0.10
0.10
000000001.00
+00000001.00
-00000001.00
111111111.11
111111111.11
-11111111.11
-99999999.99
999999999.99
999999999.99
drop table t1;
create table t1 (a decimal(10,2) unsigned);
insert into t1 values ("0.0"),("-0.0"),("+0.0"),("01.0"),("+01.0"),("-01.0");
insert into t1 values ("-.1"),("+.1"),(".1");
insert into t1 values ("00000000000001"),("+0000000000001"),("-0000000000001");
insert into t1 values ("+111111111.11"),("111111111.11"),("-11111111.11");
insert into t1 values ("-111111111.11"),("+1111111111.11"),("1111111111.11");
select * from t1;
a
0.00
0.00
0.00
01.00
01.00
0.00
0.00
0.10
0.10
00000001.00
00000001.00
0.00
99999999.99
99999999.99
0.00
0.00
99999999.99
99999999.99
drop table t1;
create table t1 (a decimal(10,2) zerofill);
insert into t1 values ("0.0"),("-0.0"),("+0.0"),("01.0"),("+01.0"),("-01.0");
insert into t1 values ("-.1"),("+.1"),(".1");
insert into t1 values ("00000000000001"),("+0000000000001"),("-0000000000001");
insert into t1 values ("+111111111.11"),("111111111.11"),("-11111111.11");
insert into t1 values ("-111111111.11"),("+1111111111.11"),("1111111111.11");
select * from t1;
a
00000000.00
00000000.00
00000000.00
00000001.00
00000001.00
00000000.00
00000000.00
00000000.10
00000000.10
00000001.00
00000001.00
00000000.00
99999999.99
99999999.99
00000000.00
00000000.00
99999999.99
99999999.99
drop table t1;
create table t1 (a decimal(10,2));
insert into t1 values (0.0),(-0.0),(+0.0),(01.0),(+01.0),(-01.0);
insert into t1 values (-.1),(+.1),(.1);
insert into t1 values (00000000000001),(+0000000000001),(-0000000000001);
insert into t1 values (+111111111.11),(111111111.11),(-11111111.11);
insert into t1 values (-111111111.11),(+1111111111.11),(1111111111.11);
select * from t1;
a
0.00
-0.00
0.00
1.00
1.00
-1.00
-0.10
0.10
0.10
1.00
1.00
-1.00
111111111.11
111111111.11
-11111111.11
-99999999.99
999999999.99
999999999.99
drop table t1;
create table t1 (a decimal);
insert into t1 values (-99999999999999),(-1),('+1'),('01'),('+00000000000001'),('+12345678901'),(99999999999999);
select * from t1;
a
-9999999999
-1
+1
01
+0000000001
12345678901
99999999999
drop table t1;
create table t1 (a decimal unsigned);
insert into t1 values (-99999999999999),(-1),('+1'),('01'),('+00000000000001'),('+1234567890'),(99999999999999);
select * from t1;
a
0
0
1
01
0000000001
1234567890
9999999999
drop table t1;
create table t1 (a decimal zerofill);
insert into t1 values (-99999999999999),(-1),('+1'),('01'),('+00000000000001'),('+1234567890'),(99999999999999);
select * from t1;
a
0000000000
0000000000
0000000001
0000000001
0000000001
1234567890
9999999999
drop table t1;
create table t1 (a decimal unsigned zerofill);
insert into t1 values (-99999999999999),(-1),('+1'),('01'),('+00000000000001'),('+1234567890'),(99999999999999);
select * from t1;
a
0000000000
0000000000
0000000001
0000000001
0000000001
1234567890
9999999999
drop table t1;
......@@ -81,7 +81,7 @@ de2 decimal(6,0) YES NULL select,insert,update,references
de3 decimal(5,2) YES NULL select,insert,update,references
n decimal(10,0) YES NULL select,insert,update,references
n2 decimal(8,0) YES NULL select,insert,update,references
n3 decimal(8,6) YES NULL select,insert,update,references
n3 decimal(7,6) YES NULL select,insert,update,references
drop table t1;
create table t1 (a decimal(7,3) not null, key (a));
insert into t1 values ("0"),("-0.00"),("-0.01"),("-0.002"),("1");
......
......@@ -47,7 +47,7 @@ struct hostent *my_gethostbyname_r(const char *name,
int buflen, int *h_errnop)
{
struct hostent *hp;
dbug_assert((size_t) buflen >= sizeof(*result));
DBUG_ASSERT((size_t) buflen >= sizeof(*result));
if (gethostbyname_r(name,result, buffer, (size_t) buflen, &hp, h_errnop))
return 0;
return hp;
......@@ -59,7 +59,7 @@ struct hostent *my_gethostbyname_r(const char *name,
struct hostent *result, char *buffer,
int buflen, int *h_errnop)
{
dbug_assert(buflen >= sizeof(struct hostent_data));
DBUG_ASSERT(buflen >= sizeof(struct hostent_data));
if (gethostbyname_r(name,result,(struct hostent_data *) buffer) == -1)
{
*h_errnop= errno;
......@@ -77,7 +77,7 @@ struct hostent *my_gethostbyname_r(const char *name,
int buflen, int *h_errnop)
{
struct hostent *hp;
dbug_assert(buflen >= sizeof(struct hostent_data));
DBUG_ASSERT(buflen >= sizeof(struct hostent_data));
hp= gethostbyname_r(name,result,(struct hostent_data *) buffer);
*h_errnop= errno;
return hp;
......
......@@ -415,7 +415,8 @@ int my_pthread_cond_init(pthread_cond_t *mp, const pthread_condattr_t *attr)
Note that currently we only remap pthread_ functions used by MySQL.
If we are depending on the value for some other pthread_xxx functions,
this has to be added here
this has to be added here.
****************************************************************************/
#if defined(HPUX) || defined(HAVE_BROKEN_PTHREAD_COND_TIMEDWAIT)
......
......@@ -4967,6 +4967,11 @@ end_send_group(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
}
if (error > 0)
DBUG_RETURN(-1); /* purecov: inspected */
if (end_of_records)
{
join->send_records++;
DBUG_RETURN(0);
}
if (!error && ++join->send_records >= join->thd->select_limit &&
join->do_send_rows)
{
......@@ -4975,8 +4980,6 @@ end_send_group(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
join->do_send_rows=0;
join->thd->select_limit = HA_POS_ERROR;
}
if (end_of_records)
DBUG_RETURN(0);
}
}
else
......
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