Commit Graph

138 Commits

Author SHA1 Message Date
Andrey Hristov
4ac04d8936 Afix not included by the fix committed by Ulf.
pemalloc and then efree - too bad!
Sorry for committing in two passes, my big tree is already patched
with compressed.
2009-09-17 15:13:36 +00:00
Ulf Wendel
1b5f0f63b4 Fix (by Andrey) and test for bug #49442 . Don't use efree() for memory allocated with malloc()... If a connection gets created by mysqli_init(), mysqlnd makes it 'persistent'. 'Persistent' means that mysqlnd uses malloc(). mysqlnd does use malloc() instead of ealloc() because it is unknown if the connection will become a true persistent connection in the sense of ext/mysqli. It is unknown if the user wants a persistent connection or not until the user calls mysqli_real_connect(). To avoid tricky conversions mysqlnd uses malloc(), which sets a private persistent flag in the mysqlnd structures. A precondition for the crash to happen was that the private persistent flag is set. The flag is also set when creating a real persistent connection (in the sense of ext/mysqli) and so the bug can happen with mysql_init()/mysqli_real_connect() and mysql_connect('p:<host>', ...). Therefore we test both cases. Note the (tricky?) difference between the implementation detail'mysqlnd private persistent flag = use malloc()' and persistent connections from a user perspective. Although mysqlnd will always set its private persistent flag and use malloc() for connections created with mysqli_init() it is still up to the user to decide in mysqli_real_connect() if the connection shall become a (true) persistent connection or not. 2009-09-16 17:03:44 +00:00
Ulf Wendel
8e42cbfeac Fix and tests for bug #49511 . mysqlnd and the MySQL Client Library (libmysql) use different networking APIs. mysqlnd does use PHP streams whereas libmysql uses its own wrapper of the operating level network calls. PHP sets by default a read timeout of 60s for streams - php.ini, default_socket_timeout. This default applies to all streams that set no other timeout value. mysqlnd has not set any other value and therefore it connections of long running queries can have been cut off after default_socket_timeout seconds resulting in a 2006 - MySQL Server has gone away error message. The MySQL Client Library sets a default timeout of 365 * 24 * 3600 seconds (1year) and waits for other timeouts to happen, e.g. TCP/IP timeouts. mysqlnd now uses the same very long timeout. The value is configurable through a new php.ini setting: mysqlnd.net_read_timeout. mysqlnd.net_read_timeout gets used by any extension (ext/mysql, ext/mysqli, PDO_MySQL) that uses mysqlnd. mysqlnd tells PHP Streams to use mysqlnd.net_read_timeout. Please note that there may be subtle differences between MYSQL_OPT_READ_TIMEOUT from the MySQL Client Library and PHP Streams. E.g. MYSQL_OPT_READ_TIMEOUT is documented to work only for TCP/IP connections and, prior to MySQL 5.1.2, only for Windows. PHP streams may not have this limitation. Please check the streams documentation, if in doubt. 2009-09-16 15:00:54 +00:00
Ulf Wendel
5254c6f372 Next attempt to fix http://bugs.php.net/bug.php?id=48745. Patch by Andrey. 2009-09-09 17:03:03 +00:00
Andrey Hristov
e8412fb61c Fix for bug#48745
mysqlnd: mysql_num_fields returns wrong column count for mysql_list_fields
2009-08-28 09:30:16 +00:00
Andrey Hristov
149914f644 Fixed bug #49027 (mysqli_options() doesn't work when using mysqlnd) 2009-08-27 13:16:39 +00:00
Andrey Hristov
ad310d21ee Baby, one more time :( 2009-08-25 14:31:29 +00:00
Andrey Hristov
ac71943174 Better fix. A fix of the fix 2009-08-25 14:30:37 +00:00
Andrey Hristov
eb02cd4450 Fix bug#48198 error: 'MYSQLND_LLU_SPEC' undeclared
Possibly fix also :
Bug #48780  	mysqlnd compile failure
Bug #46952  	mysqlnd compile failure with suncc
2009-08-25 14:14:23 +00:00
Johannes Schlüter
7f6fa981b3 MFB52: Fix include path 2009-07-01 14:13:07 +00:00
Pierre Joye
76a395e73d - fix build 2009-06-28 12:41:51 +00:00
David Soria Parra
565e6bdbdf Fix bug #48644 mysqlnd does not compile with '--enable-mysqlnd-threading' 2009-06-23 14:14:32 +00:00
Johannes Schlüter
ed4b37eb39 The experimental warning sohuld be in the configure output... 2009-06-23 13:19:22 +00:00
Andrey Hristov
64046529f0 Fix two problems:
- The value of mysqli_get_client_info() has been changed recently and did
not include "mysqlnd" anymore thus the test suite was thinking the build
is always libmysql. This did not kept the suite from running pconn tests
- Going back to the libc allocator because the memory arena could be on a
  persistent connections. If the build is not debug there will be no error
  but the memory will be freed and in the second use of this pconn freed
  memory will be used - not good! For now the arena doesn't take an argument
  whether it should allocate persistently or not, thus persistent is safe
  for now.

Johannes gave his +1 to commit this.
2009-06-17 16:21:34 +00:00
Andrey Hristov
56b1c8fe39 C-comments should be used 2009-06-16 17:59:19 +00:00
Andrey Hristov
7289831fe0 Memory usage optimisation. mysqlnd is not libmysql. mysqlnd does use the
Zend allocator, which means that is easier to hit memory_limit if you
have big stored (buffered) result sets. Before with libmysql you won't
hit memory_limit because libmysql uses libc's allocator and nothing is
checked. Now, with mysqlnd the situation is stricter and it is easier to
hit memory_limit. We try to optimize for big result sets. If a result set
is larger than 10 rows we will start freeing some data to keep memory usage
after 10 rows constant. This will help in the cases where a buffered result
set is scrolled forward only and just only once, or mysqlnd will need to
decode data from the network buffers again - yes, it is a trade-off between
CPU time and memory size. The best for big result sets is of course using
unbuffered queries - for comparison : 3 Million rows with buffered take
at least 180MB, with buffered you will stay at 3MB, and unbuffered will be
just 7-8% slower.
2009-06-16 13:06:45 +00:00
Andrey Hristov
5d3ea92ee9 Hardwire function call instead of using callbacks. We don't actually need
callbacks, it was done for making 2 functions static, not to pollute the
global functions space but that had its price of 8 bytes overheat per
allocation, which is just too much. Also making the app member 32b instead
of 64b, which should save additional 4 byte, to the total of 12 byte per
allocation of a row buffer.
2009-06-16 09:15:09 +00:00
Andrey Hristov
9ac36809f0 Use Zend's allocator instead of libc's and also don't try to work on
zvals that are NULLs.
2009-06-16 07:53:03 +00:00
Andrey Hristov
dc9d37998f Fix crash when tracing is enabled. Position after buffer was used also
direct usage of MYSQLND_STRING pointer instead of the "s" property of the
structure.
2009-06-12 13:24:37 +00:00
Andrey Hristov
b2f0e08307 Revert by adding an ifdef 2009-06-11 17:53:13 +00:00
Pierre Joye
54ac8205a0 - nuke unused var 2009-06-11 17:16:35 +00:00
Pierre Joye
c590f68297 - MF53: silent warning and make it less ambiguous 2009-06-11 17:14:34 +00:00
Johannes Schlüter
361c9d353f Use a better extension version 2009-06-11 10:08:09 +00:00
Andrey Hristov
433286f150 Protect the code when variable is NULL, which should never happen, but
anyway, you know about "never happens"
2009-06-11 08:51:20 +00:00
Andrey Hristov
6f90ebd669 Check the pointer before calling a function on it, or we will crash.
This is a very rare situation where the server is totally broken.
2009-06-11 08:32:34 +00:00
Andrey Hristov
18f107f94c MFB: Reference decrement in own function. Make a function which is not
called externally static, from PHPAPI.
2009-06-11 08:31:10 +00:00
Pierre Joye
7cc3ad6313 - fix TS build 2009-06-09 10:03:42 +00:00
Pierre Joye
67f88a0c3f - ws 2009-06-09 09:51:56 +00:00
Andrey Hristov
efc752375e Merge with the branch, someone made changes in PHP5_3 and did not merge.
Also switch off the zval cache for now.
2009-06-08 10:19:29 +00:00
Andrey Hristov
1683d46dc9 Add support for mysql_stmt_store_result() from libmysql 6.0.8+ and 5.4.x 2009-05-29 13:09:22 +00:00
Andrey Hristov
37234bb393 Fix for the failing mysql_stmt_execute() test. Data was cleaned after
stmt_reset() but it should stay and be freed as later as next stmt_execute()
2009-05-29 12:19:26 +00:00
Andrey Hristov
9230362631 Fix a very well hidden error because of not being careful with CPP.
I usually don't make this mistake :)
2009-05-29 08:05:21 +00:00
Andrey Hristov
86aa4e8035 Fix a valgrind warning as well as more trace log information 2009-05-28 17:49:00 +00:00
Andrey Hristov
09b56ed2a5 Fix a problem with cursors, which did not happen with unbuffered PS for
some reason. Double free of the data, which led to valgrind warnigns.
The fix actually optimizes the code in this cases because the old code
used copy_ctor while the new one skips it because it is not needed.
Transferring data ownership and nulling works best, for PS where we
always copy the string from the result set, unlike the text protocol.
2009-05-28 16:35:16 +00:00
Andrey Hristov
c90b10a290 Fix a bug with mysqlnd_fetch_field(_direct()). With mysqlnd the optimised
function was called, which however, doesn't respect that during store the
raw data is not unpacked, to be lazy. The data is unpacked to zvals later,
during every row fetch. However, this way max_length won't be calculated
correctly. So, if a mysqlnd_fetch_field(_direct) call comes we need to
unpack everything and then calculate max_length...and that is expensive,
defies our lazy unpacking optimisation.
2009-05-28 11:47:15 +00:00
Andrey Hristov
8b43f4fddc ws 2009-05-26 13:42:43 +00:00
Andrey Hristov
6d9d60b902 Fix a typo, utf8 is 3 byte max, for us, for now
Add a another cset
2009-05-26 13:42:06 +00:00
Johannes Schlüter
16606a9cdf Fix #47535 Compilation failure in ps_fetch_from_1_to_8_bytes() 2009-04-20 09:15:46 +00:00
Felipe Pena
cf5e94b010 - Sync with 5.3 2009-03-30 19:43:47 +00:00
Johannes Schlüter
53034b18cb - Fix #47819 (Getting pdo_mysql.so: undefined symbol: mysqlnd_debug_init at
startup)
2009-03-30 13:53:35 +00:00
Felipe Pena
7c860bb018 - Removed leftover UG(unicode) checks 2009-03-27 19:50:56 +00:00
Felipe Pena
04c90a0f51 - Removed:
- UG(unicode) checks
- Changed:
     - ZEND_STR_TYPE -> IS_UNICODE
     - convert_to_text -> convert_to_unicode
2009-03-27 19:28:26 +00:00
Johannes Schlüter
5306bb0e4b - mark mysqlnd's threading (which can be used for background pre-fetching)
experimental
2009-03-17 10:04:57 +00:00
Andrey Hristov
7271069329 Fix the build, because the macro's name has changed 2009-03-17 09:51:04 +00:00
Andrey Hristov
cf78f35270 Add the charsets available from 6.0 as a structure, to be used later 2009-02-20 13:24:14 +00:00
Johannes Schlüter
6a6e94c0d9 - Improve mysqlnd's internal method registration 2009-02-16 17:25:37 +00:00
Johannes Schlüter
d15503bfcc - Export mysql_refresh to mysqli (mysqli_refresh(), $mysqli->refresh()) 2009-01-22 20:57:32 +00:00
Sebastian Bergmann
7f4dc8702a Bump copyright year, 3 of 3. 2008-12-31 11:12:40 +00:00
Johannes Schlüter
5522a99905 No infinite loop in case the connection broke 2008-11-28 14:37:43 +00:00
Pierre Joye
3def8739ce - declaration first (fix build win) 2008-11-22 23:52:40 +00:00