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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
238c5bfa
Commit
238c5bfa
authored
Nov 27, 2008
by
Tatiana A. Nurnberg
Browse files
Options
Browse Files
Download
Plain Diff
auto-merge
parents
d57c7dcf
7b488c46
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
137 additions
and
2 deletions
+137
-2
extra/perror.c
extra/perror.c
+38
-2
mysql-test/r/perror-win.result
mysql-test/r/perror-win.result
+5
-0
mysql-test/t/perror-win.test
mysql-test/t/perror-win.test
+11
-0
sql/field.cc
sql/field.cc
+2
-0
tests/mysql_client_test.c
tests/mysql_client_test.c
+81
-0
No files found.
extra/perror.c
View file @
238c5bfa
...
@@ -185,11 +185,36 @@ static const char *get_ha_error_msg(int code)
...
@@ -185,11 +185,36 @@ static const char *get_ha_error_msg(int code)
}
}
#if defined(__WIN__)
static
my_bool
print_win_error_msg
(
DWORD
error
,
my_bool
verbose
)
{
LPTSTR
s
;
if
(
FormatMessage
(
FORMAT_MESSAGE_ALLOCATE_BUFFER
|
FORMAT_MESSAGE_FROM_SYSTEM
,
NULL
,
error
,
0
,
(
LPTSTR
)
&
s
,
0
,
NULL
))
{
if
(
verbose
)
printf
(
"Win32 error code %d: %s"
,
error
,
s
);
else
puts
(
s
);
LocalFree
(
s
);
return
0
;
}
return
1
;
}
#endif
int
main
(
int
argc
,
char
*
argv
[])
int
main
(
int
argc
,
char
*
argv
[])
{
{
int
error
,
code
,
found
;
int
error
,
code
,
found
;
const
char
*
msg
;
const
char
*
msg
;
char
*
unknown_error
=
0
;
char
*
unknown_error
=
0
;
#if defined(__WIN__)
my_bool
skip_win_message
=
0
;
#endif
MY_INIT
(
argv
[
0
]);
MY_INIT
(
argv
[
0
]);
if
(
get_options
(
&
argc
,
&
argv
))
if
(
get_options
(
&
argc
,
&
argv
))
...
@@ -286,8 +311,15 @@ int main(int argc,char *argv[])
...
@@ -286,8 +311,15 @@ int main(int argc,char *argv[])
/* Error message still not found, look in handler error codes */
/* Error message still not found, look in handler error codes */
if
(
!
(
msg
=
get_ha_error_msg
(
code
)))
if
(
!
(
msg
=
get_ha_error_msg
(
code
)))
{
{
#if defined(__WIN__)
if
(
!
(
skip_win_message
=
!
print_win_error_msg
((
DWORD
)
code
,
verbose
)))
{
#endif
fprintf
(
stderr
,
"Illegal error code: %d
\n
"
,
code
);
fprintf
(
stderr
,
"Illegal error code: %d
\n
"
,
code
);
error
=
1
;
error
=
1
;
#if defined(__WIN__)
}
#endif
}
}
else
else
{
{
...
@@ -298,6 +330,10 @@ int main(int argc,char *argv[])
...
@@ -298,6 +330,10 @@ int main(int argc,char *argv[])
puts
(
msg
);
puts
(
msg
);
}
}
}
}
#if defined(__WIN__)
if
(
!
skip_win_message
)
print_win_error_msg
((
DWORD
)
code
,
verbose
);
#endif
}
}
}
}
...
...
mysql-test/r/perror-win.result
0 → 100644
View file @
238c5bfa
MySQL error code 150: Foreign key constraint is incorrectly formed
Win32 error code 150: System trace information was not specified in your CONFIG.SYS file, or tracing is disallowed.
OS error code 23: Too many open files in system
Win32 error code 23: Data error (cyclic redundancy check).
Win32 error code 15000: The specified channel path is invalid.
mysql-test/t/perror-win.test
0 → 100644
View file @
238c5bfa
# Windows-specific tests
--
source
include
/
windows
.
inc
--
require
r
/
have_perror
.
require
disable_query_log
;
eval
select
LENGTH
(
"
$MY_PERROR
"
)
>
0
as
"have_perror"
;
enable_query_log
;
--
exec
$MY_PERROR
150
--
exec
$MY_PERROR
23
--
exec
$MY_PERROR
15000
sql/field.cc
View file @
238c5bfa
...
@@ -5372,6 +5372,7 @@ int Field_newdate::store_time(MYSQL_TIME *ltime, timestamp_type time_type)
...
@@ -5372,6 +5372,7 @@ int Field_newdate::store_time(MYSQL_TIME *ltime, timestamp_type time_type)
{
{
char
buff
[
MAX_DATE_STRING_REP_LENGTH
];
char
buff
[
MAX_DATE_STRING_REP_LENGTH
];
String
str
(
buff
,
sizeof
(
buff
),
&
my_charset_latin1
);
String
str
(
buff
,
sizeof
(
buff
),
&
my_charset_latin1
);
tmp
=
0
;
make_date
((
DATE_TIME_FORMAT
*
)
0
,
ltime
,
&
str
);
make_date
((
DATE_TIME_FORMAT
*
)
0
,
ltime
,
&
str
);
set_datetime_warning
(
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
WARN_DATA_TRUNCATED
,
set_datetime_warning
(
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
WARN_DATA_TRUNCATED
,
str
.
ptr
(),
str
.
length
(),
MYSQL_TIMESTAMP_DATE
,
1
);
str
.
ptr
(),
str
.
length
(),
MYSQL_TIMESTAMP_DATE
,
1
);
...
@@ -5608,6 +5609,7 @@ int Field_datetime::store_time(MYSQL_TIME *ltime,timestamp_type time_type)
...
@@ -5608,6 +5609,7 @@ int Field_datetime::store_time(MYSQL_TIME *ltime,timestamp_type time_type)
{
{
char
buff
[
MAX_DATE_STRING_REP_LENGTH
];
char
buff
[
MAX_DATE_STRING_REP_LENGTH
];
String
str
(
buff
,
sizeof
(
buff
),
&
my_charset_latin1
);
String
str
(
buff
,
sizeof
(
buff
),
&
my_charset_latin1
);
tmp
=
0
;
make_datetime
((
DATE_TIME_FORMAT
*
)
0
,
ltime
,
&
str
);
make_datetime
((
DATE_TIME_FORMAT
*
)
0
,
ltime
,
&
str
);
set_datetime_warning
(
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
WARN_DATA_TRUNCATED
,
set_datetime_warning
(
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
WARN_DATA_TRUNCATED
,
str
.
ptr
(),
str
.
length
(),
MYSQL_TIMESTAMP_DATETIME
,
1
);
str
.
ptr
(),
str
.
length
(),
MYSQL_TIMESTAMP_DATETIME
,
1
);
...
...
tests/mysql_client_test.c
View file @
238c5bfa
...
@@ -16218,7 +16218,87 @@ static void test_bug38486(void)
...
@@ -16218,7 +16218,87 @@ static void test_bug38486(void)
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
}
}
static
void
test_bug40365
(
void
)
{
uint
rc
,
i
,
count
=
1
;
MYSQL_STMT
*
stmt
=
0
;
MYSQL_BIND
my_bind
[
2
];
my_bool
is_null
[
2
]
=
{
0
};
MYSQL_TIME
tm
[
2
];
DBUG_ENTER
(
"test_bug40365"
);
rc
=
mysql_query
(
mysql
,
"DROP TABLE IF EXISTS t1"
);
myquery
(
rc
);
rc
=
mysql_query
(
mysql
,
"CREATE TABLE t1(c1 DATETIME, \
c2 DATE)"
);
myquery
(
rc
);
stmt
=
mysql_simple_prepare
(
mysql
,
"INSERT INTO t1 VALUES(?, ?)"
);
check_stmt
(
stmt
);
verify_param_count
(
stmt
,
2
);
bzero
((
char
*
)
my_bind
,
sizeof
(
my_bind
));
my_bind
[
0
].
buffer_type
=
MYSQL_TYPE_DATETIME
;
my_bind
[
1
].
buffer_type
=
MYSQL_TYPE_DATE
;
for
(
i
=
0
;
i
<
(
int
)
array_elements
(
my_bind
);
i
++
)
{
my_bind
[
i
].
buffer
=
(
void
*
)
&
tm
[
i
];
my_bind
[
i
].
is_null
=
&
is_null
[
i
];
}
rc
=
mysql_stmt_bind_param
(
stmt
,
my_bind
);
check_execute
(
stmt
,
rc
);
for
(
i
=
0
;
i
<
(
int
)
array_elements
(
my_bind
);
i
++
)
{
tm
[
i
].
neg
=
0
;
tm
[
i
].
second_part
=
0
;
tm
[
i
].
year
=
2009
;
tm
[
i
].
month
=
2
;
tm
[
i
].
day
=
29
;
tm
[
i
].
hour
=
0
;
tm
[
i
].
minute
=
0
;
tm
[
i
].
second
=
0
;
}
rc
=
mysql_stmt_execute
(
stmt
);
check_execute
(
stmt
,
rc
);
rc
=
mysql_commit
(
mysql
);
myquery
(
rc
);
mysql_stmt_close
(
stmt
);
stmt
=
mysql_simple_prepare
(
mysql
,
"SELECT * FROM t1"
);
check_stmt
(
stmt
);
rc
=
mysql_stmt_bind_result
(
stmt
,
my_bind
);
check_execute
(
stmt
,
rc
);
rc
=
mysql_stmt_execute
(
stmt
);
check_execute
(
stmt
,
rc
);
rc
=
mysql_stmt_store_result
(
stmt
);
check_execute
(
stmt
,
rc
);
rc
=
mysql_stmt_fetch
(
stmt
);
check_execute
(
stmt
,
rc
);
if
(
!
opt_silent
)
fprintf
(
stdout
,
"
\n
"
);
for
(
i
=
0
;
i
<
array_elements
(
my_bind
);
i
++
)
{
if
(
!
opt_silent
)
fprintf
(
stdout
,
"
\n
time[%d]: %02d-%02d-%02d "
,
i
,
tm
[
i
].
year
,
tm
[
i
].
month
,
tm
[
i
].
day
);
DIE_UNLESS
(
tm
[
i
].
year
==
0
);
DIE_UNLESS
(
tm
[
i
].
month
==
0
);
DIE_UNLESS
(
tm
[
i
].
day
==
0
);
}
mysql_stmt_close
(
stmt
);
DBUG_VOID_RETURN
;
}
/*
/*
Read and parse arguments and MySQL options from my.cnf
Read and parse arguments and MySQL options from my.cnf
*/
*/
...
@@ -16514,6 +16594,7 @@ static struct my_tests_st my_tests[]= {
...
@@ -16514,6 +16594,7 @@ static struct my_tests_st my_tests[]= {
{
"test_bug31669"
,
test_bug31669
},
{
"test_bug31669"
,
test_bug31669
},
{
"test_bug32265"
,
test_bug32265
},
{
"test_bug32265"
,
test_bug32265
},
{
"test_bug38486"
,
test_bug38486
},
{
"test_bug38486"
,
test_bug38486
},
{
"test_bug40365"
,
test_bug40365
},
{
0
,
0
}
{
0
,
0
}
};
};
...
...
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