Commit 350ab6b6 authored by joreland@mysql.com's avatar joreland@mysql.com

Merge mysql.com:/home/jonas/src/mysql-4.1

into mysql.com:/home/jonas/src/mysql-4.1-ndb
parents 8b32c7ef 72348e7c
......@@ -641,7 +641,7 @@ VAR* var_get(const char* var_name, const char** var_name_end, my_bool raw,
if (*var_name != '$')
goto err;
digit = *++var_name - '0';
if (!(digit < 10 && digit >= 0))
if (digit < 0 || digit >= 10)
{
const char* save_var_name = var_name, *end;
uint length;
......@@ -660,7 +660,7 @@ VAR* var_get(const char* var_name, const char** var_name_end, my_bool raw,
length < MAX_VAR_NAME)
{
char buff[MAX_VAR_NAME+1];
strmake(buff, save_var_name, length);
strmake(buff, save_var_name, length);
v= var_from_env(buff, "");
}
var_name--; /* Point at last character */
......
......@@ -2562,7 +2562,7 @@ case $default_charset in
;;
cp1250)
default_charset_default_collation="cp1250_general_ci"
default_charset_collations="cp1250_general_ci cp1250_czech_ci cp1250_bin"
default_charset_collations="cp1250_general_ci cp1250_czech_cs cp1250_bin"
;;
cp1251)
default_charset_default_collation="cp1251_general_ci"
......@@ -2638,7 +2638,7 @@ case $default_charset in
;;
latin2)
default_charset_default_collation="latin2_general_ci"
default_charset_collations="latin2_general_ci latin2_bin latin2_czech_ci latin2_hungarian_ci latin2_croatian_ci"
default_charset_collations="latin2_general_ci latin2_bin latin2_czech_cs latin2_hungarian_ci latin2_croatian_ci"
;;
latin5)
default_charset_default_collation="latin5_turkish_ci"
......
This diff is collapsed.
......@@ -4,6 +4,7 @@ MaxNoOfConcurrentOperations: CHOOSE_MaxNoOfConcurrentOperations
DataMemory: CHOOSE_DataMemory
IndexMemory: CHOOSE_IndexMemory
Diskless: CHOOSE_Diskless
TimeBetweenWatchDogCheck: 30000
[COMPUTER]
Id: 1
......
......@@ -90,16 +90,23 @@ insert into t1 values
('2003-01-02 11:11:12Pm', '%Y-%m-%d %h:%i:%S%p'),
('10:20:10', '%H:%i:%s'),
('10:20:10', '%h:%i:%s.%f'),
('10:20:10', '%T'),
('10:20:10AM', '%h:%i:%s%p'),
('10:20:10AM', '%r'),
('10:20:10.44AM', '%h:%i:%s.%f%p'),
('15-01-2001 12:59:58', '%d-%m-%Y %H:%i:%S'),
('15 September 2001', '%d %M %Y'),
('15 SEPTEMB 2001', '%d %M %Y'),
('15 MAY 2001', '%d %b %Y'),
('15th May 2001', '%D %b %Y'),
('Sunday 15 MAY 2001', '%W %d %b %Y'),
('Sund 15 MAY 2001', '%W %d %b %Y'),
('Tuesday 00 2002', '%W %U %Y'),
('Thursday 53 1998', '%W %u %Y'),
('Sunday 01 2001', '%W %v %x'),
('Tuesday 52 2001', '%W %V %X'),
('060 2004', '%j %Y'),
('4 53 1998', '%w %u %Y'),
('15-01-2001', '%d-%m-%Y %H:%i:%S'),
('15-01-20', '%d-%m-%y'),
('15-2001-1', '%d-%Y-%c');
......@@ -114,16 +121,23 @@ date format str_to_date
2003-01-02 11:11:12Pm %Y-%m-%d %h:%i:%S%p 2003-01-02 23:11:12
10:20:10 %H:%i:%s 0000-00-00 10:20:10
10:20:10 %h:%i:%s.%f 0000-00-00 10:20:10
10:20:10 %T 0000-00-00 10:20:10
10:20:10AM %h:%i:%s%p 0000-00-00 10:20:10
10:20:10AM %r 0000-00-00 10:20:10
10:20:10.44AM %h:%i:%s.%f%p 0000-00-00 10:20:10.440000
15-01-2001 12:59:58 %d-%m-%Y %H:%i:%S 2001-01-15 12:59:58
15 September 2001 %d %M %Y 2001-09-15 00:00:00
15 SEPTEMB 2001 %d %M %Y 2001-09-15 00:00:00
15 MAY 2001 %d %b %Y 2001-05-15 00:00:00
15th May 2001 %D %b %Y 2001-05-15 00:00:00
Sunday 15 MAY 2001 %W %d %b %Y 2001-05-15 00:00:00
Sund 15 MAY 2001 %W %d %b %Y 2001-05-15 00:00:00
Tuesday 00 2002 %W %U %Y 2002-01-01 00:00:00
Thursday 53 1998 %W %u %Y 1998-12-31 00:00:00
Sunday 01 2001 %W %v %x 2001-01-07 00:00:00
Tuesday 52 2001 %W %V %X 2002-01-01 00:00:00
060 2004 %j %Y 2004-02-29 00:00:00
4 53 1998 %w %u %Y 1998-12-31 00:00:00
15-01-2001 %d-%m-%Y %H:%i:%S 2001-01-15 00:00:00
15-01-20 %d-%m-%y 2020-01-15 00:00:00
15-2001-1 %d-%Y-%c 2001-01-15 00:00:00
......@@ -138,16 +152,23 @@ date format con
2003-01-02 11:11:12Pm %Y-%m-%d %h:%i:%S%p 2003-01-02 23:11:12
10:20:10 %H:%i:%s 0000-00-00 10:20:10
10:20:10 %h:%i:%s.%f 0000-00-00 10:20:10
10:20:10 %T 0000-00-00 10:20:10
10:20:10AM %h:%i:%s%p 0000-00-00 10:20:10
10:20:10AM %r 0000-00-00 10:20:10
10:20:10.44AM %h:%i:%s.%f%p 0000-00-00 10:20:10.440000
15-01-2001 12:59:58 %d-%m-%Y %H:%i:%S 2001-01-15 12:59:58
15 September 2001 %d %M %Y 2001-09-15 00:00:00
15 SEPTEMB 2001 %d %M %Y 2001-09-15 00:00:00
15 MAY 2001 %d %b %Y 2001-05-15 00:00:00
15th May 2001 %D %b %Y 2001-05-15 00:00:00
Sunday 15 MAY 2001 %W %d %b %Y 2001-05-15 00:00:00
Sund 15 MAY 2001 %W %d %b %Y 2001-05-15 00:00:00
Tuesday 00 2002 %W %U %Y 2002-01-01 00:00:00
Thursday 53 1998 %W %u %Y 1998-12-31 00:00:00
Sunday 01 2001 %W %v %x 2001-01-07 00:00:00
Tuesday 52 2001 %W %V %X 2002-01-01 00:00:00
060 2004 %j %Y 2004-02-29 00:00:00
4 53 1998 %w %u %Y 1998-12-31 00:00:00
15-01-2001 %d-%m-%Y %H:%i:%S 2001-01-15 00:00:00
15-01-20 %d-%m-%y 2020-01-15 00:00:00
15-2001-1 %d-%Y-%c 2001-01-15 00:00:00
......@@ -162,16 +183,23 @@ date format datetime
2003-01-02 11:11:12Pm %Y-%m-%d %h:%i:%S%p 2003-01-02 23:11:12
10:20:10 %H:%i:%s 0000-00-00 10:20:10
10:20:10 %h:%i:%s.%f 0000-00-00 10:20:10
10:20:10 %T 0000-00-00 10:20:10
10:20:10AM %h:%i:%s%p 0000-00-00 10:20:10
10:20:10AM %r 0000-00-00 10:20:10
10:20:10.44AM %h:%i:%s.%f%p 0000-00-00 10:20:10.440000
15-01-2001 12:59:58 %d-%m-%Y %H:%i:%S 2001-01-15 12:59:58
15 September 2001 %d %M %Y 2001-09-15 00:00:00
15 SEPTEMB 2001 %d %M %Y 2001-09-15 00:00:00
15 MAY 2001 %d %b %Y 2001-05-15 00:00:00
15th May 2001 %D %b %Y 2001-05-15 00:00:00
Sunday 15 MAY 2001 %W %d %b %Y 2001-05-15 00:00:00
Sund 15 MAY 2001 %W %d %b %Y 2001-05-15 00:00:00
Tuesday 00 2002 %W %U %Y 2002-01-01 00:00:00
Thursday 53 1998 %W %u %Y 1998-12-31 00:00:00
Sunday 01 2001 %W %v %x 2001-01-07 00:00:00
Tuesday 52 2001 %W %V %X 2002-01-01 00:00:00
060 2004 %j %Y 2004-02-29 00:00:00
4 53 1998 %w %u %Y 1998-12-31 00:00:00
15-01-2001 %d-%m-%Y %H:%i:%S 2001-01-15 00:00:00
15-01-20 %d-%m-%y 2020-01-15 00:00:00
15-2001-1 %d-%Y-%c 2001-01-15 00:00:00
......@@ -186,16 +214,23 @@ date format date2
2003-01-02 11:11:12Pm %Y-%m-%d %h:%i:%S%p 2003-01-02
10:20:10 %H:%i:%s 0000-00-00
10:20:10 %h:%i:%s.%f 0000-00-00
10:20:10 %T 0000-00-00
10:20:10AM %h:%i:%s%p 0000-00-00
10:20:10AM %r 0000-00-00
10:20:10.44AM %h:%i:%s.%f%p 0000-00-00
15-01-2001 12:59:58 %d-%m-%Y %H:%i:%S 2001-01-15
15 September 2001 %d %M %Y 2001-09-15
15 SEPTEMB 2001 %d %M %Y 2001-09-15
15 MAY 2001 %d %b %Y 2001-05-15
15th May 2001 %D %b %Y 2001-05-15
Sunday 15 MAY 2001 %W %d %b %Y 2001-05-15
Sund 15 MAY 2001 %W %d %b %Y 2001-05-15
Tuesday 00 2002 %W %U %Y 2002-01-01
Thursday 53 1998 %W %u %Y 1998-12-31
Sunday 01 2001 %W %v %x 2001-01-07
Tuesday 52 2001 %W %V %X 2002-01-01
060 2004 %j %Y 2004-02-29
4 53 1998 %w %u %Y 1998-12-31
15-01-2001 %d-%m-%Y %H:%i:%S 2001-01-15
15-01-20 %d-%m-%y 2020-01-15
15-2001-1 %d-%Y-%c 2001-01-15
......@@ -210,16 +245,23 @@ date format time
2003-01-02 11:11:12Pm %Y-%m-%d %h:%i:%S%p 23:11:12
10:20:10 %H:%i:%s 10:20:10
10:20:10 %h:%i:%s.%f 10:20:10
10:20:10 %T 10:20:10
10:20:10AM %h:%i:%s%p 10:20:10
10:20:10AM %r 10:20:10
10:20:10.44AM %h:%i:%s.%f%p 10:20:10.440000
15-01-2001 12:59:58 %d-%m-%Y %H:%i:%S 12:59:58
15 September 2001 %d %M %Y 00:00:00
15 SEPTEMB 2001 %d %M %Y 00:00:00
15 MAY 2001 %d %b %Y 00:00:00
15th May 2001 %D %b %Y 00:00:00
Sunday 15 MAY 2001 %W %d %b %Y 00:00:00
Sund 15 MAY 2001 %W %d %b %Y 00:00:00
Tuesday 00 2002 %W %U %Y 00:00:00
Thursday 53 1998 %W %u %Y 00:00:00
Sunday 01 2001 %W %v %x 00:00:00
Tuesday 52 2001 %W %V %X 00:00:00
060 2004 %j %Y 00:00:00
4 53 1998 %w %u %Y 00:00:00
15-01-2001 %d-%m-%Y %H:%i:%S 00:00:00
15-01-20 %d-%m-%y 00:00:00
15-2001-1 %d-%Y-%c 00:00:00
......@@ -234,16 +276,23 @@ date format time2
2003-01-02 11:11:12Pm %Y-%m-%d %h:%i:%S%p 23:11:12
10:20:10 %H:%i:%s 10:20:10
10:20:10 %h:%i:%s.%f 10:20:10
10:20:10 %T 10:20:10
10:20:10AM %h:%i:%s%p 10:20:10
10:20:10AM %r 10:20:10
10:20:10.44AM %h:%i:%s.%f%p 10:20:10.440000
15-01-2001 12:59:58 %d-%m-%Y %H:%i:%S 12:59:58
15 September 2001 %d %M %Y 00:00:00
15 SEPTEMB 2001 %d %M %Y 00:00:00
15 MAY 2001 %d %b %Y 00:00:00
15th May 2001 %D %b %Y 00:00:00
Sunday 15 MAY 2001 %W %d %b %Y 00:00:00
Sund 15 MAY 2001 %W %d %b %Y 00:00:00
Tuesday 00 2002 %W %U %Y 00:00:00
Thursday 53 1998 %W %u %Y 00:00:00
Sunday 01 2001 %W %v %x 00:00:00
Tuesday 52 2001 %W %V %X 00:00:00
060 2004 %j %Y 00:00:00
4 53 1998 %w %u %Y 00:00:00
15-01-2001 %d-%m-%Y %H:%i:%S 00:00:00
15-01-20 %d-%m-%y 00:00:00
15-2001-1 %d-%Y-%c 00:00:00
......@@ -258,10 +307,13 @@ insert into t1 values
('15 Septembei 2001', '%d %M %Y'),
('15 Ju 2001', '%d %M %Y'),
('Sund 15 MA', '%W %d %b %Y'),
('Sunday 01 2001', '%W %V %X'),
('Thursdai 12 1998', '%W %u %Y'),
(NULL, get_format(DATE,'USA')),
('Tuesday 52 2001', '%W %V %X');
('Sunday 01 2001', '%W %v %X'),
('Tuesday 52 2001', '%W %V %x'),
('Tuesday 52 2001', '%W %V %Y'),
('Tuesday 52 2001', '%W %u %x'),
('7 53 1998', '%w %u %Y'),
(NULL, get_format(DATE,'USA'));
select date,format,str_to_date(date, format) as str_to_date from t1;
date format str_to_date
2003-01-02 10:11:12 PM %Y-%m-%d %H:%i:%S %p NULL
......@@ -273,10 +325,13 @@ date format str_to_date
15 Septembei 2001 %d %M %Y NULL
15 Ju 2001 %d %M %Y NULL
Sund 15 MA %W %d %b %Y NULL
Sunday 01 2001 %W %V %X NULL
Thursdai 12 1998 %W %u %Y NULL
Sunday 01 2001 %W %v %X NULL
Tuesday 52 2001 %W %V %x NULL
Tuesday 52 2001 %W %V %Y NULL
Tuesday 52 2001 %W %u %x NULL
7 53 1998 %w %u %Y NULL
NULL %m.%d.%Y NULL
Tuesday 52 2001 %W %V %X NULL
select date,format,concat(str_to_date(date, format),'') as con from t1;
date format con
2003-01-02 10:11:12 PM %Y-%m-%d %H:%i:%S %p NULL
......@@ -288,10 +343,13 @@ date format con
15 Septembei 2001 %d %M %Y NULL
15 Ju 2001 %d %M %Y NULL
Sund 15 MA %W %d %b %Y NULL
Sunday 01 2001 %W %V %X NULL
Thursdai 12 1998 %W %u %Y NULL
Sunday 01 2001 %W %v %X NULL
Tuesday 52 2001 %W %V %x NULL
Tuesday 52 2001 %W %V %Y NULL
Tuesday 52 2001 %W %u %x NULL
7 53 1998 %w %u %Y NULL
NULL %m.%d.%Y NULL
Tuesday 52 2001 %W %V %X NULL
truncate table t1;
insert into t1 values
('10:20:10AM', '%h:%i:%s'),
......
......@@ -81,7 +81,10 @@ email varchar(50) NOT NULL default '',
PRIMARY KEY (id),
UNIQUE KEY e_n (email,name)
);
INSERT INTO t2 VALUES (1,'name1','email1'),(2,'name2','email2'),(3,'name3','email3'),(4,'name4','email4'),(5,'name5','email5'),(6,'name6','email6'),(7,'name7','email7'),(8,'name8','email8'),(9,'name9','email9'),(10,'name10','email10'),(11,'name11','email11'),(12,'name12','email12'),(13,'name13','email13'),(14,'name14','email14'),(15,'name15','email15'),(16,'name16','email16'),(17,'name17','email17'),(18,'name18','email18'),(19,'name19','email19'),(20,'name20','email20'),(21,'name21','email21'),(22,'name22','email22'),(23,'name23','email23'),(24,'name24','email24'),(25,'name25','email25'),(26,'name26','email26'),(27,'name27','email27'),(28,'name28','email28'),(29,'name29','email29'),(30,'name30','email30'),(31,'name31','email31'),(32,'name32','email32'),(33,'name33','email33'),(34,'name34','email34'),(35,'name35','email35'),(36,'name36','email36'),(37,'name37','email37'),(38,'name38','email38'),(39,'name39','email39'),(40,'name40','email40'),(41,'name41','email41'),(42,'name42','email42'),(43,'name43','email43'),(44,'name44','email44'),(45,'name45','email45'),(46,'name46','email46'),(47,'name47','email47'),(48,'name48','email48'),(49,'name49','email49'),(50,'name50','email50'),(51,'name51','email51'),(52,'name52','email52'),(53,'name53','email53'),(54,'name54','email54'),(55,'name55','email55'),(56,'name56','email56'),(57,'name57','email57'),(58,'name58','email58'),(59,'name59','email59'),(60,'name60','email60'),(61,'name61','email61'),(62,'name62','email62'),(63,'name63','email63'),(64,'name64','email64'),(65,'name65','email65'),(66,'name66','email66'),(67,'name67','email67'),(68,'name68','email68'),(69,'name69','email69'),(70,'name70','email70'),(71,'name71','email71'),(72,'name72','email72'),(73,'name73','email73'),(74,'name74','email74'),(75,'name75','email75'),(76,'name76','email76'),(77,'name77','email77'),(78,'name78','email78'),(79,'name79','email79'),(80,'name80','email80'),(81,'name81','email81'),(82,'name82','email82'),(83,'name83','email83'),(84,'name84','email84'),(85,'name85','email85'),(86,'name86','email86'),(87,'name87','email87'),(88,'name88','email88'),(89,'name89','email89'),(90,'name90','email90'),(91,'name91','email91'),(92,'name92','email92'),(93,'name93','email93'),(94,'name94','email94'),(95,'name95','email95'),(96,'name96','email96'),(97,'name97','email97'),(98,'name98','email98'),(99,'name99','email99'),(100,'name100','email100'),(101,'name101','email101'),(102,'name102','email102'),(103,'name103','email103'),(104,'name104','email104'),(105,'name105','email105'),(106,'name106','email106'),(107,'name107','email107'),(108,'name108','email108'),(109,'name109','email109'),(110,'name110','email110'),(111,'name111','email111'),(112,'name112','email112'),(113,'name113','email113'),(114,'name114','email114'),(115,'name115','email115'),(116,'name116','email116'),(117,'name117','email117'),(118,'name118','email118'),(119,'name119','email119'),(120,'name120','email120'),(121,'name121','email121'),(122,'name122','email122'),(123,'name123','email123'),(124,'name124','email124'),(125,'name125','email125'),(126,'name126','email126'),(127,'name127','email127'),(128,'name128','email128'),(129,'name129','email129'),(130,'name130','email130'),(131,'name131','email131'),(132,'name132','email132'),(133,'name133','email133'),(134,'name134','email134'),(135,'name135','email135'),(136,'name136','email136'),(137,'name137','email137'),(138,'name138','email138'),(139,'name139','email139'),(140,'name140','email140'),(141,'name141','email141'),(142,'name142','email142'),(143,'name143','email143'),(144,'name144','email144'),(145,'name145','email145'),(146,'name146','email146'),(147,'name147','email147'),(148,'name148','email148'),(149,'name149','email149'),(150,'name150','email150'),(151,'name151','email151'),(152,'name152','email152'),(153,'name153','email153'),(154,'name154','email154'),(155,'name155','email155'),(156,'name156','email156'),(157,'name157','email157'),(158,'name158','email158'),(159,'name159','email159'),(160,'name160','email160'),(161,'name161','email161'),(162,'name162','email162'),(163,'name163','email163'),(164,'name164','email164'),(165,'name165','email165'),(166,'name166','email166'),(167,'name167','email167'),(168,'name168','email168'),(169,'name169','email169'),(170,'name170','email170'),(171,'name171','email171'),(172,'name172','email172'),(173,'name173','email173'),(174,'name174','email174'),(175,'name175','email175'),(176,'name176','email176'),(177,'name177','email177'),(178,'name178','email178'),(179,'name179','email179'),(180,'name180','email180'),(181,'name181','email181'),(182,'name182','email182'),(183,'name183','email183'),(184,'name184','email184'),(185,'name185','email185'),(186,'name186','email186'),(187,'name187','email187'),(188,'name188','email188'),(189,'name189','email189'),(190,'name190','email190'),(191,'name191','email191'),(192,'name192','email192'),(193,'name193','email193'),(194,'name194','email194'),(195,'name195','email195'),(196,'name196','email196'),(197,'name197','email197'),(198,'name198','email198'),(199,'name199','email199'),(200,'name200','email200');
EXPLAIN SELECT SQL_CALC_FOUND_ROWS DISTINCT email FROM t2 LEFT JOIN t1 ON kid = t2.id WHERE t1.id IS NULL LIMIT 10;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 system PRIMARY,kid NULL NULL NULL 0 const row not found
1 SIMPLE t2 index NULL e_n 100 NULL 200
SELECT SQL_CALC_FOUND_ROWS DISTINCT email FROM t2 LEFT JOIN t1 ON kid = t2.id WHERE t1.id IS NULL LIMIT 10;
email
email1
......
......@@ -132,16 +132,23 @@ insert into t1 values
('2003-01-02 11:11:12Pm', '%Y-%m-%d %h:%i:%S%p'),
('10:20:10', '%H:%i:%s'),
('10:20:10', '%h:%i:%s.%f'),
('10:20:10', '%T'),
('10:20:10AM', '%h:%i:%s%p'),
('10:20:10AM', '%r'),
('10:20:10.44AM', '%h:%i:%s.%f%p'),
('15-01-2001 12:59:58', '%d-%m-%Y %H:%i:%S'),
('15 September 2001', '%d %M %Y'),
('15 SEPTEMB 2001', '%d %M %Y'),
('15 MAY 2001', '%d %b %Y'),
('15th May 2001', '%D %b %Y'),
('Sunday 15 MAY 2001', '%W %d %b %Y'),
('Sund 15 MAY 2001', '%W %d %b %Y'),
('Tuesday 00 2002', '%W %U %Y'),
('Thursday 53 1998', '%W %u %Y'),
('Sunday 01 2001', '%W %v %x'),
('Tuesday 52 2001', '%W %V %X'),
('060 2004', '%j %Y'),
('4 53 1998', '%w %u %Y'),
('15-01-2001', '%d-%m-%Y %H:%i:%S'),
('15-01-20', '%d-%m-%y'),
('15-2001-1', '%d-%Y-%c');
......@@ -156,7 +163,7 @@ select date,format,DATE(str_to_date(date, format)) as date2 from t1;
select date,format,TIME(str_to_date(date, format)) as time from t1;
select date,format,concat(TIME(str_to_date(date, format))) as time2 from t1;
# Test wrong dates
# Test wrong dates or converion specifiers
truncate table t1;
insert into t1 values
......@@ -169,10 +176,13 @@ insert into t1 values
('15 Septembei 2001', '%d %M %Y'),
('15 Ju 2001', '%d %M %Y'),
('Sund 15 MA', '%W %d %b %Y'),
('Sunday 01 2001', '%W %V %X'),
('Thursdai 12 1998', '%W %u %Y'),
(NULL, get_format(DATE,'USA')),
('Tuesday 52 2001', '%W %V %X');
('Sunday 01 2001', '%W %v %X'),
('Tuesday 52 2001', '%W %V %x'),
('Tuesday 52 2001', '%W %V %Y'),
('Tuesday 52 2001', '%W %u %x'),
('7 53 1998', '%w %u %Y'),
(NULL, get_format(DATE,'USA'));
select date,format,str_to_date(date, format) as str_to_date from t1;
select date,format,concat(str_to_date(date, format),'') as con from t1;
......
......@@ -54,8 +54,18 @@ CREATE TABLE t2 (
UNIQUE KEY e_n (email,name)
);
INSERT INTO t2 VALUES (1,'name1','email1'),(2,'name2','email2'),(3,'name3','email3'),(4,'name4','email4'),(5,'name5','email5'),(6,'name6','email6'),(7,'name7','email7'),(8,'name8','email8'),(9,'name9','email9'),(10,'name10','email10'),(11,'name11','email11'),(12,'name12','email12'),(13,'name13','email13'),(14,'name14','email14'),(15,'name15','email15'),(16,'name16','email16'),(17,'name17','email17'),(18,'name18','email18'),(19,'name19','email19'),(20,'name20','email20'),(21,'name21','email21'),(22,'name22','email22'),(23,'name23','email23'),(24,'name24','email24'),(25,'name25','email25'),(26,'name26','email26'),(27,'name27','email27'),(28,'name28','email28'),(29,'name29','email29'),(30,'name30','email30'),(31,'name31','email31'),(32,'name32','email32'),(33,'name33','email33'),(34,'name34','email34'),(35,'name35','email35'),(36,'name36','email36'),(37,'name37','email37'),(38,'name38','email38'),(39,'name39','email39'),(40,'name40','email40'),(41,'name41','email41'),(42,'name42','email42'),(43,'name43','email43'),(44,'name44','email44'),(45,'name45','email45'),(46,'name46','email46'),(47,'name47','email47'),(48,'name48','email48'),(49,'name49','email49'),(50,'name50','email50'),(51,'name51','email51'),(52,'name52','email52'),(53,'name53','email53'),(54,'name54','email54'),(55,'name55','email55'),(56,'name56','email56'),(57,'name57','email57'),(58,'name58','email58'),(59,'name59','email59'),(60,'name60','email60'),(61,'name61','email61'),(62,'name62','email62'),(63,'name63','email63'),(64,'name64','email64'),(65,'name65','email65'),(66,'name66','email66'),(67,'name67','email67'),(68,'name68','email68'),(69,'name69','email69'),(70,'name70','email70'),(71,'name71','email71'),(72,'name72','email72'),(73,'name73','email73'),(74,'name74','email74'),(75,'name75','email75'),(76,'name76','email76'),(77,'name77','email77'),(78,'name78','email78'),(79,'name79','email79'),(80,'name80','email80'),(81,'name81','email81'),(82,'name82','email82'),(83,'name83','email83'),(84,'name84','email84'),(85,'name85','email85'),(86,'name86','email86'),(87,'name87','email87'),(88,'name88','email88'),(89,'name89','email89'),(90,'name90','email90'),(91,'name91','email91'),(92,'name92','email92'),(93,'name93','email93'),(94,'name94','email94'),(95,'name95','email95'),(96,'name96','email96'),(97,'name97','email97'),(98,'name98','email98'),(99,'name99','email99'),(100,'name100','email100'),(101,'name101','email101'),(102,'name102','email102'),(103,'name103','email103'),(104,'name104','email104'),(105,'name105','email105'),(106,'name106','email106'),(107,'name107','email107'),(108,'name108','email108'),(109,'name109','email109'),(110,'name110','email110'),(111,'name111','email111'),(112,'name112','email112'),(113,'name113','email113'),(114,'name114','email114'),(115,'name115','email115'),(116,'name116','email116'),(117,'name117','email117'),(118,'name118','email118'),(119,'name119','email119'),(120,'name120','email120'),(121,'name121','email121'),(122,'name122','email122'),(123,'name123','email123'),(124,'name124','email124'),(125,'name125','email125'),(126,'name126','email126'),(127,'name127','email127'),(128,'name128','email128'),(129,'name129','email129'),(130,'name130','email130'),(131,'name131','email131'),(132,'name132','email132'),(133,'name133','email133'),(134,'name134','email134'),(135,'name135','email135'),(136,'name136','email136'),(137,'name137','email137'),(138,'name138','email138'),(139,'name139','email139'),(140,'name140','email140'),(141,'name141','email141'),(142,'name142','email142'),(143,'name143','email143'),(144,'name144','email144'),(145,'name145','email145'),(146,'name146','email146'),(147,'name147','email147'),(148,'name148','email148'),(149,'name149','email149'),(150,'name150','email150'),(151,'name151','email151'),(152,'name152','email152'),(153,'name153','email153'),(154,'name154','email154'),(155,'name155','email155'),(156,'name156','email156'),(157,'name157','email157'),(158,'name158','email158'),(159,'name159','email159'),(160,'name160','email160'),(161,'name161','email161'),(162,'name162','email162'),(163,'name163','email163'),(164,'name164','email164'),(165,'name165','email165'),(166,'name166','email166'),(167,'name167','email167'),(168,'name168','email168'),(169,'name169','email169'),(170,'name170','email170'),(171,'name171','email171'),(172,'name172','email172'),(173,'name173','email173'),(174,'name174','email174'),(175,'name175','email175'),(176,'name176','email176'),(177,'name177','email177'),(178,'name178','email178'),(179,'name179','email179'),(180,'name180','email180'),(181,'name181','email181'),(182,'name182','email182'),(183,'name183','email183'),(184,'name184','email184'),(185,'name185','email185'),(186,'name186','email186'),(187,'name187','email187'),(188,'name188','email188'),(189,'name189','email189'),(190,'name190','email190'),(191,'name191','email191'),(192,'name192','email192'),(193,'name193','email193'),(194,'name194','email194'),(195,'name195','email195'),(196,'name196','email196'),(197,'name197','email197'),(198,'name198','email198'),(199,'name199','email199'),(200,'name200','email200');
disable_query_log;
let $1=200;
let $2=0;
while ($1)
{
inc $2;
eval INSERT INTO t2 VALUES ($2,'name$2','email$2');
dec $1;
}
enable_query_log;
EXPLAIN SELECT SQL_CALC_FOUND_ROWS DISTINCT email FROM t2 LEFT JOIN t1 ON kid = t2.id WHERE t1.id IS NULL LIMIT 10;
SELECT SQL_CALC_FOUND_ROWS DISTINCT email FROM t2 LEFT JOIN t1 ON kid = t2.id WHERE t1.id IS NULL LIMIT 10;
SELECT FOUND_ROWS();
......
......@@ -3756,6 +3756,10 @@ Dbdict::createTab_reply(Signal* signal,
ref->senderRef = reference();
ref->senderData = createTabPtr.p->m_senderData;
ref->errorCode = createTabPtr.p->m_errorCode;
ref->masterNodeId = c_masterNodeId;
ref->status = 0;
ref->errorKey = 0;
ref->errorLine = 0;
//@todo check api failed
sendSignal(createTabPtr.p->m_senderRef, GSN_CREATE_TABLE_REF, signal,
......
......@@ -957,15 +957,21 @@ int ha_myisam::indexes_are_disabled(void)
start_bulk_insert(rows)
rows Rows to be inserted
0 if we don't know
NOTICE
Do not forget to call end_bulk_insert() later!
*/
void ha_myisam::start_bulk_insert(ha_rows rows)
{
DBUG_ENTER("ha_myisam::start_bulk_insert");
THD *thd=current_thd;
ulong size= min(thd->variables.read_buff_size, table->avg_row_length*rows);
DBUG_PRINT("info",("start_bulk_insert: rows %lu size %lu",
(ulong) rows, size));
/* don't enable row cache if too few rows */
if (!rows && rows > MI_MIN_ROWS_TO_USE_WRITE_CACHE)
if (! rows || (rows > MI_MIN_ROWS_TO_USE_WRITE_CACHE))
mi_extra(file, HA_EXTRA_WRITE_CACHE, (void*) &size);
can_enable_indexes= (file->s->state.key_map ==
......@@ -989,8 +995,22 @@ void ha_myisam::start_bulk_insert(ha_rows rows)
mi_init_bulk_insert(file, thd->variables.bulk_insert_buff_size, rows);
}
}
DBUG_VOID_RETURN;
}
/*
end special bulk-insert optimizations,
which have been activated by start_bulk_insert().
SYNOPSIS
end_bulk_insert()
no arguments
RETURN
0 OK
!= 0 Error
*/
int ha_myisam::end_bulk_insert()
{
mi_end_bulk_insert(file);
......
......@@ -268,8 +268,8 @@ void Item_bool_func2::fix_length_and_dec()
int Arg_comparator::set_compare_func(Item_bool_func2 *item, Item_result type)
{
owner= item;
func= comparator_matrix[type][(owner->functype() == Item_func::EQUAL_FUNC)?
1:0];
func= comparator_matrix[type]
[test(owner->functype() == Item_func::EQUAL_FUNC)];
if (type == ROW_RESULT)
{
uint n= (*a)->cols();
......
......@@ -113,6 +113,12 @@ static bool make_datetime(date_time_format_types format, TIME *ltime,
}
/* Date formats corresponding to compound %r and %T conversion specifiers */
static DATE_TIME_FORMAT time_ampm_format= {{}, '\0', 0,
{(char *)"%I:%i:%S %p", 11}};
static DATE_TIME_FORMAT time_24hrs_format= {{}, '\0', 0,
{(char *)"%H:%i:%S", 8}};
/*
Extract datetime value to TIME struct from string value
according to format string.
......@@ -126,6 +132,17 @@ static bool make_datetime(date_time_format_types format, TIME *ltime,
cached_timestamp_type
It uses to get an appropriate warning
in the case when the value is truncated.
sub_pattern_end if non-zero then we are parsing string which
should correspond compound specifier (like %T or
%r) and this parameter is pointer to place where
pointer to end of string matching this specifier
should be stored.
NOTE
Possibility to parse strings matching to patterns equivalent to compound
specifiers is mainly intended for use from inside of this function in
order to understand %T and %r conversion specifiers, so number of
conversion specifiers that can be used in such sub-patterns is limited.
Also most of checks are skipped in this case.
RETURN
0 ok
......@@ -134,14 +151,18 @@ static bool make_datetime(date_time_format_types format, TIME *ltime,
static bool extract_date_time(DATE_TIME_FORMAT *format,
const char *val, uint length, TIME *l_time,
timestamp_type cached_timestamp_type)
timestamp_type cached_timestamp_type,
const char **sub_pattern_end)
{
int weekday= 0, yearday= 0, daypart= 0;
int week_number= -1;
CHARSET_INFO *cs= &my_charset_bin;
int error= 0;
bool usa_time= 0;
bool sunday_first= 0;
bool sunday_first_n_first_week_non_iso;
bool strict_week_number;
int strict_week_number_year= -1;
bool strict_week_number_year_type;
int frac_part;
const char *val_begin= val;
const char *val_end= val + length;
......@@ -149,7 +170,12 @@ static bool extract_date_time(DATE_TIME_FORMAT *format,
const char *end= ptr + format->format.length;
DBUG_ENTER("extract_date_time");
bzero((char*) l_time, sizeof(*l_time));
LINT_INIT(sunday_first_n_first_week_non_iso);
LINT_INIT(strict_week_number);
LINT_INIT(strict_week_number_year_type);
if (!sub_pattern_end)
bzero((char*) l_time, sizeof(*l_time));
for (; ptr != end && val != val_end; ptr++)
{
......@@ -160,7 +186,7 @@ static bool extract_date_time(DATE_TIME_FORMAT *format,
char *tmp;
/* Skip pre-space between each argument */
while (my_isspace(cs, *val) && val != val_end)
while (val != val_end && my_isspace(cs, *val))
val++;
val_len= (uint) (val_end - val);
......@@ -268,9 +294,12 @@ static bool extract_date_time(DATE_TIME_FORMAT *format,
break;
case 'w':
tmp= (char*) val + 1;
if ((weekday= (int) my_strtoll10(val, &tmp, &error)) <= 0 ||
if ((weekday= (int) my_strtoll10(val, &tmp, &error)) < 0 ||
weekday >= 7)
goto err;
/* We should use the same 1 - 7 scale for %w as for %W */
if (!weekday)
weekday= 7;
val= tmp;
break;
case 'j':
......@@ -279,15 +308,45 @@ static bool extract_date_time(DATE_TIME_FORMAT *format,
val= tmp;
break;
/* Week numbers */
case 'V':
case 'U':
sunday_first= 1;
/* Fall through */
case 'v':
case 'u':
sunday_first_n_first_week_non_iso= (*ptr=='U' || *ptr== 'V');
strict_week_number= (*ptr=='V' || *ptr=='v');
tmp= (char*) val + min(val_len, 2);
week_number= (int) my_strtoll10(val, &tmp, &error);
if ((week_number= (int) my_strtoll10(val, &tmp, &error)) < 0 ||
strict_week_number && !week_number ||
week_number > 53)
goto err;
val= tmp;
break;
/* Year used with 'strict' %V and %v week numbers */
case 'X':
case 'x':
strict_week_number_year_type= (*ptr=='X');
tmp= (char*) val + min(4, val_len);
strict_week_number_year= (int) my_strtoll10(val, &tmp, &error);
val= tmp;
break;
/* Time in AM/PM notation */
case 'r':
error= extract_date_time(&time_ampm_format, val,
(uint)(val_end - val), l_time,
cached_timestamp_type, &val);
break;
/* Time in 24-hour notation */
case 'T':
error= extract_date_time(&time_24hrs_format, val,
(uint)(val_end - val), l_time,
cached_timestamp_type, &val);
break;
/* Conversion specifiers that match classes of characters */
case '.':
while (my_ispunct(cs, *val) && val != val_end)
val++;
......@@ -320,6 +379,16 @@ static bool extract_date_time(DATE_TIME_FORMAT *format,
l_time->hour= l_time->hour%12+daypart;
}
/*
If we are recursively called for parsing string matching compound
specifiers we are already done.
*/
if (sub_pattern_end)
{
*sub_pattern_end= val;
DBUG_RETURN(0);
}
if (yearday > 0)
{
uint days= calc_daynr(l_time->year,1,1) + yearday - 1;
......@@ -330,34 +399,45 @@ static bool extract_date_time(DATE_TIME_FORMAT *format,
if (week_number >= 0 && weekday)
{
int days= calc_daynr(l_time->year,1,1);
int days;
uint weekday_b;
if (weekday > 7 || weekday < 0)
goto err;
if (sunday_first)
weekday = weekday%7;
if (week_number == 53)
{
days+= (week_number - 1)*7;
weekday_b= calc_weekday(days, sunday_first);
weekday = weekday - weekday_b - !sunday_first;
days+= weekday;
}
else if (week_number == 0)
/*
%V,%v require %X,%x resprectively,
%U,%u should be used with %Y and not %X or %x
*/
if (strict_week_number &&
(strict_week_number_year < 0 ||
strict_week_number_year_type != sunday_first_n_first_week_non_iso) ||
!strict_week_number && strict_week_number_year >= 0)
goto err;
/* Number of days since year 0 till 1st Jan of this year */
days= calc_daynr((strict_week_number ? strict_week_number_year :
l_time->year),
1, 1);
/* Which day of week is 1st Jan of this year */
weekday_b= calc_weekday(days, sunday_first_n_first_week_non_iso);
/*
Below we are going to sum:
1) number of days since year 0 till 1st day of 1st week of this year
2) number of days between 1st week and our week
3) and position of our day in the week
*/
if (sunday_first_n_first_week_non_iso)
{
weekday_b= calc_weekday(days, sunday_first);
weekday = weekday - weekday_b - !sunday_first;
days+= weekday;
days+= ((weekday_b == 0) ? 0 : 7) - weekday_b +
(week_number - 1) * 7 +
weekday % 7;
}
else
{
days+= (week_number - !sunday_first)*7;
weekday_b= calc_weekday(days, sunday_first);
weekday =weekday - weekday_b - !sunday_first;
days+= weekday;
days+= ((weekday_b <= 3) ? 0 : 7) - weekday_b +
(week_number - 1) * 7 +
(weekday - 1);
}
if (days <= 0 || days >= MAX_DAY_NUMBER)
goto err;
get_date_from_daynr(days,&l_time->year,&l_time->month,&l_time->day);
......@@ -2599,7 +2679,7 @@ bool Item_func_str_to_date::get_date(TIME *ltime, uint fuzzy_date)
date_time_format.format.str= (char*) format->ptr();
date_time_format.format.length= format->length();
if (extract_date_time(&date_time_format, val->ptr(), val->length(),
ltime, cached_timestamp_type))
ltime, cached_timestamp_type, 0))
goto null_date;
if (cached_timestamp_type == MYSQL_TIMESTAMP_TIME && ltime->day)
{
......
This diff is collapsed.
......@@ -854,7 +854,7 @@ JOIN::optimize()
as in other cases the join is done before the sort.
*/
if (const_tables != tables &&
(order || group_list) &&
(order || group_list) &&
join_tab[const_tables].type != JT_ALL &&
join_tab[const_tables].type != JT_FT &&
join_tab[const_tables].type != JT_REF_OR_NULL &&
......@@ -868,9 +868,7 @@ JOIN::optimize()
((group_list && const_tables != tables &&
(!simple_group ||
!test_if_skip_sort_order(&join_tab[const_tables], group_list,
unit->select_limit_cnt,
0))) ||
select_distinct) &&
unit->select_limit_cnt, 0))) || select_distinct) &&
tmp_table_param.quick_group && !procedure)
{
need_tmp=1; simple_order=simple_group=0; // Force tmp table without sort
......@@ -2069,7 +2067,7 @@ merge_key_fields(KEY_FIELD *start,KEY_FIELD *new_fields,KEY_FIELD *end,
}
else if (old->eq_func && new_fields->eq_func &&
old->val->eq(new_fields->val, old->field->binary()))
{
old->level= and_level;
old->optimize= ((old->optimize & new_fields->optimize &
......@@ -2128,7 +2126,7 @@ merge_key_fields(KEY_FIELD *start,KEY_FIELD *new_fields,KEY_FIELD *end,
field Field used in comparision
eq_func True if we used =, <=> or IS NULL
value Value used for comparison with field
Is NULL for BETWEEN and IN
Is NULL for BETWEEN and IN
usable_tables Tables which can be used for key optimization
NOTES
......@@ -2207,7 +2205,7 @@ add_key_field(KEY_FIELD **key_fields,uint and_level, COND *cond,
(*value)->result_type() != STRING_RESULT &&
field->cmp_type() != (*value)->result_type())
return;
/*
We can't use indexes if the effective collation
of the operation differ from the field collation.
......@@ -2320,7 +2318,7 @@ add_key_fields(JOIN_TAB *stat,KEY_FIELD **key_fields,uint *and_level,
!(cond_func->used_tables() & OUTER_REF_TABLE_BIT))
{
Item *tmp=new Item_null;
if (!tmp) // Should never be true
if (unlikely(!tmp)) // Should never be true
return;
add_key_field(key_fields,*and_level,cond_func,
((Item_field*) (cond_func->arguments()[0])->real_item())
......@@ -2731,7 +2729,7 @@ find_best(JOIN *join,table_map rest_tables,uint idx,double record_count,
rec= keyuse->ref_table_rows;
/*
If there is one 'key_column IS NULL' expression, we can
use this ref_or_null optimsation of this field
use this ref_or_null optimisation of this field
*/
found_ref_or_null|= (keyuse->optimize &
KEY_OPTIMIZE_REF_OR_NULL);
......
......@@ -2691,7 +2691,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
if (do_send_ok)
send_ok(thd);
}
else
else if (error > 0)
{
table->file->print_error(error, MYF(0));
error= -1;
......
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