Andrey Hristov
4de0da5a56
Fix deallocation which can crash if the object is half-baken.
...
Happens during OOM.
2010-05-27 08:51:46 +00:00
Andrey Hristov
0e8b380941
Don't use conn->net without checking if it is NULL, because
...
it can be NULL in OOM conditions. This would cause a crash.
2010-05-26 13:47:43 +00:00
Andrey Hristov
433cb868d6
Handle the situation when MYSQLND_PROTOCOL's methods return NULL.
...
mysqlnd should not crash but gracefully return with an error.
2010-05-25 23:18:13 +00:00
Andrey Hristov
708b31a510
Gracefully handle OOM in mysqlnd_stmt_init. Release the handle
...
and return NULL.
2010-05-25 22:42:25 +00:00
Andrey Hristov
6d434e70a4
Init should return status value because initialization can fail.
...
In this case mysqlnd_init() should return NULL to the end-user.
2010-05-25 22:40:47 +00:00
Andrey Hristov
b3c553fa99
Use the specialized macro for this case
2010-05-25 22:38:11 +00:00
Andrey Hristov
b434301f7b
Use only memory that has been allocated
2010-05-25 22:36:33 +00:00
Andrey Hristov
decdfeeeb2
Access memory which was really allocated
2010-05-25 22:34:47 +00:00
Andrey Hristov
844b435655
Fix shared build
2010-05-25 21:54:21 +00:00
Andrey Hristov
954e7db644
Handle OOM in the code that generates PS Execute requests
...
to the server. Fixes crashes in case of OOM.
2010-05-25 19:19:29 +00:00
Andrey Hristov
52e31252fc
Fix metadata duplicatin which wasn't crash-safe in case of OOM.
2010-05-25 18:14:37 +00:00
Andrey Hristov
a25482105e
Check set->data for validity before using it.
...
Prevents crashes after OOM.
2010-05-21 13:37:18 +00:00
Andrey Hristov
476391c02e
When OOM hits the wire, don't crash.
2010-05-21 13:06:52 +00:00
Andrey Hristov
3ea05600e9
result_meta local storage
2010-05-14 16:42:17 +00:00
Andrey Hristov
8a093b3811
Allow overloading of mysqlnd_result_meta_init().
...
Add free space for future hooks.
2010-05-14 15:11:56 +00:00
Andrey Hristov
faf4659295
Export MYSQLND_PROTOCOL methods
2010-05-14 13:32:27 +00:00
Andrey Hristov
8691786ebd
- Give possibility to overload mysqlnd_result_init().
...
- Always use conn->m->stmt_init instead of mysqlnd_stmt_init()
2010-05-14 13:18:39 +00:00
Andrey Hristov
dd85f9c2f2
OOM fixes
2010-05-14 13:04:33 +00:00
Andrey Hristov
07619b7190
- initialize some variables
...
- initialize the methods in a shorter way, use the compiler.
= on structures copies them. Allows also exportability of
the methods.
2010-05-13 15:29:08 +00:00
Andrey Hristov
fccec600eb
Export the methods of MYSQLND_NET
2010-05-13 14:15:23 +00:00
Andrey Hristov
4c1487577c
Export the result_metadata methods to external modules.
2010-05-13 11:16:11 +00:00
Andrey Hristov
d53337bbe7
OOM stability fixes
2010-05-04 14:02:42 +00:00
Andrey Hristov
447c693b2d
Add possibility to control the allocator in when PHP is compiled
...
with debug
2010-05-04 13:49:43 +00:00
Andrey Hristov
5ca71c00f5
Handle OOM in mysqlnd_res::store_result_fetch_data
2010-05-03 19:32:07 +00:00
Andrey Hristov
9c276eee6c
Handle OOM in mysqlnd_fetch_row_buffered_c()
2010-05-03 19:09:45 +00:00
Andrey Hristov
2b00096004
Handle OOM in mysqlnd_fetch_row_unbuffered_c()
2010-05-03 19:02:48 +00:00
Andrey Hristov
2b18a3ff93
Handle OOM stemming from mysqlnd_result_init in the same
...
function and up the stack.
2010-05-03 18:50:47 +00:00
Andrey Hristov
7de2607c12
Handle gracefully OOM in mysqlnd_mempool_create and up the stack
2010-05-03 17:07:18 +00:00
Andrey Hristov
c32bae720c
Handle OOM in block_alloc_get_chunk, and also in the caller
...
in mysqlnd_wireprotocol.c
2010-05-03 16:20:46 +00:00
Andrey Hristov
ec0fe858c6
Remove unused parameter
2010-05-03 16:09:05 +00:00
Andrey Hristov
57059d4e31
One more case to handle in case of OOM, in block_alloc_resize_chunk
2010-05-03 14:26:08 +00:00
Andrey Hristov
8e8348a4b0
Handle OOM when resizing blocks during data fetch
2010-05-03 14:16:04 +00:00
Andrey Hristov
2da3f5ba90
Fix compiler warnings - unused functions
2010-05-03 13:51:30 +00:00
Andrey Hristov
333581fcb4
Better handing of OOM in mysqlnd::set_client_option
2010-05-03 13:45:58 +00:00
Andrey Hristov
3010485d44
Handle OOM cases, in case of persistent connections this is real
...
and the Zend MM won't help.
2010-04-29 15:49:51 +00:00
Andrey Hristov
aec94a464b
Fix valgrind warning, usage of nirvana memory
2010-04-29 15:17:44 +00:00
Andrey Hristov
ac172db01f
Fix possible crashes in case of OOM, as well as a leak.
2010-04-29 13:13:41 +00:00
Andrey Hristov
6c1a2831f6
Fix crash if OOM and USE_ZEND_ALLOC=0
2010-04-29 11:49:08 +00:00
Andrey Hristov
6d88d1a75e
Fixed few buffer overflows reported by Stefan Esser.
2010-04-28 15:35:52 +00:00
Andrey Hristov
16d5d5966e
const-ify fields
2010-04-28 12:29:13 +00:00
Andrey Hristov
8546225b6e
Fixed very rare memory leak in mysqlnd, when binding thousands of columns
2010-04-27 12:32:34 +00:00
Andrey Hristov
194444b293
Of course, 64*4 is 256, not 1024
2010-04-27 11:02:51 +00:00
Andrey Hristov
4b658e3ded
Move the macro to mysqlnd_enum_n_def.h, because it can be reused
...
in other places. Also, premultiply the values by 4 and add some
reserve for future releases of the server.
2010-04-27 10:53:27 +00:00
Andrey Hristov
207a72ca0e
Fixed buffer overflow in mysqlnd_change_user
2010-04-27 08:26:24 +00:00
Andrey Hristov
6f6909e582
Fixed possible buffer overflow in mysqlnd_conn__list_fields.
2010-04-27 08:02:08 +00:00
Kalle Sommer Nielsen
dd8e59da8f
Removed safe_mode
...
* Removed ini options, safe_mode*
* Removed --enable-safe-mode --with-exec-dir configure options on Unix
* Updated extensions, SAPI's and core
* php_get_current_user() is now declared in main.c, thrus no need to include safe_mode.h anymore
2010-04-26 23:53:30 +00:00
Andrey Hristov
3dbf6acd7b
Change the way the allocator is called - through an abstraction
...
to give the possibility of pluggability. Thanks to the macros
already used the changes are not pervasive.
2010-04-22 16:28:50 +00:00
Andrey Hristov
e5dcac245c
Fix problem spotted by Felipe.
2010-04-22 16:22:56 +00:00
Andrey Hristov
7c5259cca3
adding what last commit was missing
2010-04-22 15:14:45 +00:00
Andrey Hristov
1ed3da294b
Remove dead code and add possibility to fine tune the size of
...
a mempool (used for result sets).
2010-04-22 15:07:40 +00:00
Andrey Hristov
12c9bde2e7
Add the posibility to switch off the compilation of statistics
...
collection, for those who want to optimize the last percent of their
binaries.
2010-04-22 13:03:44 +00:00
Andrey Hristov
6dec27d58b
Hardening the reads of mysqlnd.
...
All packets but the row data packet are read into preallocated buffer,
either on the stack or on the heap (cmd_buffer). The size of the buffer
is always checked to skip buffer overruns. Only up to the size of the
buffer is stored into the buffer but packet->header.size has the size of
all data sent. In this case network layer bails.
This patch hardenes the reads, so if packets are malformed and shorter
than they should be there will be no further reads in the buffer.
In short, detection of malformed packets.
2010-04-20 20:02:32 +00:00
Andrey Hristov
f2d23c7f37
put the trigger in the right place
2010-04-20 19:09:56 +00:00
Andrey Hristov
eda9959e36
It is possible that change user tries an user who has old password.
...
Instead of error message that doesn't say much there is more information now.
2010-04-20 18:04:24 +00:00
Felipe Pena
6d951e2ded
- Fix copyrights
2010-04-20 13:50:34 +00:00
Andrey Hristov
fb76a3f2db
Last batch of int/uint comparison fixes
2010-04-15 15:58:26 +00:00
Andrey Hristov
7f43fc3b02
More int/uint comparison warning fixes
2010-04-15 15:53:58 +00:00
Andrey Hristov
f40779091c
Fix some int/uint comparison warnings
2010-04-15 15:28:00 +00:00
Andrey Hristov
8912e8f04e
Remove unused file
2010-04-15 15:22:56 +00:00
Andrey Hristov
6f0adc06fa
more WS
2010-04-15 15:16:29 +00:00
Andrey Hristov
a9880e78c6
CS + WS changes
2010-04-15 12:55:04 +00:00
Andrey Hristov
c04f752625
Fix for bug#49234 method not found ssl_set
...
Patch was tested and compiles on Windows. (Thanks Kalle)
2010-04-15 11:01:30 +00:00
Andrey Hristov
c0531d8db0
Fixint INT_AND_FLOAT_AS native. It was working ok on 64bit but
...
because on 32bit SIZEOF_LONG is 4 and INT64 from MySQL is 8 everything
was converted to string, even if it was able to put it in a long.
This closes Request #50651 Native type cast returns wrong result
2010-04-08 13:20:37 +00:00
Andrey Hristov
92698a331f
Fix the Windows build (void* arithmetic) as well as --disable-zlib
...
build.
2010-04-06 18:14:23 +00:00
Andrey Hristov
3cb852fe6b
Stricly C
2010-04-06 14:33:55 +00:00
Andrey Hristov
b8484a2e89
Recommit with an Windows build fix:
...
Fix inconsistencies
- memory allocated with spprintf, or likes, outside of mysqlnd's
allocator functions should not be freed by the mysqlnd's allocator
(a wrapper around emalloc/malloc).
- memory allocated by the mysqlnd's allocator should only be freed
by it.
- add a mode to track memory usage (malloc/free)
2010-04-06 13:28:23 +00:00
Andrey Hristov
d339672e45
Fix inconsistencies
...
- memory allocated with spprintf, or likes, outside of mysqlnd's
allocator functions should not be freed by the mysqlnd's allocator
(a wrapper around emalloc/malloc).
- memory allocated by the mysqlnd's allocator should only be freed
by it.
- add a mode to track memory usage (malloc/free)
2010-04-01 13:26:41 +00:00
Andrey Hristov
ffb8df30ab
Better fix for bug #51347 mysqli_close / connection memory leak
2010-04-01 12:46:21 +00:00
Andrey Hristov
4735c71283
Fixed bug #51347 mysqli_close / connection memory leak
...
Streams API registers every stream as resource, which lands then
in EG(regular_list), however doesn't clean that when the stream is
closed. At the end this is a para-leak. At the end of the script
all memory is cleaned, however this is a problem for long runnig
scripts that open connections. For every opened and closed connection
about 150 Bytes on 32bit and 250 Bytes on 64bit will be "lost",
according to memory_get_usage().
2010-04-01 11:50:24 +00:00
Andrey Hristov
4870cac70e
Make it coupled - what is allocated with mnd_ should be freed
...
with mnd_ and vice versa.
Added mnd_pestrndup and mnd_pestrdup, which wrap the normal
calls to be able to track this calls.
Fixed some failing tests.
2010-03-29 17:04:16 +00:00
Andrey Hristov
7868bca437
Fix tests that fail when the MySQL's socket file is not /tmp/mysql.sock
...
as it is in when compiled from source and the default for mysqlnd.
SuSE for example uses /var/run/mysql/mysql.sock . Also, sql.safe_mode
(ext/mysql and ingres) needs the socket.
Fix possible crashes in mysqlnd. When packets are shorter, functions should
return error.
2010-03-26 16:58:25 +00:00
Andrey Hristov
293ba72451
Fix a segfault when using a mysqli object after unsuccesssful connect, the
...
handle should have been allocated with mysqli_init().
2010-03-24 15:17:57 +00:00
Kalle Sommer Nielsen
c8b33a6a01
Fix declaring
2010-03-23 13:21:22 +00:00
Andrey Hristov
981ba00606
Fix for complaint from the Zend MM, efree of a NULL pointer.
2010-03-17 18:08:25 +00:00
Andrey Hristov
4941b23bcd
Fix a bug that a statement that is reset doesn't clean
...
the wire properly (as it is done when the statement is closed).
If there is more that one result sets returned from the PS
(like a call to SP that returns at least one RSet next to the
status rset) then the line was blocked. PS Multi-Res is not supported
in any libmysql from a GA-ed MySQL.
2010-03-17 18:00:47 +00:00
Andrey Hristov
3ff193c05e
fix valgrind warning introduced with the latest patch. The memory
...
should be calloc-ed, not malloced, because the code that uses the
stmt storage needs that.
2010-03-17 11:40:37 +00:00
Andrey Hristov
7496cc761e
decouple the methods in MYSQLND_STMT from the data,
...
needed to move to a new structure MYSQLND_STMT. Makes
the code cleaner and less error-prone.
Also fix PDO/MySQL which directly touch mysqlnd internals
instead of using API calls.
2010-03-16 12:36:57 +00:00
Andrey Hristov
ccfd9cd744
allow persistency of PS
2010-03-12 13:03:46 +00:00
Adam Harvey
bdbb2e77ca
Fixed bug #51242 (Empty mysql.default_port does not default to 3306 anymore, but 0).
2010-03-09 05:08:31 +00:00
Andrey Hristov
7db6387a7f
Fix the text. Correct english and a bit shorter.
2010-02-24 21:16:04 +00:00
Andrey Hristov
f8eb9abf44
add better description to the problem
2010-02-24 18:00:01 +00:00
Andrey Hristov
c7f2f1a5b1
add typedefs for all structure methods, and then reuse these typedefs
2010-02-15 16:58:33 +00:00
Andrey Hristov
480c327ff5
make send_close a hook, too
2010-02-09 19:05:40 +00:00
Andrey Hristov
e50de7d982
Pass tsrmls to all functions, which might need it in the future.
...
We are anyway breaking the internal ABI in 5.3.2 so this won't hurt
and make us prepared for the future.
2010-02-03 17:31:29 +00:00
Andrey Hristov
7b68aab24c
Fix second bug in that code, + instead of += thus not increasing
...
a pointer and mangling data. Again, ext/mysql and ext/mysqli doesn't
have access to this codepath.
2010-02-01 17:12:40 +00:00
Andrey Hristov
befab3e8c3
Fix a bug in mysqlnd where a pointer was not incremented
...
and thus wrong data was saved MYSQLND_FIELD::db. However, this
wasn't caught because there is no code in mysql/mysqli/pdo_mysql
which reads that field of the structure. The problem was found
during code review.
2010-02-01 16:12:03 +00:00
Andrey Hristov
d9449d44a2
decrement correctly!
2010-01-21 18:17:19 +00:00
Andrey Hristov
2d7ca03976
Add possibility to restrain the number of levels
2010-01-21 18:12:18 +00:00
Andrey Hristov
6136b785b9
Fix possible lock-ups when a trigger triggers a trigger.
...
Hanging was possible on the subsequent try to acquire a mutex.
Now it is correctly implemented and if a trigger is being executed
then no other trigger will be fired, on recursive calls.
2010-01-19 15:31:39 +00:00
Andrey Hristov
ac1a5cd0f7
Make it GCC only feature (tracing). VC7 and up do the work
...
too and it might be tweaked later.
2010-01-19 12:13:06 +00:00
Andrey Hristov
f056cdaa3e
fix windows
2010-01-19 11:44:43 +00:00
Andrey Hristov
beaa4d0430
Fix compiler warning, copy&paste error
2010-01-14 12:31:29 +00:00
Andrey Hristov
f551c57cf0
Fix compiler warning
2010-01-14 11:39:18 +00:00
Andrey Hristov
fef4bf8a9d
remove redefinition of bit_uint8korr
2010-01-14 10:35:28 +00:00
Andrey Hristov
6a8d4c3287
more PHPAPI for phpize-d builds
2010-01-13 18:07:02 +00:00
Andrey Hristov
4bbdce5ca7
export more functionality for phpize builds
2010-01-13 18:00:41 +00:00
Andrey Hristov
176e6dd2f2
make mysqlnd's tracing API more reusable
2010-01-13 14:06:02 +00:00
Andrey Hristov
dc09fa81f5
more typedef cosmetics
2010-01-11 20:18:56 +00:00
Andrey Hristov
c4b380a076
remove stale export
2010-01-11 20:12:46 +00:00
Andrey Hristov
2331e28509
cosmetics. typedef-ed types should be in capital case
2010-01-11 20:10:10 +00:00
Andrey Hristov
1a108f1bae
remove extern defintion of a variable that is no more
...
used outside of the file where it is declared.
Also really export with PHPAPI the protocol init/deinit functions
2010-01-11 19:13:43 +00:00
Andrey Hristov
8b3931b444
this function should be exporten in all cases, not only under PHP6
2010-01-11 18:40:11 +00:00
Andrey Hristov
d999552ae7
missed to commit in 5_3, here it comes, reusability of stats
2010-01-11 18:31:02 +00:00
Andrey Hristov
9b8d026d86
Rework the statistics macros to be reusable by external entities.
...
Rename handlers to triggers. Dynamically allocate space for the
statistics thus allow reusability.
2010-01-11 14:27:35 +00:00
Andrey Hristov
4a549fbb3d
missed to commit to the branch
2010-01-11 12:37:42 +00:00
Andrey Hristov
81695689b9
export some calls to init/deinit code outside of the module
2010-01-08 18:52:08 +00:00
Andrey Hristov
d20fdd603b
improve the stats subsystem. Reduce the number of macro definitions
...
in half by smartly introducing 2 new macros. Make MYSQLND::stats a pointer
from being aggregated and add triggers.
2010-01-08 17:35:20 +00:00
Andrey Hristov
3264e51983
add restart_psession and end_psession hooks
2010-01-08 13:47:03 +00:00
Andrey Hristov
73b23fca37
Change of way the packet objects are created/initialised
...
If the protocol gets changed, ever, we can decide at runtime
easily which protocol to use by instantiating the right protocol
object. But this is restricted to the structure of the packets, not
the flow.
2010-01-07 19:44:59 +00:00
Sebastian Bergmann
9ba1e81665
sed -i "s#1997-2009#1997-2010#g" **/*.c **/*.h **/*.php
2010-01-03 09:23:27 +00:00
Andrey Hristov
d76fa2b46c
move network creation to the init hook
2009-12-28 11:17:10 +00:00
Andrey Hristov
01adfaee5f
Unify. The typedef-ed structs in mysqlnd are always capitalized.
2009-12-23 11:58:45 +00:00
Johannes Schlüter
c764995c8e
install mysqlnd headers to allow shared build of extensions
2009-12-22 19:30:09 +00:00
Andrey Hristov
c95fa280ed
Fix double calls to free_contents if the connection cannot be
...
opened. mysqlnd have no probs, external code should not have too.
In any case, double call is not needed.
2009-12-22 17:44:42 +00:00
Andrey Hristov
e1251edc16
move state setting to the right place, in mysqlnd_init, no more
...
in mysqlnd::connect
2009-12-22 17:31:31 +00:00
Andrey Hristov
41ac91aecf
Move this function to MYSQLND_NET as it works on the
...
php stream
2009-12-21 16:52:10 +00:00
Andrey Hristov
ce349e3540
magic numbers to macros
2009-12-21 16:17:31 +00:00
Andrey Hristov
b4477669b4
Move compression and decompression code to separate functions
...
which can be overloaded on purpose.
2009-12-21 16:09:13 +00:00
Andrey Hristov
028bd4ba02
refactoring : move more network related functions to
...
mysqlnd_net.c . Now communication is split on two levels:
- logical (functions send and receive)
- physical (functions network_read and network_write)
2009-12-17 13:29:46 +00:00
Andrey Hristov
22528b14a4
During refactoring of the function mysqlnd_stream_write_w_header() it was
...
found that there is a bug in the way the data is sent, although a very rare
one which will only affect very large queries which have length 16777214. The
communication will hang. A way to test it is to execute the following:
./php -r '$c=mysqli_connect("127.0.0.1","root","root","test");
$q="insert into test.tblob values(\"".str_repeat("a",256*256*256-1-34)."\")";
$c->query($q);'
2009-12-17 12:30:58 +00:00
Andrey Hristov
d233b0b2af
call free_contents in every case, in case something is not freed
...
by the calling code
2009-12-16 14:38:30 +00:00
Andrey Hristov
a1ef2d9fb3
Remove unneeded dereferences
...
(oops, committed the trunk changes from a wrong directory, which splitted
this commit).
2009-12-16 14:06:09 +00:00
Andrey Hristov
b3546d1b5e
move MYSQLND_NET code to a separate file.
...
mysqlnd_wireprotocol is about the protocol not the transport
layer
2009-12-16 12:59:38 +00:00
Andrey Hristov
5e1c95fda4
remove duplicated code
2009-12-15 17:39:30 +00:00
Andrey Hristov
c101f7f542
Move code out of mysqlnd_conn::connect to mysqlnd_net::connect.
...
Thus mysqlnd_conn::connect() does less of what it should not do - think
about the transport level.
2009-12-15 17:33:06 +00:00
Andrey Hristov
70690e1163
remove C++ comments
2009-12-15 14:48:24 +00:00
Andrey Hristov
523471f7e8
export this function
2009-12-15 14:26:24 +00:00
Andrey Hristov
0371ef1070
refactor: move code that belongs to MYSQLND_NET out of MYSQLND
2009-12-15 13:13:51 +00:00
Pierre Joye
af206a90ae
- fix build, come on, it is not that hard to test before commit, is it?
2009-12-11 16:35:42 +00:00
Andrey Hristov
13c8bba00a
Make MYSQLND_NET dynamically allocated structure with allocator
...
and deallocator. More member functions will come.
2009-12-11 11:58:57 +00:00
Andrey Hristov
a9295f0343
remove stale comment
2009-12-11 10:21:34 +00:00
Andrey Hristov
0c7a9b8010
Move two functions which are used in the extension as methods of
...
the connection. Two functions less in the global namespace.
2009-12-11 10:18:00 +00:00
Andrey Hristov
a633de0020
bump version number
2009-12-10 11:59:14 +00:00
Andrey Hristov
00d76a8445
Add plugin storage for MYSQLND_STMT too
2009-12-10 11:18:05 +00:00
Andrey Hristov
06a417b6a9
Remove stub code which never actually was used for anything.
...
Things like this can be built on top of the core.
2009-12-09 20:38:11 +00:00
Andrey Hristov
6f598e62ff
Remove the zval caching from mysqlnd. It was disabled versions ago
...
due to problems on windows, which were not debugged. Better have
code that is disabled not in the core.
2009-12-09 20:21:05 +00:00
Andrey Hristov
d8a8d823ce
Fix compilation warnings
2009-12-09 18:11:03 +00:00
Andrey Hristov
4d2735007d
Remove disabled code - threaded fetching. This can be implemented
...
on a upper level and by offloading it we reduce the complexity of
the core.
2009-12-09 16:57:03 +00:00
Andrey Hristov
0f0f5f229b
I svn-commit.2.tmp (Modified) Row 2 Col 28 11:45 Ctrl-K H for help
...
fix compilation on windows and with other compilers who
don't like void* arithmetic
2009-12-03 10:50:02 +00:00
Pierre Joye
2386938aea
- disable this debug code until it is actually fixed
2009-12-03 10:41:20 +00:00
Andrey Hristov
bfc0ec1891
fix segfault introduced by Pierre in a recent commit
...
old code was doing something like
conn + sizeof(MYSQLND) * MYSQLND + plugin * sizeof(void) * sizeof(MYSQLND)
because `conn` is not casted to void*. `conn` has to be casted to void * and
then the whole experession will be void * and the calculations will work.
2009-12-03 09:43:26 +00:00
Andrey Hristov
2bc887e1d3
fix macro so that 5-byte BIT values are decoded correctly
2009-12-02 11:58:04 +00:00
Pierre Joye
2a3ec70d10
- void is NaN, you can't do math ops on void. Declarations go first. Fix TS build
2009-11-30 10:56:01 +00:00
Andrey Hristov
1cf1cb3015
fix debug windows build as well as remove a compilation warning
...
(a header not included)
2009-11-26 11:10:47 +00:00
Andrey Hristov
4ebc0fdfbc
Update charset table
2009-11-24 13:59:56 +00:00
Andrey Hristov
5143fe41e2
Compressed protocol support + extensibility for mysqlnd
2009-11-20 08:12:14 +00:00
Ulf Wendel
08db32e073
Fix: log slow queries in stats regardless of mysqlnd.log_mask setting.
2009-10-23 12:44:05 +00:00
Andrey Hristov
7b5ce9ab49
Don't forget to update the length too
2009-10-22 17:36:12 +00:00
Andrey Hristov
f2814dd0df
Have the lengths also to skip many calls to strlen
2009-10-22 17:07:55 +00:00
Ulf Wendel
629d8fe47e
Updating mysqlnd version number.
2009-10-22 16:10:02 +00:00
Ulf Wendel
00654b8a06
Fixing stats, updating test to accept new stats
2009-10-22 16:05:33 +00:00
Andrey Hristov
1aad525c6e
Move definition
2009-10-22 15:17:03 +00:00
Andrey Hristov
a692479d21
Count number of affected_rows for normal and PS queries
2009-10-22 14:30:51 +00:00
Ulf Wendel
d01d398bad
Fixing host info for TCP/IP and aligning mysqlnd and libmysql
2009-10-19 12:09:48 +00:00
Ulf Wendel
3eeaf566e0
Extending mysqlnd statistics/monitoring. Now counting COM_* commands.
2009-10-16 13:02:01 +00:00
Ulf Wendel
d8dc47d58f
Making mysqlnd emit no warnings when fetching pooled persistent connections that have timed out or are unusable for any other reason - bug #49761
2009-10-15 20:46:08 +00:00
Ulf Wendel
ab4670ee53
Fixing problems when calling connect (again and again) on a valid connection handle. Most of the patch comes from Andrey.
2009-10-15 15:49:40 +00:00
Ulf Wendel
a1d3a3224e
Avoid buffer resizing and let the initial buffer allocation happen a couple of lines later with conn->m->set_client_option(conn, MYSQLND_OPT_NET_CMD_BUFFER_SIZE, ...). Andrey, I leave it to you to change the default size to 128k.
2009-10-08 16:33:17 +00:00
Ulf Wendel
4e6a1c2754
Fixing pconnect statistics.
2009-10-08 11:40:16 +00:00
Andrey Hristov
309fced64d
Increase the minimal size of the command buffer, which is used
...
for sending queries and in the future commpressed patch for reading
almost all packets from the wire instead of using stack buffers.
2009-10-07 17:33:51 +00:00
Andrey Hristov
06523621dd
revert the last change
2009-10-06 12:53:01 +00:00
Andrey Hristov
d9382399fc
count the queries
2009-10-06 10:33:23 +00:00
Andrey Hristov
2f81bcd44b
Fix ZTS build
2009-09-30 23:34:56 +00:00
Andrey Hristov
ba5c40b2ad
Use mnd_ wrappers wherever possible. Needed for
...
statistics.
2009-09-30 23:13:43 +00:00
Andrey Hristov
b9dcc28c24
Fix trace output. DBG_RETURN should be used in traced
...
functions.
2009-09-30 22:26:19 +00:00
Ulf Wendel
9408303390
Fixing a leak in mysqlnd when passing invalid fetch modes to mysqlnd.
2009-09-30 14:39:33 +00:00
Andrey Hristov
80f629ed9f
Fix possible crash when conn is NULL
2009-09-25 10:37:44 +00:00
Jani Taskinen
2c90fb8ea2
- Fix the build issue with php_mysqlnd_config.h ending up in wrong build directory
2009-09-24 18:01:17 +00:00
Dmitry Stogov
6f32199f75
Fixed compilation error
2009-09-23 08:33:23 +00:00
Andrey Hristov
452aca97e3
MFH:Check for the different types and create the
...
corresponding configuration file, so it can be used
by mysqli, even if mysqlnd is not enabled at all.
2009-09-22 14:44:11 +00:00
Andrey Hristov
c2e66884e1
MFH, a fix 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:14 +00:00
Ulf Wendel
e6cf6693e6
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
20005db2a0
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
5f260e14b2
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
9bf747605d
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
67c7a37d9b
Fixed bug #49027 (mysqli_options() doesn't work when using mysqlnd)
2009-08-27 13:16:39 +00:00
Andrey Hristov
2dcfcf7387
MFH: fix of the fix
2009-08-25 14:32:10 +00:00
Andrey Hristov
27cbcc6078
MFH:
...
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:25:01 +00:00
Andrey Hristov
cac5325aac
test 2
2009-08-03 14:50:10 +00:00
Andrey Hristov
af22257ba4
test
2009-08-03 14:46:11 +00:00
Johannes Schlüter
81761e636d
Fix path
2009-06-28 21:52:51 +00:00
Pierre Joye
a68f6c9c28
- fix build
2009-06-28 12:04:44 +00:00
Johannes Schlüter
9485cad688
Revert mysqlnd to RC3 state after issues with pconnects
2009-06-25 19:03:52 +00:00
David Soria Parra
4d7e6edd63
MFH: Fix bug #48644 mysqlnd does not compile with '--enable-mysqlnd-threading'
2009-06-23 14:15:28 +00:00
Johannes Schlüter
86eaa90955
MFH The experimental warning sohuld be in the configure output...
2009-06-23 13:19:28 +00:00
Johannes Schlüter
067276a043
Temporarily disable this optimization causing too much trouble, kept in HEAD
2009-06-18 15:07:23 +00:00
Andrey Hristov
0aada07656
MFH:
...
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:22:13 +00:00
Andrey Hristov
30800a79b9
MFH: C-comments
2009-06-16 18:00:00 +00:00
Andrey Hristov
10ee06ca48
MFH:
...
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:07:14 +00:00
Andrey Hristov
27270621cb
MFH:
...
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:38 +00:00
Andrey Hristov
a2acaa7fcd
MFH:
...
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:35 +00:00
Andrey Hristov
22c8786493
MFH:
...
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:57 +00:00
Andrey Hristov
9a2cc0ce67
Put these in an ifdef because they are not used at all if the zval cache
...
is off.
2009-06-11 17:54:04 +00:00
Pierre Joye
f2fcd8fb29
- silent warning and make it less ambiguous
2009-06-11 14:36:48 +00:00
Johannes Schlüter
11340cf299
MFH: Use a better extension version
2009-06-11 10:18:08 +00:00
Andrey Hristov
28c8d25dca
MFH:
...
Protect the code when variable is NULL, which should never happen, but
anyway, you know about "never happens" :)
2009-06-11 08:52:06 +00:00
Andrey Hristov
cff09ba5df
MFH:
...
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:35:47 +00:00
Andrey Hristov
a3b85c28c6
Sync with PHP6 - TSRMLS_FETCH
...
Extract reference decrement in own function
Remove PHPAPI of a function and make it static as it is not called
externally
2009-06-11 08:30:08 +00:00
Andrey Hristov
ec777b89f4
Merge with HEAD. Someone committed changes to HEAD and did not merge back to
...
the branch.
Also switch off the zval cache, for now.
2009-06-08 10:20:27 +00:00
Andrey Hristov
c1d46eb502
MFH:Add support for mysql_stmt_store_result() from libmysql 6.0.8+ and 5.4.x
2009-05-29 13:09:47 +00:00
Andrey Hristov
ccf0665170
MFH: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:40 +00:00
Andrey Hristov
133296f962
MFH: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:38 +00:00
Andrey Hristov
804f6138a6
MFH:Fix a valgrind warning as well as more trace log information
2009-05-28 17:49:29 +00:00
Andrey Hristov
76d091d5f5
MFH: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:41 +00:00
Andrey Hristov
6c4e8fa4f9
MFH:
...
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:48 +00:00
Andrey Hristov
7ae2505cab
Fix a typo, utf8 is 3 byte max, for us, for now
...
Add a another cset
2009-05-26 13:41:18 +00:00
Johannes Schlüter
501ecb10f4
Fix #47535 Compilation failure in ps_fetch_from_1_to_8_bytes()
2009-04-20 09:16:51 +00:00
Felipe Pena
dcd86aebd2
- MFH: Removed UG(unicode) checks
2009-03-30 16:52:33 +00:00
Johannes Schlüter
bcb40030a5
MFH Fix #47819 (Getting pdo_mysql.so: undefined symbol: mysqlnd_debug_init at
...
startup)
2009-03-30 13:55:47 +00:00
Johannes Schlüter
5942f27d86
MFH: mark mysqlnd's threading (which can be used for background pre-fetching)
...
experimental
2009-03-17 10:05:19 +00:00
Andrey Hristov
df7ebb5d41
MFH: Fix the build because the macro name has changed
2009-03-17 09:51:31 +00:00
Andrey Hristov
8f102c1697
MFH: Add charsets from MySQL 6.0 as a structure to be used later
2009-02-20 13:25:12 +00:00
Johannes Schlüter
ebef020ecc
- MFH: Improve mysqlnd's internal method registration
2009-02-16 17:26:43 +00:00
Johannes Schlüter
074b084852
MFH: export mysql_refresh
...
[DOC] This makes mysql_refresh() as described in
http://dev.mysql.com/doc/refman/6.0/en/mysql-refresh.html
available as mysqli_Refresh() and mysqli->refresh()
MYSQLI_REFRESH_BACKUP_LOG is only available when linking libmysql 6.0
or mysqlnd
2009-01-22 21:01:58 +00:00
Sebastian Bergmann
08659c2dcd
MFH: Bump copyright year, 3 of 3.
2008-12-31 11:15:49 +00:00
Johannes Schlüter
836dd82c8e
MFH: No infinite loop in case the connection broke
2008-11-28 14:38:03 +00:00
Andrey Hristov
d43b7b022f
MFH:
...
Windows fixes for mysqlnd
Less warnings + PHPAPI for mysqlnd_poll
2008-11-20 17:21:36 +00:00
Andrey Hristov
e62f5f8f03
MFH:
...
Fix a small bug that mysqlnd::next_result didn't care about an error in a
multi-statement. In an inner layer the error has been already set, thus it
needed better massage on the top level.
2008-11-19 17:45:43 +00:00
Andrey Hristov
3343619b9a
MFH: Fix Windows build, pure C compiler
2008-11-18 18:02:44 +00:00
Andrey Hristov
825034cea5
MFH:
...
Asynchronous queries for mysqli, when mysqlnd is enabled.
Includes 4 tests for mysqli_poll
2008-11-18 17:02:18 +00:00
Andrey Hristov
737c3c89c6
MFB: More Windows types cleanup
2008-11-06 18:48:55 +00:00
Andrey Hristov
e49366850f
MFH: Use win32/php_stdint.h for stdint types on Windows
2008-11-06 14:21:50 +00:00
Andrey Hristov
e099d732a6
MFH: More cleanup of config-win.h
2008-11-06 11:29:20 +00:00
Andrey Hristov
9186528994
MFH:
...
Get rid of many defines (which simplifies the code a lot),
as well as uint->unsigned int
2008-11-06 10:37:47 +00:00
Andrey Hristov
a836ea7b71
Fix windows build
2008-11-01 21:22:29 +00:00
Andrey Hristov
9726d6b047
Fix the build
2008-10-31 21:29:54 +00:00
Andrey Hristov
77c1e145e1
MFB:
...
64bit fixes:
- fixes to sprintf modifiers, cleaning warnings
- use _t types, like uint64_t instead of uint64, thus skipping series of
typedefs.
2008-10-31 20:32:17 +00:00
Johannes Schlüter
04d9bbe65e
MFH: Fix #46285 (lastInsertId() returns "0" when a deferenced PDOStatement is
...
executed)
2008-10-27 17:21:22 +00:00
Andrey Hristov
7d4c51c2bd
MFH:
...
Fix overusage of memory when the result set is empty. Then no memory will be
allocated compared to before. Also grow (realloc) the rset with 10% instead
of 33% - more reallocs but better memory usage. Of course later theres is a
realloc to shrink the rset t ofree it from unused rows but its better to
to eat too much at once.
2008-10-27 15:14:17 +00:00
Andrey Hristov
b18bf1f880
Fix a name
2008-10-27 14:38:31 +00:00
Johannes Schlüter
c3dab8f191
MFH: Don't dereference NULL-pointer
2008-10-19 12:28:43 +00:00
Johannes Schlüter
80720205c0
MFH: Improve order in MINFO output
2008-10-01 21:36:43 +00:00
Johannes Schlüter
3c335a3b5e
MFH: Handle failed connections right
2008-10-01 19:47:17 +00:00
Andrey Hristov
b429a84c2b
MFH:
...
Fix a crash introduced yesterday in mysqlnd, non-zts mode - missing if () for
STAT_LAST was accessing wrong memory thus overwritting method pointers.
Windows doesn't have atoll(), which is C99, C89 has only atoi() + atol().
Win has _atoi64, so use it.
2008-09-16 14:35:01 +00:00
Andrey Hristov
8bb2465a51
MFH:
...
Add float conversions too. Float users should understand how float works!!!
2008-09-15 18:09:20 +00:00
Andrey Hristov
5f7bd521f0
MFH:Compile-in a string-to-int conversion for INT columns by default,
...
controlled by a ini setting.
2008-09-15 14:07:44 +00:00
Pierre Joye
6c7f41d482
- fix build (declaration must be fist in a given contex)
2008-09-14 22:10:24 +00:00
Andrey Hristov
99ea8068df
MFH:
...
- More statistics
- Fixed endless loop - mysqlnd_stmt_next_result() returned FAIL but as it
is defined to be 1 (and PASS is 0), checking for mysqlnd_stmt_more_result()
was successful although we were expecting a FAIL.
2008-09-12 15:08:41 +00:00
Johannes Schlüter
9a13dea744
MFH: constify strings
2008-08-19 10:42:11 +00:00
Johannes Schlüter
aeab8bade6
MFH: Fix empty error message when connecting to a bad server
2008-08-19 10:16:12 +00:00
Felipe Pena
0fbe6a0c14
- MFH: Added TSRMLS_DC to apply_func_args_t and zend_hash_apply_with_arguments.
2008-07-24 19:52:24 +00:00
Andrey Hristov
24e7d03e48
MFH: Fixed bug#44897 - failed to prepare statement
...
After a PS "CALL()" we have at least one result set. If the SP does also some, then
we need to clean the wire more fool-proof.
2008-07-23 14:07:38 +00:00
Andrey Hristov
2c54b3abb5
More debugging info for the trace log
2008-07-22 16:06:08 +00:00
Andrey Hristov
136a55fcd9
Sync with bzr
2008-07-15 13:11:09 +00:00
Jani Taskinen
1e2b2bbeae
- Some config*.m4 file cleanups: NO tabs in these!
2008-07-14 09:02:26 +00:00
Andrey Hristov
827b772c9f
Fix remaining valgrind problems with pconn and zval cache
...
HEAD merge will follow tomorrow.
2008-06-24 22:22:48 +00:00
Andrey Hristov
943e9a577b
Fix double-free, introduced lately
2008-06-24 13:19:29 +00:00
Andrey Hristov
e0f45cf7ae
Fix possible bug with persistent connections and mysqlnd
2008-06-24 11:01:38 +00:00
Andrey Hristov
9d7955b821
Add missing header
2008-06-24 08:01:13 +00:00
Andrey Hristov
f93e715fc5
Even more debug info
2008-06-24 06:56:36 +00:00