Commit 3b654d54 authored by Sergei Golubchik's avatar Sergei Golubchik

longer regex error messages

parent 9dadfdcd
......@@ -31,6 +31,7 @@
#include <m_string.h>
#include <my_getopt.h>
#include <my_dir.h>
#include <ctype.h>
#define MAX_ROWS 3000
#define ERRORS_PER_RANGE 1000
......@@ -749,18 +750,19 @@ static struct message *find_message(struct errors *err, const char *lang,
for the format specifiers
RETURN VALUE
Returns the checksum for all the characters of the
Returns the checksum for all letters of the
format specifiers
Ex.
"text '%-64.s' text part 2 %d'"
^^^^^^ ^^
"text '%-.64s' text part 2 %zu'"
^ ^^
characters will be xored to form checksum
Non-letters are skipped, because they do not change the type
of the argument.
NOTE:
Does not support format specifiers with positional args
like "%2$s" but that is not yet supported by my_vsnprintf
either.
Does not support format specifiers with positional args like "%2$s"
*/
static ha_checksum checksum_format_specifier(const char* msg)
......@@ -777,20 +779,17 @@ static ha_checksum checksum_format_specifier(const char* msg)
start= p+1; /* Entering format specifier */
num_format_specifiers++;
}
else if (start)
else if (start && isalpha(*p))
{
chksum= my_checksum(chksum, p, 1);
switch(*p) {
case 'd':
case 'u':
case 'x':
case 's':
case 'M':
chksum= my_checksum(chksum, (uchar*) start, (uint) (p + 1 - start));
start= 0; /* Not in format specifier anymore */
break;
default:
break;
}
}
......
......@@ -793,7 +793,7 @@ SELECT 'a\nb' RLIKE '(?-s)a.b';
0
SET default_regex_flags=DEFAULT;
SELECT REGEXP_SUBSTR('Monday Mon','^((?<DN>Mon|Fri|Sun)day|(?<DN>Tue)sday).*(?P=DN)$');
ERROR 42000: Got error 'two named subpatterns have the same name (PCRE2_DUPNAMES not set' from regexp
ERROR 42000: Regex error 'two named subpatterns have the same name (PCRE2_DUPNAMES not set) at offset 30'
SET default_regex_flags='DUPNAMES';
SELECT REGEXP_SUBSTR('Monday Mon','^((?<DN>Mon|Fri|Sun)day|(?<DN>Tue)sday).*(?P=DN)$');
REGEXP_SUBSTR('Monday Mon','^((?<DN>Mon|Fri|Sun)day|(?<DN>Tue)sday).*(?P=DN)$')
......@@ -817,10 +817,10 @@ SELECT 'AB' RLIKE 'A# this is a comment\nB';
1
SET default_regex_flags=DEFAULT;
SELECT 'Aq' RLIKE 'A\\q';
ERROR 42000: Got error 'unrecognized character follows \ at offset 2' from regexp
ERROR 42000: Regex error 'unrecognized character follows \ at offset 2'
SET default_regex_flags='EXTRA';
SELECT 'Aq' RLIKE 'A\\q';
ERROR 42000: Got error 'unrecognized character follows \ at offset 2' from regexp
ERROR 42000: Regex error 'unrecognized character follows \ at offset 2'
SET default_regex_flags=DEFAULT;
SELECT 'a\nb\nc' RLIKE '^b$';
'a\nb\nc' RLIKE '^b$'
......@@ -860,7 +860,7 @@ SELECT 0xE001 REGEXP @regCheck;
0xE001 REGEXP @regCheck
0
Warnings:
Warning 1139 Got error 'UTF-8 error: 1 byte missing at end' from regexp
Warning 1139 Regex error 'UTF-8 error: 1 byte missing at end'
# Testing workaround N1: This makes the pattern to be a binary string:
SET NAMES latin1;
SET @regCheck= X'E001';
......
......@@ -3,7 +3,7 @@ SELECT 'a' RLIKE 'a';
'a' RLIKE 'a'
0
Warnings:
Warning 1139 Got error 'pcre_exec: Internal error (-123)' from regexp
Warning 1139 Regex error 'pcre_exec: Internal error (-123)'
SET debug_dbug='';
SELECT 'a' RLIKE 'a';
'a' RLIKE 'a'
......
......@@ -3186,13 +3186,13 @@ ER_INVALID_USE_OF_NULL 22004
swe "Felaktig använding av NULL"
ukr "Хибне використання значення NULL"
ER_REGEXP_ERROR 42000
cze "Regulární výraz vrátil chybu '%-.64s'"
cze "Regulární výraz vrátil chybu: %s"
dan "Fik fejl '%-.64s' fra regexp"
nla "Fout '%-.64s' ontvangen van regexp"
eng "Got error '%-.64s' from regexp"
est "regexp tagastas vea '%-.64s'"
eng "Regex error '%s'"
est "regexp tagastas vea: %s"
fre "Erreur '%-.64s' provenant de regexp"
ger "regexp lieferte Fehler '%-.64s'"
ger "Regexp Fehler %s"
hindi "regexp में '%-.64s' त्रुटि हुई"
hun "'%-.64s' hiba a regularis kifejezes hasznalata soran (regexp)"
ita "Errore '%-.64s' da regexp"
......@@ -3200,11 +3200,11 @@ ER_REGEXP_ERROR 42000
kor "regexp에서 '%-.64s'가 났습니다."
por "Obteve erro '%-.64s' em regexp"
rum "Eroarea '%-.64s' obtinuta din expresia regulara (regexp)"
rus "Получена ошибка '%-.64s' от регулярного выражения"
serbian "Funkcija regexp je vratila grešku '%-.64s'"
rus "Ошибка регулярного выражения: %s"
serbian "Funkcija regexp je vratila grešku: %s"
spa "Obtenido error '%-.64s' de regexp"
swe "Fick fel '%-.64s' från REGEXP"
ukr "Отримано помилку '%-.64s' від регулярного виразу"
ukr "Помилка регулярного виразу: %s"
ER_MIX_OF_GROUP_FUNC_AND_FIELDS 42000
cze "Pokud není žádná GROUP BY klauzule, není dovoleno současné použití GROUP položek (MIN(),MAX(),COUNT()...) s ne GROUP položkami"
dan "Sammenblanding af GROUP kolonner (MIN(),MAX(),COUNT()...) uden GROUP kolonner er ikke tilladt, hvis der ikke er noget GROUP BY prædikat"
......
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