Commit Graph

61 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
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
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
5143fe41e2 Compressed protocol support + extensibility for mysqlnd 2009-11-20 08:12:14 +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
Andrey Hristov
2f81bcd44b Fix ZTS build 2009-09-30 23:34:56 +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
5f260e14b2 Next attempt to fix http://bugs.php.net/bug.php?id=48745. Patch by Andrey. 2009-09-09 17:03:03 +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
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
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
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
Sebastian Bergmann
08659c2dcd MFH: Bump copyright year, 3 of 3. 2008-12-31 11:15:49 +00:00
Andrey Hristov
737c3c89c6 MFB: More Windows types cleanup 2008-11-06 18:48:55 +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
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
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
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
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
Andrey Hristov
f4e659d2af Update ext/mysql's and ext/mysqli's tests
Add mysqli_stmt_more_result()/mysqli_stmt_next_result(), but only in
mysqlnd builds as libmysql doesn't support this feature.
2008-04-24 14:22:19 +00:00
Andrey Hristov
de560f3161 MFB: Update CVS from the development tree 2008-04-16 12:57:38 +00:00