Commit graph

424 commits

Author SHA1 Message Date
Georgi Kodinov
72ae1d65dd merge to 5.1. 2011-02-02 19:05:28 +02:00
Georgi Kodinov
a70c34bf0f Fixes for Bug #55755 and Bug #52315 part 2
Bug #55755 : Date STD variable signness breaks server on FreeBSD and OpenBSD

* Added a check to configure on the size of time_t
* Created a macro to check for a valid time_t that is safe to use with datetime 
  functions and store in TIMESTAMP columns.
* Used the macro consistently instead of the ad-hoc checks introduced by 52315
* Fixed compliation warnings on platforms where the size of time_t is smaller than
  the size of a long (e.g. OpenBSD 4.8 64 amd64).

Bug #52315: utc_date() crashes when system time > year 2037

* Added a correct check for the timestamp range instead of just variable size check to
SET TIMESTAMP.
* Added overflow checking before converting to time_t. 
* Using a correct localized error message in this case instead of the generic error.
* Added a test suite.
* fixed the checks so that they check for unsigned time_t as well. Used the checks 
  consistently across the source code.
* fixed the original test case to expect the new error code.
2011-02-02 18:51:35 +02:00
Davi Arnaut
11fae04527 Bug#45288: pb2 returns a lot of compilation warnings on linux
Although the C standard mandates that sprintf return the number
of bytes written, some very ancient systems (i.e. SunOS 4)
returned a pointer to the buffer instead. Since these systems
are not supported anymore and are hopefully long dead by now,
simply remove the portability wrapper that dealt with this
discrepancy. The autoconf check was causing trouble with GCC.
2010-07-09 09:00:17 -03:00
Jim Winstead
6170e64f67 Using an initial command with mysql_options(..., MYSQL_INIT_COMMAND, ...)
that generated multiple result sets (such as a stored procedure or a
multi-statement command) would leave the connection unusable. (Bug #42373)

A side-effect of this bug fix is to make MYSQL_INIT_COMMAND settings ignored
when connecting from within the server, but none of the existing mechanisms
for connecting from within the server use or need to set the initial command.
2010-05-09 20:02:05 -07:00
Vladislav Vaintroub
e080080711 Bug#47571: idle named pipe connection is unkillable
Bug#31621: Windows server hanging during shutdown using named pipes 
           and idle connection
            
Problem: when idle pipe connection is forcefully closed with KILL
statement or when the server goes down, thread that is closing connection
would hang infinitely in CloseHandle(). The reason for the hang is that 
named pipe operations are performed synchronously. In this mode all IOs
on pipe are serialized, that is CloseHandle() will not abort ReadFile() 
in another thread, but wait for ReadFile() to complete.
            
The fix implements asynchrnous mode for named pipes, where operation of file
are not synchronized. Read/Write operation would fire an async IO and wait for
either IO completion or timeout.
            
Note, that with this patch timeouts are properly handled for named pipes.
      
Post-review: Win32 timeout code has been fixed for named pipes and shared
memory. We do not store pointer to NET in vio structure, only the read and 
write timeouts.


include/violite.h:
  Add pipe_overlapped to Vio structure for async IO for named pipes.
sql-common/client.c:
  Use asynchronous pipe IO.
sql/mysqld.cc:
  Use asynchronous pipe IO.
vio/vio.c:
  -Refactor timeouts for win32 protocols: shared memory and named pipes.
  Store read/write timeout in VIO structure, instead of storing pointer
  to NET. New function vio_win32_timeout called indirectly via 
  vio_timeout changes these values.
vio/vio_priv.h:
  Remove vio_ignore_timeout.
  Add vio_win32_timeout to be used for named pipes and shared memory.
vio/viosocket.c:
  Use async IO for named pipes.
  After issuing IO, wait for either IO completion, pipe_close_event
  or timeout.
          
  Refactor timeouts for named pipe and shared memory.
2009-11-02 23:19:58 +01:00
Staale Smedseng
d6ca0cbb23 Merge from 5.0 2009-09-17 17:25:52 +02:00
Staale Smedseng
e5888b16af Bug #43414 Parenthesis (and other) warnings compiling MySQL
with gcc 4.3.2
      
This is the fifth patch cleaning up more GCC warnings about
variables used before initialized using the new macro
UNINIT_VAR().
2009-09-17 17:10:30 +02:00
Mattias Jonsson
82a5cfa5ab Post fix patch for bug#20577 and bug#46362.
On 64-bits machines the calculation gets the wrong types and results
in very large numbers. Fixed by explicitly cast month to (int)
2009-09-01 13:04:56 +02:00
Tatiana A. Nurnberg
cf69196922 manual merge 2009-08-31 12:40:33 -07:00
Tatiana A. Nurnberg
d85148d84c Bug#35132: MySQLadmin --wait ping always crashes on Windows systems
Failing to connect would release parts of the MYSQL struct.
We would then proceed to try again to connect without re-
initializing the struct.

We prevent the unwanted freeing of data we'll still need now.


client/mysqladmin.cc:
  Losing a connection (or not even getting on in the first place) should
  not trash the MYSQL-struct.
  
  Add a lot of comments.
  
  Rewrite re-connection fu.
sql-common/client.c:
  Assert against bad parameters usually caused by de-initing a
  MYSQL-struct without re-initing it again before re-use.
2009-08-31 10:01:13 -07:00
Staale Smedseng
5be4c38226 Merge from 5.0 for 43414 2009-08-28 18:21:54 +02:00
Staale Smedseng
1ba25ae47c Bug #43414 Parenthesis (and other) warnings compiling MySQL
with gcc 4.3.2
      
This patch fixes a number of GCC warnings about variables used
before initialized. A new macro UNINIT_VAR() is introduced for
use in the variable declaration, and LINT_INIT() usage will be
gradually deprecated. (A workaround is used for g++, pending a
patch for a g++ bug.)
      
GCC warnings for unused results (attribute warn_unused_result)
for a number of system calls (present at least in later
Ubuntus, where the usual void cast trick doesn't work) are
also fixed.


client/mysqlmanager-pwgen.c:
  A fix for warn_unused_result, adding fallback to use of
  srand()/rand() if /dev/random cannot be used. Also actually
  adds calls to rand() in the second branch so that it actually
  creates a random password.
2009-08-28 17:51:31 +02:00
Mattias Jonsson
0a76397171 Manual merge between bug#46362 and bug#20577.
sql/opt_range.cc:
  Removed duplicate code (if statement must have been duplicated during earlier merge).
sql/sql_partition.cc:
  After mergeing bug#46362 and bug#20577, the NULL partition was also searched
  when col = const, fixed by checking if = or range.
2009-08-28 12:55:59 +02:00
Mattias Jonsson
4655118bea Bug#46362: Endpoint should be set to false for TO_DAYS(DATE)
There were a problem since pruning uses the field
for comparison (while evaluate_join_record uses longlong),
resulting in pruning failures when comparing DATE to DATETIME.

Fix was to always comparing DATE vs DATETIME as DATETIME,
by adding ' 00:00:00' to the DATE string.

And adding optimization for comparing with 23:59:59, so that
DATETIME_col > '2001-02-03 23:59:59' ->
TO_DAYS(DATETIME_col) > TO_DAYS('2001-02-03 23:59:59') instead
of '>='.

mysql-test/r/partition_pruning.result:
  Bug#46362: Endpoint should be set to false for TO_DAYS(DATE)
  
  Updated result-file
mysql-test/t/partition_pruning.test:
  Bug#46362: Endpoint should be set to false for TO_DAYS(DATE)
  
  Added testcases.
sql-common/my_time.c:
  Bug#46362: Endpoint should be set to false for TO_DAYS(DATE)
  
  removed duplicate assignment.
sql/item.cc:
  Bug#46362: Endpoint should be set to false for TO_DAYS(DATE)
  
  Changed field_is_equal_to_item into field_cmp_to_item, to
  better handling DATE vs DATETIME comparision.
sql/item.h:
  Bug#46362: Endpoint should be set to false for TO_DAYS(DATE)
  
  Updated comment
sql/item_timefunc.cc:
  Bug#46362: Endpoint should be set to false for TO_DAYS(DATE)
  
  Added optimization (pruning) of DATETIME where time-part is
  23:59:59
sql/opt_range.cc:
  Bug#46362: Endpoint should be set to false for TO_DAYS(DATE)
  
  Using the new stored_field_cmp_to_item for better pruning.
2009-08-26 12:51:23 +02:00
Davi Arnaut
050c36c7de Bug#46013: rpl_extraColmaster_myisam fails on pb2
Bug#45243: crash on win in sql thread clear_tables_to_lock() -> free()
Bug#45242: crash on win in mysql_close() -> free()
Bug#45238: rpl_slave_skip, rpl_change_master failed (lost connection) for STOP SLAVE
Bug#46030: rpl_truncate_3innodb causes server crash on windows
Bug#46014: rpl_stm_reset_slave crashes the server sporadically in pb2

When killing a user session on the server, it's necessary to
interrupt (notify) the thread associated with the session that
the connection is being killed so that the thread is woken up
if waiting for I/O. On a few platforms (Mac, Windows and HP-UX)
where the SIGNAL_WITH_VIO_CLOSE flag is defined, this interruption
procedure is to asynchronously close the underlying socket of
the connection.

In order to enable this schema, each connection serving thread
registers its VIO (I/O interface) so that other threads can
access it and close the connection. But only the owner thread of
the VIO might delete it as to guarantee that other threads won't
see freed memory (the thread unregisters the VIO before deleting
it). A side note: closing the socket introduces a harmless race
that might cause a thread attempt to read from a closed socket,
but this is deemed acceptable.

The problem is that this infrastructure was meant to only be used
by server threads, but the slave I/O thread was registering the
VIO of a mysql handle (a client API structure that represents a
connection to another server instance) as a active connection of
the thread. But under some circumstances such as network failures,
the client API might destroy the VIO associated with a handle at
will, yet the VIO wouldn't be properly unregistered. This could
lead to accesses to freed data if a thread attempted to kill a
slave I/O thread whose connection was already broken.

There was a attempt to work around this by checking whether
the socket was being interrupted, but this hack didn't work as
intended due to the aforementioned race -- attempting to read
from the socket would yield a "bad file descriptor" error.

The solution is to add a hook to the client API that is called
from the client code before the VIO of a handle is deleted.
This hook allows the slave I/O thread to detach the active vio
so it does not point to freed memory.

server-tools/instance-manager/mysql_connection.cc:
  Add stub method required for linking.
sql-common/client.c:
  Invoke hook.
sql/client_settings.h:
  Export hook.
sql/slave.cc:
  Introduce hook that clears the active VIO before it is freed
  by the client API.
2009-08-13 17:07:20 -03:00
Davi Arnaut
543e86728f Bug#45017: Failure to connect if hostname maps to multiple addresses
The problem is that the C API function mysql_real_connect
only attempts to connect to the first IP address returned
for a hostname. This can be a problem if a hostname maps
to multiple IP address and the server is not bound to the
first one that is returned.

The solution is to augment mysql_real_connect so that it
attempts to connect to all IPv4 addresses that a domain
name maps to. The function goes over the list of address
until a successful connection is established.

No test case is provided as its not possible to test this
automatically with the current testing infrastructure.

sql-common/client.c:
  The client will try to connect to each IPv4 address from
  the list of addresses that hostname maps to until a successful
  connection is established or there are no more address.
2009-07-30 21:28:43 -03:00
Davi Arnaut
1c2556ff46 Merge from mysql-5.0-bugteam. 2009-08-13 17:45:01 -03:00
Davi Arnaut
eac6619ff0 Merge from mysql-5.0-bugteam. 2009-06-10 11:05:07 -03:00
Davi Arnaut
afacea4d60 Bug#41190: shared memory connections do not work in Vista, if server started from cmdline
Backport to MySQL 5.0/1 fix by Vladislav Vaintroub:

In Vista and later and also in when using terminal services, when
server is started from  command line, client cannot connect to it
via shared memory protocol.

This is a regression introduced when  Bug#24731 was fixed.  The
reason is that client is trying to attach to shared memory using
global kernel object  namespace (all kernel objects are prefixed
with Global\). However, server started from the command line in
Vista and later will create shared memory and events using current
session namespace. Thus, client is unable to find the server and
connection fails.

The fix for the client is to first try to find server using "local"
names  (omitting Global\  prefix) and only if server is not found,
trying global namespace.
2009-06-10 10:59:59 -03:00
Staale Smedseng
aede9b7d13 Adding missing forward declaration for bug 43560 2009-05-20 19:34:37 +02:00
Staale Smedseng
059dba14b7 Recommit of bug 43560 after merge with mysql-5.1-bugteam 2009-05-20 16:17:47 +02:00
Ignacio Galarza
1aefa8029f auto-merge 2009-03-19 09:42:36 -04:00
Ignacio Galarza
0d588edf61 auto-merge 2009-03-17 16:29:24 -04:00
Alexey Kopytov
f7cf8e57c1 Fix for bug #40552: Race condition around default_directories
in load_defaults() 

load_defaults(), my_search_option_files() and 
my_print_default_files()  utilized a global variable 
containing  a pointer to thread local memory. This could lead 
to race conditions when those functions were called with high 
concurrency. 

Fixed by changing the interface of the said functions to avoid 
the necessity for using a global variable.

Since we cannot change load_defaults() prototype for API
compatibility reasons, it was renamed my_load_defaults().
Now load_defaults() is a thread-unsafe wrapper around
a thread-safe version, my_load_defaults().


mysys/default.c:
  1. Added a thread-safe version of load_defaults(), changed
  load_defaults() with the old interface to be a thread-unsafe
  wrapper around the thread-safe version.
  2. Always use a private MEM_ROOT in my_print_default_files, 
  don't use a global variable.
sql-common/client.c:
  Use a thread-safe version of load_defaults().
2009-02-27 11:26:06 +02:00
Tatiana A. Nurnberg
694323952a Bug#42146 - DATETIME fractional seconds parse error
Bug#38435 - LONG Microseconds cause MySQL to fail a CAST to DATETIME or DATE

Parsing of optional microsecond part in datetime did not
fail gracefully when field width was larger than the allowed
six places.

Now handles up to the correct six places, and disregards
any extra digits without messing up what we've already got.

mysql-test/r/type_datetime.result:
  show graceful handling of overly long microsecond parts
  (correct truncation).
mysql-test/t/type_datetime.test:
  show graceful handling of overly long microsecond parts
  (correct truncation).
sql-common/my_time.c:
  Special case for time-parsing: for microsecond part,
  leading zeroes are actually meaningful! Also, don't
  break the entire date on more than the allowed six
  digits in microsecond part, just truncate the extra
  digits.
2009-02-13 19:07:03 +01:00
Ignacio Galarza
5b7347bda3 Bug#29125 Windows Server X64: so many compiler warnings
- Remove bothersome warning messages.  This change focuses on the warnings 
that are covered by the ignore file: support-files/compiler_warnings.supp.
- Strings are guaranteed to be max uint in length
2009-02-13 11:41:47 -05:00
Ignacio Galarza
54fbbf9591 Bug#29125 Windows Server X64: so many compiler warnings
- Remove bothersome warning messages.  This change focuses on the warnings 
that are covered by the ignore file: support-files/compiler_warnings.supp.
- Strings are guaranteed to be max uint in length
2009-02-10 17:47:54 -05:00
Tatiana A. Nurnberg
d3c4a5cb10 auto-merge 2009-01-09 14:22:15 +01:00
Tatiana A. Nurnberg
c42892d614 Bug#41470: DATE_FORMAT() crashes the complete server with a valid date
Passing dubious "year zero" in non-zero date (not "0000-00-00") could
lead to negative value for year internally, while variable was unsigned.
This led to Really Bad Things further down the line.

Now doing calculations with signed type for year internally.

mysql-test/r/date_formats.result:
  show that very early dates no longer break DATE_FORMAT(..., '%W')
mysql-test/t/date_formats.test:
  show that very early dates no longer break DATE_FORMAT(..., '%W')
sql-common/my_time.c:
  Allow negative years numbers internally while keeping the interface.
  otherwise if somebody passes year zero for whatever reason, we'll
  get an integer wrap-around that can lead to Really Bad Things further
  down the line. Note that amusingly, calcday_nr() already had signed
  output and calc_weekday() already had signed input, anyway.
2009-01-08 10:25:31 +01:00
unknown
fe6e1fc716 Merge zippy.cornsilk.net:/home/cmiller/work/mysql/bug26294/my51-bug26294
into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.1-build


sql/tztime.cc:
  Auto merged
2008-04-03 13:21:02 -04:00
unknown
b36b860edf Merge zippy.cornsilk.net:/home/cmiller/work/mysql/bug26294/my50-bug26294
into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-build


sql/tztime.cc:
  Auto merged
2008-04-03 13:19:55 -04:00
unknown
add10a4849 Merge zippy.cornsilk.net:/home/cmiller/work/mysql/bug26294/my50-bug26294
into  zippy.cornsilk.net:/home/cmiller/work/mysql/bug26294/my51-bug26294


client/mysqlbinlog.cc:
  Auto merged
include/my_time.h:
  Auto merged
sql-common/my_time.c:
  Auto merged
sql/init.cc:
  Auto merged
sql/tztime.cc:
  Auto merged
2008-04-03 13:14:57 -04:00
unknown
90112d1175 Bug#26294: library name conflict between MySQL 4.x, 5.0 and Qt 3.3
When linking with some external programs, "multiple definition 
of `init_time'"

Rename init_time() to my_init_time() to avoid collision with other
libraries (particularly libmng).


client/mysqlbinlog.cc:
  Rename init_time() to my_init_time().
include/my_time.h:
  Rename init_time() to my_init_time().
sql-common/my_time.c:
  Rename init_time() to my_init_time().
sql/init.cc:
  Rename init_time() to my_init_time().
sql/tztime.cc:
  Rename init_time() to my_init_time().
2008-04-03 11:32:00 -04:00
unknown
18a01ce924 fixed warnings and compile errors from the fix for bug 26243 2008-03-29 09:52:16 +02:00
unknown
f77686df0d Merge quad.opbmk:/mnt/raid/alik/MySQL/devel/5.0
into  quad.opbmk:/mnt/raid/alik/MySQL/devel/5.0-rt-merged


libmysql/libmysql.c:
  Auto merged
sql-common/client.c:
  Auto merged
tests/mysql_client_test.c:
  Manually merged.
2008-03-18 13:53:51 +03:00
unknown
07db330a55 Merge quad.opbmk:/mnt/raid/alik/MySQL/devel/5.1
into  quad.opbmk:/mnt/raid/alik/MySQL/devel/5.1-rt-merged


libmysql/libmysql.c:
  Auto merged
sql-common/client.c:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/mysqld.cc:
  Auto merged
tests/mysql_client_test.c:
  Auto merged
2008-03-18 13:51:17 +03:00
unknown
ce34828e07 Merge buzz.(none):/home/davi/mysql-5.0-runtime
into  buzz.(none):/home/davi/mysql-5.1-runtime


sql-common/client.c:
  Auto merged
sql/sql_prepare.cc:
  Manual merge
tests/mysql_client_test.c:
  Manual merge
libmysql/libmysql.c:
  Manual merge
2008-03-17 16:13:59 -03:00
unknown
063b504772 Bug#35103 mysql_client_test::test_bug29948 causes sporadic failures
The problem was that the COM_STMT_SEND_LONG_DATA was sending a response
packet if the prepared statement wasn't found in the server (due to
reconnection). The commands COM_STMT_SEND_LONG_DATA and COM_STMT_CLOSE
should not send any packets, even error packets should not be sent since
they are not expected by the client API.

The solution is to clear generated during the execution of the aforementioned
commands and to skip resend of prepared statement commands. Another fix is
that if the connection breaks during the send of prepared statement command,
the command is not sent again since the prepared statement is no longer in the
server.


libmysql/libmysql.c:
  The mysql handle might be reset after a reconnection.
  Pass the now used stmt argument to cli_advanced_command.
sql-common/client.c:
  Don't resend command if the connection broke and it's a prepared
  statement command. If the session is broken, prepared statements
  on the server are gone, set the error accordanly.
sql/sql_prepare.cc:
  Clear any error set during the execution of the request
  command.
tests/mysql_client_test.c:
  Fix memory leak by freeing result associated with statement.
  Remove test case for Bug 29948 because it's not reliable in
  5.0 (fixed in 5.1) due to KILL queries sending two packets for
  a thread that kills itself.
2008-03-14 17:40:12 -03:00
unknown
2ebee313b5 A fix for Bug#35289: Too many connections -- wrong SQL state
in some case.

ER_CON_COUNT_ERROR is defined with SQL state 08004. However, this SQL state is not always
returned.

This error can be thrown in two cases:

  1. when an ordinary user (a user w/o SUPER privilege) is connecting,
    and the number of active user connections is equal or greater than
    max_connections.

  2. when a user is connecting and the number of active user connections is
    already (max_connections + 1) -- that means that no more connections will
    be accepted regardless of the user credentials.

In the 1-st case, SQL state is correct.

The bug happens in the 2-nd case -- on UNIX the client gets 00000 SQL state, which is
absolutely wrong (00000 means "not error SQL state); on Windows
the client accidentally gets HY000 (which means "unknown SQL state).

The cause of the problem is that the server rejects extra connection
prior to read a packet with client capabilities. Thus, the server
does not know if the client supports SQL states or not (if the client
supports 4.1 protocol or not). So, the server supposes the worst and
does not send SQL state at all.

The difference in behavior on UNIX and Windows occurs because on Windows
CLI_MYSQL_REAL_CONNECT() invokes create_shared_memory(), which returns
an error (in default configuration, where shared memory is not configured).
Then, the client does not reset this error, so when the connection is
rejected, SQL state is HY000 (from the error from create_shared_memory()).

The bug appeared after test case for Bug#33507 -- before that, this behavior
just had not been tested.

The fix is to 1) reset the error after create_shared_memory();
2) set SQL state to 'unknown error' if it was not received from
the server.

A separate test case is not required, since the behavior is already
tested in connect.test.

Note for doc-team: the manual should be updated to say that under
some circumstances, 'Too many connections' has HY000 SQL state.


mysql-test/r/connect.result:
  Update result file.
sql-common/client.c:
  1. Reset an error from create_shared_memory();
  2. Set SQL state to 'unknown error' if it was not received from
     the server.
2008-03-14 15:58:27 +03:00
unknown
d6df18dd33 Merge kaamos.(none):/data/src/mysql-5.1
into  kaamos.(none):/data/src/opt/mysql-5.1-opt


client/mysql.cc:
  Auto merged
client/mysqldump.c:
  Auto merged
configure.in:
  Auto merged
include/my_global.h:
  Auto merged
libmysql/libmysql.c:
  Auto merged
libmysqld/lib_sql.cc:
  Auto merged
mysql-test/include/mix1.inc:
  Auto merged
mysql-test/r/create.result:
  Auto merged
mysql-test/r/func_str.result:
  Auto merged
mysql-test/r/innodb.result:
  Auto merged
mysql-test/r/innodb_mysql.result:
  Auto merged
mysql-test/r/select.result:
  Auto merged
mysql-test/r/subselect.result:
  Auto merged
mysql-test/t/create.test:
  Auto merged
mysql-test/t/disabled.def:
  Auto merged
sql/filesort.cc:
  Auto merged
sql/handler.cc:
  Auto merged
sql/item.cc:
  Auto merged
sql/item.h:
  Auto merged
sql/item_cmpfunc.cc:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/item_func.h:
  Auto merged
sql/item_sum.cc:
  Auto merged
sql/log.cc:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/mysqld.cc:
  Auto merged
sql/set_var.cc:
  Auto merged
sql/sp.cc:
  Auto merged
sql/sql_acl.cc:
  Auto merged
sql/sql_base.cc:
  Auto merged
sql/sql_insert.cc:
  Auto merged
sql/sql_plugin.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
storage/ndb/src/kernel/blocks/backup/Backup.hpp:
  Auto merged
tests/mysql_client_test.c:
  Auto merged
mysql-test/r/func_time.result:
  Manual merge.
mysql-test/r/view.result:
  Manual merge.
mysql-test/t/view.test:
  Manual merge.
scripts/mysql_config.sh:
  Manual merge.
sql-common/client.c:
  Manual merge.
sql/sql_parse.cc:
  Manual merge.
2008-03-12 11:19:46 +03:00
unknown
33a4e76090 Bug#34655 Compile error
Rename client_last_error to last_error and client_last_errno to last_errno
to not break connectors which use the internal net structure for error handling.


include/mysql_com.h:
  Rename client_last_error to last_error, client_last_errno to last_errno.
include/mysql_h.ic:
  Rename client_last_error to last_error, client_last_errno to last_errno.
libmysql/libmysql.c:
  Rename client_last_error to last_error, client_last_errno to last_errno.
libmysql/manager.c:
  Rename client_last_error to last_error, client_last_errno to last_errno.
libmysqld/lib_sql.cc:
  Rename client_last_error to last_error, client_last_errno to last_errno.
libmysqld/libmysqld.c:
  Rename client_last_error to last_error, client_last_errno to last_errno.
server-tools/instance-manager/mysql_connection.cc:
  Rename client_last_error to last_error, client_last_errno to last_errno.
sql/log_event.cc:
  Rename client_last_error to last_error, client_last_errno to last_errno.
sql-common/client.c:
  Rename client_last_error to last_error, client_last_errno to last_errno.
sql/log_event_old.cc:
  Rename client_last_error to last_error, client_last_errno to last_errno.
sql/net_serv.cc:
  Rename client_last_error to last_error, client_last_errno to last_errno.
sql/repl_failsafe.cc:
  Rename client_last_error to last_error, client_last_errno to last_errno.
2008-02-28 14:55:46 -03:00
unknown
68b21ebb83 Merge bk@192.168.21.1:mysql-5.1-opt
into  mysql.com:/home/hf/work/25097/my51-25097


libmysql/libmysql.c:
  Auto merged
libmysqld/lib_sql.cc:
  Auto merged
sql-common/client.c:
  Auto merged
sql/log.cc:
  Auto merged
2008-02-27 13:54:34 +04:00
unknown
33c4301922 Merge mysql.com:/home/hf/work/25097/my50-25097
into  mysql.com:/home/hf/work/25097/my51-25097


client/mysql.cc:
  Auto merged
include/sql_common.h:
  Auto merged
libmysql/libmysql.c:
  Auto merged
libmysqld/lib_sql.cc:
  Auto merged
sql-common/client.c:
  merging
sql/log.cc:
  merging
2008-02-27 13:00:59 +04:00
unknown
a4b0a2cf67 Bug #25097 mysql_server_init fails silently if no errmsg.sys is present.
There was no way to return an error from the client library
if no MYSQL connections was established.
So here i added variables to store that king of errors and
made functions like mysql_error(NULL) to return these.


client/mysql.cc:
  Bug #25097 mysql_server_init fails silently if no errmsg.sys is present.
  
  Show the error message on std_error
include/sql_common.h:
  Bug #25097 mysql_server_init fails silently if no errmsg.sys is present.
  
  cant_connect_sqlstate constant declared
libmysql/libmysql.c:
  Bug #25097 mysql_server_init fails silently if no errmsg.sys is present.
  
  mysql_sqlstate(NULL) returns 'unknown_sqlstate'
libmysqld/lib_sql.cc:
  Bug #25097 mysql_server_init fails silently if no errmsg.sys is present.
  
  EMBEDDED_SERVER version of the vprint_msg_to_log() implemented
sql-common/client.c:
  Bug #25097 mysql_server_init fails silently if no errmsg.sys is present.
  
  mysql_server_last_errno and mysql_server_last_error introduced
  to store errors not related to particular connections.
  
  mysql_error(NULL) and mysql_errno(NULL) now returns these
  mysql_server_last_error and errno respectively
sql/log.cc:
  Bug #25097 mysql_server_init fails silently if no errmsg.sys is present.
  
  EMBEDDED_LIBRARY implementation of the vprint_msg_to_log() moved
  to lib_sql.cc
2008-02-27 12:42:43 +04:00
unknown
233143fd31 Fix for Bug#29605
--local-infile=0 checks can be bypassed by sending a FETCH LOCAL FILE response
  
Add a check for CLIENT_LOCAL_FILES before sending a local file.
Beware, that all binary distributions enable sending of local files and it's up
to the programs which use libmysql to disable it, if they don't use this functionality.
Otherwise they are not safe.


client/mysqltest.c:
  Enable LOAD DATA LOCAL INFILE for the test suite, like some rpl and ndb test.
sql-common/client.c:
  Check if the client has LOAD DATA LOCAL INFILE disabled and
  don't serve such requests from the server. This is not 100% proof,
  as if the client has this enabled, in all binary builds for BC,
  the check won't work and the client can be tricked into sending a
  local file.
tests/mysql_client_test.c:
  Switch on LOCAL INFILE in client test. If one day there
  is a test which uses it, then it will work out of the box.
2008-02-22 18:45:45 +01:00
unknown
81ac684b06 Merge bk-internal.mysql.com:/home/bk/mysql-5.1
into  dipika.(none):/opt/local/work/mysql-5.1-runtime


include/my_sys.h:
  Auto merged
mysql-test/mysql-test-run.pl:
  Auto merged
mysql-test/suite/binlog/r/binlog_row_binlog.result:
  Auto merged
sql/item_cmpfunc.cc:
  Auto merged
sql/log.cc:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/mysqld.cc:
  Auto merged
sql/set_var.cc:
  Auto merged
sql/set_var.h:
  Auto merged
sql/sql_acl.cc:
  Auto merged
sql-common/client.c:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_view.cc:
  Auto merged
2008-02-08 18:55:07 +03:00
unknown
1b6b7010a6 Bug#32633 Can not create any routine if SQL_MODE=no_engine_substitution
The problem is that one can not create a stored routine if sql_mode
contains NO_ENGINE_SUBSTITUTION or PAD_CHAR_TO_FULL_LENGTH. Also when
a event is created, the mode is silently lost if sql_mode contains one
of the aforementioned.  This was happening because the table definitions
which stored sql_mode values weren't being updated to accept new values
of sql_mode.

The solution is to update, in a backwards compatible manner, the various
table definitions (columns) that store the sql_mode value to take into
account the new possible values. One incompatible change is that if a event
that is being created can't be stored to the mysql.event table, an error
will be raised.

The tests case also ensure that new SQL modes will be added to the mysql.proc
and mysql.event tables, otherwise the tests will fail.


mysql-test/r/events_bugs.result:
  Add test case result for Bug#32633
mysql-test/r/information_schema.result:
  Update the sql_mode column definition.
mysql-test/r/sp.result:
  Add test case result for Bug#32633
mysql-test/r/system_mysql_db.result:
  Update the sql_mode column definition.
mysql-test/t/events_bugs.test:
  Add test case for Bug#32633
mysql-test/t/sp.test:
  Add test case for Bug#32633
mysql-test/t/system_mysql_db_fix50117.test:
  Update the sql_mode column definition.
scripts/mysql_system_tables.sql:
  Update the sql_mode column definition.
scripts/mysql_system_tables_fix.sql:
  Update the sql_mode column definition.
sql/event_db_repository.cc:
  Reset and restore SQL modes when storing and loading a
  event from the data dictionary. Also throw out a error
  if a store fails.
sql/mysqld.cc:
  Add warning to avoid this problem in the future.
sql-common/my_user.c:
  Truncate length if user name or host name does not fit
  in the buffer.
sql/sp.cc:
  SQL mode of the thread must not effect data dictionary operations.
2008-02-07 08:47:39 -02:00
unknown
b395490480 Merge dl145h.mysql.com:/data0/mkindahl/mysql-5.1-rpl
into  dl145h.mysql.com:/data0/mkindahl/mysql-5.1-rpl-merge


BitKeeper/deleted/.del-show_binlog_events2.inc:
  Auto merged
sql-common/client.c:
  Auto merged
sql/item_cmpfunc.cc:
  Auto merged
sql/log_event.cc:
  Auto merged
sql/slave.cc:
  Auto merged
2008-01-30 16:14:14 +01:00
unknown
101c30ccc4 Post-merge changes.
BitKeeper/deleted/.del-show_binlog_events2.inc:
  Delete: mysql-test/include/show_binlog_events2.inc
client/mysqlbinlog.cc:
  char -> uchar for raw memory.
sql/item_cmpfunc.cc:
  Adding cast to remove warning when converting negative integer
  to unsigned type.
sql/log_event.cc:
  char -> uchar for raw memory.
sql/log_event.h:
  char -> uchar for raw memory.
sql/rpl_utility.cc:
  Adding cast to remove warning when converting negative integer
  to unsigned type.
sql/slave.cc:
  char -> uchar for raw memory.
sql/sql_repl.cc:
  char -> uchar for raw memory.
sql-common/client.c:
  char -> uchar for raw memory.
2008-01-30 16:03:00 +01:00
unknown
541ac20401 Merge station.:/mnt/raid/alik/MySQL/devel/5.1
into  station.:/mnt/raid/alik/MySQL/devel/5.1-rt


client/mysqltest.c:
  Auto merged
include/mysql_com.h:
  Auto merged
libmysqld/emb_qcache.cc:
  Auto merged
libmysqld/emb_qcache.h:
  Auto merged
libmysqld/lib_sql.cc:
  Auto merged
mysql-test/lib/mtr_report.pl:
  Auto merged
sql/ha_partition.cc:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/mysqld.cc:
  Auto merged
sql/opt_range.cc:
  Auto merged
sql/set_var.cc:
  Auto merged
sql/set_var.h:
  Auto merged
sql/slave.cc:
  Auto merged
sql/sql_class.cc:
  Auto merged
sql/sql_class.h:
  Auto merged
sql/sql_db.cc:
  Auto merged
sql/sql_insert.cc:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_partition.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
sql/sql_table.cc:
  Auto merged
sql/table.cc:
  Auto merged
storage/myisam/ha_myisam.cc:
  Auto merged
sql/protocol.cc:
  SCCS merged
2007-12-14 16:30:22 +03:00