diff options
author | unknown <monty@hundin.mysql.fi> | 2002-05-16 23:35:09 +0300 |
---|---|---|
committer | unknown <monty@hundin.mysql.fi> | 2002-05-16 23:35:09 +0300 |
commit | 66f426c0635d16f7f594f6bf867e13e5cba18500 (patch) | |
tree | cbcb80b627d5f9bc7c0b27150bbdef3cd36d22aa | |
parent | 4d094257dbb785d792785e610ab3cdf41eae9b8c (diff) | |
download | mariadb-git-66f426c0635d16f7f594f6bf867e13e5cba18500.tar.gz |
Fixed some compilation problems in last changeset
Docs/manual.texi:
Small changes regarind user resources
client/mysqlbinlog.cc:
Applied patch to support --database
mysql-test/r/func_isnull.result:
New test results
mysql-test/r/join.result:
New test results
mysql-test/r/show_check.result:
New test results
mysql-test/r/type_datetime.result:
New test results
mysql-test/r/type_decimal.result:
New test results
mysql-test/r/type_float.result:
New test results
mysys/my_gethostbyname.c:
Fixed type on last push
mysys/my_pthread.c:
Fixed type on last push
sql/sql_select.cc:
Fixed bug in LIMIT handling
-rw-r--r-- | Docs/manual.texi | 7 | ||||
-rw-r--r-- | client/mysqlbinlog.cc | 44 | ||||
-rw-r--r-- | mysql-test/r/func_isnull.result | 6 | ||||
-rw-r--r-- | mysql-test/r/join.result | 4 | ||||
-rw-r--r-- | mysql-test/r/show_check.result | 25 | ||||
-rw-r--r-- | mysql-test/r/type_datetime.result | 21 | ||||
-rw-r--r-- | mysql-test/r/type_decimal.result | 156 | ||||
-rw-r--r-- | mysql-test/r/type_float.result | 2 | ||||
-rw-r--r-- | mysys/my_gethostbyname.c | 6 | ||||
-rw-r--r-- | mysys/my_pthread.c | 3 | ||||
-rw-r--r-- | sql/sql_select.cc | 7 |
11 files changed, 270 insertions, 11 deletions
diff --git a/Docs/manual.texi b/Docs/manual.texi index c9a5662cb9e..1d67f3f7ed1 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -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. diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index 145c8b847ff..2591897b8de 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -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)); diff --git a/mysql-test/r/func_isnull.result b/mysql-test/r/func_isnull.result index deaeaaf71c9..20ddc87ee78 100644 --- a/mysql-test/r/func_isnull.result +++ b/mysql-test/r/func_isnull.result @@ -1 +1,7 @@ +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; diff --git a/mysql-test/r/join.result b/mysql-test/r/join.result index b8ec13e9f50..96113dcdc8b 100644 --- a/mysql-test/r/join.result +++ b/mysql-test/r/join.result @@ -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 '', diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result index 50d910564d0..2c32d766a38 100644 --- a/mysql-test/r/show_check.result +++ b/mysql-test/r/show_check.result @@ -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; diff --git a/mysql-test/r/type_datetime.result b/mysql-test/r/type_datetime.result index 3e13485c872..cae15d4f665 100644 --- a/mysql-test/r/type_datetime.result +++ b/mysql-test/r/type_datetime.result @@ -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; diff --git a/mysql-test/r/type_decimal.result b/mysql-test/r/type_decimal.result index 9fee88f4bf8..94fa112b57b 100644 --- a/mysql-test/r/type_decimal.result +++ b/mysql-test/r/type_decimal.result @@ -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; diff --git a/mysql-test/r/type_float.result b/mysql-test/r/type_float.result index 4dbfa1b9f66..e85bced353a 100644 --- a/mysql-test/r/type_float.result +++ b/mysql-test/r/type_float.result @@ -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"); diff --git a/mysys/my_gethostbyname.c b/mysys/my_gethostbyname.c index 19381734e83..76a0a780dd3 100644 --- a/mysys/my_gethostbyname.c +++ b/mysys/my_gethostbyname.c @@ -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; diff --git a/mysys/my_pthread.c b/mysys/my_pthread.c index 209b61159ec..0ac35123ad0 100644 --- a/mysys/my_pthread.c +++ b/mysys/my_pthread.c @@ -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) diff --git a/sql/sql_select.cc b/sql/sql_select.cc index d48bc3b3a18..06e0d94f524 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -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 |