Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
9d5deb07
Commit
9d5deb07
authored
Feb 23, 2010
by
Marc Alff
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug#10143 Perror not showing error description
Backport to 5.5.99
parent
b77d7d17
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
99 additions
and
4 deletions
+99
-4
client/mysqltest.cc
client/mysqltest.cc
+2
-1
extra/comp_err.c
extra/comp_err.c
+29
-3
extra/perror.c
extra/perror.c
+48
-0
mysql-test/r/perror.result
mysql-test/r/perror.result
+5
-0
mysql-test/suite/ndb/r/ndb_basic.result
mysql-test/suite/ndb/r/ndb_basic.result
+1
-0
mysql-test/t/perror.test
mysql-test/t/perror.test
+14
-0
No files found.
client/mysqltest.cc
View file @
9d5deb07
...
...
@@ -4460,12 +4460,13 @@ typedef struct
{
const
char
*
name
;
uint
code
;
const
char
*
text
;
}
st_error
;
static
st_error
global_error_names
[]
=
{
#include <mysqld_ername.h>
{
0
,
0
}
{
0
,
0
,
0
}
};
uint
get_errcode_from_name
(
char
*
error_name
,
char
*
error_end
)
...
...
extra/comp_err.c
View file @
9d5deb07
...
...
@@ -199,11 +199,34 @@ int main(int argc, char *argv[])
}
static
void
print_escaped_string
(
FILE
*
f
,
const
char
*
str
)
{
const
char
*
tmp
=
str
;
while
(
tmp
[
0
]
!=
0
)
{
switch
(
tmp
[
0
])
{
case
'\\'
:
fprintf
(
f
,
"
\\\\
"
);
break
;
case
'\''
:
fprintf
(
f
,
"
\\\'
"
);
break
;
case
'\"'
:
fprintf
(
f
,
"
\\\"
"
);
break
;
case
'\n'
:
fprintf
(
f
,
"
\\
n"
);
break
;
case
'\r'
:
fprintf
(
f
,
"
\\
r"
);
break
;
default:
fprintf
(
f
,
"%c"
,
tmp
[
0
]);
}
tmp
++
;
}
}
static
int
create_header_files
(
struct
errors
*
error_head
)
{
uint
er_last
;
FILE
*
er_definef
,
*
sql_statef
,
*
er_namef
;
struct
errors
*
tmp_error
;
struct
message
*
er_msg
;
const
char
*
er_text
;
DBUG_ENTER
(
"create_header_files"
);
LINT_INIT
(
er_last
);
...
...
@@ -245,9 +268,12 @@ static int create_header_files(struct errors *error_head)
"{ %-40s,
\"
%s
\"
,
\"
%s
\"
},
\n
"
,
tmp_error
->
er_name
,
tmp_error
->
sql_code1
,
tmp_error
->
sql_code2
);
/*generating er_name file */
fprintf
(
er_namef
,
"{
\"
%s
\"
, %d },
\n
"
,
tmp_error
->
er_name
,
tmp_error
->
d_code
);
er_msg
=
find_message
(
tmp_error
,
default_language
,
0
);
er_text
=
(
er_msg
?
er_msg
->
text
:
""
);
fprintf
(
er_namef
,
"{
\"
%s
\"
, %d,
\"
"
,
tmp_error
->
er_name
,
tmp_error
->
d_code
);
print_escaped_string
(
er_namef
,
er_text
);
fprintf
(
er_namef
,
"
\"
},
\n
"
);
}
/* finishing off with mysqld_error.h */
fprintf
(
er_definef
,
"#define ER_ERROR_LAST %d
\n
"
,
er_last
);
...
...
extra/perror.c
View file @
9d5deb07
...
...
@@ -184,6 +184,45 @@ static const char *get_ha_error_msg(int code)
return
NullS
;
}
typedef
struct
{
const
char
*
name
;
uint
code
;
const
char
*
text
;
}
st_error
;
static
st_error
global_error_names
[]
=
{
#include <mysqld_ername.h>
{
0
,
0
,
0
}
};
/**
Lookup an error by code in the global_error_names array.
@param code the code to lookup
@param [out] name_ptr the error name, when found
@param [out] msg_ptr the error text, when found
@return 1 when found, otherwise 0
*/
int
get_ER_error_msg
(
uint
code
,
const
char
**
name_ptr
,
const
char
**
msg_ptr
)
{
st_error
*
tmp_error
;
tmp_error
=
&
global_error_names
[
0
];
while
(
tmp_error
->
name
!=
NULL
)
{
if
(
tmp_error
->
code
==
code
)
{
*
name_ptr
=
tmp_error
->
name
;
*
msg_ptr
=
tmp_error
->
text
;
return
1
;
}
tmp_error
++
;
}
return
0
;
}
#if defined(__WIN__)
static
my_bool
print_win_error_msg
(
DWORD
error
,
my_bool
verbose
)
...
...
@@ -211,6 +250,7 @@ int main(int argc,char *argv[])
{
int
error
,
code
,
found
;
const
char
*
msg
;
const
char
*
name
;
char
*
unknown_error
=
0
;
#if defined(__WIN__)
my_bool
skip_win_message
=
0
;
...
...
@@ -316,6 +356,14 @@ int main(int argc,char *argv[])
else
puts
(
msg
);
}
if
(
get_ER_error_msg
(
code
,
&
name
,
&
msg
))
{
found
=
1
;
if
(
verbose
)
printf
(
"MySQL error code %3d (%s): %s
\n
"
,
code
,
name
,
msg
);
else
puts
(
msg
);
}
if
(
!
found
)
{
#if defined(__WIN__)
...
...
mysql-test/r/perror.result
View file @
9d5deb07
Illegal error code: 10000
MySQL error code 1062 (ER_DUP_ENTRY): Duplicate entry '%-.192s' for key %d
MySQL error code 1076 (ER_READY): %s: ready for connections.
Version: '%s' socket: '%s' port: %d
MySQL error code 1459 (ER_TABLE_NEEDS_UPGRADE): Table upgrade required. Please do "REPAIR TABLE `%-.32s`" or dump/reload to fix it!
MySQL error code 1461 (ER_MAX_PREPARED_STMT_COUNT_REACHED): Can't create more than max_prepared_stmt_count statements (current value: %lu)
mysql-test/suite/ndb/r/ndb_basic.result
View file @
9d5deb07
...
...
@@ -787,6 +787,7 @@ f1 f2 f3
222222 bbbbbb 2
drop table t1;
Illegal ndb error code: 1186
MySQL error code 1186 (ER_FLUSH_MASTER_BINLOG_CLOSED): Binlog closed, cannot RESET MASTER
CREATE TABLE t1 (
a VARBINARY(40) NOT NULL,
b VARCHAR (256) CHARACTER SET UTF8 NOT NULL,
...
...
mysql-test/t/perror.test
View file @
9d5deb07
...
...
@@ -17,3 +17,17 @@ enable_query_log;
# As there is no error code defined for 10000, expect error
--
error
1
--
exec
$MY_PERROR
10000
2
>&
1
#
# Bug#10143 (Perror not showing error description)
#
# test reported case
--
exec
$MY_PERROR
1062
2
>&
1
# test errors that contain characters to escape in the text.
--
exec
$MY_PERROR
1076
2
>&
1
--
exec
$MY_PERROR
1459
2
>&
1
--
exec
$MY_PERROR
1461
2
>&
1
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment