ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Coro-Mysql/Mysql.xs
(Generate patch)

Comparing Coro-Mysql/Mysql.xs (file contents):
Revision 1.10 by root, Fri Aug 2 04:08:56 2013 UTC vs.
Revision 1.15 by root, Tue Jun 3 13:38:48 2014 UTC

1#include <sys/errno.h> 1#include <errno.h>
2#include <unistd.h> 2#include <unistd.h>
3#include <fcntl.h> 3#include <fcntl.h>
4 4
5#include <mysql.h> 5#include <mysql.h>
6 6
35 int bufofs, bufcnt; 35 int bufofs, bufcnt;
36#if HAVE_EV 36#if HAVE_EV
37 ev_io rw, ww; 37 ev_io rw, ww;
38#endif 38#endif
39 char buf[VIO_READ_BUFFER_SIZE]; 39 char buf[VIO_READ_BUFFER_SIZE];
40 size_t (*old_read)(Vio*, uchar *, size_t);
41 size_t (*old_write)(Vio*, const uchar *, size_t);
42 int (*old_vioclose)(Vio*);
40} ourdata; 43} ourdata;
41 44
42#if DESC_IS_PTR 45#if DESC_IS_PTR
43# define OURDATAPTR (*(ourdata **)&((vio)->desc)) 46# define OURDATAPTR (*(ourdata **)&((vio)->desc))
44#else 47#else
176 179
177#if DESC_IS_PTR 180#if DESC_IS_PTR
178 vio->desc = our->old_desc; 181 vio->desc = our->old_desc;
179#endif 182#endif
180 183
184 vio->vioclose = our->old_vioclose;
185 vio->write = our->old_write;
186 vio->read = our->old_read;
187
181 Safefree (our); 188 Safefree (our);
182
183 vio->read = vio_read;
184 vio->write = vio_write;
185 vio->vioclose = vio_close;
186 189
187 vio->vioclose (vio); 190 vio->vioclose (vio);
188} 191}
189 192
190#if HAVE_EV 193#if HAVE_EV
241 if (fd != my->net.fd) 244 if (fd != my->net.fd)
242 croak ("DBD::mysql fd and libmysql disagree - library mismatch, unsupported transport or API changes?"); 245 croak ("DBD::mysql fd and libmysql disagree - library mismatch, unsupported transport or API changes?");
243 246
244 if (fd != vio->sd) 247 if (fd != vio->sd)
245 croak ("DBD::mysql fd and vio-sd disagree - library mismatch, unsupported transport or API changes?"); 248 croak ("DBD::mysql fd and vio-sd disagree - library mismatch, unsupported transport or API changes?");
246 249#if MYSQL_VERSION_ID < 100010 && !defined(MARIADB_BASE_VERSION)
247 if (vio->vioclose != vio_close) 250 if (vio->vioclose != vio_close)
248 croak ("vio.vioclose has unexpected content - library mismatch, unsupported transport or API changes?"); 251 croak ("vio.vioclose has unexpected content - library mismatch, unsupported transport or API changes?");
249 252
250 if (vio->write != vio_write) 253 if (vio->write != vio_write)
251 croak ("vio.write has unexpected content - library mismatch, unsupported transport or API changes?"); 254 croak ("vio.write has unexpected content - library mismatch, unsupported transport or API changes?");
252 255
253 if (vio->read != vio_read 256 if (vio->read != vio_read
254 && vio->read != vio_read_buff) 257 && vio->read != vio_read_buff)
255 croak ("vio.read has unexpected content - library mismatch, unsupported transport or API changes?"); 258 croak ("vio.read has unexpected content - library mismatch, unsupported transport or API changes?");
259#endif
256 260
257 Newz (0, our, 1, ourdata); 261 Newz (0, our, 1, ourdata);
258 our->magic = CoMy_MAGIC; 262 our->magic = CoMy_MAGIC;
259 our->corohandle_sv = newSVsv (corohandle_sv); 263 our->corohandle_sv = newSVsv (corohandle_sv);
260 our->corohandle = newSVsv (corohandle); 264 our->corohandle = newSVsv (corohandle);
272#else 276#else
273 vio->desc [DESC_OFFSET - 1] = 0; 277 vio->desc [DESC_OFFSET - 1] = 0;
274#endif 278#endif
275 OURDATAPTR = our; 279 OURDATAPTR = our;
276 280
281 our->old_vioclose = vio->vioclose;
282 our->old_write = vio->write;
283 our->old_read = vio->read;
284
277 vio->vioclose = our_close; 285 vio->vioclose = our_close;
278 vio->write = our_write; 286 vio->write = our_write;
279 vio->read = our_read; 287 vio->read = our_read;
280} 288}
281 289

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines