Commit graph

811 commits

Author SHA1 Message Date
Staale Smedseng
2217de2513 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.
2009-08-28 17:51:31 +02:00
Ignacio Galarza
6df2af22ce Bug#17270 - mysql client tool could not find ../share/charsets folder and fails.
- Define and pass compile time path variables as pre-processor definitions to 
  mimic the makefile build.
- Set new CMake version and policy requirements explicitly.
- Changed DATADIR to MYSQL_DATADIR to avoid conflicting definition in 
  Platform SDK header ObjIdl.h which also defines DATADIR.
2009-07-31 15:22:02 -04:00
Ignacio Galarza
e82390130e auto-merge 2009-03-19 09:44:58 -04:00
Ignacio Galarza
2b85c64d65 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
Alexey Kopytov
30ac49019d Fix for bug #21205: Different number of digits for float/double/real in --ps-protocol
Various parts of code used different 'precision' arguments for sprintf("%g") when converting
floating point numbers to a string. This led to differences in results in some cases 
depending on whether the text-based or prepared statements protocol is used for a query.

Fixed by changing arguments to sprintf("%g") to always be 15 (DBL_DIG) so that results are
consistent regardless of the protocol.

This patch will be null-merged to 6.0 as the problem does not exists there (fixed by the
patch for WL#2934).
2009-01-28 20:59:08 +03:00
Vladislav Vaintroub
b2a49edd4e Bug#37226 Explicit call of my_thread_init() on Windows for every new thread.
Bug#33031 app linked to libmysql.lib crash if run as service in vista under 
localsystem
  

There are some problems using DllMain hook functions on Windows that 
automatically do global and per-thread initialization for libmysqld.dll

1)per-thread initialization(DLL_THREAD_ATTACH)
MySQL internally counts number of active threads that and causes a delay in in 
my_end() if not all threads are exited. But,there are threads that can be 
started either by Windows internally (often in TCP/IP scenarios) or by user 
himself - those threads are not necessarily using libmysql.dll functionality, 
but nonetheless the contribute to the count of open threads.

2)process-initialization (DLL_PROCESS_ATTACH)
my_init() calls WSAStartup that itself loads DLLs and can lead to a deadlock in 
Windows loader.

Fix is to remove dll initialization code from libmysql.dll in general case. I
still leave an environment variable LIBMYSQL_DLLINIT, which if set to any value 
will cause the old behavior (DLL init hooks will be called). This env.variable 
exists only to prevent breakage of existing Windows-only applications that 
don't do mysql_thread_init() and work ok today. Use of LIBMYSQL_DLLINIT is 
discouraged and it will be removed in 6.0
2008-09-01 17:46:37 -04:00
gkodinov/kgeorge@macbook.gmz
7cb4b7c19d fixed warnings and compile errors from the fix for bug 26243 2008-03-29 09:52:16 +02:00
iggy@amd64.(none)
b9877b84ac Merge amd64.(none):/src/mysql-5.0-bugteam
into  amd64.(none):/src/bug26243/my50-bug26243
2008-03-28 16:01:05 -04:00
iggy@amd64.(none)
79e434bc67 Bug#26243 mysql command line crash after control-c
- Backported the 5.1 DBUG to 5.0.
- Avoid memory cleanup race on Windows client for CTRL-C
2008-03-28 14:02:27 -04:00
anozdrin/alik@quad.opbmk
50c37672a7 Merge quad.opbmk:/mnt/raid/alik/MySQL/devel/5.0
into  quad.opbmk:/mnt/raid/alik/MySQL/devel/5.0-rt-merged
2008-03-18 13:53:51 +03:00
davi@mysql.com/endora.local
f23e3fd04c 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.
2008-03-14 17:40:12 -03:00
holyfoot/hf@mysql.com/hfmain.(none)
140ca59538 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.
2008-02-27 12:42:43 +04:00
gluh@eagle.(none)
e039595029 Merge mysql.com:/home/gluh/MySQL/Merge/5.0
into  mysql.com:/home/gluh/MySQL/Merge/5.0-opt
2007-12-13 14:52:49 +04:00
tsmith@ramayana.hindu.god
8c5f194505 Merge tsmith@bk-internal.mysql.com:/home/bk/mysql-5.0
into  ramayana.hindu.god:/home/tsmith/m/bk/maint/50
2007-12-07 03:51:23 -07:00
tsmith@ramayana.hindu.god
10cab933b2 Merge tsmith@bk-internal.mysql.com:/home/bk/mysql-5.0
into  ramayana.hindu.god:/home/tsmith/m/bk/maint/50
2007-12-04 20:58:21 -07:00
davi@mysql.com/endora.local
cdad8669df Bug#29592 SQL Injection issue
Remove the mysql_odbc_escape_string() function. The function
has multi-byte character escaping issues, doesn't honor the
NO_BACKSLASH_ESCAPES mode and is not used anymore by the
Connector/ODBC as of 3.51.17.
2007-11-26 14:09:37 -02:00
kaa@polly.(none)
01c878e283 Merge polly.(none):/home/kaa/src/opt/bug32221/my50-bug31445
into  polly.(none):/home/kaa/src/opt/mysql-5.0-opt
2007-11-22 14:53:41 +03:00
kaa@polly.(none)
82c4059fc9 Fix for bug #32221: bug25714, mytest, mysql_client_test complaints and
crashes.

MySQL distributions contain a number of programs that are used only by
the MySQL test suite internally, i.e. they are not indended to be
invoked directly by a user. As a result, such programs are not
documented, do not have any built-in help or proper error reporting,
which may confuse users.

This patch fixes the problem with the following changes:
- mytest, libmysqltest and all references to them were removed from the
distribution since they are not used anymore
- bug25714 now displays an error message when run with incorrect
arguments or with the --help option
- mysql_client_test now does not call abort() in case of errors,
instead it does a clean exit() with a proper error status.
2007-11-19 18:59:25 +03:00
tsmith@ramayana.hindu.god
339b3217eb Merge ramayana.hindu.god:/home/tsmith/m/bk/build/50-fix
into  ramayana.hindu.god:/home/tsmith/m/bk/build/50
2007-11-09 18:44:08 -07:00
tsmith@ramayana.hindu.god
faf9d4e922 Fix Windows build problems. 2007-11-09 18:27:20 -07:00
joerg@trift2.
df8e60ae01 Merge trift2.:/MySQL/M50/mysql-5.0
into  trift2.:/MySQL/M50/push-5.0
2007-11-08 10:33:57 +01:00
tsmith@ramayana.hindu.god
30b56973cb Merge ramayana.hindu.god:/home/tsmith/m/bk/build/50
into  ramayana.hindu.god:/home/tsmith/m/bk/build/b20748/50
2007-11-07 16:26:29 -07:00
tsmith@ramayana.hindu.god
ef59ca3d78 Bug #20748: Configuration files should not be read more than once
A user could not override system-wide settings in their ~/.my.cnf,
because the DEFAULT_SYSCONFDIR was being searched last.  Also, in
some configurations (especially when the --sysconfdir compile-time
option is set to /etc or /etc/mysql), the system-wide my.cnf file
was read multiple times, causing confusion and potential problems.

Rearrange default directories to conform to the manual and logic.
Move --sysconfdir=<path> (DEFAULT_SYSCONFDIR) from the last default
directory to the middle of the list.  $HOME/.my.cnf should be last,
so the user is able to override the system-wide settings.

Change init_default_directories() to remove duplicates from the
list.
2007-11-07 15:23:50 -07:00
davi@moksha.com.br
26f03b0bc6 Merge moksha.local:/Users/davi/mysql/bugs/31669-5.0
into  moksha.local:/Users/davi/mysql/mysql-5.0-runtime
2007-10-30 09:41:24 -03:00
gluh@eagle.(none)
237383f0fe Merge mysql.com:/home/gluh/MySQL/Merge/5.0
into  mysql.com:/home/gluh/MySQL/Merge/5.0-opt
2007-10-23 18:51:43 +05:00
davi@moksha.local/moksha.com.br
dac55f09f0 Bug#31669 Buffer overflow in mysql_change_user()
The problem is that when copying the supplied username and
database, no bounds checking is performed on the fixed-length
buffer. A sufficiently large (> 512) user string can easily
cause stack corruption. Since this API can be used from PHP
and other programs, this is a serious problem.

The solution is to increase the buffer size to the accepted
size in similar functions and perform bounds checking when
copying the username and database.
2007-10-23 09:05:39 -03:00
kaa@polly.(none)
0b00717432 Fixed the Windows build failures introduced by the patch for bug #31207: Test "join_nested" shows different strategy on IA64 CPUs / Intel's ICC compiler. 2007-10-22 22:35:08 +04:00
kaa@polly.(none)
3af902ec47 Merge polly.(none):/home/kaa/src/maint/bug31207/my50-bug31174
into  polly.(none):/home/kaa/src/maint/mysql-5.0-maint
2007-10-18 13:47:35 +04:00
tsmith@ramayana.hindu.god
3d203e55e6 Fix syntax error build problem on Windows (variable was defined
in middle of block)
2007-10-17 11:22:41 -06:00
kaa@polly.(none)
6d1f3e8de5 Fix for bug #31207: Test "join_nested" shows different strategy on IA64
CPUs / Intel's ICC compile

The bug is a combination of two problems:

1. IA64/ICC MySQL binaries use glibc's qsort(), not the one in mysys.

2. The order relation implemented by join_tab_cmp() is not transitive,
i.e. it is possible to choose such a, b and c that (a < b) && (b < c)
but (c < a). This implies that result of a sort using the relation
implemented by join_tab_cmp() depends on the order in which
elements are compared, i.e. the result is implementation-specific. Since
choose_plan() uses qsort() to pre-sort the
join tables using join_tab_cmp() as a compare function, the results of
the sorting may vary depending on qsort() implementation.

It is neither possible nor important to implement a better ordering
algorithm in join_tab_cmp(). Therefore the only way to fix it is to
force our own qsort() to be used by renaming it to my_qsort(), so we don't depend
on linker to decide that.

This patch also "fixes" bug #20530: qsort redefinition violates the
standard.
2007-10-17 20:08:58 +04:00
msvensson@pilot.mysql.com
cecc37d8b4 Merge pilot.mysql.com:/data/msvensson/mysql/bug11589/my50-test_latest
into  pilot.mysql.com:/data/msvensson/mysql/mysql-5.0-maint
2007-10-15 09:22:11 +02:00
gluh@eagle.(none)
20ec6605d3 Merge mysql.com:/home/gluh/MySQL/Merge/5.0
into  mysql.com:/home/gluh/MySQL/Merge/5.0-opt
2007-10-10 14:31:19 +05:00
tsmith@ramayana.hindu.god
5a1284ccb2 Merge ramayana.hindu.god:/home/tsmith/m/bk/50
into  ramayana.hindu.god:/home/tsmith/m/bk/maint/50
2007-09-28 10:54:49 -06:00
msvensson@pilot.(none)
2a1e556081 Merge bk-internal:/home/bk/mysql-5.0-maint
into  pilot.(none):/data/msvensson/mysql/mysql-5.0-maint
2007-09-27 08:49:23 +02:00
msvensson@pilot.(none)
e21bb2640a Move DBUG_ENTER to begining of function to avoid build failure with debug on windows 2007-09-27 08:48:39 +02:00
evgen@sunlight.local
36bf417b40 Bug#27216: functions with parameters of different date types may return wrong
type of the result.

There are several functions that accept parameters of different types.
The result field type of such functions was determined based on
the aggregated result type of its arguments. As the DATE and the DATETIME
types are represented by the STRING type, the result field type
of the affected functions was always STRING for DATE/DATETIME arguments.
The affected functions are COALESCE, IF, IFNULL, CASE, LEAST/GREATEST, CASE.

Now the affected functions aggregate the field types of their arguments rather
than their result types and return the result of aggregation as their result
field type.
The cached_field_type member variable is added to the number of classes to
hold the aggregated result field type.
The str_to_date() function's result field type now defaults to the
MYSQL_TYPE_DATETIME.
The agg_field_type() function is added. It aggregates field types with help
of the Field::field_type_merge() function.
The create_table_from_items() function now uses the 
item->tmp_table_field_from_field_type() function to get the proper field
when the item is a function with a STRING result type.
2007-09-22 11:49:27 +04:00
tnurnberg@sin.intern.azundris.com
7451aaf48c Merge tnurnberg@bk-internal.mysql.com:/home/bk/mysql-5.0-maint
into  mysql.com:/home/tnurnberg/15327/50-15327
2007-09-15 04:45:20 +02:00
tnurnberg@mysql.com/sin.intern.azundris.com
3c6ca8d6ed Bug #15327: configure: --with-tcp-port option being partially ignored
make sure that if builder configured with a non-standard (!= 3306)
default TCP port that value actually gets used throughout. if they
didn't configure a value, assume "use a sensible default", which
will be read from /etc/services or, failing that, from the factory
default. That makes the order of preference
- command-line option
- my.cnf, where applicable
- $MYSQL_TCP_PORT environment variable
- /etc/services (unless configured --with-tcp-port)
- default port (--with-tcp-port=... or factory default)
2007-09-13 16:19:46 +02:00
joerg@trift2.
04b56132a7 libmysql/libmysql.c : Correct a wrong automerge: Don't duplicate "DBUG_ENTER()". 2007-09-05 09:30:50 +02:00
df@pippilotta.erinye.com
59b504a5e3 Merge pippilotta.erinye.com:/shared/home/df/mysql/build/mysql-5.0.48
into  pippilotta.erinye.com:/shared/home/df/mysql/build/mysql-5.0-build-work
2007-09-04 10:49:54 +02:00
kent@mysql.com/kent-amd64.(none)
edf772aef1 CMakeLists.txt:
Link with library "udf_example" depends on, needed for nmake
libmysql.c:
  DBUG_ENTER need to be in declaration section
2007-08-29 22:29:07 +02:00
df@pippilotta.erinye.com
aab055a485 build fix for aix and others 2007-08-28 15:22:14 +02:00
evgen@moonbone.local
1cc8f0e383 Merge epotemkin@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  moonbone.local:/mnt/gentoo64/work/29948-bug-5.0-opt-mysql
2007-08-14 18:16:34 +04:00
evgen@moonbone.local
4bc4d834fd Bug#29948: Unchecked NULL pointer caused server crash.
The cli_read_binary_rows function is used to fetch data from the server
after a prepared statement execution. It accepts a statement handler and gets
the connection handler from it. But when the auto-reconnect option is set
the connection handler is reset to NULL after reconnection because the
prepared statement is lost and the handler became useless. This case
wasn't checked in the cli_read_binary_rows function and caused server crash.

Now the cli_read_binary_rows function checks the connection handler to be
not NULL and returns an error if it is.
2007-08-14 17:28:51 +04:00
kent@mysql.com/kent-amd64.(none)
a6d082f36d CMakeLists.txt, README, configure.js
Several adjustments to make client libraries pass the link test
  on both win32 and winx64, Visual Studio 2003 and 2005 (bug#30118)
2007-08-03 21:51:37 +02:00
kent@mysql.com/kent-amd64.(none)
74267ad9b8 CMakeLists.txt (several), make_win_bin_dist:
Aligned client library build and use with the Unix version when it
  comes to what source to include directly in the builds, and what
  libraries to link with (bug#30118).

  Also reviewed, corrected and made more clear when static or dynamic
  Thread Local Storage is to be used. Some code duplication was removed,
  and some redundant library usage were removed, reducing the risk of
  incorrect TLS usage.
2007-08-02 12:49:27 +02:00
holyfoot/hf@mysql.com/hfmain.(none)
dfc38479ea Bug #29687 mysql_stmt_store_result memory leak in libmysqld
In embedded server we use result->alloc to store field data for the
result, but we didn't clean the result->alloc if the query returned
an empty recordset. Cleaning for the empty recordset enabled
2007-07-16 19:08:07 +05:00
jani@labbari.dsl.inet.fi
7d7524d94d Merge jamppa@bk-internal.mysql.com:/home/bk/mysql-5.0
into  labbari.dsl.inet.fi:/home/my/bk/mysql-5.0-marvel
2007-07-06 09:51:02 +03:00
gkodinov/kgeorge@magare.gmz
f45601ce58 Bug #27383: Crash in test "mysql_client_test"
The C optimizer may decide that data access operations
through pointer of different type are not related to 
the original data (strict aliasing).
This is what happens in fetch_long_with_conversion(),
when called as part of mysql_stmt_fetch() : it tries 
to check for truncation errors by first storing float
(and other types of data) into a char * buffer and then 
accesses them through a float pointer.
This is done to prevent the effects of excess precision
when using FPU registers.
However the doublestore() macro converts a double pointer
to an union pointer. This violates the strict aliasing rule.
Fixed by making the intermediary variables volatile (
to not re-introduce the excess precision bug) and using
the intermediary value instead of the char * buffer.
Note that there can be loss of precision for both signed
and unsigned 64 bit integers converted to double and back,
so the check must stay there (even for compatibility 
reasons).
Based on the excellent analysis in bug 28400.
2007-06-22 15:34:28 +03:00
monty@mysql.com/narttu.mysql.fi
9a59083163 Allow multiple calls to mysql_server_end()
(Part of fix for Bug#25621 Error in my_thread_global_end(): 1 threads didn't exit)
Give correct error message if InnoDB table is not found
(This allows us to drop a an innodb table that is not in the InnoDB registery)
2007-06-20 19:22:27 +03:00