diff --git a/oursqlx/_exceptions.c b/oursqlx/_exceptions.c index 0d76ff0..ae9cabf 100644 --- a/oursqlx/_exceptions.c +++ b/oursqlx/_exceptions.c @@ -617,23 +617,26 @@ enum _oursqlx_exception_type _oursqlx_exc_from_errno(int err) { return _oursqlx_PermissionsError; default: - #if MYSQL_VERSION_ID >= 50700 - for(unsigned int i = 0; i < sizeof(errmsg_section_start)/sizeof(int); ++i) { - int min = errmsg_section_start[i]; - int max = errmsg_section_start[i] + errmsg_section_size[i] - 1; - if ( err >= min && err <= max ) { - return _oursqlx_ProgrammingError; - } - } - if ( err > CR_MIN_ERROR && err < CR_MAX_ERROR) { - return _oursqlx_InterfaceError; - } - #else - if (err >= ER_ERROR_FIRST && err <= ER_ERROR_LAST) - return _oursqlx_ProgrammingError; - else if (err > CR_MIN_ERROR && err < CR_MAX_ERROR) - return _oursqlx_InterfaceError; - #endif + #if MYSQL_VERSION_ID >= 50700 && !defined(ER_ERROR_FIRST) + { + unsigned int i; + for(i = 0; i < sizeof(errmsg_section_start)/sizeof(int); ++i) { + int min = errmsg_section_start[i]; + int max = errmsg_section_start[i] + errmsg_section_size[i] - 1; + if ( err >= min && err <= max ) { + return _oursqlx_ProgrammingError; + } + } + if ( err > CR_MIN_ERROR && err < CR_MAX_ERROR) { + return _oursqlx_InterfaceError; + } + } + #else + if (err >= ER_ERROR_FIRST && err <= ER_ERROR_LAST) + return _oursqlx_ProgrammingError; + else if (err > CR_MIN_ERROR && err < CR_MAX_ERROR) + return _oursqlx_InterfaceError; + #endif } return _oursqlx_UnknownError; } diff --git a/oursqlx/oursql.c b/oursqlx/oursql.c new file mode 100644 index 0000000..07d4865 --- /dev/null +++ b/oursqlx/oursql.c @@ -0,0 +1,30593 @@ +/* Generated by Cython 0.21.1 */ + +#define PY_SSIZE_T_CLEAN +#ifndef CYTHON_USE_PYLONG_INTERNALS +#ifdef PYLONG_BITS_IN_DIGIT +#define CYTHON_USE_PYLONG_INTERNALS 0 +#else +#include "pyconfig.h" +#ifdef PYLONG_BITS_IN_DIGIT +#define CYTHON_USE_PYLONG_INTERNALS 1 +#else +#define CYTHON_USE_PYLONG_INTERNALS 0 +#endif +#endif +#endif +#include "Python.h" +#ifndef Py_PYTHON_H + #error Python headers needed to compile C extensions, please install development version of Python. +#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000) + #error Cython requires Python 2.6+ or Python 3.2+. +#else +#define CYTHON_ABI "0_21_1" +#include +#ifndef offsetof +#define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) +#endif +#if !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#endif +#ifndef DL_IMPORT + #define DL_IMPORT(t) t +#endif +#ifndef DL_EXPORT + #define DL_EXPORT(t) t +#endif +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif +#ifndef Py_HUGE_VAL + #define Py_HUGE_VAL HUGE_VAL +#endif +#ifdef PYPY_VERSION +#define CYTHON_COMPILING_IN_PYPY 1 +#define CYTHON_COMPILING_IN_CPYTHON 0 +#else +#define CYTHON_COMPILING_IN_PYPY 0 +#define CYTHON_COMPILING_IN_CPYTHON 1 +#endif +#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 +#define Py_OptimizeFlag 0 +#endif +#define __PYX_BUILD_PY_SSIZE_T "n" +#define CYTHON_FORMAT_SSIZE_T "z" +#if PY_MAJOR_VERSION < 3 + #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ + PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) + #define __Pyx_DefaultClassType PyClass_Type +#else + #define __Pyx_BUILTIN_MODULE_NAME "builtins" + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ + PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) + #define __Pyx_DefaultClassType PyType_Type +#endif +#if PY_MAJOR_VERSION >= 3 + #define Py_TPFLAGS_CHECKTYPES 0 + #define Py_TPFLAGS_HAVE_INDEX 0 + #define Py_TPFLAGS_HAVE_NEWBUFFER 0 +#endif +#if PY_VERSION_HEX < 0x030400a1 && !defined(Py_TPFLAGS_HAVE_FINALIZE) + #define Py_TPFLAGS_HAVE_FINALIZE 0 +#endif +#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) + #define CYTHON_PEP393_ENABLED 1 + #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \ + 0 : _PyUnicode_Ready((PyObject *)(op))) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) + #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u) + #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) + #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) +#else + #define CYTHON_PEP393_ENABLED 0 + #define __Pyx_PyUnicode_READY(op) (0) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) + #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE)) + #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) + #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) +#endif +#if CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b) + #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b) + #define __Pyx_PyFrozenSet_Size(s) PyObject_Size(s) +#else + #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b) + #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ? \ + PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) + #define __Pyx_PyFrozenSet_Size(s) PySet_Size(s) +#endif +#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) +#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b) +#else + #define __Pyx_PyString_Format(a, b) PyString_Format(a, b) +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyBaseString_Type PyUnicode_Type + #define PyStringObject PyUnicodeObject + #define PyString_Type PyUnicode_Type + #define PyString_Check PyUnicode_Check + #define PyString_CheckExact PyUnicode_CheckExact +#endif +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) + #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) +#else + #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj)) + #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) +#endif +#ifndef PySet_CheckExact + #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) +#endif +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) +#if PY_MAJOR_VERSION >= 3 + #define PyIntObject PyLongObject + #define PyInt_Type PyLong_Type + #define PyInt_Check(op) PyLong_Check(op) + #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define PyInt_FromString PyLong_FromString + #define PyInt_FromUnicode PyLong_FromUnicode + #define PyInt_FromLong PyLong_FromLong + #define PyInt_FromSize_t PyLong_FromSize_t + #define PyInt_FromSsize_t PyLong_FromSsize_t + #define PyInt_AsLong PyLong_AsLong + #define PyInt_AS_LONG PyLong_AS_LONG + #define PyInt_AsSsize_t PyLong_AsSsize_t + #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask + #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask + #define PyNumber_Int PyNumber_Long +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyBoolObject PyLongObject +#endif +#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY + #ifndef PyUnicode_InternFromString + #define PyUnicode_InternFromString(s) PyUnicode_FromString(s) + #endif +#endif +#if PY_VERSION_HEX < 0x030200A4 + typedef long Py_hash_t; + #define __Pyx_PyInt_FromHash_t PyInt_FromLong + #define __Pyx_PyInt_AsHash_t PyInt_AsLong +#else + #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t + #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t +#endif +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) +#else + #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass) +#endif +#ifndef CYTHON_INLINE + #if defined(__GNUC__) + #define CYTHON_INLINE __inline__ + #elif defined(_MSC_VER) + #define CYTHON_INLINE __inline + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_INLINE inline + #else + #define CYTHON_INLINE + #endif +#endif +#ifndef CYTHON_RESTRICT + #if defined(__GNUC__) + #define CYTHON_RESTRICT __restrict__ + #elif defined(_MSC_VER) && _MSC_VER >= 1400 + #define CYTHON_RESTRICT __restrict + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_RESTRICT restrict + #else + #define CYTHON_RESTRICT + #endif +#endif +#ifdef NAN +#define __PYX_NAN() ((float) NAN) +#else +static CYTHON_INLINE float __PYX_NAN() { + /* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and + a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is + a quiet NaN. */ + float value; + memset(&value, 0xFF, sizeof(value)); + return value; +} +#endif +#ifdef __cplusplus +template +void __Pyx_call_destructor(T* x) { + x->~T(); +} +#endif + + +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif + +#ifndef __PYX_EXTERN_C + #ifdef __cplusplus + #define __PYX_EXTERN_C extern "C" + #else + #define __PYX_EXTERN_C extern + #endif +#endif + +#if defined(WIN32) || defined(MS_WINDOWS) +#define _USE_MATH_DEFINES +#endif +#include +#define __PYX_HAVE__oursql +#define __PYX_HAVE_API__oursql +#include "compat.h" +#include "string.h" +#include "mysql.h" +#include "mysqld_error.h" +#ifdef _OPENMP +#include +#endif /* _OPENMP */ + +#ifdef PYREX_WITHOUT_ASSERTIONS +#define CYTHON_WITHOUT_ASSERTIONS +#endif + +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif +typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding; + const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; + +#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 +#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0 +#define __PYX_DEFAULT_STRING_ENCODING "" +#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString +#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize +#define __Pyx_fits_Py_ssize_t(v, type, is_signed) ( \ + (sizeof(type) < sizeof(Py_ssize_t)) || \ + (sizeof(type) > sizeof(Py_ssize_t) && \ + likely(v < (type)PY_SSIZE_T_MAX || \ + v == (type)PY_SSIZE_T_MAX) && \ + (!is_signed || likely(v > (type)PY_SSIZE_T_MIN || \ + v == (type)PY_SSIZE_T_MIN))) || \ + (sizeof(type) == sizeof(Py_ssize_t) && \ + (is_signed || likely(v < (type)PY_SSIZE_T_MAX || \ + v == (type)PY_SSIZE_T_MAX))) ) +static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*); +static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); +#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s)) +#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l) +#define __Pyx_PyBytes_FromString PyBytes_FromString +#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); +#if PY_MAJOR_VERSION < 3 + #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString + #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize +#else + #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString + #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize +#endif +#define __Pyx_PyObject_AsSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_FromUString(s) __Pyx_PyObject_FromString((const char*)s) +#define __Pyx_PyBytes_FromUString(s) __Pyx_PyBytes_FromString((const char*)s) +#define __Pyx_PyByteArray_FromUString(s) __Pyx_PyByteArray_FromString((const char*)s) +#define __Pyx_PyStr_FromUString(s) __Pyx_PyStr_FromString((const char*)s) +#define __Pyx_PyUnicode_FromUString(s) __Pyx_PyUnicode_FromString((const char*)s) +#if PY_MAJOR_VERSION < 3 +static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) +{ + const Py_UNICODE *u_end = u; + while (*u_end++) ; + return (size_t)(u_end - u - 1); +} +#else +#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen +#endif +#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) +#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode +#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode +#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) +#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +#if CYTHON_COMPILING_IN_CPYTHON +#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) +#else +#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) +#endif +#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) +#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII +static int __Pyx_sys_getdefaultencoding_not_ascii; +static int __Pyx_init_sys_getdefaultencoding_params(void) { + PyObject* sys; + PyObject* default_encoding = NULL; + PyObject* ascii_chars_u = NULL; + PyObject* ascii_chars_b = NULL; + const char* default_encoding_c; + sys = PyImport_ImportModule("sys"); + if (!sys) goto bad; + default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); + Py_DECREF(sys); + if (!default_encoding) goto bad; + default_encoding_c = PyBytes_AsString(default_encoding); + if (!default_encoding_c) goto bad; + if (strcmp(default_encoding_c, "ascii") == 0) { + __Pyx_sys_getdefaultencoding_not_ascii = 0; + } else { + char ascii_chars[128]; + int c; + for (c = 0; c < 128; c++) { + ascii_chars[c] = c; + } + __Pyx_sys_getdefaultencoding_not_ascii = 1; + ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); + if (!ascii_chars_u) goto bad; + ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL); + if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) { + PyErr_Format( + PyExc_ValueError, + "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.", + default_encoding_c); + goto bad; + } + Py_DECREF(ascii_chars_u); + Py_DECREF(ascii_chars_b); + } + Py_DECREF(default_encoding); + return 0; +bad: + Py_XDECREF(default_encoding); + Py_XDECREF(ascii_chars_u); + Py_XDECREF(ascii_chars_b); + return -1; +} +#endif +#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3 +#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) +#else +#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) +#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT +static char* __PYX_DEFAULT_STRING_ENCODING; +static int __Pyx_init_sys_getdefaultencoding_params(void) { + PyObject* sys; + PyObject* default_encoding = NULL; + char* default_encoding_c; + sys = PyImport_ImportModule("sys"); + if (!sys) goto bad; + default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); + Py_DECREF(sys); + if (!default_encoding) goto bad; + default_encoding_c = PyBytes_AsString(default_encoding); + if (!default_encoding_c) goto bad; + __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c)); + if (!__PYX_DEFAULT_STRING_ENCODING) goto bad; + strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c); + Py_DECREF(default_encoding); + return 0; +bad: + Py_XDECREF(default_encoding); + return -1; +} +#endif +#endif + + +/* Test for GCC > 2.95 */ +#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))) + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) +#else /* !__GNUC__ or GCC < 2.95 */ + #define likely(x) (x) + #define unlikely(x) (x) +#endif /* __GNUC__ */ + +static PyObject *__pyx_m; +static PyObject *__pyx_d; +static PyObject *__pyx_b; +static PyObject *__pyx_empty_tuple; +static PyObject *__pyx_empty_bytes; +static int __pyx_lineno; +static int __pyx_clineno = 0; +static const char * __pyx_cfilenm= __FILE__; +static const char *__pyx_filename; + + +static const char *__pyx_f[] = { + "conversions.pyx", + "oursql.pyx", + "util.pyx", + "connection.pyx", + "statement.pyx", + "query.pyx", + "cursor.pyx", +}; + +/*--- Type declarations ---*/ +struct __pyx_obj_6oursql__DictWhateverMixin; +struct __pyx_obj_6oursql_Connection; +struct __pyx_obj_6oursql__AbstractIterWrapper; +struct __pyx_obj_6oursql__BinaryWhateverMixin; +struct __pyx_obj_6oursql_IterWrapper; +struct __pyx_obj_6oursql_FileWrapper; +struct __pyx_obj_6oursql__Statement; +struct __pyx_obj_6oursql__ResultStringStream; +struct __pyx_obj_6oursql__ResultSet; +struct __pyx_obj_6oursql__Query; +struct __pyx_obj_6oursql__DictQuery; +struct __pyx_obj_6oursql_Cursor; +struct __pyx_obj_6oursql_DictCursor; +struct __pyx_obj_6oursql__DBAPITypeObject; +union __pyx_t_6oursql_column_data; +union __pyx_t_6oursql_bitfield; +struct __pyx_t_6oursql_column_output; +struct __pyx_opt_args_6oursql_6Cursor__update_fields; + +/* "oursql.pyx":15 + * cdef unsigned int UNSIGNED_NUM_FLAG = UNSIGNED_FLAG | NUM_FLAG + * + * cdef union column_data: # <<<<<<<<<<<<<< + * MYSQL_TIME t + * long long ll + */ +union __pyx_t_6oursql_column_data { + MYSQL_TIME t; + PY_LONG_LONG ll; + unsigned PY_LONG_LONG ull; + unsigned long ul; + Py_ssize_t st; + long l; + float f; + double d; + char c; + char dec[65]; + int8_t s8; + int16_t s16; + int32_t s32; + int64_t s64; + uint8_t u8; + uint16_t u16; + uint32_t u32; + uint64_t u64; +}; + +/* "oursql.pyx":37 + * uint64_t u64 + * + * cdef union bitfield: # <<<<<<<<<<<<<< + * char c[8] + * uint64_t u64 + */ +union __pyx_t_6oursql_bitfield { + char c[8]; + uint64_t u64; +}; + +/* "oursql.pyx":41 + * uint64_t u64 + * + * cdef struct column_output: # <<<<<<<<<<<<<< + * enum_field_types type + * unsigned int flags + */ +struct __pyx_t_6oursql_column_output { + enum enum_field_types type; + unsigned int flags; + int is_binary; + unsigned long length; + my_bool is_null; + my_bool error; + union __pyx_t_6oursql_column_data buf; +}; + +/* "oursqlx/cursor.pyx":147 + * self._update_fields(stmt, rowcount) + * + * cdef int _update_fields(self, stmt, rowcount=None) except -1: # <<<<<<<<<<<<<< + * self.messages.extend(stmt.warnings) + * if rowcount is None: + */ +struct __pyx_opt_args_6oursql_6Cursor__update_fields { + int __pyx_n; + PyObject *rowcount; +}; + +/* "oursqlx/util.pyx":45 + * return ret + * + * cdef class _DictWhateverMixin: # <<<<<<<<<<<<<< + * def fetchone(self): + * row = super(_DictWhateverMixin, self).fetchone() + */ +struct __pyx_obj_6oursql__DictWhateverMixin { + PyObject_HEAD +}; + + +/* "oursql.pyx":77 + * class UnknownError(Error): pass + * + * cdef class Connection # <<<<<<<<<<<<<< + * + * include "util.pyx" + */ +struct __pyx_obj_6oursql_Connection { + PyObject_HEAD + struct __pyx_vtabstruct_6oursql_Connection *__pyx_vtab; + PyObject *__weakref__; + MYSQL *conn; + PyObject *_charset; + PyObject *_context_cursors; + int use_unicode; + int autoping; + int raise_on_warnings; + PyObject *default_cursor; +}; + + +/* "oursqlx/statement.pyx":8 + * cdef my_ulonglong ull_negone = -1 + * + * cdef class _AbstractIterWrapper: # <<<<<<<<<<<<<< + * def __iter__(self): + * return self + */ +struct __pyx_obj_6oursql__AbstractIterWrapper { + PyObject_HEAD +}; + + +/* "oursqlx/statement.pyx":12 + * return self + * + * cdef class _BinaryWhateverMixin: # <<<<<<<<<<<<<< + * def __next__(self): + * ret = super(BinaryFileWrapper, self).next() + */ +struct __pyx_obj_6oursql__BinaryWhateverMixin { + PyObject_HEAD +}; + + +/* "oursqlx/statement.pyx":17 + * return PyBuffer_FromObject(ret, 0, Py_END_OF_BUFFER) + * + * cdef class IterWrapper(_AbstractIterWrapper): # <<<<<<<<<<<<<< + * """IterWrapper(iterobj) + * + */ +struct __pyx_obj_6oursql_IterWrapper { + struct __pyx_obj_6oursql__AbstractIterWrapper __pyx_base; + PyObject *iterobj; + PyObject *nextfunc; +}; + + +/* "oursqlx/statement.pyx":43 + * """}) + * + * cdef class FileWrapper(_AbstractIterWrapper): # <<<<<<<<<<<<<< + * """FileWrapper(fileobj, chunksize=8192, doclose=False) + * + */ +struct __pyx_obj_6oursql_FileWrapper { + struct __pyx_obj_6oursql__AbstractIterWrapper __pyx_base; + PyObject *fileobj; + PyObject *chunksize; + PyObject *readfunc; + int doclose; + int done; +}; + + +/* "oursqlx/statement.pyx":85 + * """}) + * + * cdef class _Statement: # <<<<<<<<<<<<<< + * """_Statement(...) + * + */ +struct __pyx_obj_6oursql__Statement { + PyObject_HEAD + struct __pyx_vtabstruct_6oursql__Statement *__pyx_vtab; + PyObject *__weakref__; + MYSQL_STMT *stmt; + MYSQL_BIND *bind; + struct __pyx_t_6oursql_column_output *result_data; + unsigned int result_fields; + unsigned int fetched; + unsigned long cursor_type; + unsigned long string_limit; + unsigned long _prefetch_rows; + int buffered; + int data_waiting; + int show_table; + int exhausted; + struct __pyx_obj_6oursql_Connection *conn; + PyObject *warnings; +}; + + +/* "oursqlx/statement.pyx":608 + * {'__module__': __name__}) + * + * cdef class _ResultStringStream: # <<<<<<<<<<<<<< + * """_ResultStringStream(...) + * + */ +struct __pyx_obj_6oursql__ResultStringStream { + PyObject_HEAD + MYSQL_BIND bind; + struct __pyx_obj_6oursql__Statement *stmt; + unsigned int index; + unsigned int stmt_fetched; + unsigned long offset; + unsigned long length; + int done; +}; + + +/* "oursqlx/query.pyx":4 + * # MySQL, I really do. + * + * cdef class _ResultSet: # <<<<<<<<<<<<<< + * """_ResultSet(...) + * + */ +struct __pyx_obj_6oursql__ResultSet { + PyObject_HEAD + struct __pyx_vtabstruct_6oursql__ResultSet *__pyx_vtab; + struct __pyx_obj_6oursql_Connection *conn; + MYSQL_RES *res; + unsigned int fields; + PyObject *conversion_info; + PyObject *rowcount; + PyObject *lastrowid; + PyObject *description; + PyObject *column_names; + PyObject *warnings; + int show_table; +}; + + +/* "oursqlx/query.pyx":116 + * return PyCallIter_New(self.fetchone, None) + * + * cdef class _Query: # <<<<<<<<<<<<<< + * """_Query(...) + * + */ +struct __pyx_obj_6oursql__Query { + PyObject_HEAD + struct __pyx_vtabstruct_6oursql__Query *__pyx_vtab; + struct __pyx_obj_6oursql_Connection *conn; + PyObject *result; + PyObject *res_a; + PyObject *res_kw; + PyObject *rowcount; + PyObject *lastrowid; + PyObject *description; + PyObject *warnings; + PyObject *has_result; +}; + + +/* "oursqlx/query.pyx":194 + * {'__module__': __name__}) + * + * cdef class _DictQuery(_Query): # <<<<<<<<<<<<<< + * _result_class = _DictResultSet + */ +struct __pyx_obj_6oursql__DictQuery { + struct __pyx_obj_6oursql__Query __pyx_base; +}; + + +/* "oursqlx/cursor.pyx":3 + * import collections, itertools + * + * cdef class Cursor: # <<<<<<<<<<<<<< + * """Cursor(...) + * + */ +struct __pyx_obj_6oursql_Cursor { + PyObject_HEAD + struct __pyx_vtabstruct_6oursql_Cursor *__pyx_vtab; + PyObject *_statements; + PyObject *_stmt_kwargs; + struct __pyx_obj_6oursql_Connection *conn; + int closed; + int try_plain_query; + PyObject *rowcount; + PyObject *lastrowid; + PyObject *description; + PyObject *messages; + unsigned long arraysize; +}; + + +/* "oursqlx/cursor.pyx":265 + * self.close() + * + * cdef class DictCursor(Cursor): # <<<<<<<<<<<<<< + * """DictCursor(...) + * + */ +struct __pyx_obj_6oursql_DictCursor { + struct __pyx_obj_6oursql_Cursor __pyx_base; +}; + + +/* "oursql.pyx":96 + * connect = Connection + * + * cdef class _DBAPITypeObject: # <<<<<<<<<<<<<< + * cdef readonly object values + * + */ +struct __pyx_obj_6oursql__DBAPITypeObject { + PyObject_HEAD + PyObject *values; +}; + + + +/* "oursqlx/connection.pyx":9 + * } + * + * cdef class Connection: # <<<<<<<<<<<<<< + * """Connection([host, user, passwd,] db=None, port=0, unix_socket=None, + * connect_timeout=None, read_timeout=None, write_timeout=None, + */ + +struct __pyx_vtabstruct_6oursql_Connection { + int (*_raise_error)(struct __pyx_obj_6oursql_Connection *); + int (*_check_closed)(struct __pyx_obj_6oursql_Connection *); +}; +static struct __pyx_vtabstruct_6oursql_Connection *__pyx_vtabptr_6oursql_Connection; + + +/* "oursqlx/statement.pyx":85 + * """}) + * + * cdef class _Statement: # <<<<<<<<<<<<<< + * """_Statement(...) + * + */ + +struct __pyx_vtabstruct_6oursql__Statement { + int (*_raise_error)(struct __pyx_obj_6oursql__Statement *); + int (*_check_closed)(struct __pyx_obj_6oursql__Statement *); + int (*_alloc_buffer)(struct __pyx_obj_6oursql__Statement *); + int (*_bind_buffer)(struct __pyx_obj_6oursql__Statement *); +}; +static struct __pyx_vtabstruct_6oursql__Statement *__pyx_vtabptr_6oursql__Statement; + + +/* "oursqlx/query.pyx":4 + * # MySQL, I really do. + * + * cdef class _ResultSet: # <<<<<<<<<<<<<< + * """_ResultSet(...) + * + */ + +struct __pyx_vtabstruct_6oursql__ResultSet { + int (*_raise_error)(struct __pyx_obj_6oursql__ResultSet *); + int (*_check_closed)(struct __pyx_obj_6oursql__ResultSet *); +}; +static struct __pyx_vtabstruct_6oursql__ResultSet *__pyx_vtabptr_6oursql__ResultSet; + + +/* "oursqlx/query.pyx":116 + * return PyCallIter_New(self.fetchone, None) + * + * cdef class _Query: # <<<<<<<<<<<<<< + * """_Query(...) + * + */ + +struct __pyx_vtabstruct_6oursql__Query { + int (*_raise_error)(struct __pyx_obj_6oursql__Query *); +}; +static struct __pyx_vtabstruct_6oursql__Query *__pyx_vtabptr_6oursql__Query; + + +/* "oursqlx/query.pyx":194 + * {'__module__': __name__}) + * + * cdef class _DictQuery(_Query): # <<<<<<<<<<<<<< + * _result_class = _DictResultSet + */ + +struct __pyx_vtabstruct_6oursql__DictQuery { + struct __pyx_vtabstruct_6oursql__Query __pyx_base; +}; +static struct __pyx_vtabstruct_6oursql__DictQuery *__pyx_vtabptr_6oursql__DictQuery; + + +/* "oursqlx/cursor.pyx":3 + * import collections, itertools + * + * cdef class Cursor: # <<<<<<<<<<<<<< + * """Cursor(...) + * + */ + +struct __pyx_vtabstruct_6oursql_Cursor { + int (*_check_closed)(struct __pyx_obj_6oursql_Cursor *); + int (*_update_fields)(struct __pyx_obj_6oursql_Cursor *, PyObject *, struct __pyx_opt_args_6oursql_6Cursor__update_fields *__pyx_optional_args); + int (*_check_statements)(struct __pyx_obj_6oursql_Cursor *); +}; +static struct __pyx_vtabstruct_6oursql_Cursor *__pyx_vtabptr_6oursql_Cursor; + + +/* "oursqlx/cursor.pyx":265 + * self.close() + * + * cdef class DictCursor(Cursor): # <<<<<<<<<<<<<< + * """DictCursor(...) + * + */ + +struct __pyx_vtabstruct_6oursql_DictCursor { + struct __pyx_vtabstruct_6oursql_Cursor __pyx_base; +}; +static struct __pyx_vtabstruct_6oursql_DictCursor *__pyx_vtabptr_6oursql_DictCursor; +#ifndef CYTHON_REFNANNY + #define CYTHON_REFNANNY 0 +#endif +#if CYTHON_REFNANNY + typedef struct { + void (*INCREF)(void*, PyObject*, int); + void (*DECREF)(void*, PyObject*, int); + void (*GOTREF)(void*, PyObject*, int); + void (*GIVEREF)(void*, PyObject*, int); + void* (*SetupContext)(const char*, int, const char*); + void (*FinishContext)(void**); + } __Pyx_RefNannyAPIStruct; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); + #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; +#ifdef WITH_THREAD + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + if (acquire_gil) { \ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + PyGILState_Release(__pyx_gilstate_save); \ + } else { \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + } +#else + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) +#endif + #define __Pyx_RefNannyFinishContext() \ + __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) +#else + #define __Pyx_RefNannyDeclarations + #define __Pyx_RefNannySetupContext(name, acquire_gil) + #define __Pyx_RefNannyFinishContext() + #define __Pyx_INCREF(r) Py_INCREF(r) + #define __Pyx_DECREF(r) Py_DECREF(r) + #define __Pyx_GOTREF(r) + #define __Pyx_GIVEREF(r) + #define __Pyx_XINCREF(r) Py_XINCREF(r) + #define __Pyx_XDECREF(r) Py_XDECREF(r) + #define __Pyx_XGOTREF(r) + #define __Pyx_XGIVEREF(r) +#endif +#define __Pyx_XDECREF_SET(r, v) do { \ + PyObject *tmp = (PyObject *) r; \ + r = v; __Pyx_XDECREF(tmp); \ + } while (0) +#define __Pyx_DECREF_SET(r, v) do { \ + PyObject *tmp = (PyObject *) r; \ + r = v; __Pyx_DECREF(tmp); \ + } while (0) +#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) +#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) + +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro)) + return tp->tp_getattro(obj, attr_name); +#if PY_MAJOR_VERSION < 3 + if (likely(tp->tp_getattr)) + return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); +#endif + return PyObject_GetAttr(obj, attr_name); +} +#else +#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) +#endif + +static PyObject *__Pyx_GetBuiltinName(PyObject *name); + +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); + +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); + +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \ + PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \ + const char* function_name); + +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); +#else +#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) +#endif + +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o,n,NULL) +static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) { + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_setattro)) + return tp->tp_setattro(obj, attr_name, value); +#if PY_MAJOR_VERSION < 3 + if (likely(tp->tp_setattr)) + return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value); +#endif + return PyObject_SetAttr(obj, attr_name, value); +} +#else +#define __Pyx_PyObject_DelAttrStr(o,n) PyObject_DelAttr(o,n) +#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v) +#endif + +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); +#endif + +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); + +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); +#else +#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL) +#endif + +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); + +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + +static CYTHON_INLINE int __Pyx_IterFinish(void); + +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); + +static CYTHON_INLINE int __Pyx_PyDict_Contains(PyObject* item, PyObject* dict, int eq) { + int result = PyDict_Contains(dict, item); + return unlikely(result < 0) ? result : (result == (eq == Py_EQ)); +} + +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { + PyObject *value; + value = PyDict_GetItemWithError(d, key); + if (unlikely(!value)) { + if (!PyErr_Occurred()) { + PyObject* args = PyTuple_Pack(1, key); + if (likely(args)) + PyErr_SetObject(PyExc_KeyError, args); + Py_XDECREF(args); + } + return NULL; + } + Py_INCREF(value); + return value; +} +#else + #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key) +#endif + +static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); + +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); + +static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, + const char *name, int exact); + +#include + +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); + +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); + +#if PY_MAJOR_VERSION >= 3 +#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals +#else +#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals +#endif + +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { + PyListObject* L = (PyListObject*) list; + Py_ssize_t len = Py_SIZE(list); + if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) { + Py_INCREF(x); + PyList_SET_ITEM(list, len, x); + Py_SIZE(list) = len+1; + return 0; + } + return PyList_Append(list, x); +} +#else +#define __Pyx_PyList_Append(L,x) PyList_Append(L,x) +#endif + +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice( + PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop, + PyObject** py_start, PyObject** py_stop, PyObject** py_slice, + int has_cstart, int has_cstop, int wraparound); + +static CYTHON_INLINE int __Pyx_PySequence_Contains(PyObject* item, PyObject* seq, int eq) { + int result = PySequence_Contains(seq, item); + return unlikely(result < 0) ? result : (result == (eq == Py_EQ)); +} + +static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg); + +static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x); + +static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name); + +#define __Pyx_PyObject_Pop(L) (PyList_CheckExact(L) ? \ + __Pyx_PyList_Pop(L) : __Pyx__PyObject_Pop(L)) +static CYTHON_INLINE PyObject* __Pyx_PyList_Pop(PyObject* L); +static CYTHON_INLINE PyObject* __Pyx__PyObject_Pop(PyObject* L); + +static void __Pyx_WriteUnraisable(const char *name, int clineno, + int lineno, const char *filename, + int full_traceback); + +static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); +static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); + +static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); + +static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb); + +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) { + PyListObject* L = (PyListObject*) list; + Py_ssize_t len = Py_SIZE(list); + if (likely(L->allocated > len)) { + Py_INCREF(x); + PyList_SET_ITEM(list, len, x); + Py_SIZE(list) = len+1; + return 0; + } + return PyList_Append(list, x); +} +#else +#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x) +#endif + +#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \ + __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) : \ + (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i)))) +#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \ + __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) : \ + (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL)) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck); +#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \ + __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) : \ + (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL)) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck); +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, + int is_list, int wraparound, int boundscheck); + +static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed); + +static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) { +#if CYTHON_COMPILING_IN_CPYTHON + PyObject* none = _PyList_Extend((PyListObject*)L, v); + if (unlikely(!none)) + return -1; + Py_DECREF(none); + return 0; +#else + return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v); +#endif +} + +static CYTHON_INLINE PyObject* __Pyx_PyFrozenSet_New(PyObject* it) { + if (it) { + PyObject* result; +#if CYTHON_COMPILING_IN_PYPY + PyObject* args; + args = PyTuple_Pack(1, it); + if (unlikely(!args)) + return NULL; + result = PyObject_Call((PyObject*)&PyFrozenSet_Type, args, NULL); + Py_DECREF(args); + return result; +#else + if (PyFrozenSet_CheckExact(it)) { + Py_INCREF(it); + return it; + } + result = PyFrozenSet_New(it); + if (unlikely(!result)) + return NULL; + if (likely(PySet_GET_SIZE(result))) + return result; + Py_DECREF(result); +#endif + } +#if CYTHON_COMPILING_IN_CPYTHON + return PyFrozenSet_Type.tp_new(&PyFrozenSet_Type, __pyx_empty_tuple, NULL); +#else + return PyObject_Call((PyObject*)&PyFrozenSet_Type, __pyx_empty_tuple, NULL); +#endif +} + +static int __Pyx_call_next_tp_traverse(PyObject* obj, visitproc v, void *a, traverseproc current_tp_traverse); + +static void __Pyx_call_next_tp_clear(PyObject* obj, inquiry current_tp_dealloc); + +static int __Pyx_SetVtable(PyObject *dict, void *vtable); + +static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases); + +static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname, + PyObject *mkw, PyObject *modname, PyObject *doc); +static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict, + PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass); + +static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type); + +#define __Pyx_CyFunction_USED 1 +#include +#define __Pyx_CYFUNCTION_STATICMETHOD 0x01 +#define __Pyx_CYFUNCTION_CLASSMETHOD 0x02 +#define __Pyx_CYFUNCTION_CCLASS 0x04 +#define __Pyx_CyFunction_GetClosure(f) \ + (((__pyx_CyFunctionObject *) (f))->func_closure) +#define __Pyx_CyFunction_GetClassObj(f) \ + (((__pyx_CyFunctionObject *) (f))->func_classobj) +#define __Pyx_CyFunction_Defaults(type, f) \ + ((type *)(((__pyx_CyFunctionObject *) (f))->defaults)) +#define __Pyx_CyFunction_SetDefaultsGetter(f, g) \ + ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g) +typedef struct { + PyCFunctionObject func; +#if PY_VERSION_HEX < 0x030500A0 + PyObject *func_weakreflist; +#endif + PyObject *func_dict; + PyObject *func_name; + PyObject *func_qualname; + PyObject *func_doc; + PyObject *func_globals; + PyObject *func_code; + PyObject *func_closure; + PyObject *func_classobj; + void *defaults; + int defaults_pyobjects; + int flags; + PyObject *defaults_tuple; + PyObject *defaults_kwdict; + PyObject *(*defaults_getter)(PyObject *); + PyObject *func_annotations; +} __pyx_CyFunctionObject; +static PyTypeObject *__pyx_CyFunctionType = 0; +#define __Pyx_CyFunction_NewEx(ml, flags, qualname, self, module, globals, code) \ + __Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, qualname, self, module, globals, code) +static PyObject *__Pyx_CyFunction_New(PyTypeObject *, PyMethodDef *ml, + int flags, PyObject* qualname, + PyObject *self, + PyObject *module, PyObject *globals, + PyObject* code); +static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m, + size_t size, + int pyobjects); +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m, + PyObject *tuple); +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m, + PyObject *dict); +static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m, + PyObject *dict); +static int __Pyx_CyFunction_init(void); + +typedef struct { + int code_line; + PyCodeObject* code_object; +} __Pyx_CodeObjectCacheEntry; +struct __Pyx_CodeObjectCache { + int count; + int max_count; + __Pyx_CodeObjectCacheEntry* entries; +}; +static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); +static PyCodeObject *__pyx_find_code_object(int code_line); +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); + +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename); + +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value); + +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_long(unsigned long value); + +static CYTHON_INLINE unsigned long __Pyx_PyInt_As_unsigned_long(PyObject *); + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); + +static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); + +static CYTHON_INLINE unsigned int __Pyx_PyInt_As_unsigned_int(PyObject *); + +#ifndef __PYX_FORCE_INIT_THREADS + #define __PYX_FORCE_INIT_THREADS 0 +#endif + +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_int(unsigned int value); + +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); + +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_my_ulonglong(my_ulonglong value); + +static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); + +static int __Pyx_check_binary_version(void); + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); + +static int __pyx_f_6oursql_10Connection__raise_error(struct __pyx_obj_6oursql_Connection *__pyx_v_self); /* proto*/ +static int __pyx_f_6oursql_10Connection__check_closed(struct __pyx_obj_6oursql_Connection *__pyx_v_self); /* proto*/ +static int __pyx_f_6oursql_10_Statement__raise_error(struct __pyx_obj_6oursql__Statement *__pyx_v_self); /* proto*/ +static int __pyx_f_6oursql_10_Statement__check_closed(struct __pyx_obj_6oursql__Statement *__pyx_v_self); /* proto*/ +static int __pyx_f_6oursql_10_Statement__alloc_buffer(struct __pyx_obj_6oursql__Statement *__pyx_v_self); /* proto*/ +static int __pyx_f_6oursql_10_Statement__bind_buffer(struct __pyx_obj_6oursql__Statement *__pyx_v_self); /* proto*/ +static int __pyx_f_6oursql_10_ResultSet__raise_error(struct __pyx_obj_6oursql__ResultSet *__pyx_v_self); /* proto*/ +static int __pyx_f_6oursql_10_ResultSet__check_closed(struct __pyx_obj_6oursql__ResultSet *__pyx_v_self); /* proto*/ +static int __pyx_f_6oursql_6_Query__raise_error(struct __pyx_obj_6oursql__Query *__pyx_v_self); /* proto*/ +static int __pyx_f_6oursql_6Cursor__check_closed(struct __pyx_obj_6oursql_Cursor *__pyx_v_self); /* proto*/ +static int __pyx_f_6oursql_6Cursor__update_fields(struct __pyx_obj_6oursql_Cursor *__pyx_v_self, PyObject *__pyx_v_stmt, struct __pyx_opt_args_6oursql_6Cursor__update_fields *__pyx_optional_args); /* proto*/ +static int __pyx_f_6oursql_6Cursor__check_statements(struct __pyx_obj_6oursql_Cursor *__pyx_v_self); /* proto*/ + +/* Module declarations from 'oursql' */ +static PyTypeObject *__pyx_ptype_6oursql_Connection = 0; +static PyTypeObject *__pyx_ptype_6oursql__DictWhateverMixin = 0; +static PyTypeObject *__pyx_ptype_6oursql__AbstractIterWrapper = 0; +static PyTypeObject *__pyx_ptype_6oursql__BinaryWhateverMixin = 0; +static PyTypeObject *__pyx_ptype_6oursql_IterWrapper = 0; +static PyTypeObject *__pyx_ptype_6oursql_FileWrapper = 0; +static PyTypeObject *__pyx_ptype_6oursql__Statement = 0; +static PyTypeObject *__pyx_ptype_6oursql__ResultStringStream = 0; +static PyTypeObject *__pyx_ptype_6oursql__ResultSet = 0; +static PyTypeObject *__pyx_ptype_6oursql__Query = 0; +static PyTypeObject *__pyx_ptype_6oursql__DictQuery = 0; +static PyTypeObject *__pyx_ptype_6oursql_Cursor = 0; +static PyTypeObject *__pyx_ptype_6oursql_DictCursor = 0; +static PyTypeObject *__pyx_ptype_6oursql__DBAPITypeObject = 0; +static unsigned int __pyx_v_6oursql_UNSIGNED_NUM_FLAG; +static my_ulonglong __pyx_v_6oursql_ull_negone; +static CYTHON_INLINE MYSQL *__pyx_f_6oursql_mysql_real_connect(MYSQL *, char *, char *, char *, char *, unsigned int, char *, unsigned long); /*proto*/ +static CYTHON_INLINE int __pyx_f_6oursql_mysql_ping(MYSQL *); /*proto*/ +static CYTHON_INLINE my_bool __pyx_f_6oursql_mysql_commit(MYSQL *); /*proto*/ +static CYTHON_INLINE my_bool __pyx_f_6oursql_mysql_rollback(MYSQL *); /*proto*/ +static CYTHON_INLINE int __pyx_f_6oursql_mysql_stmt_prepare(MYSQL_STMT *, char *, unsigned long); /*proto*/ +static CYTHON_INLINE int __pyx_f_6oursql_mysql_stmt_execute(MYSQL_STMT *); /*proto*/ +static CYTHON_INLINE int __pyx_f_6oursql_mysql_stmt_fetch(MYSQL_STMT *); /*proto*/ +static CYTHON_INLINE my_bool __pyx_f_6oursql_mysql_stmt_send_long_data(MYSQL_STMT *, unsigned int, char *, unsigned long); /*proto*/ +static CYTHON_INLINE int __pyx_f_6oursql_mysql_stmt_fetch_column(MYSQL_STMT *, MYSQL_BIND *, unsigned int, unsigned long); /*proto*/ +static CYTHON_INLINE int __pyx_f_6oursql_mysql_stmt_store_result(MYSQL_STMT *); /*proto*/ +static CYTHON_INLINE int __pyx_f_6oursql_mysql_real_query(MYSQL *, char *, unsigned long); /*proto*/ +static CYTHON_INLINE MYSQL_RES *__pyx_f_6oursql_mysql_store_result(MYSQL *); /*proto*/ +static CYTHON_INLINE MYSQL_ROW __pyx_f_6oursql_mysql_fetch_row(MYSQL_RES *); /*proto*/ +static unsigned long __pyx_f_6oursql_bitval_from_char_p(unsigned char *, Py_ssize_t); /*proto*/ +static PyObject *__pyx_f_6oursql_conversion_info_from_res(MYSQL_RES *, int); /*proto*/ +static PyObject *__pyx_f_6oursql_description_from_res(MYSQL_RES *, int, int); /*proto*/ +#define __Pyx_MODULE_NAME "oursql" +int __pyx_module_is_main_oursql = 0; + +/* Implementation of 'oursql' */ +static PyObject *__pyx_builtin_buffer; +static PyObject *__pyx_builtin_StandardError; +static PyObject *__pyx_builtin_super; +static PyObject *__pyx_builtin_zip; +static PyObject *__pyx_builtin_MemoryError; +static PyObject *__pyx_builtin_StopIteration; +static PyObject *__pyx_builtin_ValueError; +static PyObject *__pyx_builtin_TypeError; +static PyObject *__pyx_builtin_id; +static PyObject *__pyx_pf_6oursql_5Error___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_message, PyObject *__pyx_v_errno, PyObject *__pyx_v_extra); /* proto */ +static PyObject *__pyx_pf_6oursql_18_DictWhateverMixin_fetchone(struct __pyx_obj_6oursql__DictWhateverMixin *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6oursql__exception_from_errno(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_err); /* proto */ +static PyObject *__pyx_pf_6oursql_2_do_warnings_query(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_6oursql_Connection *__pyx_v_conn); /* proto */ +static PyObject *__pyx_pf_6oursql_4_bitval_from_string(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_s); /* proto */ +static PyObject *__pyx_pf_6oursql_6_datetime_from_string(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_s); /* proto */ +static PyObject *__pyx_pf_6oursql_8_date_from_string(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_s); /* proto */ +static PyObject *__pyx_pf_6oursql_10_time_from_string(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_s); /* proto */ +static PyObject *__pyx_pf_6oursql_12TimestampFromTicks(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_ticks); /* proto */ +static PyObject *__pyx_pf_6oursql_14DateFromTicks(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_ticks); /* proto */ +static PyObject *__pyx_pf_6oursql_16TimeFromTicks(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_ticks); /* proto */ +static int __pyx_pf_6oursql_10Connection___cinit__(struct __pyx_obj_6oursql_Connection *__pyx_v_self, char *__pyx_v_host, char *__pyx_v_user, char *__pyx_v_passwd, char *__pyx_v_db, unsigned int __pyx_v_port, char *__pyx_v_unix_socket, PyObject *__pyx_v_connect_timeout, PyObject *__pyx_v_read_timeout, PyObject *__pyx_v_write_timeout, PyObject *__pyx_v_protocol, PyObject *__pyx_v_ssl, char *__pyx_v_read_default_file, char *__pyx_v_read_default_group, char *__pyx_v_init_command, char *__pyx_v_charset_dir, char *__pyx_v_shared_memory_base_name, int __pyx_v_local_infile, int __pyx_v_require_secure_auth, int __pyx_v_compress, int __pyx_v_report_truncation, int __pyx_v_found_rows, int __pyx_v_use_unicode, PyObject *__pyx_v_charset, int __pyx_v_autoping, PyObject *__pyx_v_default_cursor, int __pyx_v_raise_on_warnings, CYTHON_UNUSED int __pyx_v_multi_results, CYTHON_UNUSED int __pyx_v_multi_statements, int __pyx_v_autoreconnect); /* proto */ +static PyObject *__pyx_pf_6oursql_10Connection_2_setup_ssl_options(struct __pyx_obj_6oursql_Connection *__pyx_v_self, char *__pyx_v_key, char *__pyx_v_cert, char *__pyx_v_ca, char *__pyx_v_capath, char *__pyx_v_cipher); /* proto */ +static PyObject *__pyx_pf_6oursql_10Connection_4close(struct __pyx_obj_6oursql_Connection *__pyx_v_self); /* proto */ +static void __pyx_pf_6oursql_10Connection_6__dealloc__(struct __pyx_obj_6oursql_Connection *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6oursql_10Connection_8ping(struct __pyx_obj_6oursql_Connection *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6oursql_10Connection_10commit(struct __pyx_obj_6oursql_Connection *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6oursql_10Connection_12rollback(struct __pyx_obj_6oursql_Connection *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6oursql_10Connection_7charset___get__(struct __pyx_obj_6oursql_Connection *__pyx_v_self); /* proto */ +static int __pyx_pf_6oursql_10Connection_7charset_2__set__(struct __pyx_obj_6oursql_Connection *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static PyObject *__pyx_pf_6oursql_10Connection_14warning_count(struct __pyx_obj_6oursql_Connection *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6oursql_10Connection_16cursor(struct __pyx_obj_6oursql_Connection *__pyx_v_self, PyObject *__pyx_v_cursor_class, PyObject *__pyx_v_kwargs); /* proto */ +static PyObject *__pyx_pf_6oursql_10Connection_11server_info___get__(struct __pyx_obj_6oursql_Connection *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6oursql_10Connection_10ssl_cipher___get__(struct __pyx_obj_6oursql_Connection *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6oursql_10Connection_18__enter__(struct __pyx_obj_6oursql_Connection *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6oursql_10Connection_20__exit__(struct __pyx_obj_6oursql_Connection *__pyx_v_self, PyObject *__pyx_v_exc, PyObject *__pyx_v_value, PyObject *__pyx_v_tb); /* proto */ +static PyObject *__pyx_pf_6oursql_10Connection_22_escape_string(struct __pyx_obj_6oursql_Connection *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static PyObject *__pyx_pf_6oursql_10Connection_24_escape_unicode_string(struct __pyx_obj_6oursql_Connection *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static PyObject *__pyx_pf_6oursql_10Connection_11use_unicode___get__(struct __pyx_obj_6oursql_Connection *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6oursql_10Connection_8autoping___get__(struct __pyx_obj_6oursql_Connection *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6oursql_10Connection_17raise_on_warnings___get__(struct __pyx_obj_6oursql_Connection *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6oursql_10Connection_14default_cursor___get__(struct __pyx_obj_6oursql_Connection *__pyx_v_self); /* proto */ +static int __pyx_pf_6oursql_10Connection_14default_cursor_2__set__(struct __pyx_obj_6oursql_Connection *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_6oursql_10Connection_14default_cursor_4__del__(struct __pyx_obj_6oursql_Connection *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6oursql_20_AbstractIterWrapper___iter__(struct __pyx_obj_6oursql__AbstractIterWrapper *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6oursql_20_BinaryWhateverMixin___next__(struct __pyx_obj_6oursql__BinaryWhateverMixin *__pyx_v_self); /* proto */ +static int __pyx_pf_6oursql_11IterWrapper___cinit__(struct __pyx_obj_6oursql_IterWrapper *__pyx_v_self, PyObject *__pyx_v_iterobj); /* proto */ +static PyObject *__pyx_pf_6oursql_11IterWrapper_2__next__(struct __pyx_obj_6oursql_IterWrapper *__pyx_v_self); /* proto */ +static int __pyx_pf_6oursql_11FileWrapper___cinit__(struct __pyx_obj_6oursql_FileWrapper *__pyx_v_self, PyObject *__pyx_v_fileobj, PyObject *__pyx_v_chunksize, int __pyx_v_doclose); /* proto */ +static PyObject *__pyx_pf_6oursql_11FileWrapper_2__next__(struct __pyx_obj_6oursql_FileWrapper *__pyx_v_self); /* proto */ +static int __pyx_pf_6oursql_10_Statement___cinit__(struct __pyx_obj_6oursql__Statement *__pyx_v_self, struct __pyx_obj_6oursql_Connection *__pyx_v_connection, unsigned long __pyx_v_string_limit, int __pyx_v_show_table, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */ +static void __pyx_pf_6oursql_10_Statement_2__dealloc__(struct __pyx_obj_6oursql__Statement *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6oursql_10_Statement_4close(struct __pyx_obj_6oursql__Statement *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6oursql_10_Statement_12string_limit___get__(struct __pyx_obj_6oursql__Statement *__pyx_v_self); /* proto */ +static int __pyx_pf_6oursql_10_Statement_12string_limit_2__set__(struct __pyx_obj_6oursql__Statement *__pyx_v_self, unsigned long __pyx_v_value); /* proto */ +static PyObject *__pyx_pf_6oursql_10_Statement_6prepare(struct __pyx_obj_6oursql__Statement *__pyx_v_self, PyObject *__pyx_v_statement); /* proto */ +static PyObject *__pyx_pf_6oursql_10_Statement_10has_result___get__(struct __pyx_obj_6oursql__Statement *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6oursql_10_Statement_11description___get__(struct __pyx_obj_6oursql__Statement *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6oursql_10_Statement_12column_names___get__(struct __pyx_obj_6oursql__Statement *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6oursql_10_Statement_8execute(struct __pyx_obj_6oursql__Statement *__pyx_v_self, PyObject *__pyx_v_parameters); /* proto */ +static PyObject *__pyx_pf_6oursql_10_Statement_10fetchone(struct __pyx_obj_6oursql__Statement *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6oursql_10_Statement_12fetchall(struct __pyx_obj_6oursql__Statement *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6oursql_10_Statement_14buffer_results(struct __pyx_obj_6oursql__Statement *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6oursql_10_Statement_16nextset(CYTHON_UNUSED struct __pyx_obj_6oursql__Statement *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6oursql_10_Statement_18__iter__(struct __pyx_obj_6oursql__Statement *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6oursql_10_Statement_8rowcount___get__(struct __pyx_obj_6oursql__Statement *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6oursql_10_Statement_9lastrowid___get__(struct __pyx_obj_6oursql__Statement *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6oursql_10_Statement_13prefetch_rows___get__(struct __pyx_obj_6oursql__Statement *__pyx_v_self); /* proto */ +static int __pyx_pf_6oursql_10_Statement_13prefetch_rows_2__set__(struct __pyx_obj_6oursql__Statement *__pyx_v_self, unsigned long __pyx_v_value); /* proto */ +static PyObject *__pyx_pf_6oursql_10_Statement_8warnings___get__(struct __pyx_obj_6oursql__Statement *__pyx_v_self); /* proto */ +static int __pyx_pf_6oursql_10_Statement_8warnings_2__set__(struct __pyx_obj_6oursql__Statement *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_6oursql_10_Statement_8warnings_4__del__(struct __pyx_obj_6oursql__Statement *__pyx_v_self); /* proto */ +static int __pyx_pf_6oursql_19_ResultStringStream___cinit__(struct __pyx_obj_6oursql__ResultStringStream *__pyx_v_self, struct __pyx_obj_6oursql__Statement *__pyx_v_stmt, unsigned int __pyx_v_index, unsigned int __pyx_v_length); /* proto */ +static PyObject *__pyx_pf_6oursql_19_ResultStringStream_2read(struct __pyx_obj_6oursql__ResultStringStream *__pyx_v_self, Py_ssize_t __pyx_v_size); /* proto */ +static int __pyx_pf_6oursql_10_ResultSet___cinit__(struct __pyx_obj_6oursql__ResultSet *__pyx_v_self, struct __pyx_obj_6oursql_Connection *__pyx_v_conn, CYTHON_UNUSED int __pyx_v_show_table, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */ +static void __pyx_pf_6oursql_10_ResultSet_2__dealloc__(struct __pyx_obj_6oursql__ResultSet *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6oursql_10_ResultSet_4close(struct __pyx_obj_6oursql__ResultSet *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6oursql_10_ResultSet_10has_result___get__(struct __pyx_obj_6oursql__ResultSet *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6oursql_10_ResultSet_6fetchone(struct __pyx_obj_6oursql__ResultSet *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6oursql_10_ResultSet_8fetchall(struct __pyx_obj_6oursql__ResultSet *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6oursql_10_ResultSet_10__iter__(struct __pyx_obj_6oursql__ResultSet *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6oursql_10_ResultSet_8rowcount___get__(struct __pyx_obj_6oursql__ResultSet *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6oursql_10_ResultSet_9lastrowid___get__(struct __pyx_obj_6oursql__ResultSet *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6oursql_10_ResultSet_11description___get__(struct __pyx_obj_6oursql__ResultSet *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6oursql_10_ResultSet_12column_names___get__(struct __pyx_obj_6oursql__ResultSet *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6oursql_10_ResultSet_8warnings___get__(struct __pyx_obj_6oursql__ResultSet *__pyx_v_self); /* proto */ +static int __pyx_pf_6oursql_10_ResultSet_8warnings_2__set__(struct __pyx_obj_6oursql__ResultSet *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_6oursql_10_ResultSet_8warnings_4__del__(struct __pyx_obj_6oursql__ResultSet *__pyx_v_self); /* proto */ +static int __pyx_pf_6oursql_6_Query___cinit__(struct __pyx_obj_6oursql__Query *__pyx_v_self, struct __pyx_obj_6oursql_Connection *__pyx_v_conn, PyObject *__pyx_v_query, PyObject *__pyx_v_a, PyObject *__pyx_v_kw); /* proto */ +static PyObject *__pyx_pf_6oursql_6_Query_2new_result(struct __pyx_obj_6oursql__Query *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6oursql_6_Query_4nextset(struct __pyx_obj_6oursql__Query *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6oursql_6_Query_6fetchone(struct __pyx_obj_6oursql__Query *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6oursql_6_Query_8__iter__(struct __pyx_obj_6oursql__Query *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6oursql_6_Query_10fetchall(struct __pyx_obj_6oursql__Query *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6oursql_6_Query_8rowcount___get__(struct __pyx_obj_6oursql__Query *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6oursql_6_Query_9lastrowid___get__(struct __pyx_obj_6oursql__Query *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6oursql_6_Query_11description___get__(struct __pyx_obj_6oursql__Query *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6oursql_6_Query_8warnings___get__(struct __pyx_obj_6oursql__Query *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6oursql_6_Query_10has_result___get__(struct __pyx_obj_6oursql__Query *__pyx_v_self); /* proto */ +static int __pyx_pf_6oursql_6Cursor___cinit__(struct __pyx_obj_6oursql_Cursor *__pyx_v_self, struct __pyx_obj_6oursql_Connection *__pyx_v_conn, int __pyx_v_try_plain_query, PyObject *__pyx_v_kwargs); /* proto */ +static PyObject *__pyx_pf_6oursql_6Cursor_2close(struct __pyx_obj_6oursql_Cursor *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6oursql_6Cursor_4_new_statement(struct __pyx_obj_6oursql_Cursor *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6oursql_6Cursor_6_new_query(struct __pyx_obj_6oursql_Cursor *__pyx_v_self, PyObject *__pyx_v_query); /* proto */ +static PyObject *__pyx_pf_6oursql_6Cursor_8callproc(CYTHON_UNUSED struct __pyx_obj_6oursql_Cursor *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_procname, CYTHON_UNUSED PyObject *__pyx_v_params); /* proto */ +static PyObject *__pyx_pf_6oursql_6Cursor_10_do_autoping(struct __pyx_obj_6oursql_Cursor *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6oursql_6Cursor_12execute(struct __pyx_obj_6oursql_Cursor *__pyx_v_self, PyObject *__pyx_v_query, PyObject *__pyx_v_params, PyObject *__pyx_v_plain_query); /* proto */ +static PyObject *__pyx_pf_6oursql_6Cursor_14executemany(struct __pyx_obj_6oursql_Cursor *__pyx_v_self, PyObject *__pyx_v_query, PyObject *__pyx_v_parambatch); /* proto */ +static PyObject *__pyx_pf_6oursql_6Cursor_16nextset(struct __pyx_obj_6oursql_Cursor *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6oursql_6Cursor_18fetchone(struct __pyx_obj_6oursql_Cursor *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6oursql_6Cursor_20fetchmany(struct __pyx_obj_6oursql_Cursor *__pyx_v_self, PyObject *__pyx_v_size); /* proto */ +static PyObject *__pyx_pf_6oursql_6Cursor_22fetchall(struct __pyx_obj_6oursql_Cursor *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6oursql_6Cursor_24__iter__(struct __pyx_obj_6oursql_Cursor *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6oursql_6Cursor_10connection___get__(struct __pyx_obj_6oursql_Cursor *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6oursql_6Cursor_26setinputsizes(CYTHON_UNUSED struct __pyx_obj_6oursql_Cursor *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_sizes); /* proto */ +static PyObject *__pyx_pf_6oursql_6Cursor_28setoutputsize(CYTHON_UNUSED struct __pyx_obj_6oursql_Cursor *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_size, CYTHON_UNUSED PyObject *__pyx_v_column); /* proto */ +static PyObject *__pyx_pf_6oursql_6Cursor_30__enter__(struct __pyx_obj_6oursql_Cursor *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6oursql_6Cursor_32__exit__(struct __pyx_obj_6oursql_Cursor *__pyx_v_self, PyObject *__pyx_v_exc, CYTHON_UNUSED PyObject *__pyx_v_value, CYTHON_UNUSED PyObject *__pyx_v_tb); /* proto */ +static PyObject *__pyx_pf_6oursql_6Cursor_11_statements___get__(struct __pyx_obj_6oursql_Cursor *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6oursql_6Cursor_12_stmt_kwargs___get__(struct __pyx_obj_6oursql_Cursor *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6oursql_6Cursor_8rowcount___get__(struct __pyx_obj_6oursql_Cursor *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6oursql_6Cursor_9lastrowid___get__(struct __pyx_obj_6oursql_Cursor *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6oursql_6Cursor_11description___get__(struct __pyx_obj_6oursql_Cursor *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6oursql_6Cursor_8messages___get__(struct __pyx_obj_6oursql_Cursor *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6oursql_6Cursor_9arraysize___get__(struct __pyx_obj_6oursql_Cursor *__pyx_v_self); /* proto */ +static int __pyx_pf_6oursql_6Cursor_9arraysize_2__set__(struct __pyx_obj_6oursql_Cursor *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_6oursql_16_DBAPITypeObject___init__(struct __pyx_obj_6oursql__DBAPITypeObject *__pyx_v_self, PyObject *__pyx_v_values); /* proto */ +static PyObject *__pyx_pf_6oursql_16_DBAPITypeObject_2__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op); /* proto */ +static PyObject *__pyx_pf_6oursql_16_DBAPITypeObject_4__repr__(struct __pyx_obj_6oursql__DBAPITypeObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6oursql_16_DBAPITypeObject_6values___get__(struct __pyx_obj_6oursql__DBAPITypeObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_tp_new_6oursql_Connection(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_6oursql__DictWhateverMixin(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_6oursql__AbstractIterWrapper(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_6oursql__BinaryWhateverMixin(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_6oursql_IterWrapper(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_6oursql_FileWrapper(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_6oursql__Statement(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_6oursql__ResultStringStream(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_6oursql__ResultSet(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_6oursql__Query(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_6oursql__DictQuery(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_6oursql_Cursor(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_6oursql_DictCursor(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_6oursql__DBAPITypeObject(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static char __pyx_k_q[] = "q"; +static char __pyx_k_s[] = "s"; +static char __pyx_k_ca[] = "ca"; +static char __pyx_k_db[] = "db"; +static char __pyx_k_id[] = "id"; +static char __pyx_k_ss[] = "ss"; +static char __pyx_k_tb[] = "tb"; +static char __pyx_k_tt[] = "tt"; +static char __pyx_k_2_0[] = "2.0"; +static char __pyx_k__20[] = ""; +static char __pyx_k_day[] = "day"; +static char __pyx_k_doc[] = "__doc__"; +static char __pyx_k_err[] = "err"; +static char __pyx_k_exc[] = "exc"; +static char __pyx_k_get[] = "get"; +static char __pyx_k_key[] = "key"; +static char __pyx_k_pop[] = "pop"; +static char __pyx_k_ret[] = "ret"; +static char __pyx_k_s_s[] = "%s.%s"; +static char __pyx_k_ssl[] = "ssl"; +static char __pyx_k_tcp[] = "tcp"; +static char __pyx_k_zip[] = "zip"; +static char __pyx_k_DATE[] = "DATE"; +static char __pyx_k_Date[] = "Date"; +static char __pyx_k_Note[] = "Note"; +static char __pyx_k_TIME[] = "TIME"; +static char __pyx_k_Time[] = "Time"; +static char __pyx_k_cert[] = "cert"; +static char __pyx_k_conn[] = "conn"; +static char __pyx_k_date[] = "date"; +static char __pyx_k_exit[] = "__exit__"; +static char __pyx_k_host[] = "host"; +static char __pyx_k_hour[] = "hour"; +static char __pyx_k_init[] = "__init__"; +static char __pyx_k_kind[] = "kind"; +static char __pyx_k_main[] = "__main__"; +static char __pyx_k_name[] = "__name__"; +static char __pyx_k_next[] = "next"; +static char __pyx_k_ping[] = "ping"; +static char __pyx_k_pipe[] = "pipe"; +static char __pyx_k_port[] = "port"; +static char __pyx_k_read[] = "read"; +static char __pyx_k_self[] = "self"; +static char __pyx_k_size[] = "size"; +static char __pyx_k_stmt[] = "stmt"; +static char __pyx_k_test[] = "__test__"; +static char __pyx_k_time[] = "time"; +static char __pyx_k_user[] = "user"; +static char __pyx_k_utf8[] = "utf8"; +static char __pyx_k_year[] = "year"; +static char __pyx_k_0_9_3[] = "0.9.3"; +static char __pyx_k_Error[] = "Error"; +static char __pyx_k_H_M_S[] = "%H:%M:%S"; +static char __pyx_k_ROWID[] = "ROWID"; +static char __pyx_k_Y_m_d[] = "%Y-%m-%d"; +static char __pyx_k_class[] = "__class__"; +static char __pyx_k_clear[] = "clear"; +static char __pyx_k_close[] = "close"; +static char __pyx_k_deque[] = "deque"; +static char __pyx_k_enter[] = "__enter__"; +static char __pyx_k_errno[] = "errno"; +static char __pyx_k_extra[] = "extra"; +static char __pyx_k_index[] = "index"; +static char __pyx_k_month[] = "month"; +static char __pyx_k_qmark[] = "qmark"; +static char __pyx_k_query[] = "query"; +static char __pyx_k_super[] = "super"; +static char __pyx_k_ticks[] = "ticks"; +static char __pyx_k_value[] = "value"; +static char __pyx_k_BINARY[] = "BINARY"; +static char __pyx_k_Binary[] = "Binary"; +static char __pyx_k_NUMBER[] = "NUMBER"; +static char __pyx_k_STRING[] = "STRING"; +static char __pyx_k_append[] = "append"; +static char __pyx_k_author[] = "__author__"; +static char __pyx_k_buffer[] = "buffer"; +static char __pyx_k_capath[] = "capath"; +static char __pyx_k_cipher[] = "cipher"; +static char __pyx_k_codecs[] = "codecs"; +static char __pyx_k_column[] = "column"; +static char __pyx_k_commit[] = "commit"; +static char __pyx_k_cursor[] = "cursor"; +static char __pyx_k_decode[] = "decode"; +static char __pyx_k_encode[] = "encode"; +static char __pyx_k_errnos[] = "errnos"; +static char __pyx_k_extend[] = "extend"; +static char __pyx_k_import[] = "__import__"; +static char __pyx_k_length[] = "length"; +static char __pyx_k_memory[] = "memory"; +static char __pyx_k_minute[] = "minute"; +static char __pyx_k_module[] = "__module__"; +static char __pyx_k_oursql[] = "oursql"; +static char __pyx_k_params[] = "params"; +static char __pyx_k_passwd[] = "passwd"; +static char __pyx_k_second[] = "second"; +static char __pyx_k_socket[] = "socket"; +static char __pyx_k_values[] = "values"; +static char __pyx_k_Decimal[] = "Decimal"; +static char __pyx_k_Warning[] = "Warning"; +static char __pyx_k_charset[] = "charset"; +static char __pyx_k_connect[] = "connect"; +static char __pyx_k_decimal[] = "decimal"; +static char __pyx_k_doclose[] = "doclose"; +static char __pyx_k_execute[] = "execute"; +static char __pyx_k_fileobj[] = "fileobj"; +static char __pyx_k_iterobj[] = "iterobj"; +static char __pyx_k_message[] = "message"; +static char __pyx_k_nextset[] = "nextset"; +static char __pyx_k_popleft[] = "popleft"; +static char __pyx_k_prepare[] = "prepare"; +static char __pyx_k_version[] = "__version__"; +static char __pyx_k_DATETIME[] = "DATETIME"; +static char __pyx_k_StringIO[] = "StringIO"; +static char __pyx_k_apilevel[] = "apilevel"; +static char __pyx_k_autoping[] = "autoping"; +static char __pyx_k_compress[] = "compress"; +static char __pyx_k_datetime[] = "datetime"; +static char __pyx_k_fetchall[] = "fetchall"; +static char __pyx_k_fetchone[] = "fetchone"; +static char __pyx_k_procname[] = "procname"; +static char __pyx_k_protocol[] = "protocol"; +static char __pyx_k_qualname[] = "__qualname__"; +static char __pyx_k_rollback[] = "rollback"; +static char __pyx_k_rowcount[] = "rowcount"; +static char __pyx_k_strptime[] = "strptime"; +static char __pyx_k_warnings[] = "warnings"; +static char __pyx_k_DataError[] = "DataError"; +static char __pyx_k_TIMESTAMP[] = "TIMESTAMP"; +static char __pyx_k_Timestamp[] = "Timestamp"; +static char __pyx_k_TypeError[] = "TypeError"; +static char __pyx_k_cStringIO[] = "cStringIO"; +static char __pyx_k_chunksize[] = "chunksize"; +static char __pyx_k_getreader[] = "getreader"; +static char __pyx_k_itertools[] = "itertools"; +static char __pyx_k_lastrowid[] = "lastrowid"; +static char __pyx_k_localtime[] = "localtime"; +static char __pyx_k_metaclass[] = "__metaclass__"; +static char __pyx_k_new_query[] = "_new_query"; +static char __pyx_k_prepare_2[] = "__prepare__"; +static char __pyx_k_ValueError[] = "ValueError"; +static char __pyx_k_connection[] = "connection"; +static char __pyx_k_exceptions[] = "exceptions"; +static char __pyx_k_found_rows[] = "found_rows"; +static char __pyx_k_has_result[] = "has_result"; +static char __pyx_k_new_result[] = "new_result"; +static char __pyx_k_parambatch[] = "parambatch"; +static char __pyx_k_paramstyle[] = "paramstyle"; +static char __pyx_k_pyx_vtable[] = "__pyx_vtable__"; +static char __pyx_k_show_table[] = "show_table"; +static char __pyx_k_MemoryError[] = "MemoryError"; +static char __pyx_k_Y_m_d_H_M_S[] = "%Y-%m-%d %H:%M:%S"; +static char __pyx_k_charset_dir[] = "charset_dir"; +static char __pyx_k_client_info[] = "client_info"; +static char __pyx_k_collections[] = "collections"; +static char __pyx_k_conversions[] = "_conversions"; +static char __pyx_k_description[] = "description"; +static char __pyx_k_do_autoping[] = "_do_autoping"; +static char __pyx_k_microsecond[] = "microsecond"; +static char __pyx_k_plain_query[] = "plain_query"; +static char __pyx_k_query_class[] = "_query_class"; +static char __pyx_k_unix_socket[] = "unix_socket"; +static char __pyx_k_use_unicode[] = "use_unicode"; +static char __pyx_k_Error___init[] = "Error.__init__"; +static char __pyx_k_UnknownError[] = "UnknownError"; +static char __pyx_k_column_names[] = "column_names"; +static char __pyx_k_cursor_class[] = "cursor_class"; +static char __pyx_k_init_command[] = "init_command"; +static char __pyx_k_local_infile[] = "local_infile"; +static char __pyx_k_query_closed[] = "query closed"; +static char __pyx_k_read_timeout[] = "read_timeout"; +static char __pyx_k_result_class[] = "_result_class"; +static char __pyx_k_should_raise[] = "should_raise"; +static char __pyx_k_string_limit[] = "string_limit"; +static char __pyx_k_threadsafety[] = "threadsafety"; +static char __pyx_k_DatabaseError[] = "DatabaseError"; +static char __pyx_k_DateFromTicks[] = "DateFromTicks"; +static char __pyx_k_DictResultSet[] = "_DictResultSet"; +static char __pyx_k_DictStatement[] = "_DictStatement"; +static char __pyx_k_InternalError[] = "InternalError"; +static char __pyx_k_SHOW_WARNINGS[] = "SHOW WARNINGS"; +static char __pyx_k_StandardError[] = "StandardError"; +static char __pyx_k_StopIteration[] = "StopIteration"; +static char __pyx_k_TimeFromTicks[] = "TimeFromTicks"; +static char __pyx_k_autoreconnect[] = "autoreconnect"; +static char __pyx_k_cursor_closed[] = "cursor closed"; +static char __pyx_k_escape_string[] = "_escape_string"; +static char __pyx_k_multi_results[] = "multi_results"; +static char __pyx_k_new_statement[] = "_new_statement"; +static char __pyx_k_prefetch_rows[] = "prefetch_rows"; +static char __pyx_k_warning_count[] = "warning_count"; +static char __pyx_k_write_timeout[] = "write_timeout"; +static char __pyx_k_IntegrityError[] = "IntegrityError"; +static char __pyx_k_InterfaceError[] = "InterfaceError"; +static char __pyx_k_buffer_results[] = "buffer_results"; +static char __pyx_k_default_cursor[] = "default_cursor"; +static char __pyx_k_connect_timeout[] = "connect_timeout"; +static char __pyx_k_statement_class[] = "_statement_class"; +static char __pyx_k_try_plain_query[] = "try_plain_query"; +static char __pyx_k_OperationalError[] = "OperationalError"; +static char __pyx_k_PermissionsError[] = "PermissionsError"; +static char __pyx_k_ProgrammingError[] = "ProgrammingError"; +static char __pyx_k_conversions_dict[] = "conversions_dict"; +static char __pyx_k_date_from_string[] = "_date_from_string"; +static char __pyx_k_multi_statements[] = "multi_statements"; +static char __pyx_k_statement_closed[] = "statement closed"; +static char __pyx_k_time_from_string[] = "_time_from_string"; +static char __pyx_k_BinaryFileWrapper[] = "BinaryFileWrapper"; +static char __pyx_k_BinaryIterWrapper[] = "BinaryIterWrapper"; +static char __pyx_k_NotSupportedError[] = "NotSupportedError"; +static char __pyx_k_connection_closed[] = "connection closed"; +static char __pyx_k_do_warnings_query[] = "_do_warnings_query"; +static char __pyx_k_protocol_enum_map[] = "_protocol_enum_map"; +static char __pyx_k_raise_on_warnings[] = "raise_on_warnings"; +static char __pyx_k_read_default_file[] = "read_default_file"; +static char __pyx_k_report_truncation[] = "report_truncation"; +static char __pyx_k_setup_ssl_options[] = "_setup_ssl_options"; +static char __pyx_k_TimestampFromTicks[] = "TimestampFromTicks"; +static char __pyx_k_bitval_from_string[] = "_bitval_from_string"; +static char __pyx_k_exception_enum_map[] = "_exception_enum_map"; +static char __pyx_k_read_default_group[] = "read_default_group"; +static char __pyx_k_unknown_protocol_r[] = "unknown protocol %r"; +static char __pyx_k_require_secure_auth[] = "require_secure_auth"; +static char __pyx_k_cannot_bind_r_object[] = "cannot bind %r object"; +static char __pyx_k_datetime_from_string[] = "_datetime_from_string"; +static char __pyx_k_exception_from_errno[] = "_exception_from_errno"; +static char __pyx_k_no_results_available[] = "no results available"; +static char __pyx_k_CollatedWarningsError[] = "CollatedWarningsError"; +static char __pyx_k_query_caused_warnings[] = "query caused warnings"; +static char __pyx_k_string_limit_must_be_0[] = "string limit must be >= 0"; +static char __pyx_k_shared_memory_base_name[] = "shared_memory_base_name"; +static char __pyx_k_alloc_of_statement_failed[] = "alloc of statement failed"; +static char __pyx_k_can_t_read_negative_bytes[] = "can't read negative bytes"; +static char __pyx_k_truncated_column_d_type_d[] = "truncated column %d, type %d"; +static char __pyx_k_unknown_kind_of_warning_r[] = "unknown kind of warning: %r"; +static char __pyx_k_unorderable_types_r_and_r[] = "unorderable types: %r and %r"; +static char __pyx_k_could_not_initialize_mysql[] = "could not initialize mysql"; +static char __pyx_k_size_remaining_should_be_0[] = "size remaining should be >= 0"; +static char __pyx_k_alloc_of_conn_object_failed[] = "alloc of conn object failed"; +static char __pyx_k_must_prefetch_at_least_1_row[] = "must prefetch at least 1 row"; +static char __pyx_k_d_parameters_expected_d_given[] = "%d parameters expected, %d given"; +static char __pyx_k_DBAPITypeObject_representing_r[] = "<_DBAPITypeObject representing %r at %#x>"; +static char __pyx_k_alloc_of_result_buffers_failed[] = "alloc of result buffers failed"; +static char __pyx_k_alloc_of_bind_parameters_failed[] = "alloc of bind parameters failed"; +static char __pyx_k_column_s_appears_more_than_once[] = "column \"%s\" appears more than once in output"; +static char __pyx_k_use_the_CALL_statement_with_the[] = "use the CALL statement with the execute method to call stored procedures"; +static char __pyx_k_usr_local_src_Python_SQL_oursql[] = "/usr/local/src/Python/SQL/oursql/oursqlx/oursql.pyx"; +static char __pyx_k_Aaron_Gallagher_habnabit_gmail_c[] = "Aaron Gallagher "; +static char __pyx_k_BinaryFileWrapper_fileobj_chunks[] = "BinaryFileWrapper(fileobj, chunksize=8192, doclose=False)\n \n BinaryFileWrapper behaves exactly like FileWrapper, except the strings \n yielded from the file object are treated as bytes instead of text strings.\n "; +static char __pyx_k_BinaryIterWrapper_iterobj_Binary[] = "BinaryIterWrapper(iterobj)\n \n BinaryIterWrapper behaves like IterWrapper, except the strings yielded from\n the iterable are treated as bytes instead of text strings.\n "; +static char __pyx_k_alloc_of_result_bind_structure_f[] = "alloc of result bind structure failed"; +static char __pyx_k_binding_this_query_would_cause_r[] = "binding this query would cause rows to become unfetchable"; +static char __pyx_k_can_t_call_execute_with_both_par[] = "can't call execute with both parameters and a plain query"; +static char __pyx_k_charset_str_Get_or_set_the_conne[] = "charset -> str\n \n Get or set the connection's current encoding. If use_unicode is \n enabled, this is the encoding that will be used to decode incoming\n strings.\n "; +static char __pyx_k_executing_this_query_would_cause[] = "executing this query would cause rows to become unfetchable"; +static char __pyx_k_oursql_python_bindings_for_MySQL[] = "oursql python bindings for MySQL.\n\nThis module is a new, better set of MySQL bindings for python, supporting novel\nfeatures like parameterization!\n"; +static char __pyx_k_row_no_longer_available_from_dat[] = "row no longer available from database"; +static char __pyx_k_unknown_column_returned_as_strin[] = "unknown column returned as string"; +static char __pyx_k_usr_local_src_Python_SQL_oursql_2[] = "/usr/local/src/Python/SQL/oursql/oursqlx/util.pyx"; +static char __pyx_k_usr_local_src_Python_SQL_oursql_3[] = "/usr/local/src/Python/SQL/oursql/oursqlx/conversions.pyx"; +static PyObject *__pyx_kp_s_0_9_3; +static PyObject *__pyx_kp_s_2_0; +static PyObject *__pyx_kp_s_Aaron_Gallagher_habnabit_gmail_c; +static PyObject *__pyx_n_s_BINARY; +static PyObject *__pyx_n_s_Binary; +static PyObject *__pyx_n_s_BinaryFileWrapper; +static PyObject *__pyx_kp_s_BinaryFileWrapper_fileobj_chunks; +static PyObject *__pyx_n_s_BinaryIterWrapper; +static PyObject *__pyx_kp_s_BinaryIterWrapper_iterobj_Binary; +static PyObject *__pyx_n_s_CollatedWarningsError; +static PyObject *__pyx_n_s_DATE; +static PyObject *__pyx_n_s_DATETIME; +static PyObject *__pyx_kp_s_DBAPITypeObject_representing_r; +static PyObject *__pyx_n_s_DataError; +static PyObject *__pyx_n_s_DatabaseError; +static PyObject *__pyx_n_s_Date; +static PyObject *__pyx_n_s_DateFromTicks; +static PyObject *__pyx_n_s_Decimal; +static PyObject *__pyx_n_s_DictResultSet; +static PyObject *__pyx_n_s_DictStatement; +static PyObject *__pyx_n_s_Error; +static PyObject *__pyx_n_s_Error___init; +static PyObject *__pyx_kp_s_H_M_S; +static PyObject *__pyx_n_s_IntegrityError; +static PyObject *__pyx_n_s_InterfaceError; +static PyObject *__pyx_n_s_InternalError; +static PyObject *__pyx_n_s_MemoryError; +static PyObject *__pyx_n_s_NUMBER; +static PyObject *__pyx_n_s_NotSupportedError; +static PyObject *__pyx_n_s_Note; +static PyObject *__pyx_n_s_OperationalError; +static PyObject *__pyx_n_s_PermissionsError; +static PyObject *__pyx_n_s_ProgrammingError; +static PyObject *__pyx_n_s_ROWID; +static PyObject *__pyx_kp_s_SHOW_WARNINGS; +static PyObject *__pyx_n_s_STRING; +static PyObject *__pyx_n_s_StandardError; +static PyObject *__pyx_n_s_StopIteration; +static PyObject *__pyx_n_s_StringIO; +static PyObject *__pyx_n_s_TIME; +static PyObject *__pyx_n_s_TIMESTAMP; +static PyObject *__pyx_n_s_Time; +static PyObject *__pyx_n_s_TimeFromTicks; +static PyObject *__pyx_n_s_Timestamp; +static PyObject *__pyx_n_s_TimestampFromTicks; +static PyObject *__pyx_n_s_TypeError; +static PyObject *__pyx_n_s_UnknownError; +static PyObject *__pyx_n_s_ValueError; +static PyObject *__pyx_n_s_Warning; +static PyObject *__pyx_kp_s_Y_m_d; +static PyObject *__pyx_kp_s_Y_m_d_H_M_S; +static PyObject *__pyx_kp_s__20; +static PyObject *__pyx_kp_s_alloc_of_bind_parameters_failed; +static PyObject *__pyx_kp_s_alloc_of_conn_object_failed; +static PyObject *__pyx_kp_s_alloc_of_result_bind_structure_f; +static PyObject *__pyx_kp_s_alloc_of_result_buffers_failed; +static PyObject *__pyx_kp_s_alloc_of_statement_failed; +static PyObject *__pyx_n_s_apilevel; +static PyObject *__pyx_n_s_append; +static PyObject *__pyx_n_s_author; +static PyObject *__pyx_n_s_autoping; +static PyObject *__pyx_n_s_autoreconnect; +static PyObject *__pyx_kp_s_binding_this_query_would_cause_r; +static PyObject *__pyx_n_s_bitval_from_string; +static PyObject *__pyx_n_s_buffer; +static PyObject *__pyx_n_s_buffer_results; +static PyObject *__pyx_n_s_cStringIO; +static PyObject *__pyx_n_s_ca; +static PyObject *__pyx_kp_s_can_t_call_execute_with_both_par; +static PyObject *__pyx_kp_s_can_t_read_negative_bytes; +static PyObject *__pyx_kp_s_cannot_bind_r_object; +static PyObject *__pyx_n_s_capath; +static PyObject *__pyx_n_s_cert; +static PyObject *__pyx_n_s_charset; +static PyObject *__pyx_n_s_charset_dir; +static PyObject *__pyx_n_s_chunksize; +static PyObject *__pyx_n_s_cipher; +static PyObject *__pyx_n_s_class; +static PyObject *__pyx_n_s_clear; +static PyObject *__pyx_n_s_client_info; +static PyObject *__pyx_n_s_close; +static PyObject *__pyx_n_s_codecs; +static PyObject *__pyx_n_s_collections; +static PyObject *__pyx_n_s_column; +static PyObject *__pyx_n_s_column_names; +static PyObject *__pyx_kp_s_column_s_appears_more_than_once; +static PyObject *__pyx_n_s_commit; +static PyObject *__pyx_n_s_compress; +static PyObject *__pyx_n_s_conn; +static PyObject *__pyx_n_s_connect; +static PyObject *__pyx_n_s_connect_timeout; +static PyObject *__pyx_n_s_connection; +static PyObject *__pyx_kp_s_connection_closed; +static PyObject *__pyx_n_s_conversions; +static PyObject *__pyx_n_s_conversions_dict; +static PyObject *__pyx_kp_s_could_not_initialize_mysql; +static PyObject *__pyx_n_s_cursor; +static PyObject *__pyx_n_s_cursor_class; +static PyObject *__pyx_kp_s_cursor_closed; +static PyObject *__pyx_kp_s_d_parameters_expected_d_given; +static PyObject *__pyx_n_s_date; +static PyObject *__pyx_n_s_date_from_string; +static PyObject *__pyx_n_s_datetime; +static PyObject *__pyx_n_s_datetime_from_string; +static PyObject *__pyx_n_s_day; +static PyObject *__pyx_n_s_db; +static PyObject *__pyx_n_s_decimal; +static PyObject *__pyx_n_s_decode; +static PyObject *__pyx_n_s_default_cursor; +static PyObject *__pyx_n_s_deque; +static PyObject *__pyx_n_s_description; +static PyObject *__pyx_n_s_do_autoping; +static PyObject *__pyx_n_s_do_warnings_query; +static PyObject *__pyx_n_s_doc; +static PyObject *__pyx_n_s_doclose; +static PyObject *__pyx_n_s_encode; +static PyObject *__pyx_n_s_enter; +static PyObject *__pyx_n_s_err; +static PyObject *__pyx_n_s_errno; +static PyObject *__pyx_n_s_errnos; +static PyObject *__pyx_n_s_escape_string; +static PyObject *__pyx_n_s_exc; +static PyObject *__pyx_n_s_exception_enum_map; +static PyObject *__pyx_n_s_exception_from_errno; +static PyObject *__pyx_n_s_exceptions; +static PyObject *__pyx_n_s_execute; +static PyObject *__pyx_kp_s_executing_this_query_would_cause; +static PyObject *__pyx_n_s_exit; +static PyObject *__pyx_n_s_extend; +static PyObject *__pyx_n_s_extra; +static PyObject *__pyx_n_s_fetchall; +static PyObject *__pyx_n_s_fetchone; +static PyObject *__pyx_n_s_fileobj; +static PyObject *__pyx_n_s_found_rows; +static PyObject *__pyx_n_s_get; +static PyObject *__pyx_n_s_getreader; +static PyObject *__pyx_n_s_has_result; +static PyObject *__pyx_n_s_host; +static PyObject *__pyx_n_s_hour; +static PyObject *__pyx_n_s_id; +static PyObject *__pyx_n_s_import; +static PyObject *__pyx_n_s_index; +static PyObject *__pyx_n_s_init; +static PyObject *__pyx_n_s_init_command; +static PyObject *__pyx_n_s_iterobj; +static PyObject *__pyx_n_s_itertools; +static PyObject *__pyx_n_s_key; +static PyObject *__pyx_n_s_kind; +static PyObject *__pyx_n_s_lastrowid; +static PyObject *__pyx_n_s_length; +static PyObject *__pyx_n_s_local_infile; +static PyObject *__pyx_n_s_localtime; +static PyObject *__pyx_n_s_main; +static PyObject *__pyx_n_s_memory; +static PyObject *__pyx_n_s_message; +static PyObject *__pyx_n_s_metaclass; +static PyObject *__pyx_n_s_microsecond; +static PyObject *__pyx_n_s_minute; +static PyObject *__pyx_n_s_module; +static PyObject *__pyx_n_s_month; +static PyObject *__pyx_n_s_multi_results; +static PyObject *__pyx_n_s_multi_statements; +static PyObject *__pyx_kp_s_must_prefetch_at_least_1_row; +static PyObject *__pyx_n_s_name; +static PyObject *__pyx_n_s_new_query; +static PyObject *__pyx_n_s_new_result; +static PyObject *__pyx_n_s_new_statement; +static PyObject *__pyx_n_s_next; +static PyObject *__pyx_n_s_nextset; +static PyObject *__pyx_kp_s_no_results_available; +static PyObject *__pyx_n_s_oursql; +static PyObject *__pyx_n_s_parambatch; +static PyObject *__pyx_n_s_params; +static PyObject *__pyx_n_s_paramstyle; +static PyObject *__pyx_n_s_passwd; +static PyObject *__pyx_n_s_ping; +static PyObject *__pyx_n_s_pipe; +static PyObject *__pyx_n_s_plain_query; +static PyObject *__pyx_n_s_pop; +static PyObject *__pyx_n_s_popleft; +static PyObject *__pyx_n_s_port; +static PyObject *__pyx_n_s_prefetch_rows; +static PyObject *__pyx_n_s_prepare; +static PyObject *__pyx_n_s_prepare_2; +static PyObject *__pyx_n_s_procname; +static PyObject *__pyx_n_s_protocol; +static PyObject *__pyx_n_s_protocol_enum_map; +static PyObject *__pyx_n_s_pyx_vtable; +static PyObject *__pyx_n_s_q; +static PyObject *__pyx_n_s_qmark; +static PyObject *__pyx_n_s_qualname; +static PyObject *__pyx_n_s_query; +static PyObject *__pyx_kp_s_query_caused_warnings; +static PyObject *__pyx_n_s_query_class; +static PyObject *__pyx_kp_s_query_closed; +static PyObject *__pyx_n_s_raise_on_warnings; +static PyObject *__pyx_n_s_read; +static PyObject *__pyx_n_s_read_default_file; +static PyObject *__pyx_n_s_read_default_group; +static PyObject *__pyx_n_s_read_timeout; +static PyObject *__pyx_n_s_report_truncation; +static PyObject *__pyx_n_s_require_secure_auth; +static PyObject *__pyx_n_s_result_class; +static PyObject *__pyx_n_s_ret; +static PyObject *__pyx_n_s_rollback; +static PyObject *__pyx_kp_s_row_no_longer_available_from_dat; +static PyObject *__pyx_n_s_rowcount; +static PyObject *__pyx_n_s_s; +static PyObject *__pyx_n_s_second; +static PyObject *__pyx_n_s_self; +static PyObject *__pyx_n_s_setup_ssl_options; +static PyObject *__pyx_n_s_shared_memory_base_name; +static PyObject *__pyx_n_s_should_raise; +static PyObject *__pyx_n_s_show_table; +static PyObject *__pyx_n_s_size; +static PyObject *__pyx_kp_s_size_remaining_should_be_0; +static PyObject *__pyx_n_s_socket; +static PyObject *__pyx_n_s_ss; +static PyObject *__pyx_n_s_ssl; +static PyObject *__pyx_n_s_statement_class; +static PyObject *__pyx_kp_s_statement_closed; +static PyObject *__pyx_n_s_stmt; +static PyObject *__pyx_n_s_string_limit; +static PyObject *__pyx_kp_s_string_limit_must_be_0; +static PyObject *__pyx_n_s_strptime; +static PyObject *__pyx_n_s_super; +static PyObject *__pyx_n_s_tb; +static PyObject *__pyx_n_s_tcp; +static PyObject *__pyx_n_s_test; +static PyObject *__pyx_n_s_threadsafety; +static PyObject *__pyx_n_s_ticks; +static PyObject *__pyx_n_s_time; +static PyObject *__pyx_n_s_time_from_string; +static PyObject *__pyx_kp_s_truncated_column_d_type_d; +static PyObject *__pyx_n_s_try_plain_query; +static PyObject *__pyx_n_s_tt; +static PyObject *__pyx_n_s_unix_socket; +static PyObject *__pyx_kp_s_unknown_kind_of_warning_r; +static PyObject *__pyx_kp_s_unknown_protocol_r; +static PyObject *__pyx_kp_s_unorderable_types_r_and_r; +static PyObject *__pyx_kp_s_use_the_CALL_statement_with_the; +static PyObject *__pyx_n_s_use_unicode; +static PyObject *__pyx_n_s_user; +static PyObject *__pyx_kp_s_usr_local_src_Python_SQL_oursql; +static PyObject *__pyx_kp_s_usr_local_src_Python_SQL_oursql_2; +static PyObject *__pyx_kp_s_usr_local_src_Python_SQL_oursql_3; +static PyObject *__pyx_n_s_utf8; +static PyObject *__pyx_n_s_value; +static PyObject *__pyx_n_s_values; +static PyObject *__pyx_n_s_version; +static PyObject *__pyx_n_s_warning_count; +static PyObject *__pyx_n_s_warnings; +static PyObject *__pyx_n_s_write_timeout; +static PyObject *__pyx_n_s_year; +static PyObject *__pyx_n_s_zip; +static PyObject *__pyx_int_0; +static PyObject *__pyx_int_1; +static PyObject *__pyx_int_3; +static PyObject *__pyx_int_6; +static PyObject *__pyx_int_63; +static PyObject *__pyx_int_8192; +static PyObject *__pyx_int_neg_1; +static PyObject *__pyx_tuple_; +static PyObject *__pyx_slice__2; +static PyObject *__pyx_slice__3; +static PyObject *__pyx_slice__4; +static PyObject *__pyx_slice__5; +static PyObject *__pyx_slice__6; +static PyObject *__pyx_slice__7; +static PyObject *__pyx_tuple__8; +static PyObject *__pyx_tuple__9; +static PyObject *__pyx_tuple__10; +static PyObject *__pyx_tuple__11; +static PyObject *__pyx_tuple__12; +static PyObject *__pyx_tuple__13; +static PyObject *__pyx_tuple__14; +static PyObject *__pyx_tuple__15; +static PyObject *__pyx_tuple__16; +static PyObject *__pyx_tuple__17; +static PyObject *__pyx_tuple__18; +static PyObject *__pyx_tuple__19; +static PyObject *__pyx_tuple__21; +static PyObject *__pyx_tuple__22; +static PyObject *__pyx_tuple__23; +static PyObject *__pyx_tuple__24; +static PyObject *__pyx_tuple__25; +static PyObject *__pyx_tuple__26; +static PyObject *__pyx_tuple__27; +static PyObject *__pyx_tuple__28; +static PyObject *__pyx_tuple__29; +static PyObject *__pyx_tuple__30; +static PyObject *__pyx_tuple__32; +static PyObject *__pyx_tuple__33; +static PyObject *__pyx_tuple__35; +static PyObject *__pyx_tuple__37; +static PyObject *__pyx_tuple__39; +static PyObject *__pyx_tuple__41; +static PyObject *__pyx_tuple__43; +static PyObject *__pyx_tuple__45; +static PyObject *__pyx_tuple__47; +static PyObject *__pyx_tuple__49; +static PyObject *__pyx_tuple__51; +static PyObject *__pyx_codeobj__31; +static PyObject *__pyx_codeobj__34; +static PyObject *__pyx_codeobj__36; +static PyObject *__pyx_codeobj__38; +static PyObject *__pyx_codeobj__40; +static PyObject *__pyx_codeobj__42; +static PyObject *__pyx_codeobj__44; +static PyObject *__pyx_codeobj__46; +static PyObject *__pyx_codeobj__48; +static PyObject *__pyx_codeobj__50; + +/* "oursqlx/nogil.pyx":5 + * # duplication of functions. + * + * cdef inline MYSQL *mysql_real_connect( # <<<<<<<<<<<<<< + * MYSQL *conn, char *host, char *user, char *passwd, char *db, + * unsigned int port, char *unix_socket, unsigned long client_flag): + */ + +static CYTHON_INLINE MYSQL *__pyx_f_6oursql_mysql_real_connect(MYSQL *__pyx_v_conn, char *__pyx_v_host, char *__pyx_v_user, char *__pyx_v_passwd, char *__pyx_v_db, unsigned int __pyx_v_port, char *__pyx_v_unix_socket, unsigned long __pyx_v_client_flag) { + MYSQL *__pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("mysql_real_connect", 0); + + /* "oursqlx/nogil.pyx":8 + * MYSQL *conn, char *host, char *user, char *passwd, char *db, + * unsigned int port, char *unix_socket, unsigned long client_flag): + * with nogil: # <<<<<<<<<<<<<< + * return _mysql_real_connect(conn, host, user, passwd, db, port, + * unix_socket, client_flag) + */ + { + #ifdef WITH_THREAD + PyThreadState *_save; + Py_UNBLOCK_THREADS + #endif + /*try:*/ { + + /* "oursqlx/nogil.pyx":9 + * unsigned int port, char *unix_socket, unsigned long client_flag): + * with nogil: + * return _mysql_real_connect(conn, host, user, passwd, db, port, # <<<<<<<<<<<<<< + * unix_socket, client_flag) + * + */ + __pyx_r = mysql_real_connect(__pyx_v_conn, __pyx_v_host, __pyx_v_user, __pyx_v_passwd, __pyx_v_db, __pyx_v_port, __pyx_v_unix_socket, __pyx_v_client_flag); + goto __pyx_L3_return; + } + + /* "oursqlx/nogil.pyx":8 + * MYSQL *conn, char *host, char *user, char *passwd, char *db, + * unsigned int port, char *unix_socket, unsigned long client_flag): + * with nogil: # <<<<<<<<<<<<<< + * return _mysql_real_connect(conn, host, user, passwd, db, port, + * unix_socket, client_flag) + */ + /*finally:*/ { + __pyx_L3_return: { + #ifdef WITH_THREAD + Py_BLOCK_THREADS + #endif + goto __pyx_L0; + } + } + } + + /* "oursqlx/nogil.pyx":5 + * # duplication of functions. + * + * cdef inline MYSQL *mysql_real_connect( # <<<<<<<<<<<<<< + * MYSQL *conn, char *host, char *user, char *passwd, char *db, + * unsigned int port, char *unix_socket, unsigned long client_flag): + */ + + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/nogil.pyx":12 + * unix_socket, client_flag) + * + * cdef inline int mysql_ping(MYSQL *conn): # <<<<<<<<<<<<<< + * with nogil: + * return _mysql_ping(conn) + */ + +static CYTHON_INLINE int __pyx_f_6oursql_mysql_ping(MYSQL *__pyx_v_conn) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("mysql_ping", 0); + + /* "oursqlx/nogil.pyx":13 + * + * cdef inline int mysql_ping(MYSQL *conn): + * with nogil: # <<<<<<<<<<<<<< + * return _mysql_ping(conn) + * + */ + { + #ifdef WITH_THREAD + PyThreadState *_save; + Py_UNBLOCK_THREADS + #endif + /*try:*/ { + + /* "oursqlx/nogil.pyx":14 + * cdef inline int mysql_ping(MYSQL *conn): + * with nogil: + * return _mysql_ping(conn) # <<<<<<<<<<<<<< + * + * cdef inline my_bool mysql_commit(MYSQL *conn): + */ + __pyx_r = mysql_ping(__pyx_v_conn); + goto __pyx_L3_return; + } + + /* "oursqlx/nogil.pyx":13 + * + * cdef inline int mysql_ping(MYSQL *conn): + * with nogil: # <<<<<<<<<<<<<< + * return _mysql_ping(conn) + * + */ + /*finally:*/ { + __pyx_L3_return: { + #ifdef WITH_THREAD + Py_BLOCK_THREADS + #endif + goto __pyx_L0; + } + } + } + + /* "oursqlx/nogil.pyx":12 + * unix_socket, client_flag) + * + * cdef inline int mysql_ping(MYSQL *conn): # <<<<<<<<<<<<<< + * with nogil: + * return _mysql_ping(conn) + */ + + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/nogil.pyx":16 + * return _mysql_ping(conn) + * + * cdef inline my_bool mysql_commit(MYSQL *conn): # <<<<<<<<<<<<<< + * with nogil: + * return _mysql_commit(conn) + */ + +static CYTHON_INLINE my_bool __pyx_f_6oursql_mysql_commit(MYSQL *__pyx_v_conn) { + my_bool __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("mysql_commit", 0); + + /* "oursqlx/nogil.pyx":17 + * + * cdef inline my_bool mysql_commit(MYSQL *conn): + * with nogil: # <<<<<<<<<<<<<< + * return _mysql_commit(conn) + * + */ + { + #ifdef WITH_THREAD + PyThreadState *_save; + Py_UNBLOCK_THREADS + #endif + /*try:*/ { + + /* "oursqlx/nogil.pyx":18 + * cdef inline my_bool mysql_commit(MYSQL *conn): + * with nogil: + * return _mysql_commit(conn) # <<<<<<<<<<<<<< + * + * cdef inline my_bool mysql_rollback(MYSQL *conn): + */ + __pyx_r = mysql_commit(__pyx_v_conn); + goto __pyx_L3_return; + } + + /* "oursqlx/nogil.pyx":17 + * + * cdef inline my_bool mysql_commit(MYSQL *conn): + * with nogil: # <<<<<<<<<<<<<< + * return _mysql_commit(conn) + * + */ + /*finally:*/ { + __pyx_L3_return: { + #ifdef WITH_THREAD + Py_BLOCK_THREADS + #endif + goto __pyx_L0; + } + } + } + + /* "oursqlx/nogil.pyx":16 + * return _mysql_ping(conn) + * + * cdef inline my_bool mysql_commit(MYSQL *conn): # <<<<<<<<<<<<<< + * with nogil: + * return _mysql_commit(conn) + */ + + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/nogil.pyx":20 + * return _mysql_commit(conn) + * + * cdef inline my_bool mysql_rollback(MYSQL *conn): # <<<<<<<<<<<<<< + * with nogil: + * return _mysql_rollback(conn) + */ + +static CYTHON_INLINE my_bool __pyx_f_6oursql_mysql_rollback(MYSQL *__pyx_v_conn) { + my_bool __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("mysql_rollback", 0); + + /* "oursqlx/nogil.pyx":21 + * + * cdef inline my_bool mysql_rollback(MYSQL *conn): + * with nogil: # <<<<<<<<<<<<<< + * return _mysql_rollback(conn) + * + */ + { + #ifdef WITH_THREAD + PyThreadState *_save; + Py_UNBLOCK_THREADS + #endif + /*try:*/ { + + /* "oursqlx/nogil.pyx":22 + * cdef inline my_bool mysql_rollback(MYSQL *conn): + * with nogil: + * return _mysql_rollback(conn) # <<<<<<<<<<<<<< + * + * cdef inline int mysql_stmt_prepare(MYSQL_STMT *stmt, + */ + __pyx_r = mysql_rollback(__pyx_v_conn); + goto __pyx_L3_return; + } + + /* "oursqlx/nogil.pyx":21 + * + * cdef inline my_bool mysql_rollback(MYSQL *conn): + * with nogil: # <<<<<<<<<<<<<< + * return _mysql_rollback(conn) + * + */ + /*finally:*/ { + __pyx_L3_return: { + #ifdef WITH_THREAD + Py_BLOCK_THREADS + #endif + goto __pyx_L0; + } + } + } + + /* "oursqlx/nogil.pyx":20 + * return _mysql_commit(conn) + * + * cdef inline my_bool mysql_rollback(MYSQL *conn): # <<<<<<<<<<<<<< + * with nogil: + * return _mysql_rollback(conn) + */ + + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/nogil.pyx":24 + * return _mysql_rollback(conn) + * + * cdef inline int mysql_stmt_prepare(MYSQL_STMT *stmt, # <<<<<<<<<<<<<< + * char *stmt_str, unsigned long length): + * with nogil: + */ + +static CYTHON_INLINE int __pyx_f_6oursql_mysql_stmt_prepare(MYSQL_STMT *__pyx_v_stmt, char *__pyx_v_stmt_str, unsigned long __pyx_v_length) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("mysql_stmt_prepare", 0); + + /* "oursqlx/nogil.pyx":26 + * cdef inline int mysql_stmt_prepare(MYSQL_STMT *stmt, + * char *stmt_str, unsigned long length): + * with nogil: # <<<<<<<<<<<<<< + * return _mysql_stmt_prepare(stmt, stmt_str, length) + * + */ + { + #ifdef WITH_THREAD + PyThreadState *_save; + Py_UNBLOCK_THREADS + #endif + /*try:*/ { + + /* "oursqlx/nogil.pyx":27 + * char *stmt_str, unsigned long length): + * with nogil: + * return _mysql_stmt_prepare(stmt, stmt_str, length) # <<<<<<<<<<<<<< + * + * cdef inline int mysql_stmt_execute(MYSQL_STMT *stmt): + */ + __pyx_r = mysql_stmt_prepare(__pyx_v_stmt, __pyx_v_stmt_str, __pyx_v_length); + goto __pyx_L3_return; + } + + /* "oursqlx/nogil.pyx":26 + * cdef inline int mysql_stmt_prepare(MYSQL_STMT *stmt, + * char *stmt_str, unsigned long length): + * with nogil: # <<<<<<<<<<<<<< + * return _mysql_stmt_prepare(stmt, stmt_str, length) + * + */ + /*finally:*/ { + __pyx_L3_return: { + #ifdef WITH_THREAD + Py_BLOCK_THREADS + #endif + goto __pyx_L0; + } + } + } + + /* "oursqlx/nogil.pyx":24 + * return _mysql_rollback(conn) + * + * cdef inline int mysql_stmt_prepare(MYSQL_STMT *stmt, # <<<<<<<<<<<<<< + * char *stmt_str, unsigned long length): + * with nogil: + */ + + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/nogil.pyx":29 + * return _mysql_stmt_prepare(stmt, stmt_str, length) + * + * cdef inline int mysql_stmt_execute(MYSQL_STMT *stmt): # <<<<<<<<<<<<<< + * with nogil: + * return _mysql_stmt_execute(stmt) + */ + +static CYTHON_INLINE int __pyx_f_6oursql_mysql_stmt_execute(MYSQL_STMT *__pyx_v_stmt) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("mysql_stmt_execute", 0); + + /* "oursqlx/nogil.pyx":30 + * + * cdef inline int mysql_stmt_execute(MYSQL_STMT *stmt): + * with nogil: # <<<<<<<<<<<<<< + * return _mysql_stmt_execute(stmt) + * + */ + { + #ifdef WITH_THREAD + PyThreadState *_save; + Py_UNBLOCK_THREADS + #endif + /*try:*/ { + + /* "oursqlx/nogil.pyx":31 + * cdef inline int mysql_stmt_execute(MYSQL_STMT *stmt): + * with nogil: + * return _mysql_stmt_execute(stmt) # <<<<<<<<<<<<<< + * + * cdef inline int mysql_stmt_fetch(MYSQL_STMT *stmt): + */ + __pyx_r = mysql_stmt_execute(__pyx_v_stmt); + goto __pyx_L3_return; + } + + /* "oursqlx/nogil.pyx":30 + * + * cdef inline int mysql_stmt_execute(MYSQL_STMT *stmt): + * with nogil: # <<<<<<<<<<<<<< + * return _mysql_stmt_execute(stmt) + * + */ + /*finally:*/ { + __pyx_L3_return: { + #ifdef WITH_THREAD + Py_BLOCK_THREADS + #endif + goto __pyx_L0; + } + } + } + + /* "oursqlx/nogil.pyx":29 + * return _mysql_stmt_prepare(stmt, stmt_str, length) + * + * cdef inline int mysql_stmt_execute(MYSQL_STMT *stmt): # <<<<<<<<<<<<<< + * with nogil: + * return _mysql_stmt_execute(stmt) + */ + + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/nogil.pyx":33 + * return _mysql_stmt_execute(stmt) + * + * cdef inline int mysql_stmt_fetch(MYSQL_STMT *stmt): # <<<<<<<<<<<<<< + * with nogil: + * return _mysql_stmt_fetch(stmt) + */ + +static CYTHON_INLINE int __pyx_f_6oursql_mysql_stmt_fetch(MYSQL_STMT *__pyx_v_stmt) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("mysql_stmt_fetch", 0); + + /* "oursqlx/nogil.pyx":34 + * + * cdef inline int mysql_stmt_fetch(MYSQL_STMT *stmt): + * with nogil: # <<<<<<<<<<<<<< + * return _mysql_stmt_fetch(stmt) + * + */ + { + #ifdef WITH_THREAD + PyThreadState *_save; + Py_UNBLOCK_THREADS + #endif + /*try:*/ { + + /* "oursqlx/nogil.pyx":35 + * cdef inline int mysql_stmt_fetch(MYSQL_STMT *stmt): + * with nogil: + * return _mysql_stmt_fetch(stmt) # <<<<<<<<<<<<<< + * + * cdef inline my_bool mysql_stmt_send_long_data(MYSQL_STMT *stmt, + */ + __pyx_r = mysql_stmt_fetch(__pyx_v_stmt); + goto __pyx_L3_return; + } + + /* "oursqlx/nogil.pyx":34 + * + * cdef inline int mysql_stmt_fetch(MYSQL_STMT *stmt): + * with nogil: # <<<<<<<<<<<<<< + * return _mysql_stmt_fetch(stmt) + * + */ + /*finally:*/ { + __pyx_L3_return: { + #ifdef WITH_THREAD + Py_BLOCK_THREADS + #endif + goto __pyx_L0; + } + } + } + + /* "oursqlx/nogil.pyx":33 + * return _mysql_stmt_execute(stmt) + * + * cdef inline int mysql_stmt_fetch(MYSQL_STMT *stmt): # <<<<<<<<<<<<<< + * with nogil: + * return _mysql_stmt_fetch(stmt) + */ + + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/nogil.pyx":37 + * return _mysql_stmt_fetch(stmt) + * + * cdef inline my_bool mysql_stmt_send_long_data(MYSQL_STMT *stmt, # <<<<<<<<<<<<<< + * unsigned int index, char *data, unsigned long length): + * with nogil: + */ + +static CYTHON_INLINE my_bool __pyx_f_6oursql_mysql_stmt_send_long_data(MYSQL_STMT *__pyx_v_stmt, unsigned int __pyx_v_index, char *__pyx_v_data, unsigned long __pyx_v_length) { + my_bool __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("mysql_stmt_send_long_data", 0); + + /* "oursqlx/nogil.pyx":39 + * cdef inline my_bool mysql_stmt_send_long_data(MYSQL_STMT *stmt, + * unsigned int index, char *data, unsigned long length): + * with nogil: # <<<<<<<<<<<<<< + * return _mysql_stmt_send_long_data(stmt, index, data, length) + * + */ + { + #ifdef WITH_THREAD + PyThreadState *_save; + Py_UNBLOCK_THREADS + #endif + /*try:*/ { + + /* "oursqlx/nogil.pyx":40 + * unsigned int index, char *data, unsigned long length): + * with nogil: + * return _mysql_stmt_send_long_data(stmt, index, data, length) # <<<<<<<<<<<<<< + * + * cdef inline int mysql_stmt_fetch_column(MYSQL_STMT *stmt, + */ + __pyx_r = mysql_stmt_send_long_data(__pyx_v_stmt, __pyx_v_index, __pyx_v_data, __pyx_v_length); + goto __pyx_L3_return; + } + + /* "oursqlx/nogil.pyx":39 + * cdef inline my_bool mysql_stmt_send_long_data(MYSQL_STMT *stmt, + * unsigned int index, char *data, unsigned long length): + * with nogil: # <<<<<<<<<<<<<< + * return _mysql_stmt_send_long_data(stmt, index, data, length) + * + */ + /*finally:*/ { + __pyx_L3_return: { + #ifdef WITH_THREAD + Py_BLOCK_THREADS + #endif + goto __pyx_L0; + } + } + } + + /* "oursqlx/nogil.pyx":37 + * return _mysql_stmt_fetch(stmt) + * + * cdef inline my_bool mysql_stmt_send_long_data(MYSQL_STMT *stmt, # <<<<<<<<<<<<<< + * unsigned int index, char *data, unsigned long length): + * with nogil: + */ + + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/nogil.pyx":42 + * return _mysql_stmt_send_long_data(stmt, index, data, length) + * + * cdef inline int mysql_stmt_fetch_column(MYSQL_STMT *stmt, # <<<<<<<<<<<<<< + * MYSQL_BIND *bind, unsigned int column, unsigned long offset): + * with nogil: + */ + +static CYTHON_INLINE int __pyx_f_6oursql_mysql_stmt_fetch_column(MYSQL_STMT *__pyx_v_stmt, MYSQL_BIND *__pyx_v_bind, unsigned int __pyx_v_column, unsigned long __pyx_v_offset) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("mysql_stmt_fetch_column", 0); + + /* "oursqlx/nogil.pyx":44 + * cdef inline int mysql_stmt_fetch_column(MYSQL_STMT *stmt, + * MYSQL_BIND *bind, unsigned int column, unsigned long offset): + * with nogil: # <<<<<<<<<<<<<< + * return _mysql_stmt_fetch_column(stmt, bind, column, offset) + * + */ + { + #ifdef WITH_THREAD + PyThreadState *_save; + Py_UNBLOCK_THREADS + #endif + /*try:*/ { + + /* "oursqlx/nogil.pyx":45 + * MYSQL_BIND *bind, unsigned int column, unsigned long offset): + * with nogil: + * return _mysql_stmt_fetch_column(stmt, bind, column, offset) # <<<<<<<<<<<<<< + * + * cdef inline int mysql_stmt_store_result(MYSQL_STMT *stmt): + */ + __pyx_r = mysql_stmt_fetch_column(__pyx_v_stmt, __pyx_v_bind, __pyx_v_column, __pyx_v_offset); + goto __pyx_L3_return; + } + + /* "oursqlx/nogil.pyx":44 + * cdef inline int mysql_stmt_fetch_column(MYSQL_STMT *stmt, + * MYSQL_BIND *bind, unsigned int column, unsigned long offset): + * with nogil: # <<<<<<<<<<<<<< + * return _mysql_stmt_fetch_column(stmt, bind, column, offset) + * + */ + /*finally:*/ { + __pyx_L3_return: { + #ifdef WITH_THREAD + Py_BLOCK_THREADS + #endif + goto __pyx_L0; + } + } + } + + /* "oursqlx/nogil.pyx":42 + * return _mysql_stmt_send_long_data(stmt, index, data, length) + * + * cdef inline int mysql_stmt_fetch_column(MYSQL_STMT *stmt, # <<<<<<<<<<<<<< + * MYSQL_BIND *bind, unsigned int column, unsigned long offset): + * with nogil: + */ + + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/nogil.pyx":47 + * return _mysql_stmt_fetch_column(stmt, bind, column, offset) + * + * cdef inline int mysql_stmt_store_result(MYSQL_STMT *stmt): # <<<<<<<<<<<<<< + * with nogil: + * return _mysql_stmt_store_result(stmt) + */ + +static CYTHON_INLINE int __pyx_f_6oursql_mysql_stmt_store_result(MYSQL_STMT *__pyx_v_stmt) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("mysql_stmt_store_result", 0); + + /* "oursqlx/nogil.pyx":48 + * + * cdef inline int mysql_stmt_store_result(MYSQL_STMT *stmt): + * with nogil: # <<<<<<<<<<<<<< + * return _mysql_stmt_store_result(stmt) + * + */ + { + #ifdef WITH_THREAD + PyThreadState *_save; + Py_UNBLOCK_THREADS + #endif + /*try:*/ { + + /* "oursqlx/nogil.pyx":49 + * cdef inline int mysql_stmt_store_result(MYSQL_STMT *stmt): + * with nogil: + * return _mysql_stmt_store_result(stmt) # <<<<<<<<<<<<<< + * + * cdef inline int mysql_real_query(MYSQL *conn, char *stmt_str, + */ + __pyx_r = mysql_stmt_store_result(__pyx_v_stmt); + goto __pyx_L3_return; + } + + /* "oursqlx/nogil.pyx":48 + * + * cdef inline int mysql_stmt_store_result(MYSQL_STMT *stmt): + * with nogil: # <<<<<<<<<<<<<< + * return _mysql_stmt_store_result(stmt) + * + */ + /*finally:*/ { + __pyx_L3_return: { + #ifdef WITH_THREAD + Py_BLOCK_THREADS + #endif + goto __pyx_L0; + } + } + } + + /* "oursqlx/nogil.pyx":47 + * return _mysql_stmt_fetch_column(stmt, bind, column, offset) + * + * cdef inline int mysql_stmt_store_result(MYSQL_STMT *stmt): # <<<<<<<<<<<<<< + * with nogil: + * return _mysql_stmt_store_result(stmt) + */ + + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/nogil.pyx":51 + * return _mysql_stmt_store_result(stmt) + * + * cdef inline int mysql_real_query(MYSQL *conn, char *stmt_str, # <<<<<<<<<<<<<< + * unsigned long length): + * with nogil: + */ + +static CYTHON_INLINE int __pyx_f_6oursql_mysql_real_query(MYSQL *__pyx_v_conn, char *__pyx_v_stmt_str, unsigned long __pyx_v_length) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("mysql_real_query", 0); + + /* "oursqlx/nogil.pyx":53 + * cdef inline int mysql_real_query(MYSQL *conn, char *stmt_str, + * unsigned long length): + * with nogil: # <<<<<<<<<<<<<< + * return _mysql_real_query(conn, stmt_str, length) + * + */ + { + #ifdef WITH_THREAD + PyThreadState *_save; + Py_UNBLOCK_THREADS + #endif + /*try:*/ { + + /* "oursqlx/nogil.pyx":54 + * unsigned long length): + * with nogil: + * return _mysql_real_query(conn, stmt_str, length) # <<<<<<<<<<<<<< + * + * cdef inline MYSQL_RES *mysql_use_result(MYSQL *conn): + */ + __pyx_r = mysql_real_query(__pyx_v_conn, __pyx_v_stmt_str, __pyx_v_length); + goto __pyx_L3_return; + } + + /* "oursqlx/nogil.pyx":53 + * cdef inline int mysql_real_query(MYSQL *conn, char *stmt_str, + * unsigned long length): + * with nogil: # <<<<<<<<<<<<<< + * return _mysql_real_query(conn, stmt_str, length) + * + */ + /*finally:*/ { + __pyx_L3_return: { + #ifdef WITH_THREAD + Py_BLOCK_THREADS + #endif + goto __pyx_L0; + } + } + } + + /* "oursqlx/nogil.pyx":51 + * return _mysql_stmt_store_result(stmt) + * + * cdef inline int mysql_real_query(MYSQL *conn, char *stmt_str, # <<<<<<<<<<<<<< + * unsigned long length): + * with nogil: + */ + + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/nogil.pyx":56 + * return _mysql_real_query(conn, stmt_str, length) + * + * cdef inline MYSQL_RES *mysql_use_result(MYSQL *conn): # <<<<<<<<<<<<<< + * with nogil: + * return _mysql_use_result(conn) + */ + +static CYTHON_INLINE MYSQL_RES *__pyx_f_6oursql_mysql_use_result(MYSQL *__pyx_v_conn) { + MYSQL_RES *__pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("mysql_use_result", 0); + + /* "oursqlx/nogil.pyx":57 + * + * cdef inline MYSQL_RES *mysql_use_result(MYSQL *conn): + * with nogil: # <<<<<<<<<<<<<< + * return _mysql_use_result(conn) + * + */ + { + #ifdef WITH_THREAD + PyThreadState *_save; + Py_UNBLOCK_THREADS + #endif + /*try:*/ { + + /* "oursqlx/nogil.pyx":58 + * cdef inline MYSQL_RES *mysql_use_result(MYSQL *conn): + * with nogil: + * return _mysql_use_result(conn) # <<<<<<<<<<<<<< + * + * cdef inline MYSQL_RES *mysql_store_result(MYSQL *conn): + */ + __pyx_r = mysql_use_result(__pyx_v_conn); + goto __pyx_L3_return; + } + + /* "oursqlx/nogil.pyx":57 + * + * cdef inline MYSQL_RES *mysql_use_result(MYSQL *conn): + * with nogil: # <<<<<<<<<<<<<< + * return _mysql_use_result(conn) + * + */ + /*finally:*/ { + __pyx_L3_return: { + #ifdef WITH_THREAD + Py_BLOCK_THREADS + #endif + goto __pyx_L0; + } + } + } + + /* "oursqlx/nogil.pyx":56 + * return _mysql_real_query(conn, stmt_str, length) + * + * cdef inline MYSQL_RES *mysql_use_result(MYSQL *conn): # <<<<<<<<<<<<<< + * with nogil: + * return _mysql_use_result(conn) + */ + + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/nogil.pyx":60 + * return _mysql_use_result(conn) + * + * cdef inline MYSQL_RES *mysql_store_result(MYSQL *conn): # <<<<<<<<<<<<<< + * with nogil: + * return _mysql_store_result(conn) + */ + +static CYTHON_INLINE MYSQL_RES *__pyx_f_6oursql_mysql_store_result(MYSQL *__pyx_v_conn) { + MYSQL_RES *__pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("mysql_store_result", 0); + + /* "oursqlx/nogil.pyx":61 + * + * cdef inline MYSQL_RES *mysql_store_result(MYSQL *conn): + * with nogil: # <<<<<<<<<<<<<< + * return _mysql_store_result(conn) + * + */ + { + #ifdef WITH_THREAD + PyThreadState *_save; + Py_UNBLOCK_THREADS + #endif + /*try:*/ { + + /* "oursqlx/nogil.pyx":62 + * cdef inline MYSQL_RES *mysql_store_result(MYSQL *conn): + * with nogil: + * return _mysql_store_result(conn) # <<<<<<<<<<<<<< + * + * cdef inline int mysql_next_result(MYSQL *conn): + */ + __pyx_r = mysql_store_result(__pyx_v_conn); + goto __pyx_L3_return; + } + + /* "oursqlx/nogil.pyx":61 + * + * cdef inline MYSQL_RES *mysql_store_result(MYSQL *conn): + * with nogil: # <<<<<<<<<<<<<< + * return _mysql_store_result(conn) + * + */ + /*finally:*/ { + __pyx_L3_return: { + #ifdef WITH_THREAD + Py_BLOCK_THREADS + #endif + goto __pyx_L0; + } + } + } + + /* "oursqlx/nogil.pyx":60 + * return _mysql_use_result(conn) + * + * cdef inline MYSQL_RES *mysql_store_result(MYSQL *conn): # <<<<<<<<<<<<<< + * with nogil: + * return _mysql_store_result(conn) + */ + + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/nogil.pyx":64 + * return _mysql_store_result(conn) + * + * cdef inline int mysql_next_result(MYSQL *conn): # <<<<<<<<<<<<<< + * with nogil: + * return _mysql_next_result(conn) + */ + +static CYTHON_INLINE int __pyx_f_6oursql_mysql_next_result(MYSQL *__pyx_v_conn) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("mysql_next_result", 0); + + /* "oursqlx/nogil.pyx":65 + * + * cdef inline int mysql_next_result(MYSQL *conn): + * with nogil: # <<<<<<<<<<<<<< + * return _mysql_next_result(conn) + * + */ + { + #ifdef WITH_THREAD + PyThreadState *_save; + Py_UNBLOCK_THREADS + #endif + /*try:*/ { + + /* "oursqlx/nogil.pyx":66 + * cdef inline int mysql_next_result(MYSQL *conn): + * with nogil: + * return _mysql_next_result(conn) # <<<<<<<<<<<<<< + * + * cdef inline MYSQL_ROW mysql_fetch_row(MYSQL_RES *result): + */ + __pyx_r = mysql_next_result(__pyx_v_conn); + goto __pyx_L3_return; + } + + /* "oursqlx/nogil.pyx":65 + * + * cdef inline int mysql_next_result(MYSQL *conn): + * with nogil: # <<<<<<<<<<<<<< + * return _mysql_next_result(conn) + * + */ + /*finally:*/ { + __pyx_L3_return: { + #ifdef WITH_THREAD + Py_BLOCK_THREADS + #endif + goto __pyx_L0; + } + } + } + + /* "oursqlx/nogil.pyx":64 + * return _mysql_store_result(conn) + * + * cdef inline int mysql_next_result(MYSQL *conn): # <<<<<<<<<<<<<< + * with nogil: + * return _mysql_next_result(conn) + */ + + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/nogil.pyx":68 + * return _mysql_next_result(conn) + * + * cdef inline MYSQL_ROW mysql_fetch_row(MYSQL_RES *result): # <<<<<<<<<<<<<< + * with nogil: + * return _mysql_fetch_row(result) + */ + +static CYTHON_INLINE MYSQL_ROW __pyx_f_6oursql_mysql_fetch_row(MYSQL_RES *__pyx_v_result) { + MYSQL_ROW __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("mysql_fetch_row", 0); + + /* "oursqlx/nogil.pyx":69 + * + * cdef inline MYSQL_ROW mysql_fetch_row(MYSQL_RES *result): + * with nogil: # <<<<<<<<<<<<<< + * return _mysql_fetch_row(result) + */ + { + #ifdef WITH_THREAD + PyThreadState *_save; + Py_UNBLOCK_THREADS + #endif + /*try:*/ { + + /* "oursqlx/nogil.pyx":70 + * cdef inline MYSQL_ROW mysql_fetch_row(MYSQL_RES *result): + * with nogil: + * return _mysql_fetch_row(result) # <<<<<<<<<<<<<< + */ + __pyx_r = mysql_fetch_row(__pyx_v_result); + goto __pyx_L3_return; + } + + /* "oursqlx/nogil.pyx":69 + * + * cdef inline MYSQL_ROW mysql_fetch_row(MYSQL_RES *result): + * with nogil: # <<<<<<<<<<<<<< + * return _mysql_fetch_row(result) + */ + /*finally:*/ { + __pyx_L3_return: { + #ifdef WITH_THREAD + Py_BLOCK_THREADS + #endif + goto __pyx_L0; + } + } + } + + /* "oursqlx/nogil.pyx":68 + * return _mysql_next_result(conn) + * + * cdef inline MYSQL_ROW mysql_fetch_row(MYSQL_RES *result): # <<<<<<<<<<<<<< + * with nogil: + * return _mysql_fetch_row(result) + */ + + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursql.pyx":56 + * + * class Error(exceptions.StandardError): + * def __init__(self, message, errno=None, extra=None): # <<<<<<<<<<<<<< + * StandardError.__init__(self, errno, message, extra) + * self.errno = errno + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_5Error_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_6oursql_5Error_1__init__ = {"__init__", (PyCFunction)__pyx_pw_6oursql_5Error_1__init__, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_6oursql_5Error_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_message = 0; + PyObject *__pyx_v_errno = 0; + PyObject *__pyx_v_extra = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_message,&__pyx_n_s_errno,&__pyx_n_s_extra,0}; + PyObject* values[4] = {0,0,0,0}; + values[2] = ((PyObject *)((PyObject *)Py_None)); + values[3] = ((PyObject *)((PyObject *)Py_None)); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_message)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 4, 1); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_errno); + if (value) { values[2] = value; kw_args--; } + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_extra); + if (value) { values[3] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_self = values[0]; + __pyx_v_message = values[1]; + __pyx_v_errno = values[2]; + __pyx_v_extra = values[3]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("oursql.Error.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6oursql_5Error___init__(__pyx_self, __pyx_v_self, __pyx_v_message, __pyx_v_errno, __pyx_v_extra); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_5Error___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_message, PyObject *__pyx_v_errno, PyObject *__pyx_v_extra) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__init__", 0); + + /* "oursql.pyx":57 + * class Error(exceptions.StandardError): + * def __init__(self, message, errno=None, extra=None): + * StandardError.__init__(self, errno, message, extra) # <<<<<<<<<<<<<< + * self.errno = errno + * self.extra = extra + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_builtin_StandardError, __pyx_n_s_init); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + __pyx_t_4 = 0; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_4 = 1; + } + } + __pyx_t_5 = PyTuple_New(4+__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + if (__pyx_t_3) { + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL; + } + __Pyx_INCREF(__pyx_v_self); + PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_self); + __Pyx_GIVEREF(__pyx_v_self); + __Pyx_INCREF(__pyx_v_errno); + PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_errno); + __Pyx_GIVEREF(__pyx_v_errno); + __Pyx_INCREF(__pyx_v_message); + PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_v_message); + __Pyx_GIVEREF(__pyx_v_message); + __Pyx_INCREF(__pyx_v_extra); + PyTuple_SET_ITEM(__pyx_t_5, 3+__pyx_t_4, __pyx_v_extra); + __Pyx_GIVEREF(__pyx_v_extra); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "oursql.pyx":58 + * def __init__(self, message, errno=None, extra=None): + * StandardError.__init__(self, errno, message, extra) + * self.errno = errno # <<<<<<<<<<<<<< + * self.extra = extra + * + */ + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_errno, __pyx_v_errno) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "oursql.pyx":59 + * StandardError.__init__(self, errno, message, extra) + * self.errno = errno + * self.extra = extra # <<<<<<<<<<<<<< + * + * class InterfaceError(Error): pass + */ + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_extra, __pyx_v_extra) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "oursql.pyx":56 + * + * class Error(exceptions.StandardError): + * def __init__(self, message, errno=None, extra=None): # <<<<<<<<<<<<<< + * StandardError.__init__(self, errno, message, extra) + * self.errno = errno + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("oursql.Error.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/util.pyx":1 + * cdef unsigned long bitval_from_char_p(unsigned char *s, Py_ssize_t length): # <<<<<<<<<<<<<< + * cdef Py_ssize_t i + * cdef unsigned long ret = 0 + */ + +static unsigned long __pyx_f_6oursql_bitval_from_char_p(unsigned char *__pyx_v_s, Py_ssize_t __pyx_v_length) { + Py_ssize_t __pyx_v_i; + unsigned long __pyx_v_ret; + unsigned long __pyx_r; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + __Pyx_RefNannySetupContext("bitval_from_char_p", 0); + + /* "oursqlx/util.pyx":3 + * cdef unsigned long bitval_from_char_p(unsigned char *s, Py_ssize_t length): + * cdef Py_ssize_t i + * cdef unsigned long ret = 0 # <<<<<<<<<<<<<< + * for 0 <= i < length: + * ret = (ret << 8) | s[i] + */ + __pyx_v_ret = 0; + + /* "oursqlx/util.pyx":4 + * cdef Py_ssize_t i + * cdef unsigned long ret = 0 + * for 0 <= i < length: # <<<<<<<<<<<<<< + * ret = (ret << 8) | s[i] + * return ret + */ + __pyx_t_1 = __pyx_v_length; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) { + + /* "oursqlx/util.pyx":5 + * cdef unsigned long ret = 0 + * for 0 <= i < length: + * ret = (ret << 8) | s[i] # <<<<<<<<<<<<<< + * return ret + * + */ + __pyx_v_ret = ((__pyx_v_ret << 8) | (__pyx_v_s[__pyx_v_i])); + } + + /* "oursqlx/util.pyx":6 + * for 0 <= i < length: + * ret = (ret << 8) | s[i] + * return ret # <<<<<<<<<<<<<< + * + * cdef object conversion_info_from_res(MYSQL_RES *res, int fields): + */ + __pyx_r = __pyx_v_ret; + goto __pyx_L0; + + /* "oursqlx/util.pyx":1 + * cdef unsigned long bitval_from_char_p(unsigned char *s, Py_ssize_t length): # <<<<<<<<<<<<<< + * cdef Py_ssize_t i + * cdef unsigned long ret = 0 + */ + + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/util.pyx":8 + * return ret + * + * cdef object conversion_info_from_res(MYSQL_RES *res, int fields): # <<<<<<<<<<<<<< + * cdef int i + * cdef MYSQL_FIELD *field + */ + +static PyObject *__pyx_f_6oursql_conversion_info_from_res(MYSQL_RES *__pyx_v_res, int __pyx_v_fields) { + int __pyx_v_i; + MYSQL_FIELD *__pyx_v_field; + PyObject *__pyx_v_ret = NULL; + PyObject *__pyx_v_data = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("conversion_info_from_res", 0); + + /* "oursqlx/util.pyx":11 + * cdef int i + * cdef MYSQL_FIELD *field + * ret = PyList_New(fields) # <<<<<<<<<<<<<< + * for 0 <= i < fields: + * field = mysql_fetch_field_direct(res, i) + */ + __pyx_t_1 = PyList_New(__pyx_v_fields); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_ret = __pyx_t_1; + __pyx_t_1 = 0; + + /* "oursqlx/util.pyx":12 + * cdef MYSQL_FIELD *field + * ret = PyList_New(fields) + * for 0 <= i < fields: # <<<<<<<<<<<<<< + * field = mysql_fetch_field_direct(res, i) + * data = ( + */ + __pyx_t_2 = __pyx_v_fields; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { + + /* "oursqlx/util.pyx":13 + * ret = PyList_New(fields) + * for 0 <= i < fields: + * field = mysql_fetch_field_direct(res, i) # <<<<<<<<<<<<<< + * data = ( + * field.type, + */ + __pyx_v_field = mysql_fetch_field_direct(__pyx_v_res, __pyx_v_i); + + /* "oursqlx/util.pyx":15 + * field = mysql_fetch_field_direct(res, i) + * data = ( + * field.type, # <<<<<<<<<<<<<< + * field.flags, + * field.charsetnr) + */ + __pyx_t_1 = PyInt_FromLong(__pyx_v_field->type); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + + /* "oursqlx/util.pyx":16 + * data = ( + * field.type, + * field.flags, # <<<<<<<<<<<<<< + * field.charsetnr) + * Py_INCREF(data) + */ + __pyx_t_3 = __Pyx_PyInt_From_unsigned_int(__pyx_v_field->flags); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + + /* "oursqlx/util.pyx":17 + * field.type, + * field.flags, + * field.charsetnr) # <<<<<<<<<<<<<< + * Py_INCREF(data) + * PyList_SET_ITEM(ret, i, data) + */ + __pyx_t_4 = __Pyx_PyInt_From_unsigned_int(__pyx_v_field->charsetnr); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + + /* "oursqlx/util.pyx":15 + * field = mysql_fetch_field_direct(res, i) + * data = ( + * field.type, # <<<<<<<<<<<<<< + * field.flags, + * field.charsetnr) + */ + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_1 = 0; + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __Pyx_XDECREF_SET(__pyx_v_data, ((PyObject*)__pyx_t_5)); + __pyx_t_5 = 0; + + /* "oursqlx/util.pyx":18 + * field.flags, + * field.charsetnr) + * Py_INCREF(data) # <<<<<<<<<<<<<< + * PyList_SET_ITEM(ret, i, data) + * return ret + */ + Py_INCREF(__pyx_v_data); + + /* "oursqlx/util.pyx":19 + * field.charsetnr) + * Py_INCREF(data) + * PyList_SET_ITEM(ret, i, data) # <<<<<<<<<<<<<< + * return ret + * + */ + PyList_SET_ITEM(__pyx_v_ret, __pyx_v_i, __pyx_v_data); + } + + /* "oursqlx/util.pyx":20 + * Py_INCREF(data) + * PyList_SET_ITEM(ret, i, data) + * return ret # <<<<<<<<<<<<<< + * + * cdef object description_from_res(MYSQL_RES *res, int fields, bint show_table): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_ret); + __pyx_r = __pyx_v_ret; + goto __pyx_L0; + + /* "oursqlx/util.pyx":8 + * return ret + * + * cdef object conversion_info_from_res(MYSQL_RES *res, int fields): # <<<<<<<<<<<<<< + * cdef int i + * cdef MYSQL_FIELD *field + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("oursql.conversion_info_from_res", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_ret); + __Pyx_XDECREF(__pyx_v_data); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/util.pyx":22 + * return ret + * + * cdef object description_from_res(MYSQL_RES *res, int fields, bint show_table): # <<<<<<<<<<<<<< + * cdef int i + * cdef MYSQL_FIELD *field + */ + +static PyObject *__pyx_f_6oursql_description_from_res(MYSQL_RES *__pyx_v_res, int __pyx_v_fields, int __pyx_v_show_table) { + int __pyx_v_i; + MYSQL_FIELD *__pyx_v_field; + PyObject *__pyx_v_ret = NULL; + PyObject *__pyx_v_name = NULL; + PyObject *__pyx_v_data = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("description_from_res", 0); + + /* "oursqlx/util.pyx":25 + * cdef int i + * cdef MYSQL_FIELD *field + * ret = PyList_New(fields) # <<<<<<<<<<<<<< + * for 0 <= i < fields: + * field = mysql_fetch_field_direct(res, i) + */ + __pyx_t_1 = PyList_New(__pyx_v_fields); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_ret = __pyx_t_1; + __pyx_t_1 = 0; + + /* "oursqlx/util.pyx":26 + * cdef MYSQL_FIELD *field + * ret = PyList_New(fields) + * for 0 <= i < fields: # <<<<<<<<<<<<<< + * field = mysql_fetch_field_direct(res, i) + * if show_table and field.table[0] != 0: + */ + __pyx_t_2 = __pyx_v_fields; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { + + /* "oursqlx/util.pyx":27 + * ret = PyList_New(fields) + * for 0 <= i < fields: + * field = mysql_fetch_field_direct(res, i) # <<<<<<<<<<<<<< + * if show_table and field.table[0] != 0: + * name = PyString_FromFormat("%s.%s", + */ + __pyx_v_field = mysql_fetch_field_direct(__pyx_v_res, __pyx_v_i); + + /* "oursqlx/util.pyx":28 + * for 0 <= i < fields: + * field = mysql_fetch_field_direct(res, i) + * if show_table and field.table[0] != 0: # <<<<<<<<<<<<<< + * name = PyString_FromFormat("%s.%s", + * field.table, field.name) + */ + __pyx_t_4 = (__pyx_v_show_table != 0); + if (__pyx_t_4) { + } else { + __pyx_t_3 = __pyx_t_4; + goto __pyx_L6_bool_binop_done; + } + __pyx_t_4 = (((__pyx_v_field->table[0]) != 0) != 0); + __pyx_t_3 = __pyx_t_4; + __pyx_L6_bool_binop_done:; + if (__pyx_t_3) { + + /* "oursqlx/util.pyx":29 + * field = mysql_fetch_field_direct(res, i) + * if show_table and field.table[0] != 0: + * name = PyString_FromFormat("%s.%s", # <<<<<<<<<<<<<< + * field.table, field.name) + * else: + */ + __pyx_t_1 = PyString_FromFormat(__pyx_k_s_s, __pyx_v_field->table, __pyx_v_field->name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L5; + } + /*else*/ { + + /* "oursqlx/util.pyx":32 + * field.table, field.name) + * else: + * name = field.name # <<<<<<<<<<<<<< + * data = ( + * name, + */ + __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_field->name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_1); + __pyx_t_1 = 0; + } + __pyx_L5:; + + /* "oursqlx/util.pyx":35 + * data = ( + * name, + * field.type, # <<<<<<<<<<<<<< + * field.max_length, + * field.length, + */ + __pyx_t_1 = PyInt_FromLong(__pyx_v_field->type); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + + /* "oursqlx/util.pyx":36 + * name, + * field.type, + * field.max_length, # <<<<<<<<<<<<<< + * field.length, + * field.length, + */ + __pyx_t_5 = __Pyx_PyInt_From_unsigned_int(__pyx_v_field->max_length); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + + /* "oursqlx/util.pyx":37 + * field.type, + * field.max_length, + * field.length, # <<<<<<<<<<<<<< + * field.length, + * field.decimals, + */ + __pyx_t_6 = __Pyx_PyInt_From_unsigned_int(__pyx_v_field->length); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + + /* "oursqlx/util.pyx":38 + * field.max_length, + * field.length, + * field.length, # <<<<<<<<<<<<<< + * field.decimals, + * field.flags & NOT_NULL_FLAG != NOT_NULL_FLAG) + */ + __pyx_t_7 = __Pyx_PyInt_From_unsigned_int(__pyx_v_field->length); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + + /* "oursqlx/util.pyx":39 + * field.length, + * field.length, + * field.decimals, # <<<<<<<<<<<<<< + * field.flags & NOT_NULL_FLAG != NOT_NULL_FLAG) + * Py_INCREF(data) + */ + __pyx_t_8 = __Pyx_PyInt_From_unsigned_int(__pyx_v_field->decimals); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + + /* "oursqlx/util.pyx":40 + * field.length, + * field.decimals, + * field.flags & NOT_NULL_FLAG != NOT_NULL_FLAG) # <<<<<<<<<<<<<< + * Py_INCREF(data) + * PyList_SET_ITEM(ret, i, data) + */ + __pyx_t_9 = __Pyx_PyBool_FromLong(((__pyx_v_field->flags & NOT_NULL_FLAG) != NOT_NULL_FLAG)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + + /* "oursqlx/util.pyx":34 + * name = field.name + * data = ( + * name, # <<<<<<<<<<<<<< + * field.type, + * field.max_length, + */ + __pyx_t_10 = PyTuple_New(7); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_INCREF(__pyx_v_name); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_name); + __Pyx_GIVEREF(__pyx_v_name); + PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_10, 3, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_10, 4, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_10, 5, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_10, 6, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + __pyx_t_1 = 0; + __pyx_t_5 = 0; + __pyx_t_6 = 0; + __pyx_t_7 = 0; + __pyx_t_8 = 0; + __pyx_t_9 = 0; + __Pyx_XDECREF_SET(__pyx_v_data, ((PyObject*)__pyx_t_10)); + __pyx_t_10 = 0; + + /* "oursqlx/util.pyx":41 + * field.decimals, + * field.flags & NOT_NULL_FLAG != NOT_NULL_FLAG) + * Py_INCREF(data) # <<<<<<<<<<<<<< + * PyList_SET_ITEM(ret, i, data) + * return ret + */ + Py_INCREF(__pyx_v_data); + + /* "oursqlx/util.pyx":42 + * field.flags & NOT_NULL_FLAG != NOT_NULL_FLAG) + * Py_INCREF(data) + * PyList_SET_ITEM(ret, i, data) # <<<<<<<<<<<<<< + * return ret + * + */ + PyList_SET_ITEM(__pyx_v_ret, __pyx_v_i, __pyx_v_data); + } + + /* "oursqlx/util.pyx":43 + * Py_INCREF(data) + * PyList_SET_ITEM(ret, i, data) + * return ret # <<<<<<<<<<<<<< + * + * cdef class _DictWhateverMixin: + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_ret); + __pyx_r = __pyx_v_ret; + goto __pyx_L0; + + /* "oursqlx/util.pyx":22 + * return ret + * + * cdef object description_from_res(MYSQL_RES *res, int fields, bint show_table): # <<<<<<<<<<<<<< + * cdef int i + * cdef MYSQL_FIELD *field + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("oursql.description_from_res", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_ret); + __Pyx_XDECREF(__pyx_v_name); + __Pyx_XDECREF(__pyx_v_data); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/util.pyx":46 + * + * cdef class _DictWhateverMixin: + * def fetchone(self): # <<<<<<<<<<<<<< + * row = super(_DictWhateverMixin, self).fetchone() + * if row is None: + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_18_DictWhateverMixin_1fetchone(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6oursql_18_DictWhateverMixin_1fetchone(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("fetchone (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_18_DictWhateverMixin_fetchone(((struct __pyx_obj_6oursql__DictWhateverMixin *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_18_DictWhateverMixin_fetchone(struct __pyx_obj_6oursql__DictWhateverMixin *__pyx_v_self) { + PyObject *__pyx_v_row = NULL; + PyObject *__pyx_v_ret = NULL; + PyObject *__pyx_v_name = NULL; + PyObject *__pyx_v_value = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_t_5; + Py_ssize_t __pyx_t_6; + PyObject *(*__pyx_t_7)(PyObject *); + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *(*__pyx_t_10)(PyObject *); + PyObject *__pyx_t_11 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("fetchone", 0); + + /* "oursqlx/util.pyx":47 + * cdef class _DictWhateverMixin: + * def fetchone(self): + * row = super(_DictWhateverMixin, self).fetchone() # <<<<<<<<<<<<<< + * if row is None: + * return None + */ + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_6oursql__DictWhateverMixin))); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)((PyObject*)__pyx_ptype_6oursql__DictWhateverMixin))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_6oursql__DictWhateverMixin))); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_fetchone); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_row = __pyx_t_1; + __pyx_t_1 = 0; + + /* "oursqlx/util.pyx":48 + * def fetchone(self): + * row = super(_DictWhateverMixin, self).fetchone() + * if row is None: # <<<<<<<<<<<<<< + * return None + * ret = {} + */ + __pyx_t_4 = (__pyx_v_row == Py_None); + __pyx_t_5 = (__pyx_t_4 != 0); + if (__pyx_t_5) { + + /* "oursqlx/util.pyx":49 + * row = super(_DictWhateverMixin, self).fetchone() + * if row is None: + * return None # <<<<<<<<<<<<<< + * ret = {} + * for name, value in zip(self.column_names, row): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + } + + /* "oursqlx/util.pyx":50 + * if row is None: + * return None + * ret = {} # <<<<<<<<<<<<<< + * for name, value in zip(self.column_names, row): + * if name in ret: + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_ret = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "oursqlx/util.pyx":51 + * return None + * ret = {} + * for name, value in zip(self.column_names, row): # <<<<<<<<<<<<<< + * if name in ret: + * if ret[name] != value: + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_column_names); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_row); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_row); + __Pyx_GIVEREF(__pyx_v_row); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_zip, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_6 = 0; + __pyx_t_7 = NULL; + } else { + __pyx_t_6 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (likely(!__pyx_t_7)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } + } else { + __pyx_t_1 = __pyx_t_7(__pyx_t_2); + if (unlikely(!__pyx_t_1)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { + PyObject* sequence = __pyx_t_1; + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); + } else { + __pyx_t_3 = PyList_GET_ITEM(sequence, 0); + __pyx_t_8 = PyList_GET_ITEM(sequence, 1); + } + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_8); + #else + __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_9 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_10 = Py_TYPE(__pyx_t_9)->tp_iternext; + index = 0; __pyx_t_3 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_3)) goto __pyx_L6_unpacking_failed; + __Pyx_GOTREF(__pyx_t_3); + index = 1; __pyx_t_8 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_8)) goto __pyx_L6_unpacking_failed; + __Pyx_GOTREF(__pyx_t_8); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = NULL; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + goto __pyx_L7_unpacking_done; + __pyx_L6_unpacking_failed:; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_10 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L7_unpacking_done:; + } + __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_3); + __pyx_t_3 = 0; + __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_8); + __pyx_t_8 = 0; + + /* "oursqlx/util.pyx":52 + * ret = {} + * for name, value in zip(self.column_names, row): + * if name in ret: # <<<<<<<<<<<<<< + * if ret[name] != value: + * raise ProgrammingError('column "%s" appears more than once' + */ + __pyx_t_5 = (__Pyx_PyDict_Contains(__pyx_v_name, __pyx_v_ret, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = (__pyx_t_5 != 0); + if (__pyx_t_4) { + + /* "oursqlx/util.pyx":53 + * for name, value in zip(self.column_names, row): + * if name in ret: + * if ret[name] != value: # <<<<<<<<<<<<<< + * raise ProgrammingError('column "%s" appears more than once' + * ' in output' % name) + */ + __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_v_ret, __pyx_v_name); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_8 = PyObject_RichCompare(__pyx_t_1, __pyx_v_value, Py_NE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (__pyx_t_4) { + + /* "oursqlx/util.pyx":54 + * if name in ret: + * if ret[name] != value: + * raise ProgrammingError('column "%s" appears more than once' # <<<<<<<<<<<<<< + * ' in output' % name) + * else: + */ + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_ProgrammingError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + + /* "oursqlx/util.pyx":55 + * if ret[name] != value: + * raise ProgrammingError('column "%s" appears more than once' + * ' in output' % name) # <<<<<<<<<<<<<< + * else: + * ret[name] = value + */ + __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_column_s_appears_more_than_once, __pyx_v_name); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_9 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_9)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_1, function); + } + } + if (!__pyx_t_9) { + __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GOTREF(__pyx_t_8); + } else { + __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9); __Pyx_GIVEREF(__pyx_t_9); __pyx_t_9 = NULL; + PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_11, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + goto __pyx_L8; + } + /*else*/ { + + /* "oursqlx/util.pyx":57 + * ' in output' % name) + * else: + * ret[name] = value # <<<<<<<<<<<<<< + * return ret + * + */ + if (unlikely(PyDict_SetItem(__pyx_v_ret, __pyx_v_name, __pyx_v_value) < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L8:; + + /* "oursqlx/util.pyx":51 + * return None + * ret = {} + * for name, value in zip(self.column_names, row): # <<<<<<<<<<<<<< + * if name in ret: + * if ret[name] != value: + */ + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "oursqlx/util.pyx":58 + * else: + * ret[name] = value + * return ret # <<<<<<<<<<<<<< + * + * _exception_enum_map = { + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_ret); + __pyx_r = __pyx_v_ret; + goto __pyx_L0; + + /* "oursqlx/util.pyx":46 + * + * cdef class _DictWhateverMixin: + * def fetchone(self): # <<<<<<<<<<<<<< + * row = super(_DictWhateverMixin, self).fetchone() + * if row is None: + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_AddTraceback("oursql._DictWhateverMixin.fetchone", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_row); + __Pyx_XDECREF(__pyx_v_ret); + __Pyx_XDECREF(__pyx_v_name); + __Pyx_XDECREF(__pyx_v_value); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/util.pyx":71 + * _oursqlx_UnknownError: UnknownError, + * } + * def _exception_from_errno(int err): # <<<<<<<<<<<<<< + * return _exception_enum_map[_oursqlx_exc_from_errno(err)] + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_1_exception_from_errno(PyObject *__pyx_self, PyObject *__pyx_arg_err); /*proto*/ +static PyMethodDef __pyx_mdef_6oursql_1_exception_from_errno = {"_exception_from_errno", (PyCFunction)__pyx_pw_6oursql_1_exception_from_errno, METH_O, 0}; +static PyObject *__pyx_pw_6oursql_1_exception_from_errno(PyObject *__pyx_self, PyObject *__pyx_arg_err) { + int __pyx_v_err; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_exception_from_errno (wrapper)", 0); + assert(__pyx_arg_err); { + __pyx_v_err = __Pyx_PyInt_As_int(__pyx_arg_err); if (unlikely((__pyx_v_err == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("oursql._exception_from_errno", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6oursql__exception_from_errno(__pyx_self, ((int)__pyx_v_err)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql__exception_from_errno(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_err) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_exception_from_errno", 0); + + /* "oursqlx/util.pyx":72 + * } + * def _exception_from_errno(int err): + * return _exception_enum_map[_oursqlx_exc_from_errno(err)] # <<<<<<<<<<<<<< + * + * def _do_warnings_query(Connection conn not None): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_exception_enum_map); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyInt_FromLong(_oursqlx_exc_from_errno(__pyx_v_err)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_GetItem(__pyx_t_1, __pyx_t_2); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "oursqlx/util.pyx":71 + * _oursqlx_UnknownError: UnknownError, + * } + * def _exception_from_errno(int err): # <<<<<<<<<<<<<< + * return _exception_enum_map[_oursqlx_exc_from_errno(err)] + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("oursql._exception_from_errno", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/util.pyx":74 + * return _exception_enum_map[_oursqlx_exc_from_errno(err)] + * + * def _do_warnings_query(Connection conn not None): # <<<<<<<<<<<<<< + * cdef int should_raise = False + * q = _Query(conn, 'SHOW WARNINGS') + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_3_do_warnings_query(PyObject *__pyx_self, PyObject *__pyx_v_conn); /*proto*/ +static PyMethodDef __pyx_mdef_6oursql_3_do_warnings_query = {"_do_warnings_query", (PyCFunction)__pyx_pw_6oursql_3_do_warnings_query, METH_O, 0}; +static PyObject *__pyx_pw_6oursql_3_do_warnings_query(PyObject *__pyx_self, PyObject *__pyx_v_conn) { + CYTHON_UNUSED int __pyx_lineno = 0; + CYTHON_UNUSED const char *__pyx_filename = NULL; + CYTHON_UNUSED int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_do_warnings_query (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_conn), __pyx_ptype_6oursql_Connection, 0, "conn", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_6oursql_2_do_warnings_query(__pyx_self, ((struct __pyx_obj_6oursql_Connection *)__pyx_v_conn)); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_2_do_warnings_query(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_6oursql_Connection *__pyx_v_conn) { + int __pyx_v_should_raise; + struct __pyx_obj_6oursql__Query *__pyx_v_q = NULL; + PyObject *__pyx_v_ret = NULL; + PyObject *__pyx_v_kind = NULL; + PyObject *__pyx_v_err = NULL; + PyObject *__pyx_v_message = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + PyObject *(*__pyx_t_4)(PyObject *); + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *(*__pyx_t_9)(PyObject *); + int __pyx_t_10; + int __pyx_t_11; + int __pyx_t_12; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_do_warnings_query", 0); + + /* "oursqlx/util.pyx":75 + * + * def _do_warnings_query(Connection conn not None): + * cdef int should_raise = False # <<<<<<<<<<<<<< + * q = _Query(conn, 'SHOW WARNINGS') + * ret = [] + */ + __pyx_v_should_raise = 0; + + /* "oursqlx/util.pyx":76 + * def _do_warnings_query(Connection conn not None): + * cdef int should_raise = False + * q = _Query(conn, 'SHOW WARNINGS') # <<<<<<<<<<<<<< + * ret = [] + * for kind, err, message in q: + */ + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_v_conn)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_conn)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_conn)); + __Pyx_INCREF(__pyx_kp_s_SHOW_WARNINGS); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_kp_s_SHOW_WARNINGS); + __Pyx_GIVEREF(__pyx_kp_s_SHOW_WARNINGS); + __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6oursql__Query)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_q = ((struct __pyx_obj_6oursql__Query *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "oursqlx/util.pyx":77 + * cdef int should_raise = False + * q = _Query(conn, 'SHOW WARNINGS') + * ret = [] # <<<<<<<<<<<<<< + * for kind, err, message in q: + * if kind == 'Note': + */ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_ret = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + + /* "oursqlx/util.pyx":78 + * q = _Query(conn, 'SHOW WARNINGS') + * ret = [] + * for kind, err, message in q: # <<<<<<<<<<<<<< + * if kind == 'Note': + * kind = Note + */ + if (likely(PyList_CheckExact(((PyObject *)__pyx_v_q))) || PyTuple_CheckExact(((PyObject *)__pyx_v_q))) { + __pyx_t_2 = ((PyObject *)__pyx_v_q); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; + __pyx_t_4 = NULL; + } else { + __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(((PyObject *)__pyx_v_q)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + for (;;) { + if (likely(!__pyx_t_4)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } + } else { + __pyx_t_1 = __pyx_t_4(__pyx_t_2); + if (unlikely(!__pyx_t_1)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { + PyObject* sequence = __pyx_t_1; + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 3)) { + if (size > 3) __Pyx_RaiseTooManyValuesError(3); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); + __pyx_t_7 = PyTuple_GET_ITEM(sequence, 2); + } else { + __pyx_t_5 = PyList_GET_ITEM(sequence, 0); + __pyx_t_6 = PyList_GET_ITEM(sequence, 1); + __pyx_t_7 = PyList_GET_ITEM(sequence, 2); + } + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); + #else + __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_8 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext; + index = 0; __pyx_t_5 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_5)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_5); + index = 1; __pyx_t_6 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_6); + index = 2; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 3) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = NULL; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L6_unpacking_done; + __pyx_L5_unpacking_failed:; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_9 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L6_unpacking_done:; + } + __Pyx_XDECREF_SET(__pyx_v_kind, __pyx_t_5); + __pyx_t_5 = 0; + __Pyx_XDECREF_SET(__pyx_v_err, __pyx_t_6); + __pyx_t_6 = 0; + __Pyx_XDECREF_SET(__pyx_v_message, __pyx_t_7); + __pyx_t_7 = 0; + + /* "oursqlx/util.pyx":79 + * ret = [] + * for kind, err, message in q: + * if kind == 'Note': # <<<<<<<<<<<<<< + * kind = Note + * elif kind == 'Warning': + */ + __pyx_t_10 = (__Pyx_PyString_Equals(__pyx_v_kind, __pyx_n_s_Note, Py_EQ)); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_10) { + + /* "oursqlx/util.pyx":80 + * for kind, err, message in q: + * if kind == 'Note': + * kind = Note # <<<<<<<<<<<<<< + * elif kind == 'Warning': + * kind = Warning + */ + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_Note); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF_SET(__pyx_v_kind, __pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L7; + } + + /* "oursqlx/util.pyx":81 + * if kind == 'Note': + * kind = Note + * elif kind == 'Warning': # <<<<<<<<<<<<<< + * kind = Warning + * should_raise = True + */ + __pyx_t_10 = (__Pyx_PyString_Equals(__pyx_v_kind, __pyx_n_s_Warning, Py_EQ)); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_10) { + + /* "oursqlx/util.pyx":82 + * kind = Note + * elif kind == 'Warning': + * kind = Warning # <<<<<<<<<<<<<< + * should_raise = True + * elif kind == 'Error': + */ + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_Warning); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF_SET(__pyx_v_kind, __pyx_t_1); + __pyx_t_1 = 0; + + /* "oursqlx/util.pyx":83 + * elif kind == 'Warning': + * kind = Warning + * should_raise = True # <<<<<<<<<<<<<< + * elif kind == 'Error': + * kind = _exception_from_errno(err) + */ + __pyx_v_should_raise = 1; + goto __pyx_L7; + } + + /* "oursqlx/util.pyx":84 + * kind = Warning + * should_raise = True + * elif kind == 'Error': # <<<<<<<<<<<<<< + * kind = _exception_from_errno(err) + * should_raise = True + */ + __pyx_t_10 = (__Pyx_PyString_Equals(__pyx_v_kind, __pyx_n_s_Error, Py_EQ)); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_10) { + + /* "oursqlx/util.pyx":85 + * should_raise = True + * elif kind == 'Error': + * kind = _exception_from_errno(err) # <<<<<<<<<<<<<< + * should_raise = True + * else: + */ + __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_exception_from_errno); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_6 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_7, function); + } + } + if (!__pyx_t_6) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_err); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + } else { + __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL; + __Pyx_INCREF(__pyx_v_err); + PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_err); + __Pyx_GIVEREF(__pyx_v_err); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF_SET(__pyx_v_kind, __pyx_t_1); + __pyx_t_1 = 0; + + /* "oursqlx/util.pyx":86 + * elif kind == 'Error': + * kind = _exception_from_errno(err) + * should_raise = True # <<<<<<<<<<<<<< + * else: + * raise InterfaceError('unknown kind of warning: %r' % kind) + */ + __pyx_v_should_raise = 1; + goto __pyx_L7; + } + /*else*/ { + + /* "oursqlx/util.pyx":88 + * should_raise = True + * else: + * raise InterfaceError('unknown kind of warning: %r' % kind) # <<<<<<<<<<<<<< + * ret.append((kind, (message, err))) + * if should_raise and conn.raise_on_warnings: + */ + __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_InterfaceError); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_unknown_kind_of_warning_r, __pyx_v_kind); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_7, function); + } + } + if (!__pyx_t_6) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else { + __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL; + PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L7:; + + /* "oursqlx/util.pyx":89 + * else: + * raise InterfaceError('unknown kind of warning: %r' % kind) + * ret.append((kind, (message, err))) # <<<<<<<<<<<<<< + * if should_raise and conn.raise_on_warnings: + * raise CollatedWarningsError('query caused warnings', extra=ret) + */ + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_message); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_message); + __Pyx_GIVEREF(__pyx_v_message); + __Pyx_INCREF(__pyx_v_err); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_err); + __Pyx_GIVEREF(__pyx_v_err); + __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_INCREF(__pyx_v_kind); + PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_kind); + __Pyx_GIVEREF(__pyx_v_kind); + PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_ret, __pyx_t_7); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "oursqlx/util.pyx":78 + * q = _Query(conn, 'SHOW WARNINGS') + * ret = [] + * for kind, err, message in q: # <<<<<<<<<<<<<< + * if kind == 'Note': + * kind = Note + */ + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "oursqlx/util.pyx":90 + * raise InterfaceError('unknown kind of warning: %r' % kind) + * ret.append((kind, (message, err))) + * if should_raise and conn.raise_on_warnings: # <<<<<<<<<<<<<< + * raise CollatedWarningsError('query caused warnings', extra=ret) + * return ret + */ + __pyx_t_12 = (__pyx_v_should_raise != 0); + if (__pyx_t_12) { + } else { + __pyx_t_10 = __pyx_t_12; + goto __pyx_L9_bool_binop_done; + } + __pyx_t_12 = (__pyx_v_conn->raise_on_warnings != 0); + __pyx_t_10 = __pyx_t_12; + __pyx_L9_bool_binop_done:; + if (__pyx_t_10) { + + /* "oursqlx/util.pyx":91 + * ret.append((kind, (message, err))) + * if should_raise and conn.raise_on_warnings: + * raise CollatedWarningsError('query caused warnings', extra=ret) # <<<<<<<<<<<<<< + * return ret + */ + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_CollatedWarningsError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_extra, __pyx_v_ret) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple_, __pyx_t_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + + /* "oursqlx/util.pyx":92 + * if should_raise and conn.raise_on_warnings: + * raise CollatedWarningsError('query caused warnings', extra=ret) + * return ret # <<<<<<<<<<<<<< + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_ret); + __pyx_r = __pyx_v_ret; + goto __pyx_L0; + + /* "oursqlx/util.pyx":74 + * return _exception_enum_map[_oursqlx_exc_from_errno(err)] + * + * def _do_warnings_query(Connection conn not None): # <<<<<<<<<<<<<< + * cdef int should_raise = False + * q = _Query(conn, 'SHOW WARNINGS') + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("oursql._do_warnings_query", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_q); + __Pyx_XDECREF(__pyx_v_ret); + __Pyx_XDECREF(__pyx_v_kind); + __Pyx_XDECREF(__pyx_v_err); + __Pyx_XDECREF(__pyx_v_message); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/conversions.pyx":3 + * import decimal, datetime, time + * + * def _bitval_from_string(s): # <<<<<<<<<<<<<< + * cdef Py_ssize_t length + * cdef unsigned char *ss + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_5_bitval_from_string(PyObject *__pyx_self, PyObject *__pyx_v_s); /*proto*/ +static PyMethodDef __pyx_mdef_6oursql_5_bitval_from_string = {"_bitval_from_string", (PyCFunction)__pyx_pw_6oursql_5_bitval_from_string, METH_O, 0}; +static PyObject *__pyx_pw_6oursql_5_bitval_from_string(PyObject *__pyx_self, PyObject *__pyx_v_s) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_bitval_from_string (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_4_bitval_from_string(__pyx_self, ((PyObject *)__pyx_v_s)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_4_bitval_from_string(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_s) { + Py_ssize_t __pyx_v_length; + unsigned char *__pyx_v_ss; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_bitval_from_string", 0); + + /* "oursqlx/conversions.pyx":6 + * cdef Py_ssize_t length + * cdef unsigned char *ss + * PyString_AsStringAndSize(s, &ss, &length) # <<<<<<<<<<<<<< + * return bitval_from_char_p(ss, length) + * + */ + __pyx_t_1 = PyString_AsStringAndSize(__pyx_v_s, ((char **)(&__pyx_v_ss)), (&__pyx_v_length)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "oursqlx/conversions.pyx":7 + * cdef unsigned char *ss + * PyString_AsStringAndSize(s, &ss, &length) + * return bitval_from_char_p(ss, length) # <<<<<<<<<<<<<< + * + * def _datetime_from_string(s): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyInt_From_unsigned_long(__pyx_f_6oursql_bitval_from_char_p(__pyx_v_ss, __pyx_v_length)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "oursqlx/conversions.pyx":3 + * import decimal, datetime, time + * + * def _bitval_from_string(s): # <<<<<<<<<<<<<< + * cdef Py_ssize_t length + * cdef unsigned char *ss + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("oursql._bitval_from_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/conversions.pyx":9 + * return bitval_from_char_p(ss, length) + * + * def _datetime_from_string(s): # <<<<<<<<<<<<<< + * tt = time.strptime(s, '%Y-%m-%d %H:%M:%S') + * return datetime.datetime(*tt[:6]) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_7_datetime_from_string(PyObject *__pyx_self, PyObject *__pyx_v_s); /*proto*/ +static PyMethodDef __pyx_mdef_6oursql_7_datetime_from_string = {"_datetime_from_string", (PyCFunction)__pyx_pw_6oursql_7_datetime_from_string, METH_O, 0}; +static PyObject *__pyx_pw_6oursql_7_datetime_from_string(PyObject *__pyx_self, PyObject *__pyx_v_s) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_datetime_from_string (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_6_datetime_from_string(__pyx_self, ((PyObject *)__pyx_v_s)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_6_datetime_from_string(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_s) { + PyObject *__pyx_v_tt = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_datetime_from_string", 0); + + /* "oursqlx/conversions.pyx":10 + * + * def _datetime_from_string(s): + * tt = time.strptime(s, '%Y-%m-%d %H:%M:%S') # <<<<<<<<<<<<<< + * return datetime.datetime(*tt[:6]) + * + */ + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_time); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_strptime); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = NULL; + __pyx_t_4 = 0; + if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_4 = 1; + } + } + __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + if (__pyx_t_2) { + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = NULL; + } + __Pyx_INCREF(__pyx_v_s); + PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_s); + __Pyx_GIVEREF(__pyx_v_s); + __Pyx_INCREF(__pyx_kp_s_Y_m_d_H_M_S); + PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_kp_s_Y_m_d_H_M_S); + __Pyx_GIVEREF(__pyx_kp_s_Y_m_d_H_M_S); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_tt = __pyx_t_1; + __pyx_t_1 = 0; + + /* "oursqlx/conversions.pyx":11 + * def _datetime_from_string(s): + * tt = time.strptime(s, '%Y-%m-%d %H:%M:%S') + * return datetime.datetime(*tt[:6]) # <<<<<<<<<<<<<< + * + * def _date_from_string(s): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_datetime); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_datetime); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_tt, 0, 6, NULL, NULL, &__pyx_slice__2, 0, 1, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PySequence_Tuple(__pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "oursqlx/conversions.pyx":9 + * return bitval_from_char_p(ss, length) + * + * def _datetime_from_string(s): # <<<<<<<<<<<<<< + * tt = time.strptime(s, '%Y-%m-%d %H:%M:%S') + * return datetime.datetime(*tt[:6]) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("oursql._datetime_from_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_tt); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/conversions.pyx":13 + * return datetime.datetime(*tt[:6]) + * + * def _date_from_string(s): # <<<<<<<<<<<<<< + * tt = time.strptime(s, '%Y-%m-%d') + * return datetime.date(*tt[:3]) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_9_date_from_string(PyObject *__pyx_self, PyObject *__pyx_v_s); /*proto*/ +static PyMethodDef __pyx_mdef_6oursql_9_date_from_string = {"_date_from_string", (PyCFunction)__pyx_pw_6oursql_9_date_from_string, METH_O, 0}; +static PyObject *__pyx_pw_6oursql_9_date_from_string(PyObject *__pyx_self, PyObject *__pyx_v_s) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_date_from_string (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_8_date_from_string(__pyx_self, ((PyObject *)__pyx_v_s)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_8_date_from_string(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_s) { + PyObject *__pyx_v_tt = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_date_from_string", 0); + + /* "oursqlx/conversions.pyx":14 + * + * def _date_from_string(s): + * tt = time.strptime(s, '%Y-%m-%d') # <<<<<<<<<<<<<< + * return datetime.date(*tt[:3]) + * + */ + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_time); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_strptime); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = NULL; + __pyx_t_4 = 0; + if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_4 = 1; + } + } + __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + if (__pyx_t_2) { + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = NULL; + } + __Pyx_INCREF(__pyx_v_s); + PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_s); + __Pyx_GIVEREF(__pyx_v_s); + __Pyx_INCREF(__pyx_kp_s_Y_m_d); + PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_kp_s_Y_m_d); + __Pyx_GIVEREF(__pyx_kp_s_Y_m_d); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_tt = __pyx_t_1; + __pyx_t_1 = 0; + + /* "oursqlx/conversions.pyx":15 + * def _date_from_string(s): + * tt = time.strptime(s, '%Y-%m-%d') + * return datetime.date(*tt[:3]) # <<<<<<<<<<<<<< + * + * def _time_from_string(s): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_datetime); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_date); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_tt, 0, 3, NULL, NULL, &__pyx_slice__3, 0, 1, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PySequence_Tuple(__pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "oursqlx/conversions.pyx":13 + * return datetime.datetime(*tt[:6]) + * + * def _date_from_string(s): # <<<<<<<<<<<<<< + * tt = time.strptime(s, '%Y-%m-%d') + * return datetime.date(*tt[:3]) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("oursql._date_from_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_tt); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/conversions.pyx":17 + * return datetime.date(*tt[:3]) + * + * def _time_from_string(s): # <<<<<<<<<<<<<< + * tt = time.strptime(s, '%H:%M:%S') + * return datetime.time(*tt[3:6]) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_11_time_from_string(PyObject *__pyx_self, PyObject *__pyx_v_s); /*proto*/ +static PyMethodDef __pyx_mdef_6oursql_11_time_from_string = {"_time_from_string", (PyCFunction)__pyx_pw_6oursql_11_time_from_string, METH_O, 0}; +static PyObject *__pyx_pw_6oursql_11_time_from_string(PyObject *__pyx_self, PyObject *__pyx_v_s) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_time_from_string (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_10_time_from_string(__pyx_self, ((PyObject *)__pyx_v_s)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_10_time_from_string(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_s) { + PyObject *__pyx_v_tt = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_time_from_string", 0); + + /* "oursqlx/conversions.pyx":18 + * + * def _time_from_string(s): + * tt = time.strptime(s, '%H:%M:%S') # <<<<<<<<<<<<<< + * return datetime.time(*tt[3:6]) + * + */ + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_time); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_strptime); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = NULL; + __pyx_t_4 = 0; + if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_4 = 1; + } + } + __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + if (__pyx_t_2) { + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = NULL; + } + __Pyx_INCREF(__pyx_v_s); + PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_s); + __Pyx_GIVEREF(__pyx_v_s); + __Pyx_INCREF(__pyx_kp_s_H_M_S); + PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_kp_s_H_M_S); + __Pyx_GIVEREF(__pyx_kp_s_H_M_S); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_tt = __pyx_t_1; + __pyx_t_1 = 0; + + /* "oursqlx/conversions.pyx":19 + * def _time_from_string(s): + * tt = time.strptime(s, '%H:%M:%S') + * return datetime.time(*tt[3:6]) # <<<<<<<<<<<<<< + * + * _conversions = { + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_datetime); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_time); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_tt, 3, 6, NULL, NULL, &__pyx_slice__4, 1, 1, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PySequence_Tuple(__pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "oursqlx/conversions.pyx":17 + * return datetime.date(*tt[:3]) + * + * def _time_from_string(s): # <<<<<<<<<<<<<< + * tt = time.strptime(s, '%H:%M:%S') + * return datetime.time(*tt[3:6]) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("oursql._time_from_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_tt); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/conversions.pyx":55 + * Binary = buffer + * + * def TimestampFromTicks(ticks): # <<<<<<<<<<<<<< + * """TimestampFromTicks(ticks) -> Timestamp. + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_13TimestampFromTicks(PyObject *__pyx_self, PyObject *__pyx_v_ticks); /*proto*/ +static char __pyx_doc_6oursql_12TimestampFromTicks[] = "TimestampFromTicks(ticks) -> Timestamp.\n \n Convert a time in seconds since the epoch into a Timestamp.\n "; +static PyMethodDef __pyx_mdef_6oursql_13TimestampFromTicks = {"TimestampFromTicks", (PyCFunction)__pyx_pw_6oursql_13TimestampFromTicks, METH_O, __pyx_doc_6oursql_12TimestampFromTicks}; +static PyObject *__pyx_pw_6oursql_13TimestampFromTicks(PyObject *__pyx_self, PyObject *__pyx_v_ticks) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("TimestampFromTicks (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_12TimestampFromTicks(__pyx_self, ((PyObject *)__pyx_v_ticks)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_12TimestampFromTicks(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_ticks) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("TimestampFromTicks", 0); + + /* "oursqlx/conversions.pyx":60 + * Convert a time in seconds since the epoch into a Timestamp. + * """ + * return Timestamp(*time.localtime(ticks)[:6]) # <<<<<<<<<<<<<< + * + * def DateFromTicks(ticks): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_Timestamp); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_time); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_localtime); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + if (!__pyx_t_3) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_ticks); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + } else { + __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL; + __Pyx_INCREF(__pyx_v_ticks); + PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_ticks); + __Pyx_GIVEREF(__pyx_v_ticks); + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetSlice(__pyx_t_2, 0, 6, NULL, NULL, &__pyx_slice__5, 0, 1, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PySequence_Tuple(__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + + /* "oursqlx/conversions.pyx":55 + * Binary = buffer + * + * def TimestampFromTicks(ticks): # <<<<<<<<<<<<<< + * """TimestampFromTicks(ticks) -> Timestamp. + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("oursql.TimestampFromTicks", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/conversions.pyx":62 + * return Timestamp(*time.localtime(ticks)[:6]) + * + * def DateFromTicks(ticks): # <<<<<<<<<<<<<< + * """DateFromTicks(ticks) -> Date. + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_15DateFromTicks(PyObject *__pyx_self, PyObject *__pyx_v_ticks); /*proto*/ +static char __pyx_doc_6oursql_14DateFromTicks[] = "DateFromTicks(ticks) -> Date.\n \n Convert a time in seconds since the epoch into a Date.\n "; +static PyMethodDef __pyx_mdef_6oursql_15DateFromTicks = {"DateFromTicks", (PyCFunction)__pyx_pw_6oursql_15DateFromTicks, METH_O, __pyx_doc_6oursql_14DateFromTicks}; +static PyObject *__pyx_pw_6oursql_15DateFromTicks(PyObject *__pyx_self, PyObject *__pyx_v_ticks) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("DateFromTicks (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_14DateFromTicks(__pyx_self, ((PyObject *)__pyx_v_ticks)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_14DateFromTicks(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_ticks) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("DateFromTicks", 0); + + /* "oursqlx/conversions.pyx":67 + * Convert a time in seconds since the epoch into a Date. + * """ + * return Date(*time.localtime(ticks)[:3]) # <<<<<<<<<<<<<< + * + * def TimeFromTicks(ticks): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_Date); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_time); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_localtime); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + if (!__pyx_t_3) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_ticks); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + } else { + __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL; + __Pyx_INCREF(__pyx_v_ticks); + PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_ticks); + __Pyx_GIVEREF(__pyx_v_ticks); + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetSlice(__pyx_t_2, 0, 3, NULL, NULL, &__pyx_slice__6, 0, 1, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PySequence_Tuple(__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + + /* "oursqlx/conversions.pyx":62 + * return Timestamp(*time.localtime(ticks)[:6]) + * + * def DateFromTicks(ticks): # <<<<<<<<<<<<<< + * """DateFromTicks(ticks) -> Date. + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("oursql.DateFromTicks", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/conversions.pyx":69 + * return Date(*time.localtime(ticks)[:3]) + * + * def TimeFromTicks(ticks): # <<<<<<<<<<<<<< + * """TimeFromTicks(ticks) -> Time. + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_17TimeFromTicks(PyObject *__pyx_self, PyObject *__pyx_v_ticks); /*proto*/ +static char __pyx_doc_6oursql_16TimeFromTicks[] = "TimeFromTicks(ticks) -> Time.\n \n Convert a time in seconds since the epoch into a Time.\n "; +static PyMethodDef __pyx_mdef_6oursql_17TimeFromTicks = {"TimeFromTicks", (PyCFunction)__pyx_pw_6oursql_17TimeFromTicks, METH_O, __pyx_doc_6oursql_16TimeFromTicks}; +static PyObject *__pyx_pw_6oursql_17TimeFromTicks(PyObject *__pyx_self, PyObject *__pyx_v_ticks) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("TimeFromTicks (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_16TimeFromTicks(__pyx_self, ((PyObject *)__pyx_v_ticks)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_16TimeFromTicks(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_ticks) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("TimeFromTicks", 0); + + /* "oursqlx/conversions.pyx":74 + * Convert a time in seconds since the epoch into a Time. + * """ + * return Time(*time.localtime(ticks)[3:6]) # <<<<<<<<<<<<<< + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_Time); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_time); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_localtime); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + if (!__pyx_t_3) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_ticks); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + } else { + __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL; + __Pyx_INCREF(__pyx_v_ticks); + PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_ticks); + __Pyx_GIVEREF(__pyx_v_ticks); + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetSlice(__pyx_t_2, 3, 6, NULL, NULL, &__pyx_slice__7, 1, 1, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PySequence_Tuple(__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + + /* "oursqlx/conversions.pyx":69 + * return Date(*time.localtime(ticks)[:3]) + * + * def TimeFromTicks(ticks): # <<<<<<<<<<<<<< + * """TimeFromTicks(ticks) -> Time. + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("oursql.TimeFromTicks", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/connection.pyx":76 + * cdef public object default_cursor + * + * def __cinit__(self, char *host=NULL, char *user=NULL, char *passwd=NULL, *, # <<<<<<<<<<<<<< + * char *db=NULL, unsigned int port=0, char *unix_socket=NULL, + * connect_timeout=None, read_timeout=None, write_timeout=None, + */ + +/* Python wrapper */ +static int __pyx_pw_6oursql_10Connection_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_6oursql_10Connection_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + char *__pyx_v_host; + char *__pyx_v_user; + char *__pyx_v_passwd; + char *__pyx_v_db; + unsigned int __pyx_v_port; + char *__pyx_v_unix_socket; + PyObject *__pyx_v_connect_timeout = 0; + PyObject *__pyx_v_read_timeout = 0; + PyObject *__pyx_v_write_timeout = 0; + PyObject *__pyx_v_protocol = 0; + PyObject *__pyx_v_ssl = 0; + char *__pyx_v_read_default_file; + char *__pyx_v_read_default_group; + char *__pyx_v_init_command; + char *__pyx_v_charset_dir; + char *__pyx_v_shared_memory_base_name; + int __pyx_v_local_infile; + int __pyx_v_require_secure_auth; + int __pyx_v_compress; + int __pyx_v_report_truncation; + int __pyx_v_found_rows; + int __pyx_v_use_unicode; + PyObject *__pyx_v_charset = 0; + int __pyx_v_autoping; + PyObject *__pyx_v_default_cursor = 0; + int __pyx_v_raise_on_warnings; + CYTHON_UNUSED int __pyx_v_multi_results; + CYTHON_UNUSED int __pyx_v_multi_statements; + int __pyx_v_autoreconnect; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_host,&__pyx_n_s_user,&__pyx_n_s_passwd,&__pyx_n_s_db,&__pyx_n_s_port,&__pyx_n_s_unix_socket,&__pyx_n_s_connect_timeout,&__pyx_n_s_read_timeout,&__pyx_n_s_write_timeout,&__pyx_n_s_protocol,&__pyx_n_s_ssl,&__pyx_n_s_read_default_file,&__pyx_n_s_read_default_group,&__pyx_n_s_init_command,&__pyx_n_s_charset_dir,&__pyx_n_s_shared_memory_base_name,&__pyx_n_s_local_infile,&__pyx_n_s_require_secure_auth,&__pyx_n_s_compress,&__pyx_n_s_report_truncation,&__pyx_n_s_found_rows,&__pyx_n_s_use_unicode,&__pyx_n_s_charset,&__pyx_n_s_autoping,&__pyx_n_s_default_cursor,&__pyx_n_s_raise_on_warnings,&__pyx_n_s_multi_results,&__pyx_n_s_multi_statements,&__pyx_n_s_autoreconnect,0}; + PyObject* values[29] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; + + /* "oursqlx/connection.pyx":78 + * def __cinit__(self, char *host=NULL, char *user=NULL, char *passwd=NULL, *, + * char *db=NULL, unsigned int port=0, char *unix_socket=NULL, + * connect_timeout=None, read_timeout=None, write_timeout=None, # <<<<<<<<<<<<<< + * protocol=None, ssl=None, char *read_default_file=NULL, + * char *read_default_group=NULL, char *init_command=NULL, + */ + values[6] = ((PyObject *)Py_None); + values[7] = ((PyObject *)Py_None); + values[8] = ((PyObject *)Py_None); + + /* "oursqlx/connection.pyx":79 + * char *db=NULL, unsigned int port=0, char *unix_socket=NULL, + * connect_timeout=None, read_timeout=None, write_timeout=None, + * protocol=None, ssl=None, char *read_default_file=NULL, # <<<<<<<<<<<<<< + * char *read_default_group=NULL, char *init_command=NULL, + * char *charset_dir=NULL, char *shared_memory_base_name=NULL, + */ + values[9] = ((PyObject *)Py_None); + values[10] = ((PyObject *)Py_None); + values[22] = ((PyObject*)__pyx_n_s_utf8); + + /* "oursqlx/connection.pyx":85 + * bint compress=False, bint report_truncation=True, + * bint found_rows=True, bint use_unicode=True, str charset='utf8', + * bint autoping=False, default_cursor=None, # <<<<<<<<<<<<<< + * bint raise_on_warnings=True, bint multi_results=True, + * bint multi_statements=True, bint autoreconnect=False): + */ + values[24] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_host); + if (value) { values[0] = value; kw_args--; } + } + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_user); + if (value) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_passwd); + if (value) { values[2] = value; kw_args--; } + } + } + if (kw_args > 0 && likely(kw_args <= 26)) { + Py_ssize_t index; + for (index = 3; index < 29 && kw_args > 0; index++) { + PyObject* value = PyDict_GetItem(__pyx_kwds, *__pyx_pyargnames[index]); + if (value) { values[index] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + } + if (values[0]) { + __pyx_v_host = __Pyx_PyObject_AsString(values[0]); if (unlikely((!__pyx_v_host) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + + /* "oursqlx/connection.pyx":76 + * cdef public object default_cursor + * + * def __cinit__(self, char *host=NULL, char *user=NULL, char *passwd=NULL, *, # <<<<<<<<<<<<<< + * char *db=NULL, unsigned int port=0, char *unix_socket=NULL, + * connect_timeout=None, read_timeout=None, write_timeout=None, + */ + __pyx_v_host = ((char *)NULL); + } + if (values[1]) { + __pyx_v_user = __Pyx_PyObject_AsString(values[1]); if (unlikely((!__pyx_v_user) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_user = ((char *)NULL); + } + if (values[2]) { + __pyx_v_passwd = __Pyx_PyObject_AsString(values[2]); if (unlikely((!__pyx_v_passwd) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_passwd = ((char *)NULL); + } + if (values[3]) { + __pyx_v_db = __Pyx_PyObject_AsString(values[3]); if (unlikely((!__pyx_v_db) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + + /* "oursqlx/connection.pyx":77 + * + * def __cinit__(self, char *host=NULL, char *user=NULL, char *passwd=NULL, *, + * char *db=NULL, unsigned int port=0, char *unix_socket=NULL, # <<<<<<<<<<<<<< + * connect_timeout=None, read_timeout=None, write_timeout=None, + * protocol=None, ssl=None, char *read_default_file=NULL, + */ + __pyx_v_db = ((char *)NULL); + } + if (values[4]) { + __pyx_v_port = __Pyx_PyInt_As_unsigned_int(values[4]); if (unlikely((__pyx_v_port == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_port = ((unsigned int)0); + } + if (values[5]) { + __pyx_v_unix_socket = __Pyx_PyObject_AsString(values[5]); if (unlikely((!__pyx_v_unix_socket) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_unix_socket = ((char *)NULL); + } + __pyx_v_connect_timeout = values[6]; + __pyx_v_read_timeout = values[7]; + __pyx_v_write_timeout = values[8]; + __pyx_v_protocol = values[9]; + __pyx_v_ssl = values[10]; + if (values[11]) { + __pyx_v_read_default_file = __Pyx_PyObject_AsString(values[11]); if (unlikely((!__pyx_v_read_default_file) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + + /* "oursqlx/connection.pyx":79 + * char *db=NULL, unsigned int port=0, char *unix_socket=NULL, + * connect_timeout=None, read_timeout=None, write_timeout=None, + * protocol=None, ssl=None, char *read_default_file=NULL, # <<<<<<<<<<<<<< + * char *read_default_group=NULL, char *init_command=NULL, + * char *charset_dir=NULL, char *shared_memory_base_name=NULL, + */ + __pyx_v_read_default_file = ((char *)NULL); + } + if (values[12]) { + __pyx_v_read_default_group = __Pyx_PyObject_AsString(values[12]); if (unlikely((!__pyx_v_read_default_group) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + + /* "oursqlx/connection.pyx":80 + * connect_timeout=None, read_timeout=None, write_timeout=None, + * protocol=None, ssl=None, char *read_default_file=NULL, + * char *read_default_group=NULL, char *init_command=NULL, # <<<<<<<<<<<<<< + * char *charset_dir=NULL, char *shared_memory_base_name=NULL, + * bint local_infile=False, bint require_secure_auth=False, + */ + __pyx_v_read_default_group = ((char *)NULL); + } + if (values[13]) { + __pyx_v_init_command = __Pyx_PyObject_AsString(values[13]); if (unlikely((!__pyx_v_init_command) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_init_command = ((char *)NULL); + } + if (values[14]) { + __pyx_v_charset_dir = __Pyx_PyObject_AsString(values[14]); if (unlikely((!__pyx_v_charset_dir) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + + /* "oursqlx/connection.pyx":81 + * protocol=None, ssl=None, char *read_default_file=NULL, + * char *read_default_group=NULL, char *init_command=NULL, + * char *charset_dir=NULL, char *shared_memory_base_name=NULL, # <<<<<<<<<<<<<< + * bint local_infile=False, bint require_secure_auth=False, + * bint compress=False, bint report_truncation=True, + */ + __pyx_v_charset_dir = ((char *)NULL); + } + if (values[15]) { + __pyx_v_shared_memory_base_name = __Pyx_PyObject_AsString(values[15]); if (unlikely((!__pyx_v_shared_memory_base_name) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_shared_memory_base_name = ((char *)NULL); + } + if (values[16]) { + __pyx_v_local_infile = __Pyx_PyObject_IsTrue(values[16]); if (unlikely((__pyx_v_local_infile == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + + /* "oursqlx/connection.pyx":82 + * char *read_default_group=NULL, char *init_command=NULL, + * char *charset_dir=NULL, char *shared_memory_base_name=NULL, + * bint local_infile=False, bint require_secure_auth=False, # <<<<<<<<<<<<<< + * bint compress=False, bint report_truncation=True, + * bint found_rows=True, bint use_unicode=True, str charset='utf8', + */ + __pyx_v_local_infile = ((int)0); + } + if (values[17]) { + __pyx_v_require_secure_auth = __Pyx_PyObject_IsTrue(values[17]); if (unlikely((__pyx_v_require_secure_auth == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_require_secure_auth = ((int)0); + } + if (values[18]) { + __pyx_v_compress = __Pyx_PyObject_IsTrue(values[18]); if (unlikely((__pyx_v_compress == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + + /* "oursqlx/connection.pyx":83 + * char *charset_dir=NULL, char *shared_memory_base_name=NULL, + * bint local_infile=False, bint require_secure_auth=False, + * bint compress=False, bint report_truncation=True, # <<<<<<<<<<<<<< + * bint found_rows=True, bint use_unicode=True, str charset='utf8', + * bint autoping=False, default_cursor=None, + */ + __pyx_v_compress = ((int)0); + } + if (values[19]) { + __pyx_v_report_truncation = __Pyx_PyObject_IsTrue(values[19]); if (unlikely((__pyx_v_report_truncation == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_report_truncation = ((int)1); + } + if (values[20]) { + __pyx_v_found_rows = __Pyx_PyObject_IsTrue(values[20]); if (unlikely((__pyx_v_found_rows == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + + /* "oursqlx/connection.pyx":84 + * bint local_infile=False, bint require_secure_auth=False, + * bint compress=False, bint report_truncation=True, + * bint found_rows=True, bint use_unicode=True, str charset='utf8', # <<<<<<<<<<<<<< + * bint autoping=False, default_cursor=None, + * bint raise_on_warnings=True, bint multi_results=True, + */ + __pyx_v_found_rows = ((int)1); + } + if (values[21]) { + __pyx_v_use_unicode = __Pyx_PyObject_IsTrue(values[21]); if (unlikely((__pyx_v_use_unicode == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_use_unicode = ((int)1); + } + __pyx_v_charset = ((PyObject*)values[22]); + if (values[23]) { + __pyx_v_autoping = __Pyx_PyObject_IsTrue(values[23]); if (unlikely((__pyx_v_autoping == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + + /* "oursqlx/connection.pyx":85 + * bint compress=False, bint report_truncation=True, + * bint found_rows=True, bint use_unicode=True, str charset='utf8', + * bint autoping=False, default_cursor=None, # <<<<<<<<<<<<<< + * bint raise_on_warnings=True, bint multi_results=True, + * bint multi_statements=True, bint autoreconnect=False): + */ + __pyx_v_autoping = ((int)0); + } + __pyx_v_default_cursor = values[24]; + if (values[25]) { + __pyx_v_raise_on_warnings = __Pyx_PyObject_IsTrue(values[25]); if (unlikely((__pyx_v_raise_on_warnings == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + + /* "oursqlx/connection.pyx":86 + * bint found_rows=True, bint use_unicode=True, str charset='utf8', + * bint autoping=False, default_cursor=None, + * bint raise_on_warnings=True, bint multi_results=True, # <<<<<<<<<<<<<< + * bint multi_statements=True, bint autoreconnect=False): + * cdef unsigned long flags = 0 + */ + __pyx_v_raise_on_warnings = ((int)1); + } + if (values[26]) { + __pyx_v_multi_results = __Pyx_PyObject_IsTrue(values[26]); if (unlikely((__pyx_v_multi_results == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_multi_results = ((int)1); + } + if (values[27]) { + __pyx_v_multi_statements = __Pyx_PyObject_IsTrue(values[27]); if (unlikely((__pyx_v_multi_statements == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + + /* "oursqlx/connection.pyx":87 + * bint autoping=False, default_cursor=None, + * bint raise_on_warnings=True, bint multi_results=True, + * bint multi_statements=True, bint autoreconnect=False): # <<<<<<<<<<<<<< + * cdef unsigned long flags = 0 + * cdef unsigned int uint_tmp + */ + __pyx_v_multi_statements = ((int)1); + } + if (values[28]) { + __pyx_v_autoreconnect = __Pyx_PyObject_IsTrue(values[28]); if (unlikely((__pyx_v_autoreconnect == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_autoreconnect = ((int)0); + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("oursql.Connection.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_charset), (&PyString_Type), 1, "charset", 1))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_6oursql_10Connection___cinit__(((struct __pyx_obj_6oursql_Connection *)__pyx_v_self), __pyx_v_host, __pyx_v_user, __pyx_v_passwd, __pyx_v_db, __pyx_v_port, __pyx_v_unix_socket, __pyx_v_connect_timeout, __pyx_v_read_timeout, __pyx_v_write_timeout, __pyx_v_protocol, __pyx_v_ssl, __pyx_v_read_default_file, __pyx_v_read_default_group, __pyx_v_init_command, __pyx_v_charset_dir, __pyx_v_shared_memory_base_name, __pyx_v_local_infile, __pyx_v_require_secure_auth, __pyx_v_compress, __pyx_v_report_truncation, __pyx_v_found_rows, __pyx_v_use_unicode, __pyx_v_charset, __pyx_v_autoping, __pyx_v_default_cursor, __pyx_v_raise_on_warnings, __pyx_v_multi_results, __pyx_v_multi_statements, __pyx_v_autoreconnect); + + /* "oursqlx/connection.pyx":76 + * cdef public object default_cursor + * + * def __cinit__(self, char *host=NULL, char *user=NULL, char *passwd=NULL, *, # <<<<<<<<<<<<<< + * char *db=NULL, unsigned int port=0, char *unix_socket=NULL, + * connect_timeout=None, read_timeout=None, write_timeout=None, + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6oursql_10Connection___cinit__(struct __pyx_obj_6oursql_Connection *__pyx_v_self, char *__pyx_v_host, char *__pyx_v_user, char *__pyx_v_passwd, char *__pyx_v_db, unsigned int __pyx_v_port, char *__pyx_v_unix_socket, PyObject *__pyx_v_connect_timeout, PyObject *__pyx_v_read_timeout, PyObject *__pyx_v_write_timeout, PyObject *__pyx_v_protocol, PyObject *__pyx_v_ssl, char *__pyx_v_read_default_file, char *__pyx_v_read_default_group, char *__pyx_v_init_command, char *__pyx_v_charset_dir, char *__pyx_v_shared_memory_base_name, int __pyx_v_local_infile, int __pyx_v_require_secure_auth, int __pyx_v_compress, int __pyx_v_report_truncation, int __pyx_v_found_rows, int __pyx_v_use_unicode, PyObject *__pyx_v_charset, int __pyx_v_autoping, PyObject *__pyx_v_default_cursor, int __pyx_v_raise_on_warnings, CYTHON_UNUSED int __pyx_v_multi_results, CYTHON_UNUSED int __pyx_v_multi_statements, int __pyx_v_autoreconnect) { + unsigned long __pyx_v_flags; + unsigned int __pyx_v_uint_tmp; + my_bool __pyx_v_bool_tmp; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + unsigned int __pyx_t_8; + int __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__cinit__", 0); + __Pyx_INCREF(__pyx_v_default_cursor); + + /* "oursqlx/connection.pyx":88 + * bint raise_on_warnings=True, bint multi_results=True, + * bint multi_statements=True, bint autoreconnect=False): + * cdef unsigned long flags = 0 # <<<<<<<<<<<<<< + * cdef unsigned int uint_tmp + * cdef my_bool bool_tmp + */ + __pyx_v_flags = 0; + + /* "oursqlx/connection.pyx":91 + * cdef unsigned int uint_tmp + * cdef my_bool bool_tmp + * if compress: # <<<<<<<<<<<<<< + * flags |= CLIENT_COMPRESS + * if found_rows: + */ + __pyx_t_1 = (__pyx_v_compress != 0); + if (__pyx_t_1) { + + /* "oursqlx/connection.pyx":92 + * cdef my_bool bool_tmp + * if compress: + * flags |= CLIENT_COMPRESS # <<<<<<<<<<<<<< + * if found_rows: + * flags |= CLIENT_FOUND_ROWS + */ + __pyx_v_flags = (__pyx_v_flags | CLIENT_COMPRESS); + goto __pyx_L3; + } + __pyx_L3:; + + /* "oursqlx/connection.pyx":93 + * if compress: + * flags |= CLIENT_COMPRESS + * if found_rows: # <<<<<<<<<<<<<< + * flags |= CLIENT_FOUND_ROWS + * # I'll come back to this later. Dealing with multiple result sets is + */ + __pyx_t_1 = (__pyx_v_found_rows != 0); + if (__pyx_t_1) { + + /* "oursqlx/connection.pyx":94 + * flags |= CLIENT_COMPRESS + * if found_rows: + * flags |= CLIENT_FOUND_ROWS # <<<<<<<<<<<<<< + * # I'll come back to this later. Dealing with multiple result sets is + * # such a pain. + */ + __pyx_v_flags = (__pyx_v_flags | CLIENT_FOUND_ROWS); + goto __pyx_L4; + } + __pyx_L4:; + + /* "oursqlx/connection.pyx":101 + * #if multi_statements: + * # flags |= CLIENT_MULTI_STATEMENTS + * self.conn = mysql_init(NULL) # <<<<<<<<<<<<<< + * if not self.conn: + * raise MemoryError('alloc of conn object failed') + */ + __pyx_v_self->conn = mysql_init(NULL); + + /* "oursqlx/connection.pyx":102 + * # flags |= CLIENT_MULTI_STATEMENTS + * self.conn = mysql_init(NULL) + * if not self.conn: # <<<<<<<<<<<<<< + * raise MemoryError('alloc of conn object failed') + * if protocol not in _protocol_enum_map: + */ + __pyx_t_1 = ((!(__pyx_v_self->conn != 0)) != 0); + if (__pyx_t_1) { + + /* "oursqlx/connection.pyx":103 + * self.conn = mysql_init(NULL) + * if not self.conn: + * raise MemoryError('alloc of conn object failed') # <<<<<<<<<<<<<< + * if protocol not in _protocol_enum_map: + * raise ProgrammingError('unknown protocol %r' % (protocol,)) + */ + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[3]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + + /* "oursqlx/connection.pyx":104 + * if not self.conn: + * raise MemoryError('alloc of conn object failed') + * if protocol not in _protocol_enum_map: # <<<<<<<<<<<<<< + * raise ProgrammingError('unknown protocol %r' % (protocol,)) + * uint_tmp = _protocol_enum_map[protocol] + */ + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_protocol_enum_map); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = (__Pyx_PySequence_Contains(__pyx_v_protocol, __pyx_t_2, Py_NE)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = (__pyx_t_1 != 0); + if (__pyx_t_3) { + + /* "oursqlx/connection.pyx":105 + * raise MemoryError('alloc of conn object failed') + * if protocol not in _protocol_enum_map: + * raise ProgrammingError('unknown protocol %r' % (protocol,)) # <<<<<<<<<<<<<< + * uint_tmp = _protocol_enum_map[protocol] + * mysql_options(self.conn, MYSQL_OPT_PROTOCOL, &uint_tmp) + */ + __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_ProgrammingError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(__pyx_v_protocol); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_protocol); + __Pyx_GIVEREF(__pyx_v_protocol); + __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_unknown_protocol_r, __pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + if (!__pyx_t_5) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_6); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_GOTREF(__pyx_t_2); + } else { + __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL; + PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + __pyx_t_6 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[3]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + + /* "oursqlx/connection.pyx":106 + * if protocol not in _protocol_enum_map: + * raise ProgrammingError('unknown protocol %r' % (protocol,)) + * uint_tmp = _protocol_enum_map[protocol] # <<<<<<<<<<<<<< + * mysql_options(self.conn, MYSQL_OPT_PROTOCOL, &uint_tmp) + * bool_tmp = report_truncation + */ + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_protocol_enum_map); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyObject_GetItem(__pyx_t_2, __pyx_v_protocol); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_8 = __Pyx_PyInt_As_unsigned_int(__pyx_t_4); if (unlikely((__pyx_t_8 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_uint_tmp = __pyx_t_8; + + /* "oursqlx/connection.pyx":107 + * raise ProgrammingError('unknown protocol %r' % (protocol,)) + * uint_tmp = _protocol_enum_map[protocol] + * mysql_options(self.conn, MYSQL_OPT_PROTOCOL, &uint_tmp) # <<<<<<<<<<<<<< + * bool_tmp = report_truncation + * mysql_options(self.conn, + */ + mysql_options(__pyx_v_self->conn, MYSQL_OPT_PROTOCOL, ((char *)(&__pyx_v_uint_tmp))); + + /* "oursqlx/connection.pyx":108 + * uint_tmp = _protocol_enum_map[protocol] + * mysql_options(self.conn, MYSQL_OPT_PROTOCOL, &uint_tmp) + * bool_tmp = report_truncation # <<<<<<<<<<<<<< + * mysql_options(self.conn, + * MYSQL_REPORT_DATA_TRUNCATION, &bool_tmp) + */ + __pyx_v_bool_tmp = __pyx_v_report_truncation; + + /* "oursqlx/connection.pyx":109 + * mysql_options(self.conn, MYSQL_OPT_PROTOCOL, &uint_tmp) + * bool_tmp = report_truncation + * mysql_options(self.conn, # <<<<<<<<<<<<<< + * MYSQL_REPORT_DATA_TRUNCATION, &bool_tmp) + * bool_tmp = require_secure_auth + */ + mysql_options(__pyx_v_self->conn, MYSQL_REPORT_DATA_TRUNCATION, ((char *)(&__pyx_v_bool_tmp))); + + /* "oursqlx/connection.pyx":111 + * mysql_options(self.conn, + * MYSQL_REPORT_DATA_TRUNCATION, &bool_tmp) + * bool_tmp = require_secure_auth # <<<<<<<<<<<<<< + * mysql_options(self.conn, MYSQL_SECURE_AUTH, &bool_tmp) + * if connect_timeout is not None: + */ + __pyx_v_bool_tmp = __pyx_v_require_secure_auth; + + /* "oursqlx/connection.pyx":112 + * MYSQL_REPORT_DATA_TRUNCATION, &bool_tmp) + * bool_tmp = require_secure_auth + * mysql_options(self.conn, MYSQL_SECURE_AUTH, &bool_tmp) # <<<<<<<<<<<<<< + * if connect_timeout is not None: + * uint_tmp = connect_timeout + */ + mysql_options(__pyx_v_self->conn, MYSQL_SECURE_AUTH, ((char *)(&__pyx_v_bool_tmp))); + + /* "oursqlx/connection.pyx":113 + * bool_tmp = require_secure_auth + * mysql_options(self.conn, MYSQL_SECURE_AUTH, &bool_tmp) + * if connect_timeout is not None: # <<<<<<<<<<<<<< + * uint_tmp = connect_timeout + * mysql_options(self.conn, + */ + __pyx_t_3 = (__pyx_v_connect_timeout != Py_None); + __pyx_t_1 = (__pyx_t_3 != 0); + if (__pyx_t_1) { + + /* "oursqlx/connection.pyx":114 + * mysql_options(self.conn, MYSQL_SECURE_AUTH, &bool_tmp) + * if connect_timeout is not None: + * uint_tmp = connect_timeout # <<<<<<<<<<<<<< + * mysql_options(self.conn, + * MYSQL_OPT_CONNECT_TIMEOUT, &uint_tmp) + */ + __pyx_t_8 = __Pyx_PyInt_As_unsigned_int(__pyx_v_connect_timeout); if (unlikely((__pyx_t_8 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_uint_tmp = __pyx_t_8; + + /* "oursqlx/connection.pyx":115 + * if connect_timeout is not None: + * uint_tmp = connect_timeout + * mysql_options(self.conn, # <<<<<<<<<<<<<< + * MYSQL_OPT_CONNECT_TIMEOUT, &uint_tmp) + * if read_timeout is not None: + */ + mysql_options(__pyx_v_self->conn, MYSQL_OPT_CONNECT_TIMEOUT, ((char *)(&__pyx_v_uint_tmp))); + goto __pyx_L7; + } + __pyx_L7:; + + /* "oursqlx/connection.pyx":117 + * mysql_options(self.conn, + * MYSQL_OPT_CONNECT_TIMEOUT, &uint_tmp) + * if read_timeout is not None: # <<<<<<<<<<<<<< + * uint_tmp = read_timeout + * mysql_options(self.conn, + */ + __pyx_t_1 = (__pyx_v_read_timeout != Py_None); + __pyx_t_3 = (__pyx_t_1 != 0); + if (__pyx_t_3) { + + /* "oursqlx/connection.pyx":118 + * MYSQL_OPT_CONNECT_TIMEOUT, &uint_tmp) + * if read_timeout is not None: + * uint_tmp = read_timeout # <<<<<<<<<<<<<< + * mysql_options(self.conn, + * MYSQL_OPT_READ_TIMEOUT, &uint_tmp) + */ + __pyx_t_8 = __Pyx_PyInt_As_unsigned_int(__pyx_v_read_timeout); if (unlikely((__pyx_t_8 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_uint_tmp = __pyx_t_8; + + /* "oursqlx/connection.pyx":119 + * if read_timeout is not None: + * uint_tmp = read_timeout + * mysql_options(self.conn, # <<<<<<<<<<<<<< + * MYSQL_OPT_READ_TIMEOUT, &uint_tmp) + * if write_timeout is not None: + */ + mysql_options(__pyx_v_self->conn, MYSQL_OPT_READ_TIMEOUT, ((char *)(&__pyx_v_uint_tmp))); + goto __pyx_L8; + } + __pyx_L8:; + + /* "oursqlx/connection.pyx":121 + * mysql_options(self.conn, + * MYSQL_OPT_READ_TIMEOUT, &uint_tmp) + * if write_timeout is not None: # <<<<<<<<<<<<<< + * uint_tmp = write_timeout + * mysql_options(self.conn, + */ + __pyx_t_3 = (__pyx_v_write_timeout != Py_None); + __pyx_t_1 = (__pyx_t_3 != 0); + if (__pyx_t_1) { + + /* "oursqlx/connection.pyx":122 + * MYSQL_OPT_READ_TIMEOUT, &uint_tmp) + * if write_timeout is not None: + * uint_tmp = write_timeout # <<<<<<<<<<<<<< + * mysql_options(self.conn, + * MYSQL_OPT_WRITE_TIMEOUT, &uint_tmp) + */ + __pyx_t_8 = __Pyx_PyInt_As_unsigned_int(__pyx_v_write_timeout); if (unlikely((__pyx_t_8 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_uint_tmp = __pyx_t_8; + + /* "oursqlx/connection.pyx":123 + * if write_timeout is not None: + * uint_tmp = write_timeout + * mysql_options(self.conn, # <<<<<<<<<<<<<< + * MYSQL_OPT_WRITE_TIMEOUT, &uint_tmp) + * if read_default_file: + */ + mysql_options(__pyx_v_self->conn, MYSQL_OPT_WRITE_TIMEOUT, ((char *)(&__pyx_v_uint_tmp))); + goto __pyx_L9; + } + __pyx_L9:; + + /* "oursqlx/connection.pyx":125 + * mysql_options(self.conn, + * MYSQL_OPT_WRITE_TIMEOUT, &uint_tmp) + * if read_default_file: # <<<<<<<<<<<<<< + * mysql_options(self.conn, + * MYSQL_READ_DEFAULT_FILE, read_default_file) + */ + __pyx_t_1 = (__pyx_v_read_default_file != 0); + if (__pyx_t_1) { + + /* "oursqlx/connection.pyx":126 + * MYSQL_OPT_WRITE_TIMEOUT, &uint_tmp) + * if read_default_file: + * mysql_options(self.conn, # <<<<<<<<<<<<<< + * MYSQL_READ_DEFAULT_FILE, read_default_file) + * if read_default_group: + */ + mysql_options(__pyx_v_self->conn, MYSQL_READ_DEFAULT_FILE, __pyx_v_read_default_file); + goto __pyx_L10; + } + __pyx_L10:; + + /* "oursqlx/connection.pyx":128 + * mysql_options(self.conn, + * MYSQL_READ_DEFAULT_FILE, read_default_file) + * if read_default_group: # <<<<<<<<<<<<<< + * mysql_options(self.conn, + * MYSQL_READ_DEFAULT_GROUP, read_default_group) + */ + __pyx_t_1 = (__pyx_v_read_default_group != 0); + if (__pyx_t_1) { + + /* "oursqlx/connection.pyx":129 + * MYSQL_READ_DEFAULT_FILE, read_default_file) + * if read_default_group: + * mysql_options(self.conn, # <<<<<<<<<<<<<< + * MYSQL_READ_DEFAULT_GROUP, read_default_group) + * if init_command: + */ + mysql_options(__pyx_v_self->conn, MYSQL_READ_DEFAULT_GROUP, __pyx_v_read_default_group); + goto __pyx_L11; + } + __pyx_L11:; + + /* "oursqlx/connection.pyx":131 + * mysql_options(self.conn, + * MYSQL_READ_DEFAULT_GROUP, read_default_group) + * if init_command: # <<<<<<<<<<<<<< + * mysql_options(self.conn, MYSQL_INIT_COMMAND, init_command) + * if charset_dir: + */ + __pyx_t_1 = (__pyx_v_init_command != 0); + if (__pyx_t_1) { + + /* "oursqlx/connection.pyx":132 + * MYSQL_READ_DEFAULT_GROUP, read_default_group) + * if init_command: + * mysql_options(self.conn, MYSQL_INIT_COMMAND, init_command) # <<<<<<<<<<<<<< + * if charset_dir: + * mysql_options(self.conn, MYSQL_SET_CHARSET_DIR, charset_dir) + */ + mysql_options(__pyx_v_self->conn, MYSQL_INIT_COMMAND, __pyx_v_init_command); + goto __pyx_L12; + } + __pyx_L12:; + + /* "oursqlx/connection.pyx":133 + * if init_command: + * mysql_options(self.conn, MYSQL_INIT_COMMAND, init_command) + * if charset_dir: # <<<<<<<<<<<<<< + * mysql_options(self.conn, MYSQL_SET_CHARSET_DIR, charset_dir) + * if shared_memory_base_name: + */ + __pyx_t_1 = (__pyx_v_charset_dir != 0); + if (__pyx_t_1) { + + /* "oursqlx/connection.pyx":134 + * mysql_options(self.conn, MYSQL_INIT_COMMAND, init_command) + * if charset_dir: + * mysql_options(self.conn, MYSQL_SET_CHARSET_DIR, charset_dir) # <<<<<<<<<<<<<< + * if shared_memory_base_name: + * mysql_options(self.conn, + */ + mysql_options(__pyx_v_self->conn, MYSQL_SET_CHARSET_DIR, __pyx_v_charset_dir); + goto __pyx_L13; + } + __pyx_L13:; + + /* "oursqlx/connection.pyx":135 + * if charset_dir: + * mysql_options(self.conn, MYSQL_SET_CHARSET_DIR, charset_dir) + * if shared_memory_base_name: # <<<<<<<<<<<<<< + * mysql_options(self.conn, + * MYSQL_SHARED_MEMORY_BASE_NAME, shared_memory_base_name) + */ + __pyx_t_1 = (__pyx_v_shared_memory_base_name != 0); + if (__pyx_t_1) { + + /* "oursqlx/connection.pyx":136 + * mysql_options(self.conn, MYSQL_SET_CHARSET_DIR, charset_dir) + * if shared_memory_base_name: + * mysql_options(self.conn, # <<<<<<<<<<<<<< + * MYSQL_SHARED_MEMORY_BASE_NAME, shared_memory_base_name) + * if local_infile: + */ + mysql_options(__pyx_v_self->conn, MYSQL_SHARED_MEMORY_BASE_NAME, __pyx_v_shared_memory_base_name); + goto __pyx_L14; + } + __pyx_L14:; + + /* "oursqlx/connection.pyx":138 + * mysql_options(self.conn, + * MYSQL_SHARED_MEMORY_BASE_NAME, shared_memory_base_name) + * if local_infile: # <<<<<<<<<<<<<< + * mysql_options(self.conn, MYSQL_OPT_LOCAL_INFILE, NULL) + * if charset is not None: + */ + __pyx_t_1 = (__pyx_v_local_infile != 0); + if (__pyx_t_1) { + + /* "oursqlx/connection.pyx":139 + * MYSQL_SHARED_MEMORY_BASE_NAME, shared_memory_base_name) + * if local_infile: + * mysql_options(self.conn, MYSQL_OPT_LOCAL_INFILE, NULL) # <<<<<<<<<<<<<< + * if charset is not None: + * mysql_options(self.conn, + */ + mysql_options(__pyx_v_self->conn, MYSQL_OPT_LOCAL_INFILE, NULL); + goto __pyx_L15; + } + __pyx_L15:; + + /* "oursqlx/connection.pyx":140 + * if local_infile: + * mysql_options(self.conn, MYSQL_OPT_LOCAL_INFILE, NULL) + * if charset is not None: # <<<<<<<<<<<<<< + * mysql_options(self.conn, + * MYSQL_SET_CHARSET_NAME, PyString_AS_STRING(charset)) + */ + __pyx_t_1 = (__pyx_v_charset != ((PyObject*)Py_None)); + __pyx_t_3 = (__pyx_t_1 != 0); + if (__pyx_t_3) { + + /* "oursqlx/connection.pyx":141 + * mysql_options(self.conn, MYSQL_OPT_LOCAL_INFILE, NULL) + * if charset is not None: + * mysql_options(self.conn, # <<<<<<<<<<<<<< + * MYSQL_SET_CHARSET_NAME, PyString_AS_STRING(charset)) + * if autoreconnect: + */ + mysql_options(__pyx_v_self->conn, MYSQL_SET_CHARSET_NAME, PyString_AS_STRING(__pyx_v_charset)); + goto __pyx_L16; + } + __pyx_L16:; + + /* "oursqlx/connection.pyx":143 + * mysql_options(self.conn, + * MYSQL_SET_CHARSET_NAME, PyString_AS_STRING(charset)) + * if autoreconnect: # <<<<<<<<<<<<<< + * bool_tmp = True + * mysql_options(self.conn, MYSQL_OPT_RECONNECT, &bool_tmp) + */ + __pyx_t_3 = (__pyx_v_autoreconnect != 0); + if (__pyx_t_3) { + + /* "oursqlx/connection.pyx":144 + * MYSQL_SET_CHARSET_NAME, PyString_AS_STRING(charset)) + * if autoreconnect: + * bool_tmp = True # <<<<<<<<<<<<<< + * mysql_options(self.conn, MYSQL_OPT_RECONNECT, &bool_tmp) + * if ssl is not None: + */ + __pyx_v_bool_tmp = 1; + + /* "oursqlx/connection.pyx":145 + * if autoreconnect: + * bool_tmp = True + * mysql_options(self.conn, MYSQL_OPT_RECONNECT, &bool_tmp) # <<<<<<<<<<<<<< + * if ssl is not None: + * self._setup_ssl_options(**ssl) + */ + mysql_options(__pyx_v_self->conn, MYSQL_OPT_RECONNECT, ((char *)(&__pyx_v_bool_tmp))); + goto __pyx_L17; + } + __pyx_L17:; + + /* "oursqlx/connection.pyx":146 + * bool_tmp = True + * mysql_options(self.conn, MYSQL_OPT_RECONNECT, &bool_tmp) + * if ssl is not None: # <<<<<<<<<<<<<< + * self._setup_ssl_options(**ssl) + * if not mysql_real_connect(self.conn, host, user, passwd, db, port, + */ + __pyx_t_3 = (__pyx_v_ssl != Py_None); + __pyx_t_1 = (__pyx_t_3 != 0); + if (__pyx_t_1) { + + /* "oursqlx/connection.pyx":147 + * mysql_options(self.conn, MYSQL_OPT_RECONNECT, &bool_tmp) + * if ssl is not None: + * self._setup_ssl_options(**ssl) # <<<<<<<<<<<<<< + * if not mysql_real_connect(self.conn, host, user, passwd, db, port, + * unix_socket, flags): + */ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_setup_ssl_options); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (unlikely(__pyx_v_ssl == Py_None)) { + PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType"); + {__pyx_filename = __pyx_f[3]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + if (likely(PyDict_Check(__pyx_v_ssl))) { + __pyx_t_2 = __pyx_v_ssl; + __Pyx_INCREF(__pyx_t_2); + } else { + __pyx_t_2 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_ssl, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L18; + } + __pyx_L18:; + + /* "oursqlx/connection.pyx":148 + * if ssl is not None: + * self._setup_ssl_options(**ssl) + * if not mysql_real_connect(self.conn, host, user, passwd, db, port, # <<<<<<<<<<<<<< + * unix_socket, flags): + * self._raise_error() + */ + __pyx_t_1 = ((!(__pyx_f_6oursql_mysql_real_connect(__pyx_v_self->conn, __pyx_v_host, __pyx_v_user, __pyx_v_passwd, __pyx_v_db, __pyx_v_port, __pyx_v_unix_socket, __pyx_v_flags) != 0)) != 0); + if (__pyx_t_1) { + + /* "oursqlx/connection.pyx":150 + * if not mysql_real_connect(self.conn, host, user, passwd, db, port, + * unix_socket, flags): + * self._raise_error() # <<<<<<<<<<<<<< + * self.use_unicode = use_unicode + * self.autoping = autoping + */ + __pyx_t_9 = ((struct __pyx_vtabstruct_6oursql_Connection *)__pyx_v_self->__pyx_vtab)->_raise_error(__pyx_v_self); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L19; + } + __pyx_L19:; + + /* "oursqlx/connection.pyx":151 + * unix_socket, flags): + * self._raise_error() + * self.use_unicode = use_unicode # <<<<<<<<<<<<<< + * self.autoping = autoping + * if default_cursor is None: + */ + __pyx_v_self->use_unicode = __pyx_v_use_unicode; + + /* "oursqlx/connection.pyx":152 + * self._raise_error() + * self.use_unicode = use_unicode + * self.autoping = autoping # <<<<<<<<<<<<<< + * if default_cursor is None: + * default_cursor = Cursor + */ + __pyx_v_self->autoping = __pyx_v_autoping; + + /* "oursqlx/connection.pyx":153 + * self.use_unicode = use_unicode + * self.autoping = autoping + * if default_cursor is None: # <<<<<<<<<<<<<< + * default_cursor = Cursor + * self.default_cursor = default_cursor + */ + __pyx_t_1 = (__pyx_v_default_cursor == Py_None); + __pyx_t_3 = (__pyx_t_1 != 0); + if (__pyx_t_3) { + + /* "oursqlx/connection.pyx":154 + * self.autoping = autoping + * if default_cursor is None: + * default_cursor = Cursor # <<<<<<<<<<<<<< + * self.default_cursor = default_cursor + * self.raise_on_warnings = raise_on_warnings + */ + __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_6oursql_Cursor))); + __Pyx_DECREF_SET(__pyx_v_default_cursor, ((PyObject *)((PyObject*)__pyx_ptype_6oursql_Cursor))); + goto __pyx_L20; + } + __pyx_L20:; + + /* "oursqlx/connection.pyx":155 + * if default_cursor is None: + * default_cursor = Cursor + * self.default_cursor = default_cursor # <<<<<<<<<<<<<< + * self.raise_on_warnings = raise_on_warnings + * self._context_cursors = [] + */ + __Pyx_INCREF(__pyx_v_default_cursor); + __Pyx_GIVEREF(__pyx_v_default_cursor); + __Pyx_GOTREF(__pyx_v_self->default_cursor); + __Pyx_DECREF(__pyx_v_self->default_cursor); + __pyx_v_self->default_cursor = __pyx_v_default_cursor; + + /* "oursqlx/connection.pyx":156 + * default_cursor = Cursor + * self.default_cursor = default_cursor + * self.raise_on_warnings = raise_on_warnings # <<<<<<<<<<<<<< + * self._context_cursors = [] + * + */ + __pyx_v_self->raise_on_warnings = __pyx_v_raise_on_warnings; + + /* "oursqlx/connection.pyx":157 + * self.default_cursor = default_cursor + * self.raise_on_warnings = raise_on_warnings + * self._context_cursors = [] # <<<<<<<<<<<<<< + * + * def _setup_ssl_options(self, *, char *key=NULL, char *cert=NULL, + */ + __pyx_t_7 = PyList_New(0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __Pyx_GOTREF(__pyx_v_self->_context_cursors); + __Pyx_DECREF(__pyx_v_self->_context_cursors); + __pyx_v_self->_context_cursors = __pyx_t_7; + __pyx_t_7 = 0; + + /* "oursqlx/connection.pyx":76 + * cdef public object default_cursor + * + * def __cinit__(self, char *host=NULL, char *user=NULL, char *passwd=NULL, *, # <<<<<<<<<<<<<< + * char *db=NULL, unsigned int port=0, char *unix_socket=NULL, + * connect_timeout=None, read_timeout=None, write_timeout=None, + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("oursql.Connection.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_default_cursor); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/connection.pyx":159 + * self._context_cursors = [] + * + * def _setup_ssl_options(self, *, char *key=NULL, char *cert=NULL, # <<<<<<<<<<<<<< + * char *ca=NULL, char *capath=NULL, char *cipher=NULL): + * mysql_ssl_set(self.conn, key, cert, ca, capath, cipher) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_10Connection_3_setup_ssl_options(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_6oursql_10Connection_3_setup_ssl_options(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + char *__pyx_v_key; + char *__pyx_v_cert; + char *__pyx_v_ca; + char *__pyx_v_capath; + char *__pyx_v_cipher; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_setup_ssl_options (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_cert,&__pyx_n_s_ca,&__pyx_n_s_capath,&__pyx_n_s_cipher,0}; + PyObject* values[5] = {0,0,0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + if (kw_args > 0 && likely(kw_args <= 5)) { + Py_ssize_t index; + for (index = 0; index < 5 && kw_args > 0; index++) { + PyObject* value = PyDict_GetItem(__pyx_kwds, *__pyx_pyargnames[index]); + if (value) { values[index] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, 0, "_setup_ssl_options") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 0) { + goto __pyx_L5_argtuple_error; + } else { + } + if (values[0]) { + __pyx_v_key = __Pyx_PyObject_AsString(values[0]); if (unlikely((!__pyx_v_key) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_key = ((char *)NULL); + } + if (values[1]) { + __pyx_v_cert = __Pyx_PyObject_AsString(values[1]); if (unlikely((!__pyx_v_cert) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_cert = ((char *)NULL); + } + if (values[2]) { + __pyx_v_ca = __Pyx_PyObject_AsString(values[2]); if (unlikely((!__pyx_v_ca) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + + /* "oursqlx/connection.pyx":160 + * + * def _setup_ssl_options(self, *, char *key=NULL, char *cert=NULL, + * char *ca=NULL, char *capath=NULL, char *cipher=NULL): # <<<<<<<<<<<<<< + * mysql_ssl_set(self.conn, key, cert, ca, capath, cipher) + * + */ + __pyx_v_ca = ((char *)NULL); + } + if (values[3]) { + __pyx_v_capath = __Pyx_PyObject_AsString(values[3]); if (unlikely((!__pyx_v_capath) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_capath = ((char *)NULL); + } + if (values[4]) { + __pyx_v_cipher = __Pyx_PyObject_AsString(values[4]); if (unlikely((!__pyx_v_cipher) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_cipher = ((char *)NULL); + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("_setup_ssl_options", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("oursql.Connection._setup_ssl_options", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6oursql_10Connection_2_setup_ssl_options(((struct __pyx_obj_6oursql_Connection *)__pyx_v_self), __pyx_v_key, __pyx_v_cert, __pyx_v_ca, __pyx_v_capath, __pyx_v_cipher); + + /* "oursqlx/connection.pyx":159 + * self._context_cursors = [] + * + * def _setup_ssl_options(self, *, char *key=NULL, char *cert=NULL, # <<<<<<<<<<<<<< + * char *ca=NULL, char *capath=NULL, char *cipher=NULL): + * mysql_ssl_set(self.conn, key, cert, ca, capath, cipher) + */ + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_10Connection_2_setup_ssl_options(struct __pyx_obj_6oursql_Connection *__pyx_v_self, char *__pyx_v_key, char *__pyx_v_cert, char *__pyx_v_ca, char *__pyx_v_capath, char *__pyx_v_cipher) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_setup_ssl_options", 0); + + /* "oursqlx/connection.pyx":161 + * def _setup_ssl_options(self, *, char *key=NULL, char *cert=NULL, + * char *ca=NULL, char *capath=NULL, char *cipher=NULL): + * mysql_ssl_set(self.conn, key, cert, ca, capath, cipher) # <<<<<<<<<<<<<< + * + * def close(self): + */ + mysql_ssl_set(__pyx_v_self->conn, __pyx_v_key, __pyx_v_cert, __pyx_v_ca, __pyx_v_capath, __pyx_v_cipher); + + /* "oursqlx/connection.pyx":159 + * self._context_cursors = [] + * + * def _setup_ssl_options(self, *, char *key=NULL, char *cert=NULL, # <<<<<<<<<<<<<< + * char *ca=NULL, char *capath=NULL, char *cipher=NULL): + * mysql_ssl_set(self.conn, key, cert, ca, capath, cipher) + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/connection.pyx":163 + * mysql_ssl_set(self.conn, key, cert, ca, capath, cipher) + * + * def close(self): # <<<<<<<<<<<<<< + * """close() + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_10Connection_5close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_6oursql_10Connection_4close[] = "close()\n \n Close the connection. The connection object and all associated cursors\n will become unusable.\n "; +static PyObject *__pyx_pw_6oursql_10Connection_5close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("close (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_10Connection_4close(((struct __pyx_obj_6oursql_Connection *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_10Connection_4close(struct __pyx_obj_6oursql_Connection *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("close", 0); + + /* "oursqlx/connection.pyx":169 + * will become unusable. + * """ + * if self.conn: # <<<<<<<<<<<<<< + * self.rollback() + * mysql_close(self.conn) + */ + __pyx_t_1 = (__pyx_v_self->conn != 0); + if (__pyx_t_1) { + + /* "oursqlx/connection.pyx":170 + * """ + * if self.conn: + * self.rollback() # <<<<<<<<<<<<<< + * mysql_close(self.conn) + * self.conn = NULL + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_rollback); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (__pyx_t_4) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else { + __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "oursqlx/connection.pyx":171 + * if self.conn: + * self.rollback() + * mysql_close(self.conn) # <<<<<<<<<<<<<< + * self.conn = NULL + * + */ + mysql_close(__pyx_v_self->conn); + + /* "oursqlx/connection.pyx":172 + * self.rollback() + * mysql_close(self.conn) + * self.conn = NULL # <<<<<<<<<<<<<< + * + * def __dealloc__(self): + */ + __pyx_v_self->conn = NULL; + goto __pyx_L3; + } + __pyx_L3:; + + /* "oursqlx/connection.pyx":163 + * mysql_ssl_set(self.conn, key, cert, ca, capath, cipher) + * + * def close(self): # <<<<<<<<<<<<<< + * """close() + * + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("oursql.Connection.close", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/connection.pyx":174 + * self.conn = NULL + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * if self.conn: + * mysql_close(self.conn) + */ + +/* Python wrapper */ +static void __pyx_pw_6oursql_10Connection_7__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pw_6oursql_10Connection_7__dealloc__(PyObject *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_pf_6oursql_10Connection_6__dealloc__(((struct __pyx_obj_6oursql_Connection *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +static void __pyx_pf_6oursql_10Connection_6__dealloc__(struct __pyx_obj_6oursql_Connection *__pyx_v_self) { + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("__dealloc__", 0); + + /* "oursqlx/connection.pyx":175 + * + * def __dealloc__(self): + * if self.conn: # <<<<<<<<<<<<<< + * mysql_close(self.conn) + * self.conn = NULL + */ + __pyx_t_1 = (__pyx_v_self->conn != 0); + if (__pyx_t_1) { + + /* "oursqlx/connection.pyx":176 + * def __dealloc__(self): + * if self.conn: + * mysql_close(self.conn) # <<<<<<<<<<<<<< + * self.conn = NULL + * + */ + mysql_close(__pyx_v_self->conn); + + /* "oursqlx/connection.pyx":177 + * if self.conn: + * mysql_close(self.conn) + * self.conn = NULL # <<<<<<<<<<<<<< + * + * cdef int _raise_error(self) except -1: + */ + __pyx_v_self->conn = NULL; + goto __pyx_L3; + } + __pyx_L3:; + + /* "oursqlx/connection.pyx":174 + * self.conn = NULL + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * if self.conn: + * mysql_close(self.conn) + */ + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +/* "oursqlx/connection.pyx":179 + * self.conn = NULL + * + * cdef int _raise_error(self) except -1: # <<<<<<<<<<<<<< + * # _raise_error can only be called internally, so we shouldn't need to + * # check for if the connection is closed. + */ + +static int __pyx_f_6oursql_10Connection__raise_error(struct __pyx_obj_6oursql_Connection *__pyx_v_self) { + int __pyx_v_err; + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + Py_ssize_t __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_raise_error", 0); + + /* "oursqlx/connection.pyx":182 + * # _raise_error can only be called internally, so we shouldn't need to + * # check for if the connection is closed. + * cdef int err = mysql_errno(self.conn) # <<<<<<<<<<<<<< + * raise _exception_from_errno(err)(mysql_error(self.conn), err) + * + */ + __pyx_v_err = mysql_errno(__pyx_v_self->conn); + + /* "oursqlx/connection.pyx":183 + * # check for if the connection is closed. + * cdef int err = mysql_errno(self.conn) + * raise _exception_from_errno(err)(mysql_error(self.conn), err) # <<<<<<<<<<<<<< + * + * cdef int _check_closed(self) except -1: + */ + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_exception_from_errno); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_err); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (!__pyx_t_5) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_2); + } else { + __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL; + PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyBytes_FromString(mysql_error(__pyx_v_self->conn)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_err); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_4 = NULL; + __pyx_t_7 = 0; + if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_7 = 1; + } + } + __pyx_t_5 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + if (__pyx_t_4) { + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL; + } + PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_7, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_7, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + __pyx_t_3 = 0; + __pyx_t_6 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + {__pyx_filename = __pyx_f[3]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "oursqlx/connection.pyx":179 + * self.conn = NULL + * + * cdef int _raise_error(self) except -1: # <<<<<<<<<<<<<< + * # _raise_error can only be called internally, so we shouldn't need to + * # check for if the connection is closed. + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("oursql.Connection._raise_error", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/connection.pyx":185 + * raise _exception_from_errno(err)(mysql_error(self.conn), err) + * + * cdef int _check_closed(self) except -1: # <<<<<<<<<<<<<< + * if not self.conn: + * raise ProgrammingError('connection closed') + */ + +static int __pyx_f_6oursql_10Connection__check_closed(struct __pyx_obj_6oursql_Connection *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_check_closed", 0); + + /* "oursqlx/connection.pyx":186 + * + * cdef int _check_closed(self) except -1: + * if not self.conn: # <<<<<<<<<<<<<< + * raise ProgrammingError('connection closed') + * + */ + __pyx_t_1 = ((!(__pyx_v_self->conn != 0)) != 0); + if (__pyx_t_1) { + + /* "oursqlx/connection.pyx":187 + * cdef int _check_closed(self) except -1: + * if not self.conn: + * raise ProgrammingError('connection closed') # <<<<<<<<<<<<<< + * + * def ping(self): + */ + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_ProgrammingError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[3]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + + /* "oursqlx/connection.pyx":185 + * raise _exception_from_errno(err)(mysql_error(self.conn), err) + * + * cdef int _check_closed(self) except -1: # <<<<<<<<<<<<<< + * if not self.conn: + * raise ProgrammingError('connection closed') + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("oursql.Connection._check_closed", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/connection.pyx":189 + * raise ProgrammingError('connection closed') + * + * def ping(self): # <<<<<<<<<<<<<< + * """ping() + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_10Connection_9ping(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_6oursql_10Connection_8ping[] = "ping()\n \n Make sure that the database connection is still open. If not, silently\n reconnect.\n "; +static PyObject *__pyx_pw_6oursql_10Connection_9ping(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("ping (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_10Connection_8ping(((struct __pyx_obj_6oursql_Connection *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_10Connection_8ping(struct __pyx_obj_6oursql_Connection *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("ping", 0); + + /* "oursqlx/connection.pyx":195 + * reconnect. + * """ + * self._check_closed() # <<<<<<<<<<<<<< + * if mysql_ping(self.conn): + * self._raise_error() + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_6oursql_Connection *)__pyx_v_self->__pyx_vtab)->_check_closed(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "oursqlx/connection.pyx":196 + * """ + * self._check_closed() + * if mysql_ping(self.conn): # <<<<<<<<<<<<<< + * self._raise_error() + * + */ + __pyx_t_2 = (__pyx_f_6oursql_mysql_ping(__pyx_v_self->conn) != 0); + if (__pyx_t_2) { + + /* "oursqlx/connection.pyx":197 + * self._check_closed() + * if mysql_ping(self.conn): + * self._raise_error() # <<<<<<<<<<<<<< + * + * def commit(self): + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_6oursql_Connection *)__pyx_v_self->__pyx_vtab)->_raise_error(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "oursqlx/connection.pyx":189 + * raise ProgrammingError('connection closed') + * + * def ping(self): # <<<<<<<<<<<<<< + * """ping() + * + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("oursql.Connection.ping", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/connection.pyx":199 + * self._raise_error() + * + * def commit(self): # <<<<<<<<<<<<<< + * """commit() + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_10Connection_11commit(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_6oursql_10Connection_10commit[] = "commit()\n \n Commit the current transaction.\n "; +static PyObject *__pyx_pw_6oursql_10Connection_11commit(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("commit (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_10Connection_10commit(((struct __pyx_obj_6oursql_Connection *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_10Connection_10commit(struct __pyx_obj_6oursql_Connection *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("commit", 0); + + /* "oursqlx/connection.pyx":204 + * Commit the current transaction. + * """ + * self._check_closed() # <<<<<<<<<<<<<< + * if mysql_commit(self.conn): + * self._raise_error() + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_6oursql_Connection *)__pyx_v_self->__pyx_vtab)->_check_closed(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "oursqlx/connection.pyx":205 + * """ + * self._check_closed() + * if mysql_commit(self.conn): # <<<<<<<<<<<<<< + * self._raise_error() + * + */ + __pyx_t_2 = (__pyx_f_6oursql_mysql_commit(__pyx_v_self->conn) != 0); + if (__pyx_t_2) { + + /* "oursqlx/connection.pyx":206 + * self._check_closed() + * if mysql_commit(self.conn): + * self._raise_error() # <<<<<<<<<<<<<< + * + * def rollback(self): + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_6oursql_Connection *)__pyx_v_self->__pyx_vtab)->_raise_error(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "oursqlx/connection.pyx":199 + * self._raise_error() + * + * def commit(self): # <<<<<<<<<<<<<< + * """commit() + * + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("oursql.Connection.commit", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/connection.pyx":208 + * self._raise_error() + * + * def rollback(self): # <<<<<<<<<<<<<< + * """rollback() + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_10Connection_13rollback(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_6oursql_10Connection_12rollback[] = "rollback()\n \n Roll back the current transaction.\n "; +static PyObject *__pyx_pw_6oursql_10Connection_13rollback(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("rollback (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_10Connection_12rollback(((struct __pyx_obj_6oursql_Connection *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_10Connection_12rollback(struct __pyx_obj_6oursql_Connection *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("rollback", 0); + + /* "oursqlx/connection.pyx":213 + * Roll back the current transaction. + * """ + * self._check_closed() # <<<<<<<<<<<<<< + * if mysql_rollback(self.conn): + * self._raise_error() + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_6oursql_Connection *)__pyx_v_self->__pyx_vtab)->_check_closed(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "oursqlx/connection.pyx":214 + * """ + * self._check_closed() + * if mysql_rollback(self.conn): # <<<<<<<<<<<<<< + * self._raise_error() + * + */ + __pyx_t_2 = (__pyx_f_6oursql_mysql_rollback(__pyx_v_self->conn) != 0); + if (__pyx_t_2) { + + /* "oursqlx/connection.pyx":215 + * self._check_closed() + * if mysql_rollback(self.conn): + * self._raise_error() # <<<<<<<<<<<<<< + * + * property charset: + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_6oursql_Connection *)__pyx_v_self->__pyx_vtab)->_raise_error(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "oursqlx/connection.pyx":208 + * self._raise_error() + * + * def rollback(self): # <<<<<<<<<<<<<< + * """rollback() + * + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("oursql.Connection.rollback", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/connection.pyx":224 + * strings. + * """ + * def __get__(self): # <<<<<<<<<<<<<< + * self._charset = PyString_FromString( + * mysql_character_set_name(self.conn)) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_10Connection_7charset_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6oursql_10Connection_7charset_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_10Connection_7charset___get__(((struct __pyx_obj_6oursql_Connection *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_10Connection_7charset___get__(struct __pyx_obj_6oursql_Connection *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "oursqlx/connection.pyx":225 + * """ + * def __get__(self): + * self._charset = PyString_FromString( # <<<<<<<<<<<<<< + * mysql_character_set_name(self.conn)) + * return self._charset + */ + __pyx_t_1 = PyString_FromString(mysql_character_set_name(__pyx_v_self->conn)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->_charset); + __Pyx_DECREF(__pyx_v_self->_charset); + __pyx_v_self->_charset = __pyx_t_1; + __pyx_t_1 = 0; + + /* "oursqlx/connection.pyx":227 + * self._charset = PyString_FromString( + * mysql_character_set_name(self.conn)) + * return self._charset # <<<<<<<<<<<<<< + * def __set__(self, value): + * cdef char *svalue + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->_charset); + __pyx_r = __pyx_v_self->_charset; + goto __pyx_L0; + + /* "oursqlx/connection.pyx":224 + * strings. + * """ + * def __get__(self): # <<<<<<<<<<<<<< + * self._charset = PyString_FromString( + * mysql_character_set_name(self.conn)) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("oursql.Connection.charset.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/connection.pyx":228 + * mysql_character_set_name(self.conn)) + * return self._charset + * def __set__(self, value): # <<<<<<<<<<<<<< + * cdef char *svalue + * self._check_closed() + */ + +/* Python wrapper */ +static int __pyx_pw_6oursql_10Connection_7charset_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_6oursql_10Connection_7charset_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_10Connection_7charset_2__set__(((struct __pyx_obj_6oursql_Connection *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6oursql_10Connection_7charset_2__set__(struct __pyx_obj_6oursql_Connection *__pyx_v_self, PyObject *__pyx_v_value) { + char *__pyx_v_svalue; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + char *__pyx_t_2; + int __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + + /* "oursqlx/connection.pyx":230 + * def __set__(self, value): + * cdef char *svalue + * self._check_closed() # <<<<<<<<<<<<<< + * svalue = PyString_AsString(value) + * if mysql_set_character_set(self.conn, svalue): + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_6oursql_Connection *)__pyx_v_self->__pyx_vtab)->_check_closed(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "oursqlx/connection.pyx":231 + * cdef char *svalue + * self._check_closed() + * svalue = PyString_AsString(value) # <<<<<<<<<<<<<< + * if mysql_set_character_set(self.conn, svalue): + * self._raise_error() + */ + __pyx_t_2 = PyString_AsString(__pyx_v_value); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_svalue = __pyx_t_2; + + /* "oursqlx/connection.pyx":232 + * self._check_closed() + * svalue = PyString_AsString(value) + * if mysql_set_character_set(self.conn, svalue): # <<<<<<<<<<<<<< + * self._raise_error() + * self._charset = value + */ + __pyx_t_3 = (mysql_set_character_set(__pyx_v_self->conn, __pyx_v_svalue) != 0); + if (__pyx_t_3) { + + /* "oursqlx/connection.pyx":233 + * svalue = PyString_AsString(value) + * if mysql_set_character_set(self.conn, svalue): + * self._raise_error() # <<<<<<<<<<<<<< + * self._charset = value + * + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_6oursql_Connection *)__pyx_v_self->__pyx_vtab)->_raise_error(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "oursqlx/connection.pyx":234 + * if mysql_set_character_set(self.conn, svalue): + * self._raise_error() + * self._charset = value # <<<<<<<<<<<<<< + * + * def warning_count(self): + */ + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->_charset); + __Pyx_DECREF(__pyx_v_self->_charset); + __pyx_v_self->_charset = __pyx_v_value; + + /* "oursqlx/connection.pyx":228 + * mysql_character_set_name(self.conn)) + * return self._charset + * def __set__(self, value): # <<<<<<<<<<<<<< + * cdef char *svalue + * self._check_closed() + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("oursql.Connection.charset.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/connection.pyx":236 + * self._charset = value + * + * def warning_count(self): # <<<<<<<<<<<<<< + * """warning_count() -> int + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_10Connection_15warning_count(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_6oursql_10Connection_14warning_count[] = "warning_count() -> int\n \n Return the number of warnings caused by the most-previously-executed\n query or statement.\n "; +static PyObject *__pyx_pw_6oursql_10Connection_15warning_count(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("warning_count (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_10Connection_14warning_count(((struct __pyx_obj_6oursql_Connection *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_10Connection_14warning_count(struct __pyx_obj_6oursql_Connection *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("warning_count", 0); + + /* "oursqlx/connection.pyx":242 + * query or statement. + * """ + * return mysql_warning_count(self.conn) # <<<<<<<<<<<<<< + * + * def cursor(self, cursor_class=None, **kwargs): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(mysql_warning_count(__pyx_v_self->conn)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "oursqlx/connection.pyx":236 + * self._charset = value + * + * def warning_count(self): # <<<<<<<<<<<<<< + * """warning_count() -> int + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("oursql.Connection.warning_count", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/connection.pyx":244 + * return mysql_warning_count(self.conn) + * + * def cursor(self, cursor_class=None, **kwargs): # <<<<<<<<<<<<<< + * """cursor([cursor_class,] **cursor_options) -> Cursor. + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_10Connection_17cursor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6oursql_10Connection_16cursor[] = "cursor([cursor_class,] **cursor_options) -> Cursor.\n \n Create a new cursor associated with this connection of the specified \n type. If no cursor class is specified, the 'default_cursor' attribute\n is used as the cursor class. The cursor_options will be forwarded to \n the cursor's initializer; see the documentation for the cursor classes \n for details.\n "; +static PyObject *__pyx_pw_6oursql_10Connection_17cursor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_cursor_class = 0; + PyObject *__pyx_v_kwargs = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("cursor (wrapper)", 0); + __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL; + __Pyx_GOTREF(__pyx_v_kwargs); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cursor_class,0}; + PyObject* values[1] = {0}; + values[0] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_cursor_class); + if (value) { values[0] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "cursor") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_cursor_class = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("cursor", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; + __Pyx_AddTraceback("oursql.Connection.cursor", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6oursql_10Connection_16cursor(((struct __pyx_obj_6oursql_Connection *)__pyx_v_self), __pyx_v_cursor_class, __pyx_v_kwargs); + + /* function exit code */ + __Pyx_XDECREF(__pyx_v_kwargs); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_10Connection_16cursor(struct __pyx_obj_6oursql_Connection *__pyx_v_self, PyObject *__pyx_v_cursor_class, PyObject *__pyx_v_kwargs) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("cursor", 0); + __Pyx_INCREF(__pyx_v_cursor_class); + + /* "oursqlx/connection.pyx":253 + * for details. + * """ + * self._check_closed() # <<<<<<<<<<<<<< + * if cursor_class is None: + * cursor_class = self.default_cursor + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_6oursql_Connection *)__pyx_v_self->__pyx_vtab)->_check_closed(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "oursqlx/connection.pyx":254 + * """ + * self._check_closed() + * if cursor_class is None: # <<<<<<<<<<<<<< + * cursor_class = self.default_cursor + * return cursor_class(self, **kwargs) + */ + __pyx_t_2 = (__pyx_v_cursor_class == Py_None); + __pyx_t_3 = (__pyx_t_2 != 0); + if (__pyx_t_3) { + + /* "oursqlx/connection.pyx":255 + * self._check_closed() + * if cursor_class is None: + * cursor_class = self.default_cursor # <<<<<<<<<<<<<< + * return cursor_class(self, **kwargs) + * + */ + __pyx_t_4 = __pyx_v_self->default_cursor; + __Pyx_INCREF(__pyx_t_4); + __Pyx_DECREF_SET(__pyx_v_cursor_class, __pyx_t_4); + __pyx_t_4 = 0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "oursqlx/connection.pyx":256 + * if cursor_class is None: + * cursor_class = self.default_cursor + * return cursor_class(self, **kwargs) # <<<<<<<<<<<<<< + * + * property server_info: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + __pyx_t_5 = __pyx_v_kwargs; + __Pyx_INCREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_v_cursor_class, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_r = __pyx_t_6; + __pyx_t_6 = 0; + goto __pyx_L0; + + /* "oursqlx/connection.pyx":244 + * return mysql_warning_count(self.conn) + * + * def cursor(self, cursor_class=None, **kwargs): # <<<<<<<<<<<<<< + * """cursor([cursor_class,] **cursor_options) -> Cursor. + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("oursql.Connection.cursor", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_cursor_class); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/connection.pyx":259 + * + * property server_info: + * def __get__(self): # <<<<<<<<<<<<<< + * self._check_closed() + * return mysql_get_server_info(self.conn) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_10Connection_11server_info_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6oursql_10Connection_11server_info_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_10Connection_11server_info___get__(((struct __pyx_obj_6oursql_Connection *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_10Connection_11server_info___get__(struct __pyx_obj_6oursql_Connection *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "oursqlx/connection.pyx":260 + * property server_info: + * def __get__(self): + * self._check_closed() # <<<<<<<<<<<<<< + * return mysql_get_server_info(self.conn) + * + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_6oursql_Connection *)__pyx_v_self->__pyx_vtab)->_check_closed(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "oursqlx/connection.pyx":261 + * def __get__(self): + * self._check_closed() + * return mysql_get_server_info(self.conn) # <<<<<<<<<<<<<< + * + * property ssl_cipher: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyBytes_FromString(mysql_get_server_info(__pyx_v_self->conn)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "oursqlx/connection.pyx":259 + * + * property server_info: + * def __get__(self): # <<<<<<<<<<<<<< + * self._check_closed() + * return mysql_get_server_info(self.conn) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("oursql.Connection.server_info.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/connection.pyx":264 + * + * property ssl_cipher: + * def __get__(self): # <<<<<<<<<<<<<< + * cdef const_char *res + * self._check_closed() + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_10Connection_10ssl_cipher_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6oursql_10Connection_10ssl_cipher_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_10Connection_10ssl_cipher___get__(((struct __pyx_obj_6oursql_Connection *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_10Connection_10ssl_cipher___get__(struct __pyx_obj_6oursql_Connection *__pyx_v_self) { + const char *__pyx_v_res; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "oursqlx/connection.pyx":266 + * def __get__(self): + * cdef const_char *res + * self._check_closed() # <<<<<<<<<<<<<< + * res = mysql_get_ssl_cipher(self.conn) + * if not res: + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_6oursql_Connection *)__pyx_v_self->__pyx_vtab)->_check_closed(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "oursqlx/connection.pyx":267 + * cdef const_char *res + * self._check_closed() + * res = mysql_get_ssl_cipher(self.conn) # <<<<<<<<<<<<<< + * if not res: + * return None + */ + __pyx_v_res = mysql_get_ssl_cipher(__pyx_v_self->conn); + + /* "oursqlx/connection.pyx":268 + * self._check_closed() + * res = mysql_get_ssl_cipher(self.conn) + * if not res: # <<<<<<<<<<<<<< + * return None + * return PyString_FromString(res) + */ + __pyx_t_2 = ((!(__pyx_v_res != 0)) != 0); + if (__pyx_t_2) { + + /* "oursqlx/connection.pyx":269 + * res = mysql_get_ssl_cipher(self.conn) + * if not res: + * return None # <<<<<<<<<<<<<< + * return PyString_FromString(res) + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + } + + /* "oursqlx/connection.pyx":270 + * if not res: + * return None + * return PyString_FromString(res) # <<<<<<<<<<<<<< + * + * # Unless someone is monkeying around with calling __enter__ and __exit__ + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = PyString_FromString(__pyx_v_res); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "oursqlx/connection.pyx":264 + * + * property ssl_cipher: + * def __get__(self): # <<<<<<<<<<<<<< + * cdef const_char *res + * self._check_closed() + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("oursql.Connection.ssl_cipher.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/connection.pyx":274 + * # Unless someone is monkeying around with calling __enter__ and __exit__ + * # manually, this approach is the simplest. Yaaay mostly-reentrant code. + * def __enter__(self): # <<<<<<<<<<<<<< + * curs = self.cursor() + * self._context_cursors.append(curs) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_10Connection_19__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6oursql_10Connection_19__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__enter__ (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_10Connection_18__enter__(((struct __pyx_obj_6oursql_Connection *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_10Connection_18__enter__(struct __pyx_obj_6oursql_Connection *__pyx_v_self) { + PyObject *__pyx_v_curs = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__enter__", 0); + + /* "oursqlx/connection.pyx":275 + * # manually, this approach is the simplest. Yaaay mostly-reentrant code. + * def __enter__(self): + * curs = self.cursor() # <<<<<<<<<<<<<< + * self._context_cursors.append(curs) + * return curs.__enter__() + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_cursor); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_curs = __pyx_t_1; + __pyx_t_1 = 0; + + /* "oursqlx/connection.pyx":276 + * def __enter__(self): + * curs = self.cursor() + * self._context_cursors.append(curs) # <<<<<<<<<<<<<< + * return curs.__enter__() + * + */ + __pyx_t_4 = __Pyx_PyObject_Append(__pyx_v_self->_context_cursors, __pyx_v_curs); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "oursqlx/connection.pyx":277 + * curs = self.cursor() + * self._context_cursors.append(curs) + * return curs.__enter__() # <<<<<<<<<<<<<< + * + * def __exit__(self, exc, value, tb): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_curs, __pyx_n_s_enter); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "oursqlx/connection.pyx":274 + * # Unless someone is monkeying around with calling __enter__ and __exit__ + * # manually, this approach is the simplest. Yaaay mostly-reentrant code. + * def __enter__(self): # <<<<<<<<<<<<<< + * curs = self.cursor() + * self._context_cursors.append(curs) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("oursql.Connection.__enter__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_curs); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/connection.pyx":279 + * return curs.__enter__() + * + * def __exit__(self, exc, value, tb): # <<<<<<<<<<<<<< + * curs = self._context_cursors.pop() + * curs.__exit__(exc, value, tb) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_10Connection_21__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_6oursql_10Connection_21__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_exc = 0; + PyObject *__pyx_v_value = 0; + PyObject *__pyx_v_tb = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__exit__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_exc,&__pyx_n_s_value,&__pyx_n_s_tb,0}; + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_exc)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_tb)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__exit__") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + } + __pyx_v_exc = values[0]; + __pyx_v_value = values[1]; + __pyx_v_tb = values[2]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("oursql.Connection.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6oursql_10Connection_20__exit__(((struct __pyx_obj_6oursql_Connection *)__pyx_v_self), __pyx_v_exc, __pyx_v_value, __pyx_v_tb); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_10Connection_20__exit__(struct __pyx_obj_6oursql_Connection *__pyx_v_self, PyObject *__pyx_v_exc, PyObject *__pyx_v_value, PyObject *__pyx_v_tb) { + PyObject *__pyx_v_curs = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__exit__", 0); + + /* "oursqlx/connection.pyx":280 + * + * def __exit__(self, exc, value, tb): + * curs = self._context_cursors.pop() # <<<<<<<<<<<<<< + * curs.__exit__(exc, value, tb) + * + */ + __pyx_t_1 = __Pyx_PyObject_Pop(__pyx_v_self->_context_cursors); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_curs = __pyx_t_1; + __pyx_t_1 = 0; + + /* "oursqlx/connection.pyx":281 + * def __exit__(self, exc, value, tb): + * curs = self._context_cursors.pop() + * curs.__exit__(exc, value, tb) # <<<<<<<<<<<<<< + * + * # FML. + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_curs, __pyx_n_s_exit); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + __pyx_t_4 = 0; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_4 = 1; + } + } + __pyx_t_5 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + if (__pyx_t_3) { + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL; + } + __Pyx_INCREF(__pyx_v_exc); + PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_exc); + __Pyx_GIVEREF(__pyx_v_exc); + __Pyx_INCREF(__pyx_v_value); + PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_INCREF(__pyx_v_tb); + PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_v_tb); + __Pyx_GIVEREF(__pyx_v_tb); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "oursqlx/connection.pyx":279 + * return curs.__enter__() + * + * def __exit__(self, exc, value, tb): # <<<<<<<<<<<<<< + * curs = self._context_cursors.pop() + * curs.__exit__(exc, value, tb) + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("oursql.Connection.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_curs); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/connection.pyx":284 + * + * # FML. + * def _escape_string(self, value): # <<<<<<<<<<<<<< + * """_escape_string(value) -> str. + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_10Connection_23_escape_string(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static char __pyx_doc_6oursql_10Connection_22_escape_string[] = "_escape_string(value) -> str.\n \n A wrapper around mysql_real_escape_string. Takes a bytestring in and \n produces a bytestring out. Please do not every use this unless mysql\n refuses to parameterize a query; oursql has good support for \n parameterization which also works consistently with unicode.\n "; +static PyObject *__pyx_pw_6oursql_10Connection_23_escape_string(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_escape_string (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_10Connection_22_escape_string(((struct __pyx_obj_6oursql_Connection *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_10Connection_22_escape_string(struct __pyx_obj_6oursql_Connection *__pyx_v_self, PyObject *__pyx_v_value) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_escape_string", 0); + + /* "oursqlx/connection.pyx":292 + * parameterization which also works consistently with unicode. + * """ + * return _oursqlx_escape_string(self.conn, value) # <<<<<<<<<<<<<< + * + * def _escape_unicode_string(self, value): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = _oursqlx_escape_string(__pyx_v_self->conn, __pyx_v_value); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "oursqlx/connection.pyx":284 + * + * # FML. + * def _escape_string(self, value): # <<<<<<<<<<<<<< + * """_escape_string(value) -> str. + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("oursql.Connection._escape_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/connection.pyx":294 + * return _oursqlx_escape_string(self.conn, value) + * + * def _escape_unicode_string(self, value): # <<<<<<<<<<<<<< + * """_escape_unicode_stirng(value) -> unicode. + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_10Connection_25_escape_unicode_string(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static char __pyx_doc_6oursql_10Connection_24_escape_unicode_string[] = "_escape_unicode_stirng(value) -> unicode.\n \n _escape_string that takes unicode in and produces unicode out, using\n the connection's charset. As with _escape_string, please do not use \n this function.\n "; +static PyObject *__pyx_pw_6oursql_10Connection_25_escape_unicode_string(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_escape_unicode_string (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_10Connection_24_escape_unicode_string(((struct __pyx_obj_6oursql_Connection *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_10Connection_24_escape_unicode_string(struct __pyx_obj_6oursql_Connection *__pyx_v_self, PyObject *__pyx_v_value) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_escape_unicode_string", 0); + + /* "oursqlx/connection.pyx":301 + * this function. + * """ + * return self._escape_string( # <<<<<<<<<<<<<< + * value.encode(self.charset)).decode(self.charset) + */ + __Pyx_XDECREF(__pyx_r); + + /* "oursqlx/connection.pyx":302 + * """ + * return self._escape_string( + * value.encode(self.charset)).decode(self.charset) # <<<<<<<<<<<<<< + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_escape_string); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_value, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_charset); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + } + } + if (!__pyx_t_7) { + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_GOTREF(__pyx_t_4); + } else { + __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = NULL; + PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + __pyx_t_6 = 0; + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (!__pyx_t_5) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_2); + } else { + __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL; + PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_decode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_charset); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_8 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_8)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (!__pyx_t_8) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else { + __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); __pyx_t_8 = NULL; + PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "oursqlx/connection.pyx":294 + * return _oursqlx_escape_string(self.conn, value) + * + * def _escape_unicode_string(self, value): # <<<<<<<<<<<<<< + * """_escape_unicode_stirng(value) -> unicode. + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("oursql.Connection._escape_unicode_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/connection.pyx":73 + * cdef MYSQL *conn + * cdef object _charset, _context_cursors + * cdef readonly int use_unicode, autoping, raise_on_warnings # <<<<<<<<<<<<<< + * cdef public object default_cursor + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_10Connection_11use_unicode_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6oursql_10Connection_11use_unicode_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_10Connection_11use_unicode___get__(((struct __pyx_obj_6oursql_Connection *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_10Connection_11use_unicode___get__(struct __pyx_obj_6oursql_Connection *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->use_unicode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("oursql.Connection.use_unicode.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_10Connection_8autoping_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6oursql_10Connection_8autoping_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_10Connection_8autoping___get__(((struct __pyx_obj_6oursql_Connection *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_10Connection_8autoping___get__(struct __pyx_obj_6oursql_Connection *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->autoping); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("oursql.Connection.autoping.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_10Connection_17raise_on_warnings_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6oursql_10Connection_17raise_on_warnings_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_10Connection_17raise_on_warnings___get__(((struct __pyx_obj_6oursql_Connection *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_10Connection_17raise_on_warnings___get__(struct __pyx_obj_6oursql_Connection *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->raise_on_warnings); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("oursql.Connection.raise_on_warnings.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/connection.pyx":74 + * cdef object _charset, _context_cursors + * cdef readonly int use_unicode, autoping, raise_on_warnings + * cdef public object default_cursor # <<<<<<<<<<<<<< + * + * def __cinit__(self, char *host=NULL, char *user=NULL, char *passwd=NULL, *, + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_10Connection_14default_cursor_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6oursql_10Connection_14default_cursor_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_10Connection_14default_cursor___get__(((struct __pyx_obj_6oursql_Connection *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_10Connection_14default_cursor___get__(struct __pyx_obj_6oursql_Connection *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->default_cursor); + __pyx_r = __pyx_v_self->default_cursor; + goto __pyx_L0; + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6oursql_10Connection_14default_cursor_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_6oursql_10Connection_14default_cursor_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_10Connection_14default_cursor_2__set__(((struct __pyx_obj_6oursql_Connection *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6oursql_10Connection_14default_cursor_2__set__(struct __pyx_obj_6oursql_Connection *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__", 0); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->default_cursor); + __Pyx_DECREF(__pyx_v_self->default_cursor); + __pyx_v_self->default_cursor = __pyx_v_value; + + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6oursql_10Connection_14default_cursor_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_6oursql_10Connection_14default_cursor_5__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_10Connection_14default_cursor_4__del__(((struct __pyx_obj_6oursql_Connection *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6oursql_10Connection_14default_cursor_4__del__(struct __pyx_obj_6oursql_Connection *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->default_cursor); + __Pyx_DECREF(__pyx_v_self->default_cursor); + __pyx_v_self->default_cursor = Py_None; + + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/statement.pyx":9 + * + * cdef class _AbstractIterWrapper: + * def __iter__(self): # <<<<<<<<<<<<<< + * return self + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_20_AbstractIterWrapper_1__iter__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6oursql_20_AbstractIterWrapper_1__iter__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_20_AbstractIterWrapper___iter__(((struct __pyx_obj_6oursql__AbstractIterWrapper *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_20_AbstractIterWrapper___iter__(struct __pyx_obj_6oursql__AbstractIterWrapper *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__iter__", 0); + + /* "oursqlx/statement.pyx":10 + * cdef class _AbstractIterWrapper: + * def __iter__(self): + * return self # <<<<<<<<<<<<<< + * + * cdef class _BinaryWhateverMixin: + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "oursqlx/statement.pyx":9 + * + * cdef class _AbstractIterWrapper: + * def __iter__(self): # <<<<<<<<<<<<<< + * return self + * + */ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/statement.pyx":13 + * + * cdef class _BinaryWhateverMixin: + * def __next__(self): # <<<<<<<<<<<<<< + * ret = super(BinaryFileWrapper, self).next() + * return PyBuffer_FromObject(ret, 0, Py_END_OF_BUFFER) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_20_BinaryWhateverMixin_1__next__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6oursql_20_BinaryWhateverMixin_1__next__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__next__ (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_20_BinaryWhateverMixin___next__(((struct __pyx_obj_6oursql__BinaryWhateverMixin *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_20_BinaryWhateverMixin___next__(struct __pyx_obj_6oursql__BinaryWhateverMixin *__pyx_v_self) { + PyObject *__pyx_v_ret = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__next__", 0); + + /* "oursqlx/statement.pyx":14 + * cdef class _BinaryWhateverMixin: + * def __next__(self): + * ret = super(BinaryFileWrapper, self).next() # <<<<<<<<<<<<<< + * return PyBuffer_FromObject(ret, 0, Py_END_OF_BUFFER) + * + */ + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_BinaryFileWrapper); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_next); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (__pyx_t_2) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } else { + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_ret = __pyx_t_1; + __pyx_t_1 = 0; + + /* "oursqlx/statement.pyx":15 + * def __next__(self): + * ret = super(BinaryFileWrapper, self).next() + * return PyBuffer_FromObject(ret, 0, Py_END_OF_BUFFER) # <<<<<<<<<<<<<< + * + * cdef class IterWrapper(_AbstractIterWrapper): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyBuffer_FromObject(__pyx_v_ret, 0, Py_END_OF_BUFFER); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "oursqlx/statement.pyx":13 + * + * cdef class _BinaryWhateverMixin: + * def __next__(self): # <<<<<<<<<<<<<< + * ret = super(BinaryFileWrapper, self).next() + * return PyBuffer_FromObject(ret, 0, Py_END_OF_BUFFER) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("oursql._BinaryWhateverMixin.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_ret); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/statement.pyx":28 + * cdef object iterobj, nextfunc + * + * def __cinit__(self, iterobj): # <<<<<<<<<<<<<< + * self.iterobj = iter(iterobj) + * self.nextfunc = self.iterobj.next + */ + +/* Python wrapper */ +static int __pyx_pw_6oursql_11IterWrapper_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_6oursql_11IterWrapper_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_iterobj = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_iterobj,0}; + PyObject* values[1] = {0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_iterobj)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + } + __pyx_v_iterobj = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("oursql.IterWrapper.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6oursql_11IterWrapper___cinit__(((struct __pyx_obj_6oursql_IterWrapper *)__pyx_v_self), __pyx_v_iterobj); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6oursql_11IterWrapper___cinit__(struct __pyx_obj_6oursql_IterWrapper *__pyx_v_self, PyObject *__pyx_v_iterobj) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__cinit__", 0); + + /* "oursqlx/statement.pyx":29 + * + * def __cinit__(self, iterobj): + * self.iterobj = iter(iterobj) # <<<<<<<<<<<<<< + * self.nextfunc = self.iterobj.next + * + */ + __pyx_t_1 = PyObject_GetIter(__pyx_v_iterobj); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->iterobj); + __Pyx_DECREF(__pyx_v_self->iterobj); + __pyx_v_self->iterobj = __pyx_t_1; + __pyx_t_1 = 0; + + /* "oursqlx/statement.pyx":30 + * def __cinit__(self, iterobj): + * self.iterobj = iter(iterobj) + * self.nextfunc = self.iterobj.next # <<<<<<<<<<<<<< + * + * def __next__(self): + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->iterobj, __pyx_n_s_next); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->nextfunc); + __Pyx_DECREF(__pyx_v_self->nextfunc); + __pyx_v_self->nextfunc = __pyx_t_1; + __pyx_t_1 = 0; + + /* "oursqlx/statement.pyx":28 + * cdef object iterobj, nextfunc + * + * def __cinit__(self, iterobj): # <<<<<<<<<<<<<< + * self.iterobj = iter(iterobj) + * self.nextfunc = self.iterobj.next + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("oursql.IterWrapper.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/statement.pyx":32 + * self.nextfunc = self.iterobj.next + * + * def __next__(self): # <<<<<<<<<<<<<< + * return self.nextfunc() + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_11IterWrapper_3__next__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6oursql_11IterWrapper_3__next__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__next__ (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_11IterWrapper_2__next__(((struct __pyx_obj_6oursql_IterWrapper *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_11IterWrapper_2__next__(struct __pyx_obj_6oursql_IterWrapper *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__next__", 0); + + /* "oursqlx/statement.pyx":33 + * + * def __next__(self): + * return self.nextfunc() # <<<<<<<<<<<<<< + * + * BinaryIterWrapper = type('BinaryIterWrapper', + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->nextfunc); + __pyx_t_2 = __pyx_v_self->nextfunc; __pyx_t_3 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "oursqlx/statement.pyx":32 + * self.nextfunc = self.iterobj.next + * + * def __next__(self): # <<<<<<<<<<<<<< + * return self.nextfunc() + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("oursql.IterWrapper.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/statement.pyx":59 + * cdef int doclose, done + * + * def __cinit__(self, fileobj, chunksize=8192, bint doclose=False): # <<<<<<<<<<<<<< + * self.fileobj = fileobj + * self.readfunc = fileobj.read + */ + +/* Python wrapper */ +static int __pyx_pw_6oursql_11FileWrapper_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_6oursql_11FileWrapper_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_fileobj = 0; + PyObject *__pyx_v_chunksize = 0; + int __pyx_v_doclose; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fileobj,&__pyx_n_s_chunksize,&__pyx_n_s_doclose,0}; + PyObject* values[3] = {0,0,0}; + values[1] = ((PyObject *)__pyx_int_8192); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_fileobj)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_chunksize); + if (value) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_doclose); + if (value) { values[2] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_fileobj = values[0]; + __pyx_v_chunksize = values[1]; + if (values[2]) { + __pyx_v_doclose = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_doclose == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_doclose = ((int)0); + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("oursql.FileWrapper.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6oursql_11FileWrapper___cinit__(((struct __pyx_obj_6oursql_FileWrapper *)__pyx_v_self), __pyx_v_fileobj, __pyx_v_chunksize, __pyx_v_doclose); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6oursql_11FileWrapper___cinit__(struct __pyx_obj_6oursql_FileWrapper *__pyx_v_self, PyObject *__pyx_v_fileobj, PyObject *__pyx_v_chunksize, int __pyx_v_doclose) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__cinit__", 0); + + /* "oursqlx/statement.pyx":60 + * + * def __cinit__(self, fileobj, chunksize=8192, bint doclose=False): + * self.fileobj = fileobj # <<<<<<<<<<<<<< + * self.readfunc = fileobj.read + * self.chunksize = chunksize + */ + __Pyx_INCREF(__pyx_v_fileobj); + __Pyx_GIVEREF(__pyx_v_fileobj); + __Pyx_GOTREF(__pyx_v_self->fileobj); + __Pyx_DECREF(__pyx_v_self->fileobj); + __pyx_v_self->fileobj = __pyx_v_fileobj; + + /* "oursqlx/statement.pyx":61 + * def __cinit__(self, fileobj, chunksize=8192, bint doclose=False): + * self.fileobj = fileobj + * self.readfunc = fileobj.read # <<<<<<<<<<<<<< + * self.chunksize = chunksize + * self.doclose = doclose + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_fileobj, __pyx_n_s_read); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->readfunc); + __Pyx_DECREF(__pyx_v_self->readfunc); + __pyx_v_self->readfunc = __pyx_t_1; + __pyx_t_1 = 0; + + /* "oursqlx/statement.pyx":62 + * self.fileobj = fileobj + * self.readfunc = fileobj.read + * self.chunksize = chunksize # <<<<<<<<<<<<<< + * self.doclose = doclose + * self.done = False + */ + __Pyx_INCREF(__pyx_v_chunksize); + __Pyx_GIVEREF(__pyx_v_chunksize); + __Pyx_GOTREF(__pyx_v_self->chunksize); + __Pyx_DECREF(__pyx_v_self->chunksize); + __pyx_v_self->chunksize = __pyx_v_chunksize; + + /* "oursqlx/statement.pyx":63 + * self.readfunc = fileobj.read + * self.chunksize = chunksize + * self.doclose = doclose # <<<<<<<<<<<<<< + * self.done = False + * + */ + __pyx_v_self->doclose = __pyx_v_doclose; + + /* "oursqlx/statement.pyx":64 + * self.chunksize = chunksize + * self.doclose = doclose + * self.done = False # <<<<<<<<<<<<<< + * + * def __next__(self): + */ + __pyx_v_self->done = 0; + + /* "oursqlx/statement.pyx":59 + * cdef int doclose, done + * + * def __cinit__(self, fileobj, chunksize=8192, bint doclose=False): # <<<<<<<<<<<<<< + * self.fileobj = fileobj + * self.readfunc = fileobj.read + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("oursql.FileWrapper.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/statement.pyx":66 + * self.done = False + * + * def __next__(self): # <<<<<<<<<<<<<< + * if self.done: + * raise StopIteration + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_11FileWrapper_3__next__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6oursql_11FileWrapper_3__next__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__next__ (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_11FileWrapper_2__next__(((struct __pyx_obj_6oursql_FileWrapper *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_11FileWrapper_2__next__(struct __pyx_obj_6oursql_FileWrapper *__pyx_v_self) { + PyObject *__pyx_v_ret = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__next__", 0); + + /* "oursqlx/statement.pyx":67 + * + * def __next__(self): + * if self.done: # <<<<<<<<<<<<<< + * raise StopIteration + * ret = self.readfunc(self.chunksize) + */ + __pyx_t_1 = (__pyx_v_self->done != 0); + if (__pyx_t_1) { + + /* "oursqlx/statement.pyx":68 + * def __next__(self): + * if self.done: + * raise StopIteration # <<<<<<<<<<<<<< + * ret = self.readfunc(self.chunksize) + * if not ret: + */ + __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0); + {__pyx_filename = __pyx_f[4]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + + /* "oursqlx/statement.pyx":69 + * if self.done: + * raise StopIteration + * ret = self.readfunc(self.chunksize) # <<<<<<<<<<<<<< + * if not ret: + * if self.doclose: + */ + __Pyx_INCREF(__pyx_v_self->readfunc); + __pyx_t_3 = __pyx_v_self->readfunc; __pyx_t_4 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (!__pyx_t_4) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_self->chunksize); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + } else { + __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL; + __Pyx_INCREF(__pyx_v_self->chunksize); + PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_self->chunksize); + __Pyx_GIVEREF(__pyx_v_self->chunksize); + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_ret = __pyx_t_2; + __pyx_t_2 = 0; + + /* "oursqlx/statement.pyx":70 + * raise StopIteration + * ret = self.readfunc(self.chunksize) + * if not ret: # <<<<<<<<<<<<<< + * if self.doclose: + * self.fileobj.close() + */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_ret); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = ((!__pyx_t_1) != 0); + if (__pyx_t_6) { + + /* "oursqlx/statement.pyx":71 + * ret = self.readfunc(self.chunksize) + * if not ret: + * if self.doclose: # <<<<<<<<<<<<<< + * self.fileobj.close() + * self.done = True + */ + __pyx_t_6 = (__pyx_v_self->doclose != 0); + if (__pyx_t_6) { + + /* "oursqlx/statement.pyx":72 + * if not ret: + * if self.doclose: + * self.fileobj.close() # <<<<<<<<<<<<<< + * self.done = True + * raise StopIteration + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->fileobj, __pyx_n_s_close); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (__pyx_t_5) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } else { + __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "oursqlx/statement.pyx":73 + * if self.doclose: + * self.fileobj.close() + * self.done = True # <<<<<<<<<<<<<< + * raise StopIteration + * return ret + */ + __pyx_v_self->done = 1; + + /* "oursqlx/statement.pyx":74 + * self.fileobj.close() + * self.done = True + * raise StopIteration # <<<<<<<<<<<<<< + * return ret + * + */ + __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0); + {__pyx_filename = __pyx_f[4]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + + /* "oursqlx/statement.pyx":75 + * self.done = True + * raise StopIteration + * return ret # <<<<<<<<<<<<<< + * + * BinaryFileWrapper = type('BinaryFileWrapper', + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_ret); + __pyx_r = __pyx_v_ret; + goto __pyx_L0; + + /* "oursqlx/statement.pyx":66 + * self.done = False + * + * def __next__(self): # <<<<<<<<<<<<<< + * if self.done: + * raise StopIteration + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("oursql.FileWrapper.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_ret); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/statement.pyx":101 + * cdef public object warnings + * + * def __cinit__(self, Connection connection not None, # <<<<<<<<<<<<<< + * unsigned long string_limit=0, bint show_table=False, **kwargs): + * self.conn = connection + */ + +/* Python wrapper */ +static int __pyx_pw_6oursql_10_Statement_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_6oursql_10_Statement_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_6oursql_Connection *__pyx_v_connection = 0; + unsigned long __pyx_v_string_limit; + int __pyx_v_show_table; + CYTHON_UNUSED PyObject *__pyx_v_kwargs = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1; + __Pyx_GOTREF(__pyx_v_kwargs); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_connection,&__pyx_n_s_string_limit,&__pyx_n_s_show_table,0}; + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_connection)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_string_limit); + if (value) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_show_table); + if (value) { values[2] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_connection = ((struct __pyx_obj_6oursql_Connection *)values[0]); + if (values[1]) { + __pyx_v_string_limit = __Pyx_PyInt_As_unsigned_long(values[1]); if (unlikely((__pyx_v_string_limit == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_string_limit = ((unsigned long)0); + } + if (values[2]) { + __pyx_v_show_table = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_show_table == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + + /* "oursqlx/statement.pyx":102 + * + * def __cinit__(self, Connection connection not None, + * unsigned long string_limit=0, bint show_table=False, **kwargs): # <<<<<<<<<<<<<< + * self.conn = connection + * self.stmt = mysql_stmt_init(self.conn.conn) + */ + __pyx_v_show_table = ((int)0); + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; + __Pyx_AddTraceback("oursql._Statement.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_connection), __pyx_ptype_6oursql_Connection, 0, "connection", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_6oursql_10_Statement___cinit__(((struct __pyx_obj_6oursql__Statement *)__pyx_v_self), __pyx_v_connection, __pyx_v_string_limit, __pyx_v_show_table, __pyx_v_kwargs); + + /* "oursqlx/statement.pyx":101 + * cdef public object warnings + * + * def __cinit__(self, Connection connection not None, # <<<<<<<<<<<<<< + * unsigned long string_limit=0, bint show_table=False, **kwargs): + * self.conn = connection + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_kwargs); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6oursql_10_Statement___cinit__(struct __pyx_obj_6oursql__Statement *__pyx_v_self, struct __pyx_obj_6oursql_Connection *__pyx_v_connection, unsigned long __pyx_v_string_limit, int __pyx_v_show_table, CYTHON_UNUSED PyObject *__pyx_v_kwargs) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__cinit__", 0); + + /* "oursqlx/statement.pyx":103 + * def __cinit__(self, Connection connection not None, + * unsigned long string_limit=0, bint show_table=False, **kwargs): + * self.conn = connection # <<<<<<<<<<<<<< + * self.stmt = mysql_stmt_init(self.conn.conn) + * if not self.stmt: + */ + __Pyx_INCREF(((PyObject *)__pyx_v_connection)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_connection)); + __Pyx_GOTREF(__pyx_v_self->conn); + __Pyx_DECREF(((PyObject *)__pyx_v_self->conn)); + __pyx_v_self->conn = __pyx_v_connection; + + /* "oursqlx/statement.pyx":104 + * unsigned long string_limit=0, bint show_table=False, **kwargs): + * self.conn = connection + * self.stmt = mysql_stmt_init(self.conn.conn) # <<<<<<<<<<<<<< + * if not self.stmt: + * raise MemoryError('alloc of statement failed') + */ + __pyx_v_self->stmt = mysql_stmt_init(__pyx_v_self->conn->conn); + + /* "oursqlx/statement.pyx":105 + * self.conn = connection + * self.stmt = mysql_stmt_init(self.conn.conn) + * if not self.stmt: # <<<<<<<<<<<<<< + * raise MemoryError('alloc of statement failed') + * self.string_limit = string_limit + */ + __pyx_t_1 = ((!(__pyx_v_self->stmt != 0)) != 0); + if (__pyx_t_1) { + + /* "oursqlx/statement.pyx":106 + * self.stmt = mysql_stmt_init(self.conn.conn) + * if not self.stmt: + * raise MemoryError('alloc of statement failed') # <<<<<<<<<<<<<< + * self.string_limit = string_limit + * self.show_table = show_table + */ + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[4]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + + /* "oursqlx/statement.pyx":107 + * if not self.stmt: + * raise MemoryError('alloc of statement failed') + * self.string_limit = string_limit # <<<<<<<<<<<<<< + * self.show_table = show_table + * self.result_data = NULL + */ + __pyx_v_self->string_limit = __pyx_v_string_limit; + + /* "oursqlx/statement.pyx":108 + * raise MemoryError('alloc of statement failed') + * self.string_limit = string_limit + * self.show_table = show_table # <<<<<<<<<<<<<< + * self.result_data = NULL + * self.warnings = [] + */ + __pyx_v_self->show_table = __pyx_v_show_table; + + /* "oursqlx/statement.pyx":109 + * self.string_limit = string_limit + * self.show_table = show_table + * self.result_data = NULL # <<<<<<<<<<<<<< + * self.warnings = [] + * self.buffered = self.data_waiting = self.exhausted = False + */ + __pyx_v_self->result_data = NULL; + + /* "oursqlx/statement.pyx":110 + * self.show_table = show_table + * self.result_data = NULL + * self.warnings = [] # <<<<<<<<<<<<<< + * self.buffered = self.data_waiting = self.exhausted = False + * if _oursqlx_init_stmt_cursor(self.stmt, &self.cursor_type): + */ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_v_self->warnings); + __Pyx_DECREF(__pyx_v_self->warnings); + __pyx_v_self->warnings = __pyx_t_2; + __pyx_t_2 = 0; + + /* "oursqlx/statement.pyx":111 + * self.result_data = NULL + * self.warnings = [] + * self.buffered = self.data_waiting = self.exhausted = False # <<<<<<<<<<<<<< + * if _oursqlx_init_stmt_cursor(self.stmt, &self.cursor_type): + * self._raise_error() + */ + __pyx_v_self->buffered = 0; + __pyx_v_self->data_waiting = 0; + __pyx_v_self->exhausted = 0; + + /* "oursqlx/statement.pyx":112 + * self.warnings = [] + * self.buffered = self.data_waiting = self.exhausted = False + * if _oursqlx_init_stmt_cursor(self.stmt, &self.cursor_type): # <<<<<<<<<<<<<< + * self._raise_error() + * + */ + __pyx_t_1 = (_oursqlx_init_stmt_cursor(__pyx_v_self->stmt, (&__pyx_v_self->cursor_type)) != 0); + if (__pyx_t_1) { + + /* "oursqlx/statement.pyx":113 + * self.buffered = self.data_waiting = self.exhausted = False + * if _oursqlx_init_stmt_cursor(self.stmt, &self.cursor_type): + * self._raise_error() # <<<<<<<<<<<<<< + * + * def __dealloc__(self): + */ + __pyx_t_3 = ((struct __pyx_vtabstruct_6oursql__Statement *)__pyx_v_self->__pyx_vtab)->_raise_error(__pyx_v_self); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L4; + } + __pyx_L4:; + + /* "oursqlx/statement.pyx":101 + * cdef public object warnings + * + * def __cinit__(self, Connection connection not None, # <<<<<<<<<<<<<< + * unsigned long string_limit=0, bint show_table=False, **kwargs): + * self.conn = connection + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("oursql._Statement.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/statement.pyx":115 + * self._raise_error() + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * self.close() + * PyMem_Free(self.result_data) + */ + +/* Python wrapper */ +static void __pyx_pw_6oursql_10_Statement_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pw_6oursql_10_Statement_3__dealloc__(PyObject *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_pf_6oursql_10_Statement_2__dealloc__(((struct __pyx_obj_6oursql__Statement *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +static void __pyx_pf_6oursql_10_Statement_2__dealloc__(struct __pyx_obj_6oursql__Statement *__pyx_v_self) { + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__dealloc__", 0); + + /* "oursqlx/statement.pyx":116 + * + * def __dealloc__(self): + * self.close() # <<<<<<<<<<<<<< + * PyMem_Free(self.result_data) + * PyMem_Free(self.bind) + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_close); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "oursqlx/statement.pyx":117 + * def __dealloc__(self): + * self.close() + * PyMem_Free(self.result_data) # <<<<<<<<<<<<<< + * PyMem_Free(self.bind) + * + */ + PyMem_Free(__pyx_v_self->result_data); + + /* "oursqlx/statement.pyx":118 + * self.close() + * PyMem_Free(self.result_data) + * PyMem_Free(self.bind) # <<<<<<<<<<<<<< + * + * def close(self): + */ + PyMem_Free(__pyx_v_self->bind); + + /* "oursqlx/statement.pyx":115 + * self._raise_error() + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * self.close() + * PyMem_Free(self.result_data) + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_WriteUnraisable("oursql._Statement.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 0); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* "oursqlx/statement.pyx":120 + * PyMem_Free(self.bind) + * + * def close(self): # <<<<<<<<<<<<<< + * if self.stmt: + * mysql_stmt_close(self.stmt) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_10_Statement_5close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6oursql_10_Statement_5close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("close (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_10_Statement_4close(((struct __pyx_obj_6oursql__Statement *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_10_Statement_4close(struct __pyx_obj_6oursql__Statement *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("close", 0); + + /* "oursqlx/statement.pyx":121 + * + * def close(self): + * if self.stmt: # <<<<<<<<<<<<<< + * mysql_stmt_close(self.stmt) + * self.stmt = NULL + */ + __pyx_t_1 = (__pyx_v_self->stmt != 0); + if (__pyx_t_1) { + + /* "oursqlx/statement.pyx":122 + * def close(self): + * if self.stmt: + * mysql_stmt_close(self.stmt) # <<<<<<<<<<<<<< + * self.stmt = NULL + * + */ + mysql_stmt_close(__pyx_v_self->stmt); + + /* "oursqlx/statement.pyx":123 + * if self.stmt: + * mysql_stmt_close(self.stmt) + * self.stmt = NULL # <<<<<<<<<<<<<< + * + * cdef int _raise_error(self) except -1: + */ + __pyx_v_self->stmt = NULL; + goto __pyx_L3; + } + __pyx_L3:; + + /* "oursqlx/statement.pyx":120 + * PyMem_Free(self.bind) + * + * def close(self): # <<<<<<<<<<<<<< + * if self.stmt: + * mysql_stmt_close(self.stmt) + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/statement.pyx":125 + * self.stmt = NULL + * + * cdef int _raise_error(self) except -1: # <<<<<<<<<<<<<< + * cdef int err = mysql_stmt_errno(self.stmt) + * raise _exception_from_errno(err)(mysql_stmt_error(self.stmt), err) + */ + +static int __pyx_f_6oursql_10_Statement__raise_error(struct __pyx_obj_6oursql__Statement *__pyx_v_self) { + int __pyx_v_err; + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + Py_ssize_t __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_raise_error", 0); + + /* "oursqlx/statement.pyx":126 + * + * cdef int _raise_error(self) except -1: + * cdef int err = mysql_stmt_errno(self.stmt) # <<<<<<<<<<<<<< + * raise _exception_from_errno(err)(mysql_stmt_error(self.stmt), err) + * + */ + __pyx_v_err = mysql_stmt_errno(__pyx_v_self->stmt); + + /* "oursqlx/statement.pyx":127 + * cdef int _raise_error(self) except -1: + * cdef int err = mysql_stmt_errno(self.stmt) + * raise _exception_from_errno(err)(mysql_stmt_error(self.stmt), err) # <<<<<<<<<<<<<< + * + * cdef int _check_closed(self) except -1: + */ + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_exception_from_errno); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_err); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (!__pyx_t_5) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_2); + } else { + __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL; + PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyBytes_FromString(mysql_stmt_error(__pyx_v_self->stmt)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_err); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_4 = NULL; + __pyx_t_7 = 0; + if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_7 = 1; + } + } + __pyx_t_5 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + if (__pyx_t_4) { + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL; + } + PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_7, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_7, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + __pyx_t_3 = 0; + __pyx_t_6 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + {__pyx_filename = __pyx_f[4]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "oursqlx/statement.pyx":125 + * self.stmt = NULL + * + * cdef int _raise_error(self) except -1: # <<<<<<<<<<<<<< + * cdef int err = mysql_stmt_errno(self.stmt) + * raise _exception_from_errno(err)(mysql_stmt_error(self.stmt), err) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("oursql._Statement._raise_error", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/statement.pyx":129 + * raise _exception_from_errno(err)(mysql_stmt_error(self.stmt), err) + * + * cdef int _check_closed(self) except -1: # <<<<<<<<<<<<<< + * if not self.conn.conn: + * if self.stmt: + */ + +static int __pyx_f_6oursql_10_Statement__check_closed(struct __pyx_obj_6oursql__Statement *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_check_closed", 0); + + /* "oursqlx/statement.pyx":130 + * + * cdef int _check_closed(self) except -1: + * if not self.conn.conn: # <<<<<<<<<<<<<< + * if self.stmt: + * self.close() + */ + __pyx_t_1 = ((!(__pyx_v_self->conn->conn != 0)) != 0); + if (__pyx_t_1) { + + /* "oursqlx/statement.pyx":131 + * cdef int _check_closed(self) except -1: + * if not self.conn.conn: + * if self.stmt: # <<<<<<<<<<<<<< + * self.close() + * raise ProgrammingError('connection closed') + */ + __pyx_t_1 = (__pyx_v_self->stmt != 0); + if (__pyx_t_1) { + + /* "oursqlx/statement.pyx":132 + * if not self.conn.conn: + * if self.stmt: + * self.close() # <<<<<<<<<<<<<< + * raise ProgrammingError('connection closed') + * if not self.stmt: + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_close); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (__pyx_t_4) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else { + __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L4; + } + __pyx_L4:; + + /* "oursqlx/statement.pyx":133 + * if self.stmt: + * self.close() + * raise ProgrammingError('connection closed') # <<<<<<<<<<<<<< + * if not self.stmt: + * raise ProgrammingError('statement closed') + */ + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_ProgrammingError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[4]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + + /* "oursqlx/statement.pyx":134 + * self.close() + * raise ProgrammingError('connection closed') + * if not self.stmt: # <<<<<<<<<<<<<< + * raise ProgrammingError('statement closed') + * + */ + __pyx_t_1 = ((!(__pyx_v_self->stmt != 0)) != 0); + if (__pyx_t_1) { + + /* "oursqlx/statement.pyx":135 + * raise ProgrammingError('connection closed') + * if not self.stmt: + * raise ProgrammingError('statement closed') # <<<<<<<<<<<<<< + * + * property string_limit: + */ + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_ProgrammingError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[4]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + + /* "oursqlx/statement.pyx":129 + * raise _exception_from_errno(err)(mysql_stmt_error(self.stmt), err) + * + * cdef int _check_closed(self) except -1: # <<<<<<<<<<<<<< + * if not self.conn.conn: + * if self.stmt: + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("oursql._Statement._check_closed", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/statement.pyx":138 + * + * property string_limit: + * def __get__(self): # <<<<<<<<<<<<<< + * return self.string_limit + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_10_Statement_12string_limit_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6oursql_10_Statement_12string_limit_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_10_Statement_12string_limit___get__(((struct __pyx_obj_6oursql__Statement *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_10_Statement_12string_limit___get__(struct __pyx_obj_6oursql__Statement *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "oursqlx/statement.pyx":139 + * property string_limit: + * def __get__(self): + * return self.string_limit # <<<<<<<<<<<<<< + * + * def __set__(self, unsigned long value): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_From_unsigned_long(__pyx_v_self->string_limit); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "oursqlx/statement.pyx":138 + * + * property string_limit: + * def __get__(self): # <<<<<<<<<<<<<< + * return self.string_limit + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("oursql._Statement.string_limit.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/statement.pyx":141 + * return self.string_limit + * + * def __set__(self, unsigned long value): # <<<<<<<<<<<<<< + * if value < 0: + * raise ValueError('string limit must be >= 0') + */ + +/* Python wrapper */ +static int __pyx_pw_6oursql_10_Statement_12string_limit_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_value); /*proto*/ +static int __pyx_pw_6oursql_10_Statement_12string_limit_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_value) { + unsigned long __pyx_v_value; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + assert(__pyx_arg_value); { + __pyx_v_value = __Pyx_PyInt_As_unsigned_long(__pyx_arg_value); if (unlikely((__pyx_v_value == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("oursql._Statement.string_limit.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6oursql_10_Statement_12string_limit_2__set__(((struct __pyx_obj_6oursql__Statement *)__pyx_v_self), ((unsigned long)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6oursql_10_Statement_12string_limit_2__set__(struct __pyx_obj_6oursql__Statement *__pyx_v_self, unsigned long __pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + + /* "oursqlx/statement.pyx":142 + * + * def __set__(self, unsigned long value): + * if value < 0: # <<<<<<<<<<<<<< + * raise ValueError('string limit must be >= 0') + * self.string_limit = value + */ + __pyx_t_1 = ((__pyx_v_value < 0) != 0); + if (__pyx_t_1) { + + /* "oursqlx/statement.pyx":143 + * def __set__(self, unsigned long value): + * if value < 0: + * raise ValueError('string limit must be >= 0') # <<<<<<<<<<<<<< + * self.string_limit = value + * + */ + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[4]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + + /* "oursqlx/statement.pyx":144 + * if value < 0: + * raise ValueError('string limit must be >= 0') + * self.string_limit = value # <<<<<<<<<<<<<< + * + * def prepare(self, statement): + */ + __pyx_v_self->string_limit = __pyx_v_value; + + /* "oursqlx/statement.pyx":141 + * return self.string_limit + * + * def __set__(self, unsigned long value): # <<<<<<<<<<<<<< + * if value < 0: + * raise ValueError('string limit must be >= 0') + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("oursql._Statement.string_limit.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/statement.pyx":146 + * self.string_limit = value + * + * def prepare(self, statement): # <<<<<<<<<<<<<< + * cdef char *buf + * cdef Py_ssize_t bufsize + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_10_Statement_7prepare(PyObject *__pyx_v_self, PyObject *__pyx_v_statement); /*proto*/ +static PyObject *__pyx_pw_6oursql_10_Statement_7prepare(PyObject *__pyx_v_self, PyObject *__pyx_v_statement) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("prepare (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_10_Statement_6prepare(((struct __pyx_obj_6oursql__Statement *)__pyx_v_self), ((PyObject *)__pyx_v_statement)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_10_Statement_6prepare(struct __pyx_obj_6oursql__Statement *__pyx_v_self, PyObject *__pyx_v_statement) { + char *__pyx_v_buf; + Py_ssize_t __pyx_v_bufsize; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("prepare", 0); + __Pyx_INCREF(__pyx_v_statement); + + /* "oursqlx/statement.pyx":149 + * cdef char *buf + * cdef Py_ssize_t bufsize + * self._check_closed() # <<<<<<<<<<<<<< + * if self.data_waiting: + * raise ProgrammingError('binding this query would cause rows to ' + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_6oursql__Statement *)__pyx_v_self->__pyx_vtab)->_check_closed(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "oursqlx/statement.pyx":150 + * cdef Py_ssize_t bufsize + * self._check_closed() + * if self.data_waiting: # <<<<<<<<<<<<<< + * raise ProgrammingError('binding this query would cause rows to ' + * 'become unfetchable') + */ + __pyx_t_2 = (__pyx_v_self->data_waiting != 0); + if (__pyx_t_2) { + + /* "oursqlx/statement.pyx":151 + * self._check_closed() + * if self.data_waiting: + * raise ProgrammingError('binding this query would cause rows to ' # <<<<<<<<<<<<<< + * 'become unfetchable') + * if PyUnicode_Check(statement): + */ + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_ProgrammingError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[4]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + + /* "oursqlx/statement.pyx":153 + * raise ProgrammingError('binding this query would cause rows to ' + * 'become unfetchable') + * if PyUnicode_Check(statement): # <<<<<<<<<<<<<< + * statement = statement.encode(self.conn.charset) + * PyString_AsStringAndSize(statement, &buf, &bufsize) + */ + __pyx_t_2 = (PyUnicode_Check(__pyx_v_statement) != 0); + if (__pyx_t_2) { + + /* "oursqlx/statement.pyx":154 + * 'become unfetchable') + * if PyUnicode_Check(statement): + * statement = statement.encode(self.conn.charset) # <<<<<<<<<<<<<< + * PyString_AsStringAndSize(statement, &buf, &bufsize) + * if mysql_stmt_prepare(self.stmt, buf, bufsize): + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_statement, __pyx_n_s_encode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->conn), __pyx_n_s_charset); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (!__pyx_t_6) { + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_4); + } else { + __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL; + PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF_SET(__pyx_v_statement, __pyx_t_4); + __pyx_t_4 = 0; + goto __pyx_L4; + } + __pyx_L4:; + + /* "oursqlx/statement.pyx":155 + * if PyUnicode_Check(statement): + * statement = statement.encode(self.conn.charset) + * PyString_AsStringAndSize(statement, &buf, &bufsize) # <<<<<<<<<<<<<< + * if mysql_stmt_prepare(self.stmt, buf, bufsize): + * self._raise_error() + */ + __pyx_t_1 = PyString_AsStringAndSize(__pyx_v_statement, (&__pyx_v_buf), (&__pyx_v_bufsize)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "oursqlx/statement.pyx":156 + * statement = statement.encode(self.conn.charset) + * PyString_AsStringAndSize(statement, &buf, &bufsize) + * if mysql_stmt_prepare(self.stmt, buf, bufsize): # <<<<<<<<<<<<<< + * self._raise_error() + * self._alloc_buffer() + */ + __pyx_t_2 = (__pyx_f_6oursql_mysql_stmt_prepare(__pyx_v_self->stmt, __pyx_v_buf, __pyx_v_bufsize) != 0); + if (__pyx_t_2) { + + /* "oursqlx/statement.pyx":157 + * PyString_AsStringAndSize(statement, &buf, &bufsize) + * if mysql_stmt_prepare(self.stmt, buf, bufsize): + * self._raise_error() # <<<<<<<<<<<<<< + * self._alloc_buffer() + * + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_6oursql__Statement *)__pyx_v_self->__pyx_vtab)->_raise_error(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "oursqlx/statement.pyx":158 + * if mysql_stmt_prepare(self.stmt, buf, bufsize): + * self._raise_error() + * self._alloc_buffer() # <<<<<<<<<<<<<< + * + * cdef int _alloc_buffer(self) except -1: + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_6oursql__Statement *)__pyx_v_self->__pyx_vtab)->_alloc_buffer(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "oursqlx/statement.pyx":146 + * self.string_limit = value + * + * def prepare(self, statement): # <<<<<<<<<<<<<< + * cdef char *buf + * cdef Py_ssize_t bufsize + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("oursql._Statement.prepare", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_statement); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/statement.pyx":160 + * self._alloc_buffer() + * + * cdef int _alloc_buffer(self) except -1: # <<<<<<<<<<<<<< + * cdef MYSQL_RES *res + * cdef MYSQL_BIND *bind = NULL + */ + +static int __pyx_f_6oursql_10_Statement__alloc_buffer(struct __pyx_obj_6oursql__Statement *__pyx_v_self) { + MYSQL_RES *__pyx_v_res; + MYSQL_BIND *__pyx_v_bind; + struct __pyx_t_6oursql_column_output *__pyx_v_result_data; + PyObject *__pyx_v_fields = NULL; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + Py_ssize_t __pyx_t_7; + unsigned int __pyx_t_8; + PyObject *__pyx_t_9 = NULL; + int __pyx_t_10; + int __pyx_t_11; + char const *__pyx_t_12; + PyObject *__pyx_t_13 = NULL; + PyObject *__pyx_t_14 = NULL; + PyObject *__pyx_t_15 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_alloc_buffer", 0); + + /* "oursqlx/statement.pyx":162 + * cdef int _alloc_buffer(self) except -1: + * cdef MYSQL_RES *res + * cdef MYSQL_BIND *bind = NULL # <<<<<<<<<<<<<< + * cdef column_output *result_data = NULL + * res = mysql_stmt_result_metadata(self.stmt) + */ + __pyx_v_bind = NULL; + + /* "oursqlx/statement.pyx":163 + * cdef MYSQL_RES *res + * cdef MYSQL_BIND *bind = NULL + * cdef column_output *result_data = NULL # <<<<<<<<<<<<<< + * res = mysql_stmt_result_metadata(self.stmt) + * + */ + __pyx_v_result_data = NULL; + + /* "oursqlx/statement.pyx":164 + * cdef MYSQL_BIND *bind = NULL + * cdef column_output *result_data = NULL + * res = mysql_stmt_result_metadata(self.stmt) # <<<<<<<<<<<<<< + * + * # Okay so. MySQL doesn't require that we keep around the MYSQL_BIND + */ + __pyx_v_res = mysql_stmt_result_metadata(__pyx_v_self->stmt); + + /* "oursqlx/statement.pyx":175 + * # So! Since we have no reason not to, we free any previously bound + * # buffers. + * PyMem_Free(self.result_data) # <<<<<<<<<<<<<< + * self.result_data = NULL + * # But if we don't need any buffers, we're done anyway. + */ + PyMem_Free(__pyx_v_self->result_data); + + /* "oursqlx/statement.pyx":176 + * # buffers. + * PyMem_Free(self.result_data) + * self.result_data = NULL # <<<<<<<<<<<<<< + * # But if we don't need any buffers, we're done anyway. + * if not res: + */ + __pyx_v_self->result_data = NULL; + + /* "oursqlx/statement.pyx":178 + * self.result_data = NULL + * # But if we don't need any buffers, we're done anyway. + * if not res: # <<<<<<<<<<<<<< + * return 0 + * + */ + __pyx_t_1 = ((!(__pyx_v_res != 0)) != 0); + if (__pyx_t_1) { + + /* "oursqlx/statement.pyx":179 + * # But if we don't need any buffers, we're done anyway. + * if not res: + * return 0 # <<<<<<<<<<<<<< + * + * try: + */ + __pyx_r = 0; + goto __pyx_L0; + } + + /* "oursqlx/statement.pyx":181 + * return 0 + * + * try: # <<<<<<<<<<<<<< + * # Otherwise, we (try to) allocate the result buffers. + * fields = mysql_num_fields(res) + */ + /*try:*/ { + { + __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_4); + /*try:*/ { + + /* "oursqlx/statement.pyx":183 + * try: + * # Otherwise, we (try to) allocate the result buffers. + * fields = mysql_num_fields(res) # <<<<<<<<<<<<<< + * bind = PyMem_Malloc(sizeof(MYSQL_BIND) * fields) + * if not bind: + */ + __pyx_t_5 = __Pyx_PyInt_From_unsigned_int(mysql_num_fields(__pyx_v_res)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_v_fields = __pyx_t_5; + __pyx_t_5 = 0; + + /* "oursqlx/statement.pyx":184 + * # Otherwise, we (try to) allocate the result buffers. + * fields = mysql_num_fields(res) + * bind = PyMem_Malloc(sizeof(MYSQL_BIND) * fields) # <<<<<<<<<<<<<< + * if not bind: + * raise MemoryError('alloc of result bind structure failed') + */ + __pyx_t_5 = __Pyx_PyInt_FromSize_t((sizeof(MYSQL_BIND))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyNumber_Multiply(__pyx_t_5, __pyx_v_fields); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_t_6); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_v_bind = ((MYSQL_BIND *)PyMem_Malloc(__pyx_t_7)); + + /* "oursqlx/statement.pyx":185 + * fields = mysql_num_fields(res) + * bind = PyMem_Malloc(sizeof(MYSQL_BIND) * fields) + * if not bind: # <<<<<<<<<<<<<< + * raise MemoryError('alloc of result bind structure failed') + * memset(bind, 0, sizeof(MYSQL_BIND) * fields) + */ + __pyx_t_1 = ((!(__pyx_v_bind != 0)) != 0); + if (__pyx_t_1) { + + /* "oursqlx/statement.pyx":186 + * bind = PyMem_Malloc(sizeof(MYSQL_BIND) * fields) + * if not bind: + * raise MemoryError('alloc of result bind structure failed') # <<<<<<<<<<<<<< + * memset(bind, 0, sizeof(MYSQL_BIND) * fields) + * result_data = PyMem_Malloc( + */ + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_Raise(__pyx_t_6, 0, 0, 0); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + {__pyx_filename = __pyx_f[4]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + } + + /* "oursqlx/statement.pyx":187 + * if not bind: + * raise MemoryError('alloc of result bind structure failed') + * memset(bind, 0, sizeof(MYSQL_BIND) * fields) # <<<<<<<<<<<<<< + * result_data = PyMem_Malloc( + * sizeof(column_output) * fields) + */ + __pyx_t_6 = __Pyx_PyInt_FromSize_t((sizeof(MYSQL_BIND))); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = PyNumber_Multiply(__pyx_t_6, __pyx_v_fields); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + memset(__pyx_v_bind, 0, __pyx_t_7); + + /* "oursqlx/statement.pyx":189 + * memset(bind, 0, sizeof(MYSQL_BIND) * fields) + * result_data = PyMem_Malloc( + * sizeof(column_output) * fields) # <<<<<<<<<<<<<< + * if not result_data: + * raise MemoryError('alloc of result buffers failed') + */ + __pyx_t_5 = __Pyx_PyInt_FromSize_t((sizeof(struct __pyx_t_6oursql_column_output))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyNumber_Multiply(__pyx_t_5, __pyx_v_fields); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_t_6); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "oursqlx/statement.pyx":188 + * raise MemoryError('alloc of result bind structure failed') + * memset(bind, 0, sizeof(MYSQL_BIND) * fields) + * result_data = PyMem_Malloc( # <<<<<<<<<<<<<< + * sizeof(column_output) * fields) + * if not result_data: + */ + __pyx_v_result_data = ((struct __pyx_t_6oursql_column_output *)PyMem_Malloc(__pyx_t_7)); + + /* "oursqlx/statement.pyx":190 + * result_data = PyMem_Malloc( + * sizeof(column_output) * fields) + * if not result_data: # <<<<<<<<<<<<<< + * raise MemoryError('alloc of result buffers failed') + * memset(result_data, 0, sizeof(column_output) * fields) + */ + __pyx_t_1 = ((!(__pyx_v_result_data != 0)) != 0); + if (__pyx_t_1) { + + /* "oursqlx/statement.pyx":191 + * sizeof(column_output) * fields) + * if not result_data: + * raise MemoryError('alloc of result buffers failed') # <<<<<<<<<<<<<< + * memset(result_data, 0, sizeof(column_output) * fields) + * except: + */ + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_Raise(__pyx_t_6, 0, 0, 0); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + {__pyx_filename = __pyx_f[4]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + } + + /* "oursqlx/statement.pyx":192 + * if not result_data: + * raise MemoryError('alloc of result buffers failed') + * memset(result_data, 0, sizeof(column_output) * fields) # <<<<<<<<<<<<<< + * except: + * # We only want to free the buffers if there was a failure and we + */ + __pyx_t_6 = __Pyx_PyInt_FromSize_t((sizeof(struct __pyx_t_6oursql_column_output))); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = PyNumber_Multiply(__pyx_t_6, __pyx_v_fields); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + memset(__pyx_v_result_data, 0, __pyx_t_7); + } + /*else:*/ { + + /* "oursqlx/statement.pyx":201 + * else: + * # And we only want to save the buffers if there was no failure. + * self.bind = bind # <<<<<<<<<<<<<< + * self.result_data = result_data + * self.result_fields = fields + */ + __pyx_v_self->bind = __pyx_v_bind; + + /* "oursqlx/statement.pyx":202 + * # And we only want to save the buffers if there was no failure. + * self.bind = bind + * self.result_data = result_data # <<<<<<<<<<<<<< + * self.result_fields = fields + * finally: + */ + __pyx_v_self->result_data = __pyx_v_result_data; + + /* "oursqlx/statement.pyx":203 + * self.bind = bind + * self.result_data = result_data + * self.result_fields = fields # <<<<<<<<<<<<<< + * finally: + * # But in any case, we don't need the result. + */ + __pyx_t_8 = __Pyx_PyInt_As_unsigned_int(__pyx_v_fields); if (unlikely((__pyx_t_8 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + __pyx_v_self->result_fields = __pyx_t_8; + } + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + goto __pyx_L14_try_end; + __pyx_L7_error:; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "oursqlx/statement.pyx":193 + * raise MemoryError('alloc of result buffers failed') + * memset(result_data, 0, sizeof(column_output) * fields) + * except: # <<<<<<<<<<<<<< + * # We only want to free the buffers if there was a failure and we + * # can't use 'em. + */ + /*except:*/ { + __Pyx_AddTraceback("oursql._Statement._alloc_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_9) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GOTREF(__pyx_t_9); + + /* "oursqlx/statement.pyx":196 + * # We only want to free the buffers if there was a failure and we + * # can't use 'em. + * PyMem_Free(result_data) # <<<<<<<<<<<<<< + * PyMem_Free(bind) + * raise + */ + PyMem_Free(__pyx_v_result_data); + + /* "oursqlx/statement.pyx":197 + * # can't use 'em. + * PyMem_Free(result_data) + * PyMem_Free(bind) # <<<<<<<<<<<<<< + * raise + * else: + */ + PyMem_Free(__pyx_v_bind); + + /* "oursqlx/statement.pyx":198 + * PyMem_Free(result_data) + * PyMem_Free(bind) + * raise # <<<<<<<<<<<<<< + * else: + * # And we only want to save the buffers if there was no failure. + */ + __Pyx_GIVEREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_6); + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_ErrRestore(__pyx_t_5, __pyx_t_6, __pyx_t_9); + __pyx_t_5 = 0; __pyx_t_6 = 0; __pyx_t_9 = 0; + {__pyx_filename = __pyx_f[4]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + } + __pyx_L9_except_error:; + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); + goto __pyx_L5_error; + __pyx_L14_try_end:; + } + } + + /* "oursqlx/statement.pyx":206 + * finally: + * # But in any case, we don't need the result. + * mysql_free_result(res) # <<<<<<<<<<<<<< + * + * cdef int _bind_buffer(self) except -1: + */ + /*finally:*/ { + /*normal exit:*/{ + mysql_free_result(__pyx_v_res); + goto __pyx_L6; + } + /*exception exit:*/{ + __pyx_L5_error:; + __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15); + if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2) < 0)) __Pyx_ErrFetch(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_4); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_13); + __Pyx_XGOTREF(__pyx_t_14); + __Pyx_XGOTREF(__pyx_t_15); + __pyx_t_10 = __pyx_lineno; __pyx_t_11 = __pyx_clineno; __pyx_t_12 = __pyx_filename; + { + mysql_free_result(__pyx_v_res); + } + if (PY_MAJOR_VERSION >= 3) { + __Pyx_XGIVEREF(__pyx_t_13); + __Pyx_XGIVEREF(__pyx_t_14); + __Pyx_XGIVEREF(__pyx_t_15); + __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15); + } + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_ErrRestore(__pyx_t_4, __pyx_t_3, __pyx_t_2); + __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; + __pyx_lineno = __pyx_t_10; __pyx_clineno = __pyx_t_11; __pyx_filename = __pyx_t_12; + goto __pyx_L1_error; + } + __pyx_L6:; + } + + /* "oursqlx/statement.pyx":160 + * self._alloc_buffer() + * + * cdef int _alloc_buffer(self) except -1: # <<<<<<<<<<<<<< + * cdef MYSQL_RES *res + * cdef MYSQL_BIND *bind = NULL + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("oursql._Statement._alloc_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_fields); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/statement.pyx":208 + * mysql_free_result(res) + * + * cdef int _bind_buffer(self) except -1: # <<<<<<<<<<<<<< + * cdef MYSQL_RES *res + * cdef MYSQL_FIELD *field + */ + +static int __pyx_f_6oursql_10_Statement__bind_buffer(struct __pyx_obj_6oursql__Statement *__pyx_v_self) { + MYSQL_RES *__pyx_v_res; + MYSQL_FIELD *__pyx_v_field; + MYSQL_BIND *__pyx_v_b; + struct __pyx_t_6oursql_column_output *__pyx_v_c; + unsigned int __pyx_v_fields; + unsigned int __pyx_v_i; + int __pyx_r; + __Pyx_RefNannyDeclarations + unsigned int __pyx_t_1; + MYSQL_BIND *__pyx_t_2; + struct __pyx_t_6oursql_column_output *__pyx_t_3; + int __pyx_t_4; + enum enum_field_types __pyx_t_5; + unsigned int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + char const *__pyx_t_9; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + PyObject *__pyx_t_13 = NULL; + PyObject *__pyx_t_14 = NULL; + PyObject *__pyx_t_15 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_bind_buffer", 0); + + /* "oursqlx/statement.pyx":214 + * cdef column_output *c + * cdef unsigned int fields, i + * res = mysql_stmt_result_metadata(self.stmt) # <<<<<<<<<<<<<< + * + * try: + */ + __pyx_v_res = mysql_stmt_result_metadata(__pyx_v_self->stmt); + + /* "oursqlx/statement.pyx":216 + * res = mysql_stmt_result_metadata(self.stmt) + * + * try: # <<<<<<<<<<<<<< + * # And now we (try to) set up the result buffers. + * fields = mysql_num_fields(res) + */ + /*try:*/ { + + /* "oursqlx/statement.pyx":218 + * try: + * # And now we (try to) set up the result buffers. + * fields = mysql_num_fields(res) # <<<<<<<<<<<<<< + * for 0 <= i < fields: + * b, c = &self.bind[i], &self.result_data[i] + */ + __pyx_v_fields = mysql_num_fields(__pyx_v_res); + + /* "oursqlx/statement.pyx":219 + * # And now we (try to) set up the result buffers. + * fields = mysql_num_fields(res) + * for 0 <= i < fields: # <<<<<<<<<<<<<< + * b, c = &self.bind[i], &self.result_data[i] + * field = mysql_fetch_field_direct(res, i) + */ + __pyx_t_1 = __pyx_v_fields; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) { + + /* "oursqlx/statement.pyx":220 + * fields = mysql_num_fields(res) + * for 0 <= i < fields: + * b, c = &self.bind[i], &self.result_data[i] # <<<<<<<<<<<<<< + * field = mysql_fetch_field_direct(res, i) + * if field.type == MYSQL_TYPE_GEOMETRY: + */ + __pyx_t_2 = (&(__pyx_v_self->bind[__pyx_v_i])); + __pyx_t_3 = (&(__pyx_v_self->result_data[__pyx_v_i])); + __pyx_v_b = __pyx_t_2; + __pyx_v_c = __pyx_t_3; + + /* "oursqlx/statement.pyx":221 + * for 0 <= i < fields: + * b, c = &self.bind[i], &self.result_data[i] + * field = mysql_fetch_field_direct(res, i) # <<<<<<<<<<<<<< + * if field.type == MYSQL_TYPE_GEOMETRY: + * c.type = b.buffer_type = MYSQL_TYPE_STRING + */ + __pyx_v_field = mysql_fetch_field_direct(__pyx_v_res, __pyx_v_i); + + /* "oursqlx/statement.pyx":222 + * b, c = &self.bind[i], &self.result_data[i] + * field = mysql_fetch_field_direct(res, i) + * if field.type == MYSQL_TYPE_GEOMETRY: # <<<<<<<<<<<<<< + * c.type = b.buffer_type = MYSQL_TYPE_STRING + * else: + */ + __pyx_t_4 = ((__pyx_v_field->type == MYSQL_TYPE_GEOMETRY) != 0); + if (__pyx_t_4) { + + /* "oursqlx/statement.pyx":223 + * field = mysql_fetch_field_direct(res, i) + * if field.type == MYSQL_TYPE_GEOMETRY: + * c.type = b.buffer_type = MYSQL_TYPE_STRING # <<<<<<<<<<<<<< + * else: + * c.type = b.buffer_type = field.type + */ + __pyx_v_c->type = MYSQL_TYPE_STRING; + __pyx_v_b->buffer_type = MYSQL_TYPE_STRING; + goto __pyx_L8; + } + /*else*/ { + + /* "oursqlx/statement.pyx":225 + * c.type = b.buffer_type = MYSQL_TYPE_STRING + * else: + * c.type = b.buffer_type = field.type # <<<<<<<<<<<<<< + * c.flags = field.flags + * c.is_binary = (field.charsetnr == CS_BINARY) + */ + __pyx_t_5 = __pyx_v_field->type; + __pyx_v_c->type = __pyx_t_5; + __pyx_v_b->buffer_type = __pyx_t_5; + } + __pyx_L8:; + + /* "oursqlx/statement.pyx":226 + * else: + * c.type = b.buffer_type = field.type + * c.flags = field.flags # <<<<<<<<<<<<<< + * c.is_binary = (field.charsetnr == CS_BINARY) + * b.buffer_length = sizeof(column_data) + */ + __pyx_t_6 = __pyx_v_field->flags; + __pyx_v_c->flags = __pyx_t_6; + + /* "oursqlx/statement.pyx":227 + * c.type = b.buffer_type = field.type + * c.flags = field.flags + * c.is_binary = (field.charsetnr == CS_BINARY) # <<<<<<<<<<<<<< + * b.buffer_length = sizeof(column_data) + * b.buffer = &c.buf + */ + __pyx_v_c->is_binary = (__pyx_v_field->charsetnr == 63); + + /* "oursqlx/statement.pyx":228 + * c.flags = field.flags + * c.is_binary = (field.charsetnr == CS_BINARY) + * b.buffer_length = sizeof(column_data) # <<<<<<<<<<<<<< + * b.buffer = &c.buf + * b.length = &c.length + */ + __pyx_v_b->buffer_length = (sizeof(union __pyx_t_6oursql_column_data)); + + /* "oursqlx/statement.pyx":229 + * c.is_binary = (field.charsetnr == CS_BINARY) + * b.buffer_length = sizeof(column_data) + * b.buffer = &c.buf # <<<<<<<<<<<<<< + * b.length = &c.length + * b.is_null = &c.is_null + */ + __pyx_v_b->buffer = (&__pyx_v_c->buf); + + /* "oursqlx/statement.pyx":230 + * b.buffer_length = sizeof(column_data) + * b.buffer = &c.buf + * b.length = &c.length # <<<<<<<<<<<<<< + * b.is_null = &c.is_null + * b.error = &c.error + */ + __pyx_v_b->length = (&__pyx_v_c->length); + + /* "oursqlx/statement.pyx":231 + * b.buffer = &c.buf + * b.length = &c.length + * b.is_null = &c.is_null # <<<<<<<<<<<<<< + * b.error = &c.error + * if field.flags & UNSIGNED_NUM_FLAG == UNSIGNED_NUM_FLAG: + */ + __pyx_v_b->is_null = (&__pyx_v_c->is_null); + + /* "oursqlx/statement.pyx":232 + * b.length = &c.length + * b.is_null = &c.is_null + * b.error = &c.error # <<<<<<<<<<<<<< + * if field.flags & UNSIGNED_NUM_FLAG == UNSIGNED_NUM_FLAG: + * b.is_unsigned = True + */ + __pyx_v_b->error = (&__pyx_v_c->error); + + /* "oursqlx/statement.pyx":233 + * b.is_null = &c.is_null + * b.error = &c.error + * if field.flags & UNSIGNED_NUM_FLAG == UNSIGNED_NUM_FLAG: # <<<<<<<<<<<<<< + * b.is_unsigned = True + * if mysql_stmt_bind_result(self.stmt, self.bind): + */ + __pyx_t_4 = (((__pyx_v_field->flags & __pyx_v_6oursql_UNSIGNED_NUM_FLAG) == __pyx_v_6oursql_UNSIGNED_NUM_FLAG) != 0); + if (__pyx_t_4) { + + /* "oursqlx/statement.pyx":234 + * b.error = &c.error + * if field.flags & UNSIGNED_NUM_FLAG == UNSIGNED_NUM_FLAG: + * b.is_unsigned = True # <<<<<<<<<<<<<< + * if mysql_stmt_bind_result(self.stmt, self.bind): + * self._raise_error() + */ + __pyx_v_b->is_unsigned = 1; + goto __pyx_L9; + } + __pyx_L9:; + } + + /* "oursqlx/statement.pyx":235 + * if field.flags & UNSIGNED_NUM_FLAG == UNSIGNED_NUM_FLAG: + * b.is_unsigned = True + * if mysql_stmt_bind_result(self.stmt, self.bind): # <<<<<<<<<<<<<< + * self._raise_error() + * finally: + */ + __pyx_t_4 = (mysql_stmt_bind_result(__pyx_v_self->stmt, __pyx_v_self->bind) != 0); + if (__pyx_t_4) { + + /* "oursqlx/statement.pyx":236 + * b.is_unsigned = True + * if mysql_stmt_bind_result(self.stmt, self.bind): + * self._raise_error() # <<<<<<<<<<<<<< + * finally: + * # And clean up the result data. + */ + __pyx_t_7 = ((struct __pyx_vtabstruct_6oursql__Statement *)__pyx_v_self->__pyx_vtab)->_raise_error(__pyx_v_self); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L4_error;} + goto __pyx_L10; + } + __pyx_L10:; + } + + /* "oursqlx/statement.pyx":239 + * finally: + * # And clean up the result data. + * mysql_free_result(res) # <<<<<<<<<<<<<< + * + * property has_result: + */ + /*finally:*/ { + /*normal exit:*/{ + mysql_free_result(__pyx_v_res); + goto __pyx_L5; + } + /*exception exit:*/{ + __pyx_L4_error:; + __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; + if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15); + if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12) < 0)) __Pyx_ErrFetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12); + __Pyx_XGOTREF(__pyx_t_10); + __Pyx_XGOTREF(__pyx_t_11); + __Pyx_XGOTREF(__pyx_t_12); + __Pyx_XGOTREF(__pyx_t_13); + __Pyx_XGOTREF(__pyx_t_14); + __Pyx_XGOTREF(__pyx_t_15); + __pyx_t_7 = __pyx_lineno; __pyx_t_8 = __pyx_clineno; __pyx_t_9 = __pyx_filename; + { + mysql_free_result(__pyx_v_res); + } + if (PY_MAJOR_VERSION >= 3) { + __Pyx_XGIVEREF(__pyx_t_13); + __Pyx_XGIVEREF(__pyx_t_14); + __Pyx_XGIVEREF(__pyx_t_15); + __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15); + } + __Pyx_XGIVEREF(__pyx_t_10); + __Pyx_XGIVEREF(__pyx_t_11); + __Pyx_XGIVEREF(__pyx_t_12); + __Pyx_ErrRestore(__pyx_t_10, __pyx_t_11, __pyx_t_12); + __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; + __pyx_lineno = __pyx_t_7; __pyx_clineno = __pyx_t_8; __pyx_filename = __pyx_t_9; + goto __pyx_L1_error; + } + __pyx_L5:; + } + + /* "oursqlx/statement.pyx":208 + * mysql_free_result(res) + * + * cdef int _bind_buffer(self) except -1: # <<<<<<<<<<<<<< + * cdef MYSQL_RES *res + * cdef MYSQL_FIELD *field + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("oursql._Statement._bind_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/statement.pyx":242 + * + * property has_result: + * def __get__(self): # <<<<<<<<<<<<<< + * self._check_closed() + * return self.result_data != NULL + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_10_Statement_10has_result_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6oursql_10_Statement_10has_result_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_10_Statement_10has_result___get__(((struct __pyx_obj_6oursql__Statement *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_10_Statement_10has_result___get__(struct __pyx_obj_6oursql__Statement *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "oursqlx/statement.pyx":243 + * property has_result: + * def __get__(self): + * self._check_closed() # <<<<<<<<<<<<<< + * return self.result_data != NULL + * + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_6oursql__Statement *)__pyx_v_self->__pyx_vtab)->_check_closed(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "oursqlx/statement.pyx":244 + * def __get__(self): + * self._check_closed() + * return self.result_data != NULL # <<<<<<<<<<<<<< + * + * property description: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyBool_FromLong((__pyx_v_self->result_data != NULL)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "oursqlx/statement.pyx":242 + * + * property has_result: + * def __get__(self): # <<<<<<<<<<<<<< + * self._check_closed() + * return self.result_data != NULL + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("oursql._Statement.has_result.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/statement.pyx":247 + * + * property description: + * def __get__(self): # <<<<<<<<<<<<<< + * cdef MYSQL_RES *res + * self._check_closed() + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_10_Statement_11description_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6oursql_10_Statement_11description_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_10_Statement_11description___get__(((struct __pyx_obj_6oursql__Statement *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_10_Statement_11description___get__(struct __pyx_obj_6oursql__Statement *__pyx_v_self) { + MYSQL_RES *__pyx_v_res; + PyObject *__pyx_v_ret = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + char const *__pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "oursqlx/statement.pyx":249 + * def __get__(self): + * cdef MYSQL_RES *res + * self._check_closed() # <<<<<<<<<<<<<< + * if not self.result_data: + * return None + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_6oursql__Statement *)__pyx_v_self->__pyx_vtab)->_check_closed(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "oursqlx/statement.pyx":250 + * cdef MYSQL_RES *res + * self._check_closed() + * if not self.result_data: # <<<<<<<<<<<<<< + * return None + * res = mysql_stmt_result_metadata(self.stmt) + */ + __pyx_t_2 = ((!(__pyx_v_self->result_data != 0)) != 0); + if (__pyx_t_2) { + + /* "oursqlx/statement.pyx":251 + * self._check_closed() + * if not self.result_data: + * return None # <<<<<<<<<<<<<< + * res = mysql_stmt_result_metadata(self.stmt) + * if not res: + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + } + + /* "oursqlx/statement.pyx":252 + * if not self.result_data: + * return None + * res = mysql_stmt_result_metadata(self.stmt) # <<<<<<<<<<<<<< + * if not res: + * self.result_data = NULL + */ + __pyx_v_res = mysql_stmt_result_metadata(__pyx_v_self->stmt); + + /* "oursqlx/statement.pyx":253 + * return None + * res = mysql_stmt_result_metadata(self.stmt) + * if not res: # <<<<<<<<<<<<<< + * self.result_data = NULL + * return + */ + __pyx_t_2 = ((!(__pyx_v_res != 0)) != 0); + if (__pyx_t_2) { + + /* "oursqlx/statement.pyx":254 + * res = mysql_stmt_result_metadata(self.stmt) + * if not res: + * self.result_data = NULL # <<<<<<<<<<<<<< + * return + * try: + */ + __pyx_v_self->result_data = NULL; + + /* "oursqlx/statement.pyx":255 + * if not res: + * self.result_data = NULL + * return # <<<<<<<<<<<<<< + * try: + * ret = description_from_res( + */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + } + + /* "oursqlx/statement.pyx":256 + * self.result_data = NULL + * return + * try: # <<<<<<<<<<<<<< + * ret = description_from_res( + * res, self.result_fields, self.show_table) + */ + /*try:*/ { + + /* "oursqlx/statement.pyx":257 + * return + * try: + * ret = description_from_res( # <<<<<<<<<<<<<< + * res, self.result_fields, self.show_table) + * finally: + */ + __pyx_t_3 = __pyx_f_6oursql_description_from_res(__pyx_v_res, __pyx_v_self->result_fields, __pyx_v_self->show_table); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_v_ret = __pyx_t_3; + __pyx_t_3 = 0; + } + + /* "oursqlx/statement.pyx":260 + * res, self.result_fields, self.show_table) + * finally: + * mysql_free_result(res) # <<<<<<<<<<<<<< + * return ret + * + */ + /*finally:*/ { + /*normal exit:*/{ + mysql_free_result(__pyx_v_res); + goto __pyx_L7; + } + /*exception exit:*/{ + __pyx_L6_error:; + __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11); + if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8) < 0)) __Pyx_ErrFetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_9); + __Pyx_XGOTREF(__pyx_t_10); + __Pyx_XGOTREF(__pyx_t_11); + __pyx_t_1 = __pyx_lineno; __pyx_t_4 = __pyx_clineno; __pyx_t_5 = __pyx_filename; + { + mysql_free_result(__pyx_v_res); + } + if (PY_MAJOR_VERSION >= 3) { + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_XGIVEREF(__pyx_t_10); + __Pyx_XGIVEREF(__pyx_t_11); + __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11); + } + __Pyx_XGIVEREF(__pyx_t_6); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_ErrRestore(__pyx_t_6, __pyx_t_7, __pyx_t_8); + __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; + __pyx_lineno = __pyx_t_1; __pyx_clineno = __pyx_t_4; __pyx_filename = __pyx_t_5; + goto __pyx_L1_error; + } + __pyx_L7:; + } + + /* "oursqlx/statement.pyx":261 + * finally: + * mysql_free_result(res) + * return ret # <<<<<<<<<<<<<< + * + * property column_names: + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_ret); + __pyx_r = __pyx_v_ret; + goto __pyx_L0; + + /* "oursqlx/statement.pyx":247 + * + * property description: + * def __get__(self): # <<<<<<<<<<<<<< + * cdef MYSQL_RES *res + * self._check_closed() + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("oursql._Statement.description.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_ret); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/statement.pyx":264 + * + * property column_names: + * def __get__(self): # <<<<<<<<<<<<<< + * desc = self.description + * if desc is None: + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_10_Statement_12column_names_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6oursql_10_Statement_12column_names_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_10_Statement_12column_names___get__(((struct __pyx_obj_6oursql__Statement *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_10_Statement_12column_names___get__(struct __pyx_obj_6oursql__Statement *__pyx_v_self) { + PyObject *__pyx_v_desc = NULL; + PyObject *__pyx_v_x = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + Py_ssize_t __pyx_t_5; + PyObject *(*__pyx_t_6)(PyObject *); + PyObject *__pyx_t_7 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "oursqlx/statement.pyx":265 + * property column_names: + * def __get__(self): + * desc = self.description # <<<<<<<<<<<<<< + * if desc is None: + * return None + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_description); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_desc = __pyx_t_1; + __pyx_t_1 = 0; + + /* "oursqlx/statement.pyx":266 + * def __get__(self): + * desc = self.description + * if desc is None: # <<<<<<<<<<<<<< + * return None + * return [x[0] for x in desc] + */ + __pyx_t_2 = (__pyx_v_desc == Py_None); + __pyx_t_3 = (__pyx_t_2 != 0); + if (__pyx_t_3) { + + /* "oursqlx/statement.pyx":267 + * desc = self.description + * if desc is None: + * return None # <<<<<<<<<<<<<< + * return [x[0] for x in desc] + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + } + + /* "oursqlx/statement.pyx":268 + * if desc is None: + * return None + * return [x[0] for x in desc] # <<<<<<<<<<<<<< + * + * def execute(self, *parameters): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (likely(PyList_CheckExact(__pyx_v_desc)) || PyTuple_CheckExact(__pyx_v_desc)) { + __pyx_t_4 = __pyx_v_desc; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0; + __pyx_t_6 = NULL; + } else { + __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_desc); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + for (;;) { + if (likely(!__pyx_t_6)) { + if (likely(PyList_CheckExact(__pyx_t_4))) { + if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } + } else { + __pyx_t_7 = __pyx_t_6(__pyx_t_4); + if (unlikely(!__pyx_t_7)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[4]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_7); + } + __Pyx_XDECREF_SET(__pyx_v_x, __pyx_t_7); + __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_x, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __Pyx_GOTREF(__pyx_t_7); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_7))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "oursqlx/statement.pyx":264 + * + * property column_names: + * def __get__(self): # <<<<<<<<<<<<<< + * desc = self.description + * if desc is None: + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("oursql._Statement.column_names.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_desc); + __Pyx_XDECREF(__pyx_v_x); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/statement.pyx":270 + * return [x[0] for x in desc] + * + * def execute(self, *parameters): # <<<<<<<<<<<<<< + * cdef char *buf = NULL + * cdef void *long_buffer + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_10_Statement_9execute(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_6oursql_10_Statement_9execute(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_parameters = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("execute (wrapper)", 0); + if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "execute", 0))) return NULL; + __Pyx_INCREF(__pyx_args); + __pyx_v_parameters = __pyx_args; + __pyx_r = __pyx_pf_6oursql_10_Statement_8execute(((struct __pyx_obj_6oursql__Statement *)__pyx_v_self), __pyx_v_parameters); + + /* function exit code */ + __Pyx_XDECREF(__pyx_v_parameters); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_10_Statement_8execute(struct __pyx_obj_6oursql__Statement *__pyx_v_self, PyObject *__pyx_v_parameters) { + char *__pyx_v_buf; + void *__pyx_v_long_buffer; + MYSQL_BIND *__pyx_v_bind; + MYSQL_BIND *__pyx_v_b; + union __pyx_t_6oursql_column_data *__pyx_v_column; + union __pyx_t_6oursql_column_data *__pyx_v_c; + Py_ssize_t __pyx_v_i; + Py_ssize_t __pyx_v_n_params; + Py_ssize_t __pyx_v_stmt_params; + Py_ssize_t __pyx_v_long_buffer_size; + PyObject *__pyx_v_long_strings = NULL; + PyObject *__pyx_v_temp_strings = NULL; + PyObject *__pyx_v_o = NULL; + PyObject *__pyx_v_s = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + Py_ssize_t __pyx_t_8; + MYSQL_BIND *__pyx_t_9; + union __pyx_t_6oursql_column_data *__pyx_t_10; + int __pyx_t_11; + int __pyx_t_12; + Py_ssize_t __pyx_t_13; + unsigned PY_LONG_LONG __pyx_t_14; + PY_LONG_LONG __pyx_t_15; + unsigned int __pyx_t_16; + unsigned long __pyx_t_17; + PyObject *(*__pyx_t_18)(PyObject *); + PyObject *(*__pyx_t_19)(PyObject *); + PyObject *__pyx_t_20 = NULL; + int __pyx_t_21; + char const *__pyx_t_22; + PyObject *__pyx_t_23 = NULL; + PyObject *__pyx_t_24 = NULL; + PyObject *__pyx_t_25 = NULL; + PyObject *__pyx_t_26 = NULL; + PyObject *__pyx_t_27 = NULL; + PyObject *__pyx_t_28 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("execute", 0); + + /* "oursqlx/statement.pyx":271 + * + * def execute(self, *parameters): + * cdef char *buf = NULL # <<<<<<<<<<<<<< + * cdef void *long_buffer + * cdef MYSQL_BIND *bind = NULL, *b + */ + __pyx_v_buf = NULL; + + /* "oursqlx/statement.pyx":273 + * cdef char *buf = NULL + * cdef void *long_buffer + * cdef MYSQL_BIND *bind = NULL, *b # <<<<<<<<<<<<<< + * cdef column_data *column, *c + * cdef Py_ssize_t i, n_params, stmt_params, long_buffer_size + */ + __pyx_v_bind = NULL; + + /* "oursqlx/statement.pyx":276 + * cdef column_data *column, *c + * cdef Py_ssize_t i, n_params, stmt_params, long_buffer_size + * self._check_closed() # <<<<<<<<<<<<<< + * if self.data_waiting: + * raise ProgrammingError('executing this query would cause rows to ' + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_6oursql__Statement *)__pyx_v_self->__pyx_vtab)->_check_closed(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "oursqlx/statement.pyx":277 + * cdef Py_ssize_t i, n_params, stmt_params, long_buffer_size + * self._check_closed() + * if self.data_waiting: # <<<<<<<<<<<<<< + * raise ProgrammingError('executing this query would cause rows to ' + * 'become unfetchable') + */ + __pyx_t_2 = (__pyx_v_self->data_waiting != 0); + if (__pyx_t_2) { + + /* "oursqlx/statement.pyx":278 + * self._check_closed() + * if self.data_waiting: + * raise ProgrammingError('executing this query would cause rows to ' # <<<<<<<<<<<<<< + * 'become unfetchable') + * n_params = PyTuple_GET_SIZE(parameters) + */ + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_ProgrammingError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[4]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + + /* "oursqlx/statement.pyx":280 + * raise ProgrammingError('executing this query would cause rows to ' + * 'become unfetchable') + * n_params = PyTuple_GET_SIZE(parameters) # <<<<<<<<<<<<<< + * stmt_params = mysql_stmt_param_count(self.stmt) + * if stmt_params != n_params: + */ + __pyx_v_n_params = PyTuple_GET_SIZE(__pyx_v_parameters); + + /* "oursqlx/statement.pyx":281 + * 'become unfetchable') + * n_params = PyTuple_GET_SIZE(parameters) + * stmt_params = mysql_stmt_param_count(self.stmt) # <<<<<<<<<<<<<< + * if stmt_params != n_params: + * raise ProgrammingError('%d parameters expected, %d given' % ( + */ + __pyx_v_stmt_params = mysql_stmt_param_count(__pyx_v_self->stmt); + + /* "oursqlx/statement.pyx":282 + * n_params = PyTuple_GET_SIZE(parameters) + * stmt_params = mysql_stmt_param_count(self.stmt) + * if stmt_params != n_params: # <<<<<<<<<<<<<< + * raise ProgrammingError('%d parameters expected, %d given' % ( + * stmt_params, n_params)) + */ + __pyx_t_2 = ((__pyx_v_stmt_params != __pyx_v_n_params) != 0); + if (__pyx_t_2) { + + /* "oursqlx/statement.pyx":283 + * stmt_params = mysql_stmt_param_count(self.stmt) + * if stmt_params != n_params: + * raise ProgrammingError('%d parameters expected, %d given' % ( # <<<<<<<<<<<<<< + * stmt_params, n_params)) + * long_strings = [] + */ + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_ProgrammingError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + + /* "oursqlx/statement.pyx":284 + * if stmt_params != n_params: + * raise ProgrammingError('%d parameters expected, %d given' % ( + * stmt_params, n_params)) # <<<<<<<<<<<<<< + * long_strings = [] + * # So we don't have temporary values cleaned up before they're used. + */ + __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_stmt_params); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_n_params); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + __pyx_t_5 = 0; + __pyx_t_6 = 0; + + /* "oursqlx/statement.pyx":283 + * stmt_params = mysql_stmt_param_count(self.stmt) + * if stmt_params != n_params: + * raise ProgrammingError('%d parameters expected, %d given' % ( # <<<<<<<<<<<<<< + * stmt_params, n_params)) + * long_strings = [] + */ + __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_d_parameters_expected_d_given, __pyx_t_7); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (!__pyx_t_7) { + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_GOTREF(__pyx_t_4); + } else { + __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = NULL; + PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + __pyx_t_6 = 0; + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[4]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + + /* "oursqlx/statement.pyx":285 + * raise ProgrammingError('%d parameters expected, %d given' % ( + * stmt_params, n_params)) + * long_strings = [] # <<<<<<<<<<<<<< + * # So we don't have temporary values cleaned up before they're used. + * temp_strings = [] + */ + __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_v_long_strings = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; + + /* "oursqlx/statement.pyx":287 + * long_strings = [] + * # So we don't have temporary values cleaned up before they're used. + * temp_strings = [] # <<<<<<<<<<<<<< + * try: + * if n_params > 0: + */ + __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_v_temp_strings = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; + + /* "oursqlx/statement.pyx":288 + * # So we don't have temporary values cleaned up before they're used. + * temp_strings = [] + * try: # <<<<<<<<<<<<<< + * if n_params > 0: + * buf = PyMem_Malloc( + */ + /*try:*/ { + + /* "oursqlx/statement.pyx":289 + * temp_strings = [] + * try: + * if n_params > 0: # <<<<<<<<<<<<<< + * buf = PyMem_Malloc( + * (sizeof(MYSQL_BIND) + sizeof(column_data)) * n_params) + */ + __pyx_t_2 = ((__pyx_v_n_params > 0) != 0); + if (__pyx_t_2) { + + /* "oursqlx/statement.pyx":290 + * try: + * if n_params > 0: + * buf = PyMem_Malloc( # <<<<<<<<<<<<<< + * (sizeof(MYSQL_BIND) + sizeof(column_data)) * n_params) + * if not buf: + */ + __pyx_v_buf = ((char *)PyMem_Malloc((((sizeof(MYSQL_BIND)) + (sizeof(union __pyx_t_6oursql_column_data))) * __pyx_v_n_params))); + + /* "oursqlx/statement.pyx":292 + * buf = PyMem_Malloc( + * (sizeof(MYSQL_BIND) + sizeof(column_data)) * n_params) + * if not buf: # <<<<<<<<<<<<<< + * raise MemoryError('alloc of bind parameters failed') + * bind = buf + */ + __pyx_t_2 = ((!(__pyx_v_buf != 0)) != 0); + if (__pyx_t_2) { + + /* "oursqlx/statement.pyx":293 + * (sizeof(MYSQL_BIND) + sizeof(column_data)) * n_params) + * if not buf: + * raise MemoryError('alloc of bind parameters failed') # <<<<<<<<<<<<<< + * bind = buf + * memset(bind, 0, sizeof(MYSQL_BIND) * n_params) + */ + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[4]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + } + + /* "oursqlx/statement.pyx":294 + * if not buf: + * raise MemoryError('alloc of bind parameters failed') + * bind = buf # <<<<<<<<<<<<<< + * memset(bind, 0, sizeof(MYSQL_BIND) * n_params) + * column = (buf + (sizeof(MYSQL_BIND) * n_params)) + */ + __pyx_v_bind = ((MYSQL_BIND *)__pyx_v_buf); + + /* "oursqlx/statement.pyx":295 + * raise MemoryError('alloc of bind parameters failed') + * bind = buf + * memset(bind, 0, sizeof(MYSQL_BIND) * n_params) # <<<<<<<<<<<<<< + * column = (buf + (sizeof(MYSQL_BIND) * n_params)) + * memset(column, 0, sizeof(column_data) * n_params) + */ + memset(__pyx_v_bind, 0, ((sizeof(MYSQL_BIND)) * __pyx_v_n_params)); + + /* "oursqlx/statement.pyx":296 + * bind = buf + * memset(bind, 0, sizeof(MYSQL_BIND) * n_params) + * column = (buf + (sizeof(MYSQL_BIND) * n_params)) # <<<<<<<<<<<<<< + * memset(column, 0, sizeof(column_data) * n_params) + * # Cache the connection charset. + */ + __pyx_v_column = ((union __pyx_t_6oursql_column_data *)(__pyx_v_buf + ((sizeof(MYSQL_BIND)) * __pyx_v_n_params))); + + /* "oursqlx/statement.pyx":297 + * memset(bind, 0, sizeof(MYSQL_BIND) * n_params) + * column = (buf + (sizeof(MYSQL_BIND) * n_params)) + * memset(column, 0, sizeof(column_data) * n_params) # <<<<<<<<<<<<<< + * # Cache the connection charset. + * self.conn.charset + */ + memset(__pyx_v_column, 0, ((sizeof(union __pyx_t_6oursql_column_data)) * __pyx_v_n_params)); + + /* "oursqlx/statement.pyx":299 + * memset(column, 0, sizeof(column_data) * n_params) + * # Cache the connection charset. + * self.conn.charset # <<<<<<<<<<<<<< + * for 0 <= i < n_params: + * o = PyTuple_GET_ITEM(parameters, i) + */ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->conn), __pyx_n_s_charset); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "oursqlx/statement.pyx":300 + * # Cache the connection charset. + * self.conn.charset + * for 0 <= i < n_params: # <<<<<<<<<<<<<< + * o = PyTuple_GET_ITEM(parameters, i) + * Py_INCREF(o) + */ + __pyx_t_8 = __pyx_v_n_params; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_8; __pyx_v_i++) { + + /* "oursqlx/statement.pyx":301 + * self.conn.charset + * for 0 <= i < n_params: + * o = PyTuple_GET_ITEM(parameters, i) # <<<<<<<<<<<<<< + * Py_INCREF(o) + * b, c = &bind[i], &column[i] + */ + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_v_parameters, __pyx_v_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_XDECREF_SET(__pyx_v_o, __pyx_t_4); + __pyx_t_4 = 0; + + /* "oursqlx/statement.pyx":302 + * for 0 <= i < n_params: + * o = PyTuple_GET_ITEM(parameters, i) + * Py_INCREF(o) # <<<<<<<<<<<<<< + * b, c = &bind[i], &column[i] + * # This monolith should be refactored into something better + */ + Py_INCREF(__pyx_v_o); + + /* "oursqlx/statement.pyx":303 + * o = PyTuple_GET_ITEM(parameters, i) + * Py_INCREF(o) + * b, c = &bind[i], &column[i] # <<<<<<<<<<<<<< + * # This monolith should be refactored into something better + * # someday. It can't really work the same way as MySQLdb has + */ + __pyx_t_9 = (&(__pyx_v_bind[__pyx_v_i])); + __pyx_t_10 = (&(__pyx_v_column[__pyx_v_i])); + __pyx_v_b = __pyx_t_9; + __pyx_v_c = __pyx_t_10; + + /* "oursqlx/statement.pyx":308 + * # a conversion dict, since this involves some C-level union + * # and buffer munging. + * if o is None: # <<<<<<<<<<<<<< + * b.buffer_type = MYSQL_TYPE_NULL + * b.buffer = NULL + */ + __pyx_t_2 = (__pyx_v_o == Py_None); + __pyx_t_11 = (__pyx_t_2 != 0); + if (__pyx_t_11) { + + /* "oursqlx/statement.pyx":309 + * # and buffer munging. + * if o is None: + * b.buffer_type = MYSQL_TYPE_NULL # <<<<<<<<<<<<<< + * b.buffer = NULL + * # I wish there was a better way to do this. The split + */ + __pyx_v_b->buffer_type = MYSQL_TYPE_NULL; + + /* "oursqlx/statement.pyx":310 + * if o is None: + * b.buffer_type = MYSQL_TYPE_NULL + * b.buffer = NULL # <<<<<<<<<<<<<< + * # I wish there was a better way to do this. The split + * # between str/unicode/buffer is to make sure that people + */ + __pyx_v_b->buffer = NULL; + goto __pyx_L12; + } + + /* "oursqlx/statement.pyx":315 + * # are really really sure that they're inserting raw binary + * # data into a database instead of strings. + * elif PyString_Check(o) or PyUnicode_Check(o): # <<<<<<<<<<<<<< + * b.buffer_type = MYSQL_TYPE_STRING + * if self.conn.use_unicode: + */ + __pyx_t_2 = (PyString_Check(__pyx_v_o) != 0); + if (!__pyx_t_2) { + } else { + __pyx_t_11 = __pyx_t_2; + goto __pyx_L13_bool_binop_done; + } + __pyx_t_2 = (PyUnicode_Check(__pyx_v_o) != 0); + __pyx_t_11 = __pyx_t_2; + __pyx_L13_bool_binop_done:; + if (__pyx_t_11) { + + /* "oursqlx/statement.pyx":316 + * # data into a database instead of strings. + * elif PyString_Check(o) or PyUnicode_Check(o): + * b.buffer_type = MYSQL_TYPE_STRING # <<<<<<<<<<<<<< + * if self.conn.use_unicode: + * o = o.encode(self.conn._charset) + */ + __pyx_v_b->buffer_type = MYSQL_TYPE_STRING; + + /* "oursqlx/statement.pyx":317 + * elif PyString_Check(o) or PyUnicode_Check(o): + * b.buffer_type = MYSQL_TYPE_STRING + * if self.conn.use_unicode: # <<<<<<<<<<<<<< + * o = o.encode(self.conn._charset) + * temp_strings.append(o) + */ + __pyx_t_11 = (__pyx_v_self->conn->use_unicode != 0); + if (__pyx_t_11) { + + /* "oursqlx/statement.pyx":318 + * b.buffer_type = MYSQL_TYPE_STRING + * if self.conn.use_unicode: + * o = o.encode(self.conn._charset) # <<<<<<<<<<<<<< + * temp_strings.append(o) + * PyString_AsStringAndSize(o, + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_o, __pyx_n_s_encode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (!__pyx_t_5) { + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_self->conn->_charset); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_4); + } else { + __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL; + __Pyx_INCREF(__pyx_v_self->conn->_charset); + PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_self->conn->_charset); + __Pyx_GIVEREF(__pyx_v_self->conn->_charset); + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF_SET(__pyx_v_o, __pyx_t_4); + __pyx_t_4 = 0; + + /* "oursqlx/statement.pyx":319 + * if self.conn.use_unicode: + * o = o.encode(self.conn._charset) + * temp_strings.append(o) # <<<<<<<<<<<<<< + * PyString_AsStringAndSize(o, + * &b.buffer, &c.st) + */ + __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_temp_strings, __pyx_v_o); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + goto __pyx_L15; + } + __pyx_L15:; + + /* "oursqlx/statement.pyx":320 + * o = o.encode(self.conn._charset) + * temp_strings.append(o) + * PyString_AsStringAndSize(o, # <<<<<<<<<<<<<< + * &b.buffer, &c.st) + * c.ul = c.st + */ + __pyx_t_1 = PyString_AsStringAndSize(__pyx_v_o, ((char **)(&__pyx_v_b->buffer)), (&__pyx_v_c->st)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + + /* "oursqlx/statement.pyx":322 + * PyString_AsStringAndSize(o, + * &b.buffer, &c.st) + * c.ul = c.st # <<<<<<<<<<<<<< + * b.length = &c.ul + * elif PyBuffer_Check(o): + */ + __pyx_t_13 = __pyx_v_c->st; + __pyx_v_c->ul = __pyx_t_13; + + /* "oursqlx/statement.pyx":323 + * &b.buffer, &c.st) + * c.ul = c.st + * b.length = &c.ul # <<<<<<<<<<<<<< + * elif PyBuffer_Check(o): + * b.buffer_type = MYSQL_TYPE_STRING + */ + __pyx_v_b->length = (&__pyx_v_c->ul); + goto __pyx_L12; + } + + /* "oursqlx/statement.pyx":324 + * c.ul = c.st + * b.length = &c.ul + * elif PyBuffer_Check(o): # <<<<<<<<<<<<<< + * b.buffer_type = MYSQL_TYPE_STRING + * _oursqlx_PyObject_AsReadBuffer(o, &b.buffer, &c.st) + */ + __pyx_t_11 = (PyBuffer_Check(__pyx_v_o) != 0); + if (__pyx_t_11) { + + /* "oursqlx/statement.pyx":325 + * b.length = &c.ul + * elif PyBuffer_Check(o): + * b.buffer_type = MYSQL_TYPE_STRING # <<<<<<<<<<<<<< + * _oursqlx_PyObject_AsReadBuffer(o, &b.buffer, &c.st) + * c.ul = c.st + */ + __pyx_v_b->buffer_type = MYSQL_TYPE_STRING; + + /* "oursqlx/statement.pyx":326 + * elif PyBuffer_Check(o): + * b.buffer_type = MYSQL_TYPE_STRING + * _oursqlx_PyObject_AsReadBuffer(o, &b.buffer, &c.st) # <<<<<<<<<<<<<< + * c.ul = c.st + * b.length = &c.ul + */ + __pyx_t_1 = _oursqlx_PyObject_AsReadBuffer(__pyx_v_o, (&__pyx_v_b->buffer), (&__pyx_v_c->st)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + + /* "oursqlx/statement.pyx":327 + * b.buffer_type = MYSQL_TYPE_STRING + * _oursqlx_PyObject_AsReadBuffer(o, &b.buffer, &c.st) + * c.ul = c.st # <<<<<<<<<<<<<< + * b.length = &c.ul + * elif PyInt_Check(o): + */ + __pyx_t_13 = __pyx_v_c->st; + __pyx_v_c->ul = __pyx_t_13; + + /* "oursqlx/statement.pyx":328 + * _oursqlx_PyObject_AsReadBuffer(o, &b.buffer, &c.st) + * c.ul = c.st + * b.length = &c.ul # <<<<<<<<<<<<<< + * elif PyInt_Check(o): + * # MYSQL_TYPE_LONG really takes a C int, not a C long. + */ + __pyx_v_b->length = (&__pyx_v_c->ul); + goto __pyx_L12; + } + + /* "oursqlx/statement.pyx":329 + * c.ul = c.st + * b.length = &c.ul + * elif PyInt_Check(o): # <<<<<<<<<<<<<< + * # MYSQL_TYPE_LONG really takes a C int, not a C long. + * # This is necessary for platforms where sizeof(long) > + */ + __pyx_t_11 = (PyInt_Check(__pyx_v_o) != 0); + if (__pyx_t_11) { + + /* "oursqlx/statement.pyx":333 + * # This is necessary for platforms where sizeof(long) > + * # sizeof(int). + * b.buffer_type = MYSQL_TYPE_LONGLONG # <<<<<<<<<<<<<< + * c.ll = PyInt_AS_LONG(o) + * b.buffer = &c.ll + */ + __pyx_v_b->buffer_type = MYSQL_TYPE_LONGLONG; + + /* "oursqlx/statement.pyx":334 + * # sizeof(int). + * b.buffer_type = MYSQL_TYPE_LONGLONG + * c.ll = PyInt_AS_LONG(o) # <<<<<<<<<<<<<< + * b.buffer = &c.ll + * elif PyLong_Check(o): + */ + __pyx_v_c->ll = PyInt_AS_LONG(__pyx_v_o); + + /* "oursqlx/statement.pyx":335 + * b.buffer_type = MYSQL_TYPE_LONGLONG + * c.ll = PyInt_AS_LONG(o) + * b.buffer = &c.ll # <<<<<<<<<<<<<< + * elif PyLong_Check(o): + * b.buffer_type = MYSQL_TYPE_LONGLONG + */ + __pyx_v_b->buffer = ((void *)(&__pyx_v_c->ll)); + goto __pyx_L12; + } + + /* "oursqlx/statement.pyx":336 + * c.ll = PyInt_AS_LONG(o) + * b.buffer = &c.ll + * elif PyLong_Check(o): # <<<<<<<<<<<<<< + * b.buffer_type = MYSQL_TYPE_LONGLONG + * if o >= 0: + */ + __pyx_t_11 = (PyLong_Check(__pyx_v_o) != 0); + if (__pyx_t_11) { + + /* "oursqlx/statement.pyx":337 + * b.buffer = &c.ll + * elif PyLong_Check(o): + * b.buffer_type = MYSQL_TYPE_LONGLONG # <<<<<<<<<<<<<< + * if o >= 0: + * c.ull = PyLong_AsUnsignedLongLong(o) + */ + __pyx_v_b->buffer_type = MYSQL_TYPE_LONGLONG; + + /* "oursqlx/statement.pyx":338 + * elif PyLong_Check(o): + * b.buffer_type = MYSQL_TYPE_LONGLONG + * if o >= 0: # <<<<<<<<<<<<<< + * c.ull = PyLong_AsUnsignedLongLong(o) + * b.buffer = &c.ull + */ + __pyx_t_4 = PyObject_RichCompare(__pyx_v_o, __pyx_int_0, Py_GE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_11) { + + /* "oursqlx/statement.pyx":339 + * b.buffer_type = MYSQL_TYPE_LONGLONG + * if o >= 0: + * c.ull = PyLong_AsUnsignedLongLong(o) # <<<<<<<<<<<<<< + * b.buffer = &c.ull + * b.is_unsigned = True + */ + __pyx_t_14 = PyLong_AsUnsignedLongLong(__pyx_v_o); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __pyx_v_c->ull = __pyx_t_14; + + /* "oursqlx/statement.pyx":340 + * if o >= 0: + * c.ull = PyLong_AsUnsignedLongLong(o) + * b.buffer = &c.ull # <<<<<<<<<<<<<< + * b.is_unsigned = True + * else: + */ + __pyx_v_b->buffer = ((void *)(&__pyx_v_c->ull)); + + /* "oursqlx/statement.pyx":341 + * c.ull = PyLong_AsUnsignedLongLong(o) + * b.buffer = &c.ull + * b.is_unsigned = True # <<<<<<<<<<<<<< + * else: + * c.ll = PyLong_AsLongLong(o) + */ + __pyx_v_b->is_unsigned = 1; + goto __pyx_L16; + } + /*else*/ { + + /* "oursqlx/statement.pyx":343 + * b.is_unsigned = True + * else: + * c.ll = PyLong_AsLongLong(o) # <<<<<<<<<<<<<< + * b.buffer = &c.ll + * elif PyFloat_Check(o): + */ + __pyx_t_15 = PyLong_AsLongLong(__pyx_v_o); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __pyx_v_c->ll = __pyx_t_15; + + /* "oursqlx/statement.pyx":344 + * else: + * c.ll = PyLong_AsLongLong(o) + * b.buffer = &c.ll # <<<<<<<<<<<<<< + * elif PyFloat_Check(o): + * b.buffer_type = MYSQL_TYPE_DOUBLE + */ + __pyx_v_b->buffer = ((void *)(&__pyx_v_c->ll)); + } + __pyx_L16:; + goto __pyx_L12; + } + + /* "oursqlx/statement.pyx":345 + * c.ll = PyLong_AsLongLong(o) + * b.buffer = &c.ll + * elif PyFloat_Check(o): # <<<<<<<<<<<<<< + * b.buffer_type = MYSQL_TYPE_DOUBLE + * c.d = PyFloat_AS_DOUBLE(o) + */ + __pyx_t_11 = (PyFloat_Check(__pyx_v_o) != 0); + if (__pyx_t_11) { + + /* "oursqlx/statement.pyx":346 + * b.buffer = &c.ll + * elif PyFloat_Check(o): + * b.buffer_type = MYSQL_TYPE_DOUBLE # <<<<<<<<<<<<<< + * c.d = PyFloat_AS_DOUBLE(o) + * b.buffer = &c.d + */ + __pyx_v_b->buffer_type = MYSQL_TYPE_DOUBLE; + + /* "oursqlx/statement.pyx":347 + * elif PyFloat_Check(o): + * b.buffer_type = MYSQL_TYPE_DOUBLE + * c.d = PyFloat_AS_DOUBLE(o) # <<<<<<<<<<<<<< + * b.buffer = &c.d + * elif isinstance(o, datetime.datetime): + */ + __pyx_v_c->d = PyFloat_AS_DOUBLE(__pyx_v_o); + + /* "oursqlx/statement.pyx":348 + * b.buffer_type = MYSQL_TYPE_DOUBLE + * c.d = PyFloat_AS_DOUBLE(o) + * b.buffer = &c.d # <<<<<<<<<<<<<< + * elif isinstance(o, datetime.datetime): + * b.buffer_type = MYSQL_TYPE_DATETIME + */ + __pyx_v_b->buffer = ((void *)(&__pyx_v_c->d)); + goto __pyx_L12; + } + + /* "oursqlx/statement.pyx":349 + * c.d = PyFloat_AS_DOUBLE(o) + * b.buffer = &c.d + * elif isinstance(o, datetime.datetime): # <<<<<<<<<<<<<< + * b.buffer_type = MYSQL_TYPE_DATETIME + * c.t.year = o.year + */ + __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_datetime); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_datetime); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_11 = PyObject_IsInstance(__pyx_v_o, __pyx_t_3); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = (__pyx_t_11 != 0); + if (__pyx_t_2) { + + /* "oursqlx/statement.pyx":350 + * b.buffer = &c.d + * elif isinstance(o, datetime.datetime): + * b.buffer_type = MYSQL_TYPE_DATETIME # <<<<<<<<<<<<<< + * c.t.year = o.year + * c.t.month = o.month + */ + __pyx_v_b->buffer_type = MYSQL_TYPE_DATETIME; + + /* "oursqlx/statement.pyx":351 + * elif isinstance(o, datetime.datetime): + * b.buffer_type = MYSQL_TYPE_DATETIME + * c.t.year = o.year # <<<<<<<<<<<<<< + * c.t.month = o.month + * c.t.day = o.day + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_o, __pyx_n_s_year); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_16 = __Pyx_PyInt_As_unsigned_int(__pyx_t_3); if (unlikely((__pyx_t_16 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_c->t.year = __pyx_t_16; + + /* "oursqlx/statement.pyx":352 + * b.buffer_type = MYSQL_TYPE_DATETIME + * c.t.year = o.year + * c.t.month = o.month # <<<<<<<<<<<<<< + * c.t.day = o.day + * c.t.hour = o.hour + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_o, __pyx_n_s_month); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_16 = __Pyx_PyInt_As_unsigned_int(__pyx_t_3); if (unlikely((__pyx_t_16 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_c->t.month = __pyx_t_16; + + /* "oursqlx/statement.pyx":353 + * c.t.year = o.year + * c.t.month = o.month + * c.t.day = o.day # <<<<<<<<<<<<<< + * c.t.hour = o.hour + * c.t.minute = o.minute + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_o, __pyx_n_s_day); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_16 = __Pyx_PyInt_As_unsigned_int(__pyx_t_3); if (unlikely((__pyx_t_16 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_c->t.day = __pyx_t_16; + + /* "oursqlx/statement.pyx":354 + * c.t.month = o.month + * c.t.day = o.day + * c.t.hour = o.hour # <<<<<<<<<<<<<< + * c.t.minute = o.minute + * c.t.second = o.second + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_o, __pyx_n_s_hour); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_16 = __Pyx_PyInt_As_unsigned_int(__pyx_t_3); if (unlikely((__pyx_t_16 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_c->t.hour = __pyx_t_16; + + /* "oursqlx/statement.pyx":355 + * c.t.day = o.day + * c.t.hour = o.hour + * c.t.minute = o.minute # <<<<<<<<<<<<<< + * c.t.second = o.second + * c.t.second_part = o.microsecond + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_o, __pyx_n_s_minute); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_16 = __Pyx_PyInt_As_unsigned_int(__pyx_t_3); if (unlikely((__pyx_t_16 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_c->t.minute = __pyx_t_16; + + /* "oursqlx/statement.pyx":356 + * c.t.hour = o.hour + * c.t.minute = o.minute + * c.t.second = o.second # <<<<<<<<<<<<<< + * c.t.second_part = o.microsecond + * b.buffer = &c.t + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_o, __pyx_n_s_second); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_16 = __Pyx_PyInt_As_unsigned_int(__pyx_t_3); if (unlikely((__pyx_t_16 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_c->t.second = __pyx_t_16; + + /* "oursqlx/statement.pyx":357 + * c.t.minute = o.minute + * c.t.second = o.second + * c.t.second_part = o.microsecond # <<<<<<<<<<<<<< + * b.buffer = &c.t + * elif isinstance(o, datetime.date): + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_o, __pyx_n_s_microsecond); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_17 = __Pyx_PyInt_As_unsigned_long(__pyx_t_3); if (unlikely((__pyx_t_17 == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_c->t.second_part = __pyx_t_17; + + /* "oursqlx/statement.pyx":358 + * c.t.second = o.second + * c.t.second_part = o.microsecond + * b.buffer = &c.t # <<<<<<<<<<<<<< + * elif isinstance(o, datetime.date): + * b.buffer_type = MYSQL_TYPE_DATE + */ + __pyx_v_b->buffer = ((void *)(&__pyx_v_c->t)); + goto __pyx_L12; + } + + /* "oursqlx/statement.pyx":359 + * c.t.second_part = o.microsecond + * b.buffer = &c.t + * elif isinstance(o, datetime.date): # <<<<<<<<<<<<<< + * b.buffer_type = MYSQL_TYPE_DATE + * c.t.year = o.year + */ + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_datetime); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_date); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = PyObject_IsInstance(__pyx_v_o, __pyx_t_4); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_11 = (__pyx_t_2 != 0); + if (__pyx_t_11) { + + /* "oursqlx/statement.pyx":360 + * b.buffer = &c.t + * elif isinstance(o, datetime.date): + * b.buffer_type = MYSQL_TYPE_DATE # <<<<<<<<<<<<<< + * c.t.year = o.year + * c.t.month = o.month + */ + __pyx_v_b->buffer_type = MYSQL_TYPE_DATE; + + /* "oursqlx/statement.pyx":361 + * elif isinstance(o, datetime.date): + * b.buffer_type = MYSQL_TYPE_DATE + * c.t.year = o.year # <<<<<<<<<<<<<< + * c.t.month = o.month + * c.t.day = o.day + */ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_o, __pyx_n_s_year); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_16 = __Pyx_PyInt_As_unsigned_int(__pyx_t_4); if (unlikely((__pyx_t_16 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_c->t.year = __pyx_t_16; + + /* "oursqlx/statement.pyx":362 + * b.buffer_type = MYSQL_TYPE_DATE + * c.t.year = o.year + * c.t.month = o.month # <<<<<<<<<<<<<< + * c.t.day = o.day + * b.buffer = &c.t + */ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_o, __pyx_n_s_month); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_16 = __Pyx_PyInt_As_unsigned_int(__pyx_t_4); if (unlikely((__pyx_t_16 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_c->t.month = __pyx_t_16; + + /* "oursqlx/statement.pyx":363 + * c.t.year = o.year + * c.t.month = o.month + * c.t.day = o.day # <<<<<<<<<<<<<< + * b.buffer = &c.t + * elif isinstance(o, datetime.time): + */ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_o, __pyx_n_s_day); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_16 = __Pyx_PyInt_As_unsigned_int(__pyx_t_4); if (unlikely((__pyx_t_16 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_c->t.day = __pyx_t_16; + + /* "oursqlx/statement.pyx":364 + * c.t.month = o.month + * c.t.day = o.day + * b.buffer = &c.t # <<<<<<<<<<<<<< + * elif isinstance(o, datetime.time): + * b.buffer_type = MYSQL_TYPE_TIME + */ + __pyx_v_b->buffer = ((void *)(&__pyx_v_c->t)); + goto __pyx_L12; + } + + /* "oursqlx/statement.pyx":365 + * c.t.day = o.day + * b.buffer = &c.t + * elif isinstance(o, datetime.time): # <<<<<<<<<<<<<< + * b.buffer_type = MYSQL_TYPE_TIME + * c.t.hour = o.hour + */ + __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_datetime); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_time); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_11 = PyObject_IsInstance(__pyx_v_o, __pyx_t_3); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = (__pyx_t_11 != 0); + if (__pyx_t_2) { + + /* "oursqlx/statement.pyx":366 + * b.buffer = &c.t + * elif isinstance(o, datetime.time): + * b.buffer_type = MYSQL_TYPE_TIME # <<<<<<<<<<<<<< + * c.t.hour = o.hour + * c.t.minute = o.minute + */ + __pyx_v_b->buffer_type = MYSQL_TYPE_TIME; + + /* "oursqlx/statement.pyx":367 + * elif isinstance(o, datetime.time): + * b.buffer_type = MYSQL_TYPE_TIME + * c.t.hour = o.hour # <<<<<<<<<<<<<< + * c.t.minute = o.minute + * c.t.second = o.second + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_o, __pyx_n_s_hour); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_16 = __Pyx_PyInt_As_unsigned_int(__pyx_t_3); if (unlikely((__pyx_t_16 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_c->t.hour = __pyx_t_16; + + /* "oursqlx/statement.pyx":368 + * b.buffer_type = MYSQL_TYPE_TIME + * c.t.hour = o.hour + * c.t.minute = o.minute # <<<<<<<<<<<<<< + * c.t.second = o.second + * c.t.second_part = o.microsecond + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_o, __pyx_n_s_minute); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_16 = __Pyx_PyInt_As_unsigned_int(__pyx_t_3); if (unlikely((__pyx_t_16 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_c->t.minute = __pyx_t_16; + + /* "oursqlx/statement.pyx":369 + * c.t.hour = o.hour + * c.t.minute = o.minute + * c.t.second = o.second # <<<<<<<<<<<<<< + * c.t.second_part = o.microsecond + * b.buffer = &c.t + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_o, __pyx_n_s_second); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_16 = __Pyx_PyInt_As_unsigned_int(__pyx_t_3); if (unlikely((__pyx_t_16 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_c->t.second = __pyx_t_16; + + /* "oursqlx/statement.pyx":370 + * c.t.minute = o.minute + * c.t.second = o.second + * c.t.second_part = o.microsecond # <<<<<<<<<<<<<< + * b.buffer = &c.t + * elif isinstance(o, decimal.Decimal): + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_o, __pyx_n_s_microsecond); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_17 = __Pyx_PyInt_As_unsigned_long(__pyx_t_3); if (unlikely((__pyx_t_17 == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_c->t.second_part = __pyx_t_17; + + /* "oursqlx/statement.pyx":371 + * c.t.second = o.second + * c.t.second_part = o.microsecond + * b.buffer = &c.t # <<<<<<<<<<<<<< + * elif isinstance(o, decimal.Decimal): + * b.buffer_type = MYSQL_TYPE_NEWDECIMAL + */ + __pyx_v_b->buffer = ((void *)(&__pyx_v_c->t)); + goto __pyx_L12; + } + + /* "oursqlx/statement.pyx":372 + * c.t.second_part = o.microsecond + * b.buffer = &c.t + * elif isinstance(o, decimal.Decimal): # <<<<<<<<<<<<<< + * b.buffer_type = MYSQL_TYPE_NEWDECIMAL + * o = str(o) + */ + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_decimal); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_Decimal); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = PyObject_IsInstance(__pyx_v_o, __pyx_t_4); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_11 = (__pyx_t_2 != 0); + if (__pyx_t_11) { + + /* "oursqlx/statement.pyx":373 + * b.buffer = &c.t + * elif isinstance(o, decimal.Decimal): + * b.buffer_type = MYSQL_TYPE_NEWDECIMAL # <<<<<<<<<<<<<< + * o = str(o) + * temp_strings.append(o) + */ + __pyx_v_b->buffer_type = MYSQL_TYPE_NEWDECIMAL; + + /* "oursqlx/statement.pyx":374 + * elif isinstance(o, decimal.Decimal): + * b.buffer_type = MYSQL_TYPE_NEWDECIMAL + * o = str(o) # <<<<<<<<<<<<<< + * temp_strings.append(o) + * b.buffer = PyString_AS_STRING(o) + */ + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_o); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_o); + __Pyx_GIVEREF(__pyx_v_o); + __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF_SET(__pyx_v_o, __pyx_t_3); + __pyx_t_3 = 0; + + /* "oursqlx/statement.pyx":375 + * b.buffer_type = MYSQL_TYPE_NEWDECIMAL + * o = str(o) + * temp_strings.append(o) # <<<<<<<<<<<<<< + * b.buffer = PyString_AS_STRING(o) + * c.ul = PyString_GET_SIZE(o) + */ + __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_temp_strings, __pyx_v_o); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + + /* "oursqlx/statement.pyx":376 + * o = str(o) + * temp_strings.append(o) + * b.buffer = PyString_AS_STRING(o) # <<<<<<<<<<<<<< + * c.ul = PyString_GET_SIZE(o) + * b.length = &c.ul + */ + __pyx_v_b->buffer = PyString_AS_STRING(__pyx_v_o); + + /* "oursqlx/statement.pyx":377 + * temp_strings.append(o) + * b.buffer = PyString_AS_STRING(o) + * c.ul = PyString_GET_SIZE(o) # <<<<<<<<<<<<<< + * b.length = &c.ul + * elif isinstance(o, _AbstractIterWrapper): + */ + __pyx_v_c->ul = PyString_GET_SIZE(__pyx_v_o); + + /* "oursqlx/statement.pyx":378 + * b.buffer = PyString_AS_STRING(o) + * c.ul = PyString_GET_SIZE(o) + * b.length = &c.ul # <<<<<<<<<<<<<< + * elif isinstance(o, _AbstractIterWrapper): + * b.buffer_type = MYSQL_TYPE_STRING + */ + __pyx_v_b->length = (&__pyx_v_c->ul); + goto __pyx_L12; + } + + /* "oursqlx/statement.pyx":379 + * c.ul = PyString_GET_SIZE(o) + * b.length = &c.ul + * elif isinstance(o, _AbstractIterWrapper): # <<<<<<<<<<<<<< + * b.buffer_type = MYSQL_TYPE_STRING + * b.length = &c.ul + */ + __pyx_t_11 = __Pyx_TypeCheck(__pyx_v_o, ((PyObject*)__pyx_ptype_6oursql__AbstractIterWrapper)); + __pyx_t_2 = (__pyx_t_11 != 0); + if (__pyx_t_2) { + + /* "oursqlx/statement.pyx":380 + * b.length = &c.ul + * elif isinstance(o, _AbstractIterWrapper): + * b.buffer_type = MYSQL_TYPE_STRING # <<<<<<<<<<<<<< + * b.length = &c.ul + * long_strings.append((i, o)) + */ + __pyx_v_b->buffer_type = MYSQL_TYPE_STRING; + + /* "oursqlx/statement.pyx":381 + * elif isinstance(o, _AbstractIterWrapper): + * b.buffer_type = MYSQL_TYPE_STRING + * b.length = &c.ul # <<<<<<<<<<<<<< + * long_strings.append((i, o)) + * else: + */ + __pyx_v_b->length = (&__pyx_v_c->ul); + + /* "oursqlx/statement.pyx":382 + * b.buffer_type = MYSQL_TYPE_STRING + * b.length = &c.ul + * long_strings.append((i, o)) # <<<<<<<<<<<<<< + * else: + * raise TypeError('cannot bind %r object' % o.__class__) + */ + __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_i); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_o); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_o); + __Pyx_GIVEREF(__pyx_v_o); + __pyx_t_3 = 0; + __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_long_strings, __pyx_t_4); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + goto __pyx_L12; + } + /*else*/ { + + /* "oursqlx/statement.pyx":384 + * long_strings.append((i, o)) + * else: + * raise TypeError('cannot bind %r object' % o.__class__) # <<<<<<<<<<<<<< + * if mysql_stmt_bind_param(self.stmt, bind): + * self._raise_error() + */ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_o, __pyx_n_s_class); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_cannot_bind_r_object, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[4]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + } + __pyx_L12:; + } + goto __pyx_L8; + } + __pyx_L8:; + + /* "oursqlx/statement.pyx":385 + * else: + * raise TypeError('cannot bind %r object' % o.__class__) + * if mysql_stmt_bind_param(self.stmt, bind): # <<<<<<<<<<<<<< + * self._raise_error() + * for i, o in long_strings: + */ + __pyx_t_2 = (mysql_stmt_bind_param(__pyx_v_self->stmt, __pyx_v_bind) != 0); + if (__pyx_t_2) { + + /* "oursqlx/statement.pyx":386 + * raise TypeError('cannot bind %r object' % o.__class__) + * if mysql_stmt_bind_param(self.stmt, bind): + * self._raise_error() # <<<<<<<<<<<<<< + * for i, o in long_strings: + * # Yaay consistency. + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_6oursql__Statement *)__pyx_v_self->__pyx_vtab)->_raise_error(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + goto __pyx_L17; + } + __pyx_L17:; + + /* "oursqlx/statement.pyx":387 + * if mysql_stmt_bind_param(self.stmt, bind): + * self._raise_error() + * for i, o in long_strings: # <<<<<<<<<<<<<< + * # Yaay consistency. + * for s in o: + */ + __pyx_t_3 = __pyx_v_long_strings; __Pyx_INCREF(__pyx_t_3); __pyx_t_8 = 0; + for (;;) { + if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + #endif + if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) { + PyObject* sequence = __pyx_t_4; + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[4]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); + } else { + __pyx_t_6 = PyList_GET_ITEM(sequence, 0); + __pyx_t_5 = PyList_GET_ITEM(sequence, 1); + } + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(__pyx_t_5); + #else + __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_5); + #endif + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_18 = Py_TYPE(__pyx_t_7)->tp_iternext; + index = 0; __pyx_t_6 = __pyx_t_18(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L20_unpacking_failed; + __Pyx_GOTREF(__pyx_t_6); + index = 1; __pyx_t_5 = __pyx_t_18(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L20_unpacking_failed; + __Pyx_GOTREF(__pyx_t_5); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_18(__pyx_t_7), 2) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __pyx_t_18 = NULL; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L21_unpacking_done; + __pyx_L20_unpacking_failed:; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_18 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[4]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __pyx_L21_unpacking_done:; + } + __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_t_6); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_v_i = __pyx_t_13; + __Pyx_XDECREF_SET(__pyx_v_o, __pyx_t_5); + __pyx_t_5 = 0; + + /* "oursqlx/statement.pyx":389 + * for i, o in long_strings: + * # Yaay consistency. + * for s in o: # <<<<<<<<<<<<<< + * if PyBuffer_Check(s): + * _oursqlx_PyObject_AsReadBuffer(s, + */ + if (likely(PyList_CheckExact(__pyx_v_o)) || PyTuple_CheckExact(__pyx_v_o)) { + __pyx_t_4 = __pyx_v_o; __Pyx_INCREF(__pyx_t_4); __pyx_t_13 = 0; + __pyx_t_19 = NULL; + } else { + __pyx_t_13 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_o); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_19 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + } + for (;;) { + if (likely(!__pyx_t_19)) { + if (likely(PyList_CheckExact(__pyx_t_4))) { + if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_13); __Pyx_INCREF(__pyx_t_5); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + #endif + } else { + if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_13); __Pyx_INCREF(__pyx_t_5); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + #endif + } + } else { + __pyx_t_5 = __pyx_t_19(__pyx_t_4); + if (unlikely(!__pyx_t_5)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[4]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_5); + } + __Pyx_XDECREF_SET(__pyx_v_s, __pyx_t_5); + __pyx_t_5 = 0; + + /* "oursqlx/statement.pyx":390 + * # Yaay consistency. + * for s in o: + * if PyBuffer_Check(s): # <<<<<<<<<<<<<< + * _oursqlx_PyObject_AsReadBuffer(s, + * &long_buffer, &long_buffer_size) + */ + __pyx_t_2 = (PyBuffer_Check(__pyx_v_s) != 0); + if (__pyx_t_2) { + + /* "oursqlx/statement.pyx":391 + * for s in o: + * if PyBuffer_Check(s): + * _oursqlx_PyObject_AsReadBuffer(s, # <<<<<<<<<<<<<< + * &long_buffer, &long_buffer_size) + * else: + */ + __pyx_t_1 = _oursqlx_PyObject_AsReadBuffer(__pyx_v_s, (&__pyx_v_long_buffer), (&__pyx_v_long_buffer_size)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + goto __pyx_L24; + } + /*else*/ { + + /* "oursqlx/statement.pyx":394 + * &long_buffer, &long_buffer_size) + * else: + * if self.conn.use_unicode: # <<<<<<<<<<<<<< + * s = s.encode(self.conn._charset) + * PyString_AsStringAndSize(s, + */ + __pyx_t_2 = (__pyx_v_self->conn->use_unicode != 0); + if (__pyx_t_2) { + + /* "oursqlx/statement.pyx":395 + * else: + * if self.conn.use_unicode: + * s = s.encode(self.conn._charset) # <<<<<<<<<<<<<< + * PyString_AsStringAndSize(s, + * &long_buffer, &long_buffer_size) + */ + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_s, __pyx_n_s_encode); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + } + } + if (!__pyx_t_7) { + __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_self->conn->_charset); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_5); + } else { + __pyx_t_20 = PyTuple_New(1+1); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_20); + PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = NULL; + __Pyx_INCREF(__pyx_v_self->conn->_charset); + PyTuple_SET_ITEM(__pyx_t_20, 0+1, __pyx_v_self->conn->_charset); + __Pyx_GIVEREF(__pyx_v_self->conn->_charset); + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_20, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_5); + __pyx_t_5 = 0; + goto __pyx_L25; + } + __pyx_L25:; + + /* "oursqlx/statement.pyx":396 + * if self.conn.use_unicode: + * s = s.encode(self.conn._charset) + * PyString_AsStringAndSize(s, # <<<<<<<<<<<<<< + * &long_buffer, &long_buffer_size) + * if mysql_stmt_send_long_data(self.stmt, i, + */ + __pyx_t_1 = PyString_AsStringAndSize(__pyx_v_s, ((char **)(&__pyx_v_long_buffer)), (&__pyx_v_long_buffer_size)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + } + __pyx_L24:; + + /* "oursqlx/statement.pyx":398 + * PyString_AsStringAndSize(s, + * &long_buffer, &long_buffer_size) + * if mysql_stmt_send_long_data(self.stmt, i, # <<<<<<<<<<<<<< + * long_buffer, long_buffer_size): + * self._raise_error() + */ + __pyx_t_2 = (__pyx_f_6oursql_mysql_stmt_send_long_data(__pyx_v_self->stmt, __pyx_v_i, ((char *)__pyx_v_long_buffer), __pyx_v_long_buffer_size) != 0); + if (__pyx_t_2) { + + /* "oursqlx/statement.pyx":400 + * if mysql_stmt_send_long_data(self.stmt, i, + * long_buffer, long_buffer_size): + * self._raise_error() # <<<<<<<<<<<<<< + * if mysql_stmt_execute(self.stmt): + * self._raise_error() + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_6oursql__Statement *)__pyx_v_self->__pyx_vtab)->_raise_error(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + goto __pyx_L26; + } + __pyx_L26:; + + /* "oursqlx/statement.pyx":389 + * for i, o in long_strings: + * # Yaay consistency. + * for s in o: # <<<<<<<<<<<<<< + * if PyBuffer_Check(s): + * _oursqlx_PyObject_AsReadBuffer(s, + */ + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "oursqlx/statement.pyx":387 + * if mysql_stmt_bind_param(self.stmt, bind): + * self._raise_error() + * for i, o in long_strings: # <<<<<<<<<<<<<< + * # Yaay consistency. + * for s in o: + */ + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "oursqlx/statement.pyx":401 + * long_buffer, long_buffer_size): + * self._raise_error() + * if mysql_stmt_execute(self.stmt): # <<<<<<<<<<<<<< + * self._raise_error() + * if _oursqlx_stmt_cursor_prefetch(self.stmt, &self.buffered): + */ + __pyx_t_2 = (__pyx_f_6oursql_mysql_stmt_execute(__pyx_v_self->stmt) != 0); + if (__pyx_t_2) { + + /* "oursqlx/statement.pyx":402 + * self._raise_error() + * if mysql_stmt_execute(self.stmt): + * self._raise_error() # <<<<<<<<<<<<<< + * if _oursqlx_stmt_cursor_prefetch(self.stmt, &self.buffered): + * self._raise_error() + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_6oursql__Statement *)__pyx_v_self->__pyx_vtab)->_raise_error(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + goto __pyx_L27; + } + __pyx_L27:; + + /* "oursqlx/statement.pyx":403 + * if mysql_stmt_execute(self.stmt): + * self._raise_error() + * if _oursqlx_stmt_cursor_prefetch(self.stmt, &self.buffered): # <<<<<<<<<<<<<< + * self._raise_error() + * self.exhausted = False + */ + __pyx_t_2 = (_oursqlx_stmt_cursor_prefetch(__pyx_v_self->stmt, (&__pyx_v_self->buffered)) != 0); + if (__pyx_t_2) { + + /* "oursqlx/statement.pyx":404 + * self._raise_error() + * if _oursqlx_stmt_cursor_prefetch(self.stmt, &self.buffered): + * self._raise_error() # <<<<<<<<<<<<<< + * self.exhausted = False + * if self.result_data: + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_6oursql__Statement *)__pyx_v_self->__pyx_vtab)->_raise_error(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + goto __pyx_L28; + } + __pyx_L28:; + + /* "oursqlx/statement.pyx":405 + * if _oursqlx_stmt_cursor_prefetch(self.stmt, &self.buffered): + * self._raise_error() + * self.exhausted = False # <<<<<<<<<<<<<< + * if self.result_data: + * self.data_waiting = True + */ + __pyx_v_self->exhausted = 0; + + /* "oursqlx/statement.pyx":406 + * self._raise_error() + * self.exhausted = False + * if self.result_data: # <<<<<<<<<<<<<< + * self.data_waiting = True + * if self.conn.warning_count(): + */ + __pyx_t_2 = (__pyx_v_self->result_data != 0); + if (__pyx_t_2) { + + /* "oursqlx/statement.pyx":407 + * self.exhausted = False + * if self.result_data: + * self.data_waiting = True # <<<<<<<<<<<<<< + * if self.conn.warning_count(): + * self.warnings.extend(_do_warnings_query(self.conn)) + */ + __pyx_v_self->data_waiting = 1; + goto __pyx_L29; + } + __pyx_L29:; + + /* "oursqlx/statement.pyx":408 + * if self.result_data: + * self.data_waiting = True + * if self.conn.warning_count(): # <<<<<<<<<<<<<< + * self.warnings.extend(_do_warnings_query(self.conn)) + * finally: + */ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->conn), __pyx_n_s_warning_count); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + if (__pyx_t_5) { + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } else { + __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + } + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_2) { + + /* "oursqlx/statement.pyx":409 + * self.data_waiting = True + * if self.conn.warning_count(): + * self.warnings.extend(_do_warnings_query(self.conn)) # <<<<<<<<<<<<<< + * finally: + * PyMem_Free(buf) + */ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->warnings, __pyx_n_s_extend); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_do_warnings_query); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_20 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_20 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_20)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_20); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + } + } + if (!__pyx_t_20) { + __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_6, ((PyObject *)__pyx_v_self->conn)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_5); + } else { + __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_20); __Pyx_GIVEREF(__pyx_t_20); __pyx_t_20 = NULL; + __Pyx_INCREF(((PyObject *)__pyx_v_self->conn)); + PyTuple_SET_ITEM(__pyx_t_7, 0+1, ((PyObject *)__pyx_v_self->conn)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self->conn)); + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_7, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + if (!__pyx_t_6) { + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_3); + } else { + __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL; + PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L30; + } + __pyx_L30:; + } + + /* "oursqlx/statement.pyx":411 + * self.warnings.extend(_do_warnings_query(self.conn)) + * finally: + * PyMem_Free(buf) # <<<<<<<<<<<<<< + * + * def fetchone(self): + */ + /*finally:*/ { + /*normal exit:*/{ + PyMem_Free(__pyx_v_buf); + goto __pyx_L7; + } + /*exception exit:*/{ + __pyx_L6_error:; + __pyx_t_23 = 0; __pyx_t_24 = 0; __pyx_t_25 = 0; __pyx_t_26 = 0; __pyx_t_27 = 0; __pyx_t_28 = 0; + __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_26, &__pyx_t_27, &__pyx_t_28); + if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_23, &__pyx_t_24, &__pyx_t_25) < 0)) __Pyx_ErrFetch(&__pyx_t_23, &__pyx_t_24, &__pyx_t_25); + __Pyx_XGOTREF(__pyx_t_23); + __Pyx_XGOTREF(__pyx_t_24); + __Pyx_XGOTREF(__pyx_t_25); + __Pyx_XGOTREF(__pyx_t_26); + __Pyx_XGOTREF(__pyx_t_27); + __Pyx_XGOTREF(__pyx_t_28); + __pyx_t_1 = __pyx_lineno; __pyx_t_21 = __pyx_clineno; __pyx_t_22 = __pyx_filename; + { + PyMem_Free(__pyx_v_buf); + } + if (PY_MAJOR_VERSION >= 3) { + __Pyx_XGIVEREF(__pyx_t_26); + __Pyx_XGIVEREF(__pyx_t_27); + __Pyx_XGIVEREF(__pyx_t_28); + __Pyx_ExceptionReset(__pyx_t_26, __pyx_t_27, __pyx_t_28); + } + __Pyx_XGIVEREF(__pyx_t_23); + __Pyx_XGIVEREF(__pyx_t_24); + __Pyx_XGIVEREF(__pyx_t_25); + __Pyx_ErrRestore(__pyx_t_23, __pyx_t_24, __pyx_t_25); + __pyx_t_23 = 0; __pyx_t_24 = 0; __pyx_t_25 = 0; __pyx_t_26 = 0; __pyx_t_27 = 0; __pyx_t_28 = 0; + __pyx_lineno = __pyx_t_1; __pyx_clineno = __pyx_t_21; __pyx_filename = __pyx_t_22; + goto __pyx_L1_error; + } + __pyx_L7:; + } + + /* "oursqlx/statement.pyx":270 + * return [x[0] for x in desc] + * + * def execute(self, *parameters): # <<<<<<<<<<<<<< + * cdef char *buf = NULL + * cdef void *long_buffer + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_20); + __Pyx_AddTraceback("oursql._Statement.execute", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_long_strings); + __Pyx_XDECREF(__pyx_v_temp_strings); + __Pyx_XDECREF(__pyx_v_o); + __Pyx_XDECREF(__pyx_v_s); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/statement.pyx":413 + * PyMem_Free(buf) + * + * def fetchone(self): # <<<<<<<<<<<<<< + * cdef MYSQL_BIND b_tryagain + * cdef column_output *c + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_10_Statement_11fetchone(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6oursql_10_Statement_11fetchone(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("fetchone (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_10_Statement_10fetchone(((struct __pyx_obj_6oursql__Statement *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_10_Statement_10fetchone(struct __pyx_obj_6oursql__Statement *__pyx_v_self) { + MYSQL_BIND __pyx_v_b_tryagain; + struct __pyx_t_6oursql_column_output *__pyx_v_c; + union __pyx_t_6oursql_column_data *__pyx_v_d; + unsigned int __pyx_v_i; + int __pyx_v_result; + PyObject *__pyx_v_ret = NULL; + PyObject *__pyx_v_val = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + unsigned int __pyx_t_5; + unsigned long __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + int __pyx_t_11; + PyObject *__pyx_t_12 = NULL; + PyObject *__pyx_t_13 = NULL; + PyObject *__pyx_t_14 = NULL; + PyObject *__pyx_t_15 = NULL; + PyObject *__pyx_t_16 = NULL; + Py_ssize_t __pyx_t_17; + PyObject *__pyx_t_18 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("fetchone", 0); + + /* "oursqlx/statement.pyx":420 + * cdef int result + * cdef uint64_t u + * self._check_closed() # <<<<<<<<<<<<<< + * if not self.result_data or self.exhausted: + * return None + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_6oursql__Statement *)__pyx_v_self->__pyx_vtab)->_check_closed(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "oursqlx/statement.pyx":421 + * cdef uint64_t u + * self._check_closed() + * if not self.result_data or self.exhausted: # <<<<<<<<<<<<<< + * return None + * elif self.result_data: + */ + __pyx_t_3 = ((!(__pyx_v_self->result_data != 0)) != 0); + if (!__pyx_t_3) { + } else { + __pyx_t_2 = __pyx_t_3; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_3 = (__pyx_v_self->exhausted != 0); + __pyx_t_2 = __pyx_t_3; + __pyx_L4_bool_binop_done:; + if (__pyx_t_2) { + + /* "oursqlx/statement.pyx":422 + * self._check_closed() + * if not self.result_data or self.exhausted: + * return None # <<<<<<<<<<<<<< + * elif self.result_data: + * self._bind_buffer() + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + } + + /* "oursqlx/statement.pyx":423 + * if not self.result_data or self.exhausted: + * return None + * elif self.result_data: # <<<<<<<<<<<<<< + * self._bind_buffer() + * result = mysql_stmt_fetch(self.stmt) + */ + __pyx_t_2 = (__pyx_v_self->result_data != 0); + if (__pyx_t_2) { + + /* "oursqlx/statement.pyx":424 + * return None + * elif self.result_data: + * self._bind_buffer() # <<<<<<<<<<<<<< + * result = mysql_stmt_fetch(self.stmt) + * self.fetched += 1 + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_6oursql__Statement *)__pyx_v_self->__pyx_vtab)->_bind_buffer(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "oursqlx/statement.pyx":425 + * elif self.result_data: + * self._bind_buffer() + * result = mysql_stmt_fetch(self.stmt) # <<<<<<<<<<<<<< + * self.fetched += 1 + * if result == 1: + */ + __pyx_v_result = __pyx_f_6oursql_mysql_stmt_fetch(__pyx_v_self->stmt); + + /* "oursqlx/statement.pyx":426 + * self._bind_buffer() + * result = mysql_stmt_fetch(self.stmt) + * self.fetched += 1 # <<<<<<<<<<<<<< + * if result == 1: + * self._raise_error() + */ + __pyx_v_self->fetched = (__pyx_v_self->fetched + 1); + + /* "oursqlx/statement.pyx":427 + * result = mysql_stmt_fetch(self.stmt) + * self.fetched += 1 + * if result == 1: # <<<<<<<<<<<<<< + * self._raise_error() + * elif result == MYSQL_NO_DATA: + */ + __pyx_t_2 = ((__pyx_v_result == 1) != 0); + if (__pyx_t_2) { + + /* "oursqlx/statement.pyx":428 + * self.fetched += 1 + * if result == 1: + * self._raise_error() # <<<<<<<<<<<<<< + * elif result == MYSQL_NO_DATA: + * if mysql_stmt_free_result(self.stmt): + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_6oursql__Statement *)__pyx_v_self->__pyx_vtab)->_raise_error(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + + /* "oursqlx/statement.pyx":429 + * if result == 1: + * self._raise_error() + * elif result == MYSQL_NO_DATA: # <<<<<<<<<<<<<< + * if mysql_stmt_free_result(self.stmt): + * self._raise_error() + */ + __pyx_t_2 = ((__pyx_v_result == MYSQL_NO_DATA) != 0); + if (__pyx_t_2) { + + /* "oursqlx/statement.pyx":430 + * self._raise_error() + * elif result == MYSQL_NO_DATA: + * if mysql_stmt_free_result(self.stmt): # <<<<<<<<<<<<<< + * self._raise_error() + * self.buffered = self.data_waiting = False + */ + __pyx_t_2 = (mysql_stmt_free_result(__pyx_v_self->stmt) != 0); + if (__pyx_t_2) { + + /* "oursqlx/statement.pyx":431 + * elif result == MYSQL_NO_DATA: + * if mysql_stmt_free_result(self.stmt): + * self._raise_error() # <<<<<<<<<<<<<< + * self.buffered = self.data_waiting = False + * self.exhausted = True + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_6oursql__Statement *)__pyx_v_self->__pyx_vtab)->_raise_error(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; + } + __pyx_L7:; + + /* "oursqlx/statement.pyx":432 + * if mysql_stmt_free_result(self.stmt): + * self._raise_error() + * self.buffered = self.data_waiting = False # <<<<<<<<<<<<<< + * self.exhausted = True + * return None + */ + __pyx_v_self->buffered = 0; + __pyx_v_self->data_waiting = 0; + + /* "oursqlx/statement.pyx":433 + * self._raise_error() + * self.buffered = self.data_waiting = False + * self.exhausted = True # <<<<<<<<<<<<<< + * return None + * if self.result_fields == 0: + */ + __pyx_v_self->exhausted = 1; + + /* "oursqlx/statement.pyx":434 + * self.buffered = self.data_waiting = False + * self.exhausted = True + * return None # <<<<<<<<<<<<<< + * if self.result_fields == 0: + * return () + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + } + __pyx_L6:; + + /* "oursqlx/statement.pyx":435 + * self.exhausted = True + * return None + * if self.result_fields == 0: # <<<<<<<<<<<<<< + * return () + * ret = PyTuple_New(self.result_fields) + */ + __pyx_t_2 = ((__pyx_v_self->result_fields == 0) != 0); + if (__pyx_t_2) { + + /* "oursqlx/statement.pyx":436 + * return None + * if self.result_fields == 0: + * return () # <<<<<<<<<<<<<< + * ret = PyTuple_New(self.result_fields) + * # Cache the connection charset. + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_empty_tuple); + __pyx_r = __pyx_empty_tuple; + goto __pyx_L0; + } + + /* "oursqlx/statement.pyx":437 + * if self.result_fields == 0: + * return () + * ret = PyTuple_New(self.result_fields) # <<<<<<<<<<<<<< + * # Cache the connection charset. + * self.conn.charset + */ + __pyx_t_4 = PyTuple_New(__pyx_v_self->result_fields); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_v_ret = __pyx_t_4; + __pyx_t_4 = 0; + + /* "oursqlx/statement.pyx":439 + * ret = PyTuple_New(self.result_fields) + * # Cache the connection charset. + * self.conn.charset # <<<<<<<<<<<<<< + * for 0 <= i < self.result_fields: + * c = &self.result_data[i] + */ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->conn), __pyx_n_s_charset); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "oursqlx/statement.pyx":440 + * # Cache the connection charset. + * self.conn.charset + * for 0 <= i < self.result_fields: # <<<<<<<<<<<<<< + * c = &self.result_data[i] + * d = &c.buf + */ + __pyx_t_5 = __pyx_v_self->result_fields; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_5; __pyx_v_i++) { + + /* "oursqlx/statement.pyx":441 + * self.conn.charset + * for 0 <= i < self.result_fields: + * c = &self.result_data[i] # <<<<<<<<<<<<<< + * d = &c.buf + * if c.is_null: + */ + __pyx_v_c = (&(__pyx_v_self->result_data[__pyx_v_i])); + + /* "oursqlx/statement.pyx":442 + * for 0 <= i < self.result_fields: + * c = &self.result_data[i] + * d = &c.buf # <<<<<<<<<<<<<< + * if c.is_null: + * val = None + */ + __pyx_v_d = (&__pyx_v_c->buf); + + /* "oursqlx/statement.pyx":443 + * c = &self.result_data[i] + * d = &c.buf + * if c.is_null: # <<<<<<<<<<<<<< + * val = None + * elif c.type in (MYSQL_TYPE_STRING, MYSQL_TYPE_BLOB, + */ + __pyx_t_2 = (__pyx_v_c->is_null != 0); + if (__pyx_t_2) { + + /* "oursqlx/statement.pyx":444 + * d = &c.buf + * if c.is_null: + * val = None # <<<<<<<<<<<<<< + * elif c.type in (MYSQL_TYPE_STRING, MYSQL_TYPE_BLOB, + * MYSQL_TYPE_VAR_STRING): + */ + __Pyx_INCREF(Py_None); + __Pyx_XDECREF_SET(__pyx_v_val, Py_None); + goto __pyx_L11; + } + + /* "oursqlx/statement.pyx":445 + * if c.is_null: + * val = None + * elif c.type in (MYSQL_TYPE_STRING, MYSQL_TYPE_BLOB, # <<<<<<<<<<<<<< + * MYSQL_TYPE_VAR_STRING): + * # Oh string handling. + */ + switch (__pyx_v_c->type) { + case MYSQL_TYPE_STRING: + case MYSQL_TYPE_BLOB: + + /* "oursqlx/statement.pyx":446 + * val = None + * elif c.type in (MYSQL_TYPE_STRING, MYSQL_TYPE_BLOB, + * MYSQL_TYPE_VAR_STRING): # <<<<<<<<<<<<<< + * # Oh string handling. + * val = None + */ + case MYSQL_TYPE_VAR_STRING: + + /* "oursqlx/statement.pyx":445 + * if c.is_null: + * val = None + * elif c.type in (MYSQL_TYPE_STRING, MYSQL_TYPE_BLOB, # <<<<<<<<<<<<<< + * MYSQL_TYPE_VAR_STRING): + * # Oh string handling. + */ + __pyx_t_2 = 1; + break; + default: + __pyx_t_2 = 0; + break; + } + __pyx_t_3 = (__pyx_t_2 != 0); + if (__pyx_t_3) { + + /* "oursqlx/statement.pyx":448 + * MYSQL_TYPE_VAR_STRING): + * # Oh string handling. + * val = None # <<<<<<<<<<<<<< + * # If the string wasn't too long to fit in our minimal buffer, + * # then we can just copy it out of the buffer. + */ + __Pyx_INCREF(Py_None); + __Pyx_XDECREF_SET(__pyx_v_val, Py_None); + + /* "oursqlx/statement.pyx":451 + * # If the string wasn't too long to fit in our minimal buffer, + * # then we can just copy it out of the buffer. + * if not c.error: # <<<<<<<<<<<<<< + * val = PyString_FromStringAndSize(&d.c, c.length) + * # If we already have all the results stored clientside, or we + */ + __pyx_t_3 = ((!(__pyx_v_c->error != 0)) != 0); + if (__pyx_t_3) { + + /* "oursqlx/statement.pyx":452 + * # then we can just copy it out of the buffer. + * if not c.error: + * val = PyString_FromStringAndSize(&d.c, c.length) # <<<<<<<<<<<<<< + * # If we already have all the results stored clientside, or we + * # don't care about strings being too long, or we *do* care + */ + __pyx_t_4 = PyString_FromStringAndSize((&__pyx_v_d->c), __pyx_v_c->length); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF_SET(__pyx_v_val, __pyx_t_4); + __pyx_t_4 = 0; + goto __pyx_L12; + } + + /* "oursqlx/statement.pyx":456 + * # don't care about strings being too long, or we *do* care + * # about strings being too long and it's not too long... + * elif (self.buffered # <<<<<<<<<<<<<< + * or not self.string_limit + * or c.length <= self.string_limit): + */ + __pyx_t_2 = (__pyx_v_self->buffered != 0); + if (!__pyx_t_2) { + } else { + __pyx_t_3 = __pyx_t_2; + goto __pyx_L13_bool_binop_done; + } + + /* "oursqlx/statement.pyx":457 + * # about strings being too long and it's not too long... + * elif (self.buffered + * or not self.string_limit # <<<<<<<<<<<<<< + * or c.length <= self.string_limit): + * # First, allocate a string of the necessary length. + */ + __pyx_t_2 = ((!(__pyx_v_self->string_limit != 0)) != 0); + if (!__pyx_t_2) { + } else { + __pyx_t_3 = __pyx_t_2; + goto __pyx_L13_bool_binop_done; + } + + /* "oursqlx/statement.pyx":458 + * elif (self.buffered + * or not self.string_limit + * or c.length <= self.string_limit): # <<<<<<<<<<<<<< + * # First, allocate a string of the necessary length. + * val = PyString_FromStringAndSize(NULL, c.length) + */ + __pyx_t_2 = ((__pyx_v_c->length <= __pyx_v_self->string_limit) != 0); + __pyx_t_3 = __pyx_t_2; + __pyx_L13_bool_binop_done:; + if (__pyx_t_3) { + + /* "oursqlx/statement.pyx":460 + * or c.length <= self.string_limit): + * # First, allocate a string of the necessary length. + * val = PyString_FromStringAndSize(NULL, c.length) # <<<<<<<<<<<<<< + * # Then, fill up a MYSQL_BIND that will fetch into the + * # aforementioned string. + */ + __pyx_t_4 = PyString_FromStringAndSize(NULL, __pyx_v_c->length); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF_SET(__pyx_v_val, __pyx_t_4); + __pyx_t_4 = 0; + + /* "oursqlx/statement.pyx":463 + * # Then, fill up a MYSQL_BIND that will fetch into the + * # aforementioned string. + * memset(&b_tryagain, 0, sizeof(MYSQL_BIND)) # <<<<<<<<<<<<<< + * b_tryagain.buffer_type = MYSQL_TYPE_BLOB + * b_tryagain.buffer_length = c.length + */ + memset((&__pyx_v_b_tryagain), 0, (sizeof(MYSQL_BIND))); + + /* "oursqlx/statement.pyx":464 + * # aforementioned string. + * memset(&b_tryagain, 0, sizeof(MYSQL_BIND)) + * b_tryagain.buffer_type = MYSQL_TYPE_BLOB # <<<<<<<<<<<<<< + * b_tryagain.buffer_length = c.length + * b_tryagain.buffer = PyString_AS_STRING(val) + */ + __pyx_v_b_tryagain.buffer_type = MYSQL_TYPE_BLOB; + + /* "oursqlx/statement.pyx":465 + * memset(&b_tryagain, 0, sizeof(MYSQL_BIND)) + * b_tryagain.buffer_type = MYSQL_TYPE_BLOB + * b_tryagain.buffer_length = c.length # <<<<<<<<<<<<<< + * b_tryagain.buffer = PyString_AS_STRING(val) + * # This means that if there is still a truncation error for + */ + __pyx_t_6 = __pyx_v_c->length; + __pyx_v_b_tryagain.buffer_length = __pyx_t_6; + + /* "oursqlx/statement.pyx":466 + * b_tryagain.buffer_type = MYSQL_TYPE_BLOB + * b_tryagain.buffer_length = c.length + * b_tryagain.buffer = PyString_AS_STRING(val) # <<<<<<<<<<<<<< + * # This means that if there is still a truncation error for + * # whatever reason, something later in the function will + */ + __pyx_v_b_tryagain.buffer = PyString_AS_STRING(__pyx_v_val); + + /* "oursqlx/statement.pyx":470 + * # whatever reason, something later in the function will + * # complain. + * b_tryagain.error = &c.error # <<<<<<<<<<<<<< + * # Aaand fetch it. + * if mysql_stmt_fetch_column(self.stmt, &b_tryagain, i, 0): + */ + __pyx_v_b_tryagain.error = (&__pyx_v_c->error); + + /* "oursqlx/statement.pyx":472 + * b_tryagain.error = &c.error + * # Aaand fetch it. + * if mysql_stmt_fetch_column(self.stmt, &b_tryagain, i, 0): # <<<<<<<<<<<<<< + * self._raise_error() + * # But, if we care about the length of the string, we need to + */ + __pyx_t_3 = (__pyx_f_6oursql_mysql_stmt_fetch_column(__pyx_v_self->stmt, (&__pyx_v_b_tryagain), __pyx_v_i, 0) != 0); + if (__pyx_t_3) { + + /* "oursqlx/statement.pyx":473 + * # Aaand fetch it. + * if mysql_stmt_fetch_column(self.stmt, &b_tryagain, i, 0): + * self._raise_error() # <<<<<<<<<<<<<< + * # But, if we care about the length of the string, we need to + * # make sure we have a consistent API. + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_6oursql__Statement *)__pyx_v_self->__pyx_vtab)->_raise_error(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L16; + } + __pyx_L16:; + goto __pyx_L12; + } + __pyx_L12:; + + /* "oursqlx/statement.pyx":476 + * # But, if we care about the length of the string, we need to + * # make sure we have a consistent API. + * if self.string_limit: # <<<<<<<<<<<<<< + * # At this point, if 'val' still isn't set, it means we + * # should stream it from the database. + */ + __pyx_t_3 = (__pyx_v_self->string_limit != 0); + if (__pyx_t_3) { + + /* "oursqlx/statement.pyx":479 + * # At this point, if 'val' still isn't set, it means we + * # should stream it from the database. + * if val is None: # <<<<<<<<<<<<<< + * val = _ResultStringStream(self, i, c.length) + * c.error = False + */ + __pyx_t_3 = (__pyx_v_val == Py_None); + __pyx_t_2 = (__pyx_t_3 != 0); + if (__pyx_t_2) { + + /* "oursqlx/statement.pyx":480 + * # should stream it from the database. + * if val is None: + * val = _ResultStringStream(self, i, c.length) # <<<<<<<<<<<<<< + * c.error = False + * # Since _ResultStringStream has a file-like interface, we + */ + __pyx_t_4 = __Pyx_PyInt_From_unsigned_int(__pyx_v_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = __Pyx_PyInt_From_unsigned_long(__pyx_v_c->length); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_4 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6oursql__ResultStringStream)), __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF_SET(__pyx_v_val, __pyx_t_7); + __pyx_t_7 = 0; + + /* "oursqlx/statement.pyx":481 + * if val is None: + * val = _ResultStringStream(self, i, c.length) + * c.error = False # <<<<<<<<<<<<<< + * # Since _ResultStringStream has a file-like interface, we + * # make sure that everything passed back has a file-like + */ + __pyx_v_c->error = 0; + goto __pyx_L18; + } + /*else*/ { + + /* "oursqlx/statement.pyx":486 + * # interface. + * else: + * val = cStringIO.StringIO(val) # <<<<<<<<<<<<<< + * # And if we're decoding unicode, decode unicode in a + * # streaming fashion! + */ + __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_cStringIO); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_StringIO); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_8)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + if (!__pyx_t_8) { + __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_val); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + } else { + __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); __pyx_t_8 = NULL; + __Pyx_INCREF(__pyx_v_val); + PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_v_val); + __Pyx_GIVEREF(__pyx_v_val); + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_9, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF_SET(__pyx_v_val, __pyx_t_7); + __pyx_t_7 = 0; + } + __pyx_L18:; + + /* "oursqlx/statement.pyx":489 + * # And if we're decoding unicode, decode unicode in a + * # streaming fashion! + * if self.conn.use_unicode and not c.is_binary: # <<<<<<<<<<<<<< + * val = codecs.getreader(self.conn._charset)(val) + * else: + */ + __pyx_t_3 = (__pyx_v_self->conn->use_unicode != 0); + if (__pyx_t_3) { + } else { + __pyx_t_2 = __pyx_t_3; + goto __pyx_L20_bool_binop_done; + } + __pyx_t_3 = ((!(__pyx_v_c->is_binary != 0)) != 0); + __pyx_t_2 = __pyx_t_3; + __pyx_L20_bool_binop_done:; + if (__pyx_t_2) { + + /* "oursqlx/statement.pyx":490 + * # streaming fashion! + * if self.conn.use_unicode and not c.is_binary: + * val = codecs.getreader(self.conn._charset)(val) # <<<<<<<<<<<<<< + * else: + * # At this point, 'val' should be a string read in from the + */ + __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_codecs); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_getreader); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_8))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8); + if (likely(__pyx_t_9)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_8, function); + } + } + if (!__pyx_t_9) { + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_self->conn->_charset); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + } else { + __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); __Pyx_GIVEREF(__pyx_t_9); __pyx_t_9 = NULL; + __Pyx_INCREF(__pyx_v_self->conn->_charset); + PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_v_self->conn->_charset); + __Pyx_GIVEREF(__pyx_v_self->conn->_charset); + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_10, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + } + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_8)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + if (!__pyx_t_8) { + __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_val); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + } else { + __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); __pyx_t_8 = NULL; + __Pyx_INCREF(__pyx_v_val); + PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_v_val); + __Pyx_GIVEREF(__pyx_v_val); + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_10, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF_SET(__pyx_v_val, __pyx_t_7); + __pyx_t_7 = 0; + goto __pyx_L19; + } + __pyx_L19:; + goto __pyx_L17; + } + /*else*/ { + + /* "oursqlx/statement.pyx":495 + * # database since there's no possibility of streaming. If + * # we're handling unicode, decode it. + * if self.conn.use_unicode and not c.is_binary: # <<<<<<<<<<<<<< + * val = val.decode(self.conn._charset) + * elif c.type in (MYSQL_TYPE_DECIMAL, MYSQL_TYPE_NEWDECIMAL): + */ + __pyx_t_3 = (__pyx_v_self->conn->use_unicode != 0); + if (__pyx_t_3) { + } else { + __pyx_t_2 = __pyx_t_3; + goto __pyx_L23_bool_binop_done; + } + __pyx_t_3 = ((!(__pyx_v_c->is_binary != 0)) != 0); + __pyx_t_2 = __pyx_t_3; + __pyx_L23_bool_binop_done:; + if (__pyx_t_2) { + + /* "oursqlx/statement.pyx":496 + * # we're handling unicode, decode it. + * if self.conn.use_unicode and not c.is_binary: + * val = val.decode(self.conn._charset) # <<<<<<<<<<<<<< + * elif c.type in (MYSQL_TYPE_DECIMAL, MYSQL_TYPE_NEWDECIMAL): + * val = decimal.Decimal( + */ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_val, __pyx_n_s_decode); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_10 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_10)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_10); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + if (!__pyx_t_10) { + __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_self->conn->_charset); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + } else { + __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_10); __Pyx_GIVEREF(__pyx_t_10); __pyx_t_10 = NULL; + __Pyx_INCREF(__pyx_v_self->conn->_charset); + PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_v_self->conn->_charset); + __Pyx_GIVEREF(__pyx_v_self->conn->_charset); + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF_SET(__pyx_v_val, __pyx_t_7); + __pyx_t_7 = 0; + goto __pyx_L22; + } + __pyx_L22:; + } + __pyx_L17:; + goto __pyx_L11; + } + + /* "oursqlx/statement.pyx":497 + * if self.conn.use_unicode and not c.is_binary: + * val = val.decode(self.conn._charset) + * elif c.type in (MYSQL_TYPE_DECIMAL, MYSQL_TYPE_NEWDECIMAL): # <<<<<<<<<<<<<< + * val = decimal.Decimal( + * PyString_FromStringAndSize(d.dec, c.length)) + */ + switch (__pyx_v_c->type) { + case MYSQL_TYPE_DECIMAL: + case MYSQL_TYPE_NEWDECIMAL: + __pyx_t_2 = 1; + break; + default: + __pyx_t_2 = 0; + break; + } + __pyx_t_3 = (__pyx_t_2 != 0); + if (__pyx_t_3) { + + /* "oursqlx/statement.pyx":498 + * val = val.decode(self.conn._charset) + * elif c.type in (MYSQL_TYPE_DECIMAL, MYSQL_TYPE_NEWDECIMAL): + * val = decimal.Decimal( # <<<<<<<<<<<<<< + * PyString_FromStringAndSize(d.dec, c.length)) + * # Sometimes mysql likes to give back invalid data instead of doing + */ + __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_decimal); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_Decimal); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "oursqlx/statement.pyx":499 + * elif c.type in (MYSQL_TYPE_DECIMAL, MYSQL_TYPE_NEWDECIMAL): + * val = decimal.Decimal( + * PyString_FromStringAndSize(d.dec, c.length)) # <<<<<<<<<<<<<< + * # Sometimes mysql likes to give back invalid data instead of doing + * # anything sensible. + */ + __pyx_t_4 = PyString_FromStringAndSize(__pyx_v_d->dec, __pyx_v_c->length); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_10 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_8))) { + __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_8); + if (likely(__pyx_t_10)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); + __Pyx_INCREF(__pyx_t_10); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_8, function); + } + } + if (!__pyx_t_10) { + __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_7); + } else { + __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_10); __Pyx_GIVEREF(__pyx_t_10); __pyx_t_10 = NULL; + PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_9, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF_SET(__pyx_v_val, __pyx_t_7); + __pyx_t_7 = 0; + goto __pyx_L11; + } + + /* "oursqlx/statement.pyx":502 + * # Sometimes mysql likes to give back invalid data instead of doing + * # anything sensible. + * elif c.type in (MYSQL_TYPE_DATETIME, MYSQL_TYPE_TIMESTAMP, # <<<<<<<<<<<<<< + * MYSQL_TYPE_DATE) and d.t.year == 0: + * val = None + */ + switch (__pyx_v_c->type) { + case MYSQL_TYPE_DATETIME: + case MYSQL_TYPE_TIMESTAMP: + + /* "oursqlx/statement.pyx":503 + * # anything sensible. + * elif c.type in (MYSQL_TYPE_DATETIME, MYSQL_TYPE_TIMESTAMP, + * MYSQL_TYPE_DATE) and d.t.year == 0: # <<<<<<<<<<<<<< + * val = None + * elif c.type in (MYSQL_TYPE_DATETIME, MYSQL_TYPE_TIMESTAMP): + */ + case MYSQL_TYPE_DATE: + + /* "oursqlx/statement.pyx":502 + * # Sometimes mysql likes to give back invalid data instead of doing + * # anything sensible. + * elif c.type in (MYSQL_TYPE_DATETIME, MYSQL_TYPE_TIMESTAMP, # <<<<<<<<<<<<<< + * MYSQL_TYPE_DATE) and d.t.year == 0: + * val = None + */ + __pyx_t_2 = 1; + break; + default: + __pyx_t_2 = 0; + break; + } + __pyx_t_11 = (__pyx_t_2 != 0); + if (__pyx_t_11) { + } else { + __pyx_t_3 = __pyx_t_11; + goto __pyx_L25_bool_binop_done; + } + + /* "oursqlx/statement.pyx":503 + * # anything sensible. + * elif c.type in (MYSQL_TYPE_DATETIME, MYSQL_TYPE_TIMESTAMP, + * MYSQL_TYPE_DATE) and d.t.year == 0: # <<<<<<<<<<<<<< + * val = None + * elif c.type in (MYSQL_TYPE_DATETIME, MYSQL_TYPE_TIMESTAMP): + */ + __pyx_t_11 = ((__pyx_v_d->t.year == 0) != 0); + __pyx_t_3 = __pyx_t_11; + __pyx_L25_bool_binop_done:; + if (__pyx_t_3) { + + /* "oursqlx/statement.pyx":504 + * elif c.type in (MYSQL_TYPE_DATETIME, MYSQL_TYPE_TIMESTAMP, + * MYSQL_TYPE_DATE) and d.t.year == 0: + * val = None # <<<<<<<<<<<<<< + * elif c.type in (MYSQL_TYPE_DATETIME, MYSQL_TYPE_TIMESTAMP): + * val = datetime.datetime(d.t.year, d.t.month, d.t.day, + */ + __Pyx_INCREF(Py_None); + __Pyx_XDECREF_SET(__pyx_v_val, Py_None); + goto __pyx_L11; + } + + /* "oursqlx/statement.pyx":505 + * MYSQL_TYPE_DATE) and d.t.year == 0: + * val = None + * elif c.type in (MYSQL_TYPE_DATETIME, MYSQL_TYPE_TIMESTAMP): # <<<<<<<<<<<<<< + * val = datetime.datetime(d.t.year, d.t.month, d.t.day, + * d.t.hour, d.t.minute, d.t.second, d.t.second_part) + */ + switch (__pyx_v_c->type) { + case MYSQL_TYPE_DATETIME: + case MYSQL_TYPE_TIMESTAMP: + __pyx_t_3 = 1; + break; + default: + __pyx_t_3 = 0; + break; + } + __pyx_t_11 = (__pyx_t_3 != 0); + if (__pyx_t_11) { + + /* "oursqlx/statement.pyx":506 + * val = None + * elif c.type in (MYSQL_TYPE_DATETIME, MYSQL_TYPE_TIMESTAMP): + * val = datetime.datetime(d.t.year, d.t.month, d.t.day, # <<<<<<<<<<<<<< + * d.t.hour, d.t.minute, d.t.second, d.t.second_part) + * elif c.type == MYSQL_TYPE_DATE: + */ + __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_datetime); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_datetime); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyInt_From_unsigned_int(__pyx_v_d->t.year); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_4 = __Pyx_PyInt_From_unsigned_int(__pyx_v_d->t.month); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_10 = __Pyx_PyInt_From_unsigned_int(__pyx_v_d->t.day); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + + /* "oursqlx/statement.pyx":507 + * elif c.type in (MYSQL_TYPE_DATETIME, MYSQL_TYPE_TIMESTAMP): + * val = datetime.datetime(d.t.year, d.t.month, d.t.day, + * d.t.hour, d.t.minute, d.t.second, d.t.second_part) # <<<<<<<<<<<<<< + * elif c.type == MYSQL_TYPE_DATE: + * val = datetime.date(d.t.year, d.t.month, d.t.day) + */ + __pyx_t_12 = __Pyx_PyInt_From_unsigned_int(__pyx_v_d->t.hour); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_13 = __Pyx_PyInt_From_unsigned_int(__pyx_v_d->t.minute); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_14 = __Pyx_PyInt_From_unsigned_int(__pyx_v_d->t.second); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_15 = __Pyx_PyInt_From_unsigned_long(__pyx_v_d->t.second_part); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_16 = NULL; + __pyx_t_17 = 0; + if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_9))) { + __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_9); + if (likely(__pyx_t_16)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); + __Pyx_INCREF(__pyx_t_16); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_9, function); + __pyx_t_17 = 1; + } + } + __pyx_t_18 = PyTuple_New(7+__pyx_t_17); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + if (__pyx_t_16) { + PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_16); __Pyx_GIVEREF(__pyx_t_16); __pyx_t_16 = NULL; + } + PyTuple_SET_ITEM(__pyx_t_18, 0+__pyx_t_17, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_18, 1+__pyx_t_17, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_18, 2+__pyx_t_17, __pyx_t_10); + __Pyx_GIVEREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_18, 3+__pyx_t_17, __pyx_t_12); + __Pyx_GIVEREF(__pyx_t_12); + PyTuple_SET_ITEM(__pyx_t_18, 4+__pyx_t_17, __pyx_t_13); + __Pyx_GIVEREF(__pyx_t_13); + PyTuple_SET_ITEM(__pyx_t_18, 5+__pyx_t_17, __pyx_t_14); + __Pyx_GIVEREF(__pyx_t_14); + PyTuple_SET_ITEM(__pyx_t_18, 6+__pyx_t_17, __pyx_t_15); + __Pyx_GIVEREF(__pyx_t_15); + __pyx_t_8 = 0; + __pyx_t_4 = 0; + __pyx_t_10 = 0; + __pyx_t_12 = 0; + __pyx_t_13 = 0; + __pyx_t_14 = 0; + __pyx_t_15 = 0; + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_18, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_XDECREF_SET(__pyx_v_val, __pyx_t_7); + __pyx_t_7 = 0; + goto __pyx_L11; + } + + /* "oursqlx/statement.pyx":508 + * val = datetime.datetime(d.t.year, d.t.month, d.t.day, + * d.t.hour, d.t.minute, d.t.second, d.t.second_part) + * elif c.type == MYSQL_TYPE_DATE: # <<<<<<<<<<<<<< + * val = datetime.date(d.t.year, d.t.month, d.t.day) + * elif c.type == MYSQL_TYPE_TIME: + */ + __pyx_t_11 = ((__pyx_v_c->type == MYSQL_TYPE_DATE) != 0); + if (__pyx_t_11) { + + /* "oursqlx/statement.pyx":509 + * d.t.hour, d.t.minute, d.t.second, d.t.second_part) + * elif c.type == MYSQL_TYPE_DATE: + * val = datetime.date(d.t.year, d.t.month, d.t.day) # <<<<<<<<<<<<<< + * elif c.type == MYSQL_TYPE_TIME: + * val = datetime.time( + */ + __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_datetime); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_date); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyInt_From_unsigned_int(__pyx_v_d->t.year); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_15 = __Pyx_PyInt_From_unsigned_int(__pyx_v_d->t.month); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_14 = __Pyx_PyInt_From_unsigned_int(__pyx_v_d->t.day); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_13 = NULL; + __pyx_t_17 = 0; + if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_18))) { + __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_18); + if (likely(__pyx_t_13)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_18); + __Pyx_INCREF(__pyx_t_13); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_18, function); + __pyx_t_17 = 1; + } + } + __pyx_t_12 = PyTuple_New(3+__pyx_t_17); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + if (__pyx_t_13) { + PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_13); __Pyx_GIVEREF(__pyx_t_13); __pyx_t_13 = NULL; + } + PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_17, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_17, __pyx_t_15); + __Pyx_GIVEREF(__pyx_t_15); + PyTuple_SET_ITEM(__pyx_t_12, 2+__pyx_t_17, __pyx_t_14); + __Pyx_GIVEREF(__pyx_t_14); + __pyx_t_9 = 0; + __pyx_t_15 = 0; + __pyx_t_14 = 0; + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_18, __pyx_t_12, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __Pyx_XDECREF_SET(__pyx_v_val, __pyx_t_7); + __pyx_t_7 = 0; + goto __pyx_L11; + } + + /* "oursqlx/statement.pyx":510 + * elif c.type == MYSQL_TYPE_DATE: + * val = datetime.date(d.t.year, d.t.month, d.t.day) + * elif c.type == MYSQL_TYPE_TIME: # <<<<<<<<<<<<<< + * val = datetime.time( + * d.t.hour, d.t.minute, d.t.second, d.t.second_part) + */ + __pyx_t_11 = ((__pyx_v_c->type == MYSQL_TYPE_TIME) != 0); + if (__pyx_t_11) { + + /* "oursqlx/statement.pyx":511 + * val = datetime.date(d.t.year, d.t.month, d.t.day) + * elif c.type == MYSQL_TYPE_TIME: + * val = datetime.time( # <<<<<<<<<<<<<< + * d.t.hour, d.t.minute, d.t.second, d.t.second_part) + * elif c.type == MYSQL_TYPE_TINY: + */ + __pyx_t_18 = __Pyx_GetModuleGlobalName(__pyx_n_s_datetime); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_18, __pyx_n_s_time); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + + /* "oursqlx/statement.pyx":512 + * elif c.type == MYSQL_TYPE_TIME: + * val = datetime.time( + * d.t.hour, d.t.minute, d.t.second, d.t.second_part) # <<<<<<<<<<<<<< + * elif c.type == MYSQL_TYPE_TINY: + * if c.flags & UNSIGNED_FLAG == UNSIGNED_FLAG: + */ + __pyx_t_18 = __Pyx_PyInt_From_unsigned_int(__pyx_v_d->t.hour); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_14 = __Pyx_PyInt_From_unsigned_int(__pyx_v_d->t.minute); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_15 = __Pyx_PyInt_From_unsigned_int(__pyx_v_d->t.second); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_9 = __Pyx_PyInt_From_unsigned_long(__pyx_v_d->t.second_part); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_13 = NULL; + __pyx_t_17 = 0; + if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_12))) { + __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_12); + if (likely(__pyx_t_13)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12); + __Pyx_INCREF(__pyx_t_13); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_12, function); + __pyx_t_17 = 1; + } + } + __pyx_t_10 = PyTuple_New(4+__pyx_t_17); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + if (__pyx_t_13) { + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_13); __Pyx_GIVEREF(__pyx_t_13); __pyx_t_13 = NULL; + } + PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_17, __pyx_t_18); + __Pyx_GIVEREF(__pyx_t_18); + PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_17, __pyx_t_14); + __Pyx_GIVEREF(__pyx_t_14); + PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_17, __pyx_t_15); + __Pyx_GIVEREF(__pyx_t_15); + PyTuple_SET_ITEM(__pyx_t_10, 3+__pyx_t_17, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + __pyx_t_18 = 0; + __pyx_t_14 = 0; + __pyx_t_15 = 0; + __pyx_t_9 = 0; + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_10, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_XDECREF_SET(__pyx_v_val, __pyx_t_7); + __pyx_t_7 = 0; + goto __pyx_L11; + } + + /* "oursqlx/statement.pyx":513 + * val = datetime.time( + * d.t.hour, d.t.minute, d.t.second, d.t.second_part) + * elif c.type == MYSQL_TYPE_TINY: # <<<<<<<<<<<<<< + * if c.flags & UNSIGNED_FLAG == UNSIGNED_FLAG: + * val = PyLong_FromUnsignedLong(d.u8) + */ + __pyx_t_11 = ((__pyx_v_c->type == MYSQL_TYPE_TINY) != 0); + if (__pyx_t_11) { + + /* "oursqlx/statement.pyx":514 + * d.t.hour, d.t.minute, d.t.second, d.t.second_part) + * elif c.type == MYSQL_TYPE_TINY: + * if c.flags & UNSIGNED_FLAG == UNSIGNED_FLAG: # <<<<<<<<<<<<<< + * val = PyLong_FromUnsignedLong(d.u8) + * else: + */ + __pyx_t_11 = (((__pyx_v_c->flags & UNSIGNED_FLAG) == UNSIGNED_FLAG) != 0); + if (__pyx_t_11) { + + /* "oursqlx/statement.pyx":515 + * elif c.type == MYSQL_TYPE_TINY: + * if c.flags & UNSIGNED_FLAG == UNSIGNED_FLAG: + * val = PyLong_FromUnsignedLong(d.u8) # <<<<<<<<<<<<<< + * else: + * val = PyLong_FromLong(d.s8) + */ + __pyx_t_7 = PyLong_FromUnsignedLong(__pyx_v_d->u8); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_XDECREF_SET(__pyx_v_val, __pyx_t_7); + __pyx_t_7 = 0; + goto __pyx_L27; + } + /*else*/ { + + /* "oursqlx/statement.pyx":517 + * val = PyLong_FromUnsignedLong(d.u8) + * else: + * val = PyLong_FromLong(d.s8) # <<<<<<<<<<<<<< + * elif c.type in (MYSQL_TYPE_SHORT, MYSQL_TYPE_YEAR): + * if c.flags & UNSIGNED_FLAG == UNSIGNED_FLAG: + */ + __pyx_t_7 = PyLong_FromLong(__pyx_v_d->s8); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_XDECREF_SET(__pyx_v_val, __pyx_t_7); + __pyx_t_7 = 0; + } + __pyx_L27:; + goto __pyx_L11; + } + + /* "oursqlx/statement.pyx":518 + * else: + * val = PyLong_FromLong(d.s8) + * elif c.type in (MYSQL_TYPE_SHORT, MYSQL_TYPE_YEAR): # <<<<<<<<<<<<<< + * if c.flags & UNSIGNED_FLAG == UNSIGNED_FLAG: + * val = PyLong_FromUnsignedLong(d.u16) + */ + switch (__pyx_v_c->type) { + case MYSQL_TYPE_SHORT: + case MYSQL_TYPE_YEAR: + __pyx_t_11 = 1; + break; + default: + __pyx_t_11 = 0; + break; + } + __pyx_t_3 = (__pyx_t_11 != 0); + if (__pyx_t_3) { + + /* "oursqlx/statement.pyx":519 + * val = PyLong_FromLong(d.s8) + * elif c.type in (MYSQL_TYPE_SHORT, MYSQL_TYPE_YEAR): + * if c.flags & UNSIGNED_FLAG == UNSIGNED_FLAG: # <<<<<<<<<<<<<< + * val = PyLong_FromUnsignedLong(d.u16) + * else: + */ + __pyx_t_3 = (((__pyx_v_c->flags & UNSIGNED_FLAG) == UNSIGNED_FLAG) != 0); + if (__pyx_t_3) { + + /* "oursqlx/statement.pyx":520 + * elif c.type in (MYSQL_TYPE_SHORT, MYSQL_TYPE_YEAR): + * if c.flags & UNSIGNED_FLAG == UNSIGNED_FLAG: + * val = PyLong_FromUnsignedLong(d.u16) # <<<<<<<<<<<<<< + * else: + * val = PyLong_FromLong(d.s16) + */ + __pyx_t_7 = PyLong_FromUnsignedLong(__pyx_v_d->u16); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_XDECREF_SET(__pyx_v_val, __pyx_t_7); + __pyx_t_7 = 0; + goto __pyx_L28; + } + /*else*/ { + + /* "oursqlx/statement.pyx":522 + * val = PyLong_FromUnsignedLong(d.u16) + * else: + * val = PyLong_FromLong(d.s16) # <<<<<<<<<<<<<< + * elif c.type in (MYSQL_TYPE_LONG, MYSQL_TYPE_INT24): + * if c.flags & UNSIGNED_FLAG == UNSIGNED_FLAG: + */ + __pyx_t_7 = PyLong_FromLong(__pyx_v_d->s16); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_XDECREF_SET(__pyx_v_val, __pyx_t_7); + __pyx_t_7 = 0; + } + __pyx_L28:; + goto __pyx_L11; + } + + /* "oursqlx/statement.pyx":523 + * else: + * val = PyLong_FromLong(d.s16) + * elif c.type in (MYSQL_TYPE_LONG, MYSQL_TYPE_INT24): # <<<<<<<<<<<<<< + * if c.flags & UNSIGNED_FLAG == UNSIGNED_FLAG: + * val = PyLong_FromUnsignedLong(d.u32) + */ + switch (__pyx_v_c->type) { + case MYSQL_TYPE_LONG: + case MYSQL_TYPE_INT24: + __pyx_t_3 = 1; + break; + default: + __pyx_t_3 = 0; + break; + } + __pyx_t_11 = (__pyx_t_3 != 0); + if (__pyx_t_11) { + + /* "oursqlx/statement.pyx":524 + * val = PyLong_FromLong(d.s16) + * elif c.type in (MYSQL_TYPE_LONG, MYSQL_TYPE_INT24): + * if c.flags & UNSIGNED_FLAG == UNSIGNED_FLAG: # <<<<<<<<<<<<<< + * val = PyLong_FromUnsignedLong(d.u32) + * else: + */ + __pyx_t_11 = (((__pyx_v_c->flags & UNSIGNED_FLAG) == UNSIGNED_FLAG) != 0); + if (__pyx_t_11) { + + /* "oursqlx/statement.pyx":525 + * elif c.type in (MYSQL_TYPE_LONG, MYSQL_TYPE_INT24): + * if c.flags & UNSIGNED_FLAG == UNSIGNED_FLAG: + * val = PyLong_FromUnsignedLong(d.u32) # <<<<<<<<<<<<<< + * else: + * val = PyLong_FromLong(d.s32) + */ + __pyx_t_7 = PyLong_FromUnsignedLong(__pyx_v_d->u32); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_XDECREF_SET(__pyx_v_val, __pyx_t_7); + __pyx_t_7 = 0; + goto __pyx_L29; + } + /*else*/ { + + /* "oursqlx/statement.pyx":527 + * val = PyLong_FromUnsignedLong(d.u32) + * else: + * val = PyLong_FromLong(d.s32) # <<<<<<<<<<<<<< + * elif c.type == MYSQL_TYPE_LONGLONG: + * if c.flags & UNSIGNED_FLAG == UNSIGNED_FLAG: + */ + __pyx_t_7 = PyLong_FromLong(__pyx_v_d->s32); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_XDECREF_SET(__pyx_v_val, __pyx_t_7); + __pyx_t_7 = 0; + } + __pyx_L29:; + goto __pyx_L11; + } + + /* "oursqlx/statement.pyx":528 + * else: + * val = PyLong_FromLong(d.s32) + * elif c.type == MYSQL_TYPE_LONGLONG: # <<<<<<<<<<<<<< + * if c.flags & UNSIGNED_FLAG == UNSIGNED_FLAG: + * val = PyLong_FromUnsignedLongLong(d.u64) + */ + __pyx_t_11 = ((__pyx_v_c->type == MYSQL_TYPE_LONGLONG) != 0); + if (__pyx_t_11) { + + /* "oursqlx/statement.pyx":529 + * val = PyLong_FromLong(d.s32) + * elif c.type == MYSQL_TYPE_LONGLONG: + * if c.flags & UNSIGNED_FLAG == UNSIGNED_FLAG: # <<<<<<<<<<<<<< + * val = PyLong_FromUnsignedLongLong(d.u64) + * else: + */ + __pyx_t_11 = (((__pyx_v_c->flags & UNSIGNED_FLAG) == UNSIGNED_FLAG) != 0); + if (__pyx_t_11) { + + /* "oursqlx/statement.pyx":530 + * elif c.type == MYSQL_TYPE_LONGLONG: + * if c.flags & UNSIGNED_FLAG == UNSIGNED_FLAG: + * val = PyLong_FromUnsignedLongLong(d.u64) # <<<<<<<<<<<<<< + * else: + * val = PyLong_FromLongLong(d.s64) + */ + __pyx_t_7 = PyLong_FromUnsignedLongLong(__pyx_v_d->u64); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_XDECREF_SET(__pyx_v_val, __pyx_t_7); + __pyx_t_7 = 0; + goto __pyx_L30; + } + /*else*/ { + + /* "oursqlx/statement.pyx":532 + * val = PyLong_FromUnsignedLongLong(d.u64) + * else: + * val = PyLong_FromLongLong(d.s64) # <<<<<<<<<<<<<< + * elif c.type == MYSQL_TYPE_FLOAT: + * val = d.f + */ + __pyx_t_7 = PyLong_FromLongLong(__pyx_v_d->s64); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_XDECREF_SET(__pyx_v_val, __pyx_t_7); + __pyx_t_7 = 0; + } + __pyx_L30:; + goto __pyx_L11; + } + + /* "oursqlx/statement.pyx":533 + * else: + * val = PyLong_FromLongLong(d.s64) + * elif c.type == MYSQL_TYPE_FLOAT: # <<<<<<<<<<<<<< + * val = d.f + * elif c.type == MYSQL_TYPE_DOUBLE: + */ + __pyx_t_11 = ((__pyx_v_c->type == MYSQL_TYPE_FLOAT) != 0); + if (__pyx_t_11) { + + /* "oursqlx/statement.pyx":534 + * val = PyLong_FromLongLong(d.s64) + * elif c.type == MYSQL_TYPE_FLOAT: + * val = d.f # <<<<<<<<<<<<<< + * elif c.type == MYSQL_TYPE_DOUBLE: + * val = d.d + */ + __pyx_t_7 = PyFloat_FromDouble(__pyx_v_d->f); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 534; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_XDECREF_SET(__pyx_v_val, __pyx_t_7); + __pyx_t_7 = 0; + goto __pyx_L11; + } + + /* "oursqlx/statement.pyx":535 + * elif c.type == MYSQL_TYPE_FLOAT: + * val = d.f + * elif c.type == MYSQL_TYPE_DOUBLE: # <<<<<<<<<<<<<< + * val = d.d + * elif c.type == MYSQL_TYPE_BIT: + */ + __pyx_t_11 = ((__pyx_v_c->type == MYSQL_TYPE_DOUBLE) != 0); + if (__pyx_t_11) { + + /* "oursqlx/statement.pyx":536 + * val = d.f + * elif c.type == MYSQL_TYPE_DOUBLE: + * val = d.d # <<<<<<<<<<<<<< + * elif c.type == MYSQL_TYPE_BIT: + * # Bitfields column come variable-length and always in big- + */ + __pyx_t_7 = PyFloat_FromDouble(__pyx_v_d->d); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_XDECREF_SET(__pyx_v_val, __pyx_t_7); + __pyx_t_7 = 0; + goto __pyx_L11; + } + + /* "oursqlx/statement.pyx":537 + * elif c.type == MYSQL_TYPE_DOUBLE: + * val = d.d + * elif c.type == MYSQL_TYPE_BIT: # <<<<<<<<<<<<<< + * # Bitfields column come variable-length and always in big- + * # endian format. Convert it to an int instead of passing back + */ + __pyx_t_11 = ((__pyx_v_c->type == MYSQL_TYPE_BIT) != 0); + if (__pyx_t_11) { + + /* "oursqlx/statement.pyx":542 + * # a string that people would probably be converting to ints + * # anyway. + * val = bitval_from_char_p(&d.c, c.length) # <<<<<<<<<<<<<< + * else: + * val = PyString_FromStringAndSize(&d.c, c.length) + */ + __pyx_t_7 = __Pyx_PyInt_From_unsigned_long(__pyx_f_6oursql_bitval_from_char_p(((unsigned char *)(&__pyx_v_d->c)), __pyx_v_c->length)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_XDECREF_SET(__pyx_v_val, __pyx_t_7); + __pyx_t_7 = 0; + goto __pyx_L11; + } + /*else*/ { + + /* "oursqlx/statement.pyx":544 + * val = bitval_from_char_p(&d.c, c.length) + * else: + * val = PyString_FromStringAndSize(&d.c, c.length) # <<<<<<<<<<<<<< + * PyErr_WarnEx(Warning, "unknown column returned as string", 1) + * if c.error: + */ + __pyx_t_7 = PyString_FromStringAndSize((&__pyx_v_d->c), __pyx_v_c->length); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_XDECREF_SET(__pyx_v_val, __pyx_t_7); + __pyx_t_7 = 0; + + /* "oursqlx/statement.pyx":545 + * else: + * val = PyString_FromStringAndSize(&d.c, c.length) + * PyErr_WarnEx(Warning, "unknown column returned as string", 1) # <<<<<<<<<<<<<< + * if c.error: + * # This *shouldn't* ever happen. + */ + __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_Warning); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = PyErr_WarnEx(__pyx_t_7, __pyx_k_unknown_column_returned_as_strin, 1); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } + __pyx_L11:; + + /* "oursqlx/statement.pyx":546 + * val = PyString_FromStringAndSize(&d.c, c.length) + * PyErr_WarnEx(Warning, "unknown column returned as string", 1) + * if c.error: # <<<<<<<<<<<<<< + * # This *shouldn't* ever happen. + * raise InterfaceError('truncated column %d, type %d' % ( + */ + __pyx_t_11 = (__pyx_v_c->error != 0); + if (__pyx_t_11) { + + /* "oursqlx/statement.pyx":548 + * if c.error: + * # This *shouldn't* ever happen. + * raise InterfaceError('truncated column %d, type %d' % ( # <<<<<<<<<<<<<< + * i, c.type)) + * Py_INCREF(val) + */ + __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s_InterfaceError); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + + /* "oursqlx/statement.pyx":549 + * # This *shouldn't* ever happen. + * raise InterfaceError('truncated column %d, type %d' % ( + * i, c.type)) # <<<<<<<<<<<<<< + * Py_INCREF(val) + * PyTuple_SET_ITEM(ret, i, val) + */ + __pyx_t_10 = __Pyx_PyInt_From_unsigned_int(__pyx_v_i); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_9 = PyInt_FromLong(__pyx_v_c->type); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_15 = PyTuple_New(2); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_10); + __Pyx_GIVEREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + __pyx_t_10 = 0; + __pyx_t_9 = 0; + + /* "oursqlx/statement.pyx":548 + * if c.error: + * # This *shouldn't* ever happen. + * raise InterfaceError('truncated column %d, type %d' % ( # <<<<<<<<<<<<<< + * i, c.type)) + * Py_INCREF(val) + */ + __pyx_t_9 = __Pyx_PyString_Format(__pyx_kp_s_truncated_column_d_type_d, __pyx_t_15); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __pyx_t_15 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_12))) { + __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_12); + if (likely(__pyx_t_15)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12); + __Pyx_INCREF(__pyx_t_15); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_12, function); + } + } + if (!__pyx_t_15) { + __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_9); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_GOTREF(__pyx_t_7); + } else { + __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_15); __Pyx_GIVEREF(__pyx_t_15); __pyx_t_15 = NULL; + PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + __pyx_t_9 = 0; + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_10, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + } + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_Raise(__pyx_t_7, 0, 0, 0); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + {__pyx_filename = __pyx_f[4]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + + /* "oursqlx/statement.pyx":550 + * raise InterfaceError('truncated column %d, type %d' % ( + * i, c.type)) + * Py_INCREF(val) # <<<<<<<<<<<<<< + * PyTuple_SET_ITEM(ret, i, val) + * return ret + */ + Py_INCREF(__pyx_v_val); + + /* "oursqlx/statement.pyx":551 + * i, c.type)) + * Py_INCREF(val) + * PyTuple_SET_ITEM(ret, i, val) # <<<<<<<<<<<<<< + * return ret + * + */ + PyTuple_SET_ITEM(__pyx_v_ret, __pyx_v_i, __pyx_v_val); + } + + /* "oursqlx/statement.pyx":552 + * Py_INCREF(val) + * PyTuple_SET_ITEM(ret, i, val) + * return ret # <<<<<<<<<<<<<< + * + * def fetchall(self): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_ret); + __pyx_r = __pyx_v_ret; + goto __pyx_L0; + + /* "oursqlx/statement.pyx":413 + * PyMem_Free(buf) + * + * def fetchone(self): # <<<<<<<<<<<<<< + * cdef MYSQL_BIND b_tryagain + * cdef column_output *c + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_XDECREF(__pyx_t_13); + __Pyx_XDECREF(__pyx_t_14); + __Pyx_XDECREF(__pyx_t_15); + __Pyx_XDECREF(__pyx_t_16); + __Pyx_XDECREF(__pyx_t_18); + __Pyx_AddTraceback("oursql._Statement.fetchone", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_ret); + __Pyx_XDECREF(__pyx_v_val); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/statement.pyx":554 + * return ret + * + * def fetchall(self): # <<<<<<<<<<<<<< + * # buffer_results() calls _check_closed() + * self.buffer_results() + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_10_Statement_13fetchall(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6oursql_10_Statement_13fetchall(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("fetchall (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_10_Statement_12fetchall(((struct __pyx_obj_6oursql__Statement *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_10_Statement_12fetchall(struct __pyx_obj_6oursql__Statement *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("fetchall", 0); + + /* "oursqlx/statement.pyx":556 + * def fetchall(self): + * # buffer_results() calls _check_closed() + * self.buffer_results() # <<<<<<<<<<<<<< + * return PySequence_List(self) + * + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_buffer_results); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "oursqlx/statement.pyx":557 + * # buffer_results() calls _check_closed() + * self.buffer_results() + * return PySequence_List(self) # <<<<<<<<<<<<<< + * + * def buffer_results(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PySequence_List(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "oursqlx/statement.pyx":554 + * return ret + * + * def fetchall(self): # <<<<<<<<<<<<<< + * # buffer_results() calls _check_closed() + * self.buffer_results() + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("oursql._Statement.fetchall", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/statement.pyx":559 + * return PySequence_List(self) + * + * def buffer_results(self): # <<<<<<<<<<<<<< + * self._check_closed() + * if not self.buffered: + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_10_Statement_15buffer_results(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6oursql_10_Statement_15buffer_results(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("buffer_results (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_10_Statement_14buffer_results(((struct __pyx_obj_6oursql__Statement *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_10_Statement_14buffer_results(struct __pyx_obj_6oursql__Statement *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("buffer_results", 0); + + /* "oursqlx/statement.pyx":560 + * + * def buffer_results(self): + * self._check_closed() # <<<<<<<<<<<<<< + * if not self.buffered: + * if mysql_stmt_store_result(self.stmt): + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_6oursql__Statement *)__pyx_v_self->__pyx_vtab)->_check_closed(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "oursqlx/statement.pyx":561 + * def buffer_results(self): + * self._check_closed() + * if not self.buffered: # <<<<<<<<<<<<<< + * if mysql_stmt_store_result(self.stmt): + * self._raise_error() + */ + __pyx_t_2 = ((!(__pyx_v_self->buffered != 0)) != 0); + if (__pyx_t_2) { + + /* "oursqlx/statement.pyx":562 + * self._check_closed() + * if not self.buffered: + * if mysql_stmt_store_result(self.stmt): # <<<<<<<<<<<<<< + * self._raise_error() + * self.buffered = True + */ + __pyx_t_2 = (__pyx_f_6oursql_mysql_stmt_store_result(__pyx_v_self->stmt) != 0); + if (__pyx_t_2) { + + /* "oursqlx/statement.pyx":563 + * if not self.buffered: + * if mysql_stmt_store_result(self.stmt): + * self._raise_error() # <<<<<<<<<<<<<< + * self.buffered = True + * + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_6oursql__Statement *)__pyx_v_self->__pyx_vtab)->_raise_error(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L4; + } + __pyx_L4:; + + /* "oursqlx/statement.pyx":564 + * if mysql_stmt_store_result(self.stmt): + * self._raise_error() + * self.buffered = True # <<<<<<<<<<<<<< + * + * def nextset(self): + */ + __pyx_v_self->buffered = 1; + goto __pyx_L3; + } + __pyx_L3:; + + /* "oursqlx/statement.pyx":559 + * return PySequence_List(self) + * + * def buffer_results(self): # <<<<<<<<<<<<<< + * self._check_closed() + * if not self.buffered: + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("oursql._Statement.buffer_results", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/statement.pyx":566 + * self.buffered = True + * + * def nextset(self): # <<<<<<<<<<<<<< + * return False + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_10_Statement_17nextset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6oursql_10_Statement_17nextset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("nextset (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_10_Statement_16nextset(((struct __pyx_obj_6oursql__Statement *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_10_Statement_16nextset(CYTHON_UNUSED struct __pyx_obj_6oursql__Statement *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("nextset", 0); + + /* "oursqlx/statement.pyx":567 + * + * def nextset(self): + * return False # <<<<<<<<<<<<<< + * + * def __iter__(self): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_False); + __pyx_r = Py_False; + goto __pyx_L0; + + /* "oursqlx/statement.pyx":566 + * self.buffered = True + * + * def nextset(self): # <<<<<<<<<<<<<< + * return False + * + */ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/statement.pyx":569 + * return False + * + * def __iter__(self): # <<<<<<<<<<<<<< + * self._check_closed() + * return PyCallIter_New(self.fetchone, None) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_10_Statement_19__iter__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6oursql_10_Statement_19__iter__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_10_Statement_18__iter__(((struct __pyx_obj_6oursql__Statement *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_10_Statement_18__iter__(struct __pyx_obj_6oursql__Statement *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__iter__", 0); + + /* "oursqlx/statement.pyx":570 + * + * def __iter__(self): + * self._check_closed() # <<<<<<<<<<<<<< + * return PyCallIter_New(self.fetchone, None) + * + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_6oursql__Statement *)__pyx_v_self->__pyx_vtab)->_check_closed(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "oursqlx/statement.pyx":571 + * def __iter__(self): + * self._check_closed() + * return PyCallIter_New(self.fetchone, None) # <<<<<<<<<<<<<< + * + * property rowcount: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_fetchone); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyCallIter_New(__pyx_t_2, Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "oursqlx/statement.pyx":569 + * return False + * + * def __iter__(self): # <<<<<<<<<<<<<< + * self._check_closed() + * return PyCallIter_New(self.fetchone, None) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("oursql._Statement.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/statement.pyx":574 + * + * property rowcount: + * def __get__(self): # <<<<<<<<<<<<<< + * cdef my_ulonglong res + * self._check_closed() + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_10_Statement_8rowcount_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6oursql_10_Statement_8rowcount_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_10_Statement_8rowcount___get__(((struct __pyx_obj_6oursql__Statement *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_10_Statement_8rowcount___get__(struct __pyx_obj_6oursql__Statement *__pyx_v_self) { + my_ulonglong __pyx_v_res; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "oursqlx/statement.pyx":576 + * def __get__(self): + * cdef my_ulonglong res + * self._check_closed() # <<<<<<<<<<<<<< + * res = mysql_stmt_affected_rows(self.stmt) + * if res == ull_negone: + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_6oursql__Statement *)__pyx_v_self->__pyx_vtab)->_check_closed(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "oursqlx/statement.pyx":577 + * cdef my_ulonglong res + * self._check_closed() + * res = mysql_stmt_affected_rows(self.stmt) # <<<<<<<<<<<<<< + * if res == ull_negone: + * return -1 + */ + __pyx_v_res = mysql_stmt_affected_rows(__pyx_v_self->stmt); + + /* "oursqlx/statement.pyx":578 + * self._check_closed() + * res = mysql_stmt_affected_rows(self.stmt) + * if res == ull_negone: # <<<<<<<<<<<<<< + * return -1 + * else: + */ + __pyx_t_2 = ((__pyx_v_res == __pyx_v_6oursql_ull_negone) != 0); + if (__pyx_t_2) { + + /* "oursqlx/statement.pyx":579 + * res = mysql_stmt_affected_rows(self.stmt) + * if res == ull_negone: + * return -1 # <<<<<<<<<<<<<< + * else: + * return res + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_int_neg_1); + __pyx_r = __pyx_int_neg_1; + goto __pyx_L0; + } + /*else*/ { + + /* "oursqlx/statement.pyx":581 + * return -1 + * else: + * return res # <<<<<<<<<<<<<< + * + * property lastrowid: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = __Pyx_PyInt_From_my_ulonglong(__pyx_v_res); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + } + + /* "oursqlx/statement.pyx":574 + * + * property rowcount: + * def __get__(self): # <<<<<<<<<<<<<< + * cdef my_ulonglong res + * self._check_closed() + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("oursql._Statement.rowcount.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/statement.pyx":584 + * + * property lastrowid: + * def __get__(self): # <<<<<<<<<<<<<< + * cdef my_ulonglong res + * self._check_closed() + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_10_Statement_9lastrowid_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6oursql_10_Statement_9lastrowid_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_10_Statement_9lastrowid___get__(((struct __pyx_obj_6oursql__Statement *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_10_Statement_9lastrowid___get__(struct __pyx_obj_6oursql__Statement *__pyx_v_self) { + my_ulonglong __pyx_v_res; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "oursqlx/statement.pyx":586 + * def __get__(self): + * cdef my_ulonglong res + * self._check_closed() # <<<<<<<<<<<<<< + * res = mysql_stmt_insert_id(self.stmt) + * if res == 0: + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_6oursql__Statement *)__pyx_v_self->__pyx_vtab)->_check_closed(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 586; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "oursqlx/statement.pyx":587 + * cdef my_ulonglong res + * self._check_closed() + * res = mysql_stmt_insert_id(self.stmt) # <<<<<<<<<<<<<< + * if res == 0: + * return None + */ + __pyx_v_res = mysql_stmt_insert_id(__pyx_v_self->stmt); + + /* "oursqlx/statement.pyx":588 + * self._check_closed() + * res = mysql_stmt_insert_id(self.stmt) + * if res == 0: # <<<<<<<<<<<<<< + * return None + * else: + */ + __pyx_t_2 = ((__pyx_v_res == 0) != 0); + if (__pyx_t_2) { + + /* "oursqlx/statement.pyx":589 + * res = mysql_stmt_insert_id(self.stmt) + * if res == 0: + * return None # <<<<<<<<<<<<<< + * else: + * return res + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + } + /*else*/ { + + /* "oursqlx/statement.pyx":591 + * return None + * else: + * return res # <<<<<<<<<<<<<< + * + * property prefetch_rows: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = __Pyx_PyInt_From_my_ulonglong(__pyx_v_res); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + } + + /* "oursqlx/statement.pyx":584 + * + * property lastrowid: + * def __get__(self): # <<<<<<<<<<<<<< + * cdef my_ulonglong res + * self._check_closed() + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("oursql._Statement.lastrowid.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/statement.pyx":594 + * + * property prefetch_rows: + * def __get__(self): # <<<<<<<<<<<<<< + * return self._prefetch_rows + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_10_Statement_13prefetch_rows_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6oursql_10_Statement_13prefetch_rows_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_10_Statement_13prefetch_rows___get__(((struct __pyx_obj_6oursql__Statement *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_10_Statement_13prefetch_rows___get__(struct __pyx_obj_6oursql__Statement *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "oursqlx/statement.pyx":595 + * property prefetch_rows: + * def __get__(self): + * return self._prefetch_rows # <<<<<<<<<<<<<< + * + * def __set__(self, unsigned long value): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_From_unsigned_long(__pyx_v_self->_prefetch_rows); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "oursqlx/statement.pyx":594 + * + * property prefetch_rows: + * def __get__(self): # <<<<<<<<<<<<<< + * return self._prefetch_rows + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("oursql._Statement.prefetch_rows.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/statement.pyx":597 + * return self._prefetch_rows + * + * def __set__(self, unsigned long value): # <<<<<<<<<<<<<< + * if value < 1: + * raise ValueError('must prefetch at least 1 row') + */ + +/* Python wrapper */ +static int __pyx_pw_6oursql_10_Statement_13prefetch_rows_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_value); /*proto*/ +static int __pyx_pw_6oursql_10_Statement_13prefetch_rows_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_value) { + unsigned long __pyx_v_value; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + assert(__pyx_arg_value); { + __pyx_v_value = __Pyx_PyInt_As_unsigned_long(__pyx_arg_value); if (unlikely((__pyx_v_value == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("oursql._Statement.prefetch_rows.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6oursql_10_Statement_13prefetch_rows_2__set__(((struct __pyx_obj_6oursql__Statement *)__pyx_v_self), ((unsigned long)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6oursql_10_Statement_13prefetch_rows_2__set__(struct __pyx_obj_6oursql__Statement *__pyx_v_self, unsigned long __pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + + /* "oursqlx/statement.pyx":598 + * + * def __set__(self, unsigned long value): + * if value < 1: # <<<<<<<<<<<<<< + * raise ValueError('must prefetch at least 1 row') + * self._prefetch_rows = value + */ + __pyx_t_1 = ((__pyx_v_value < 1) != 0); + if (__pyx_t_1) { + + /* "oursqlx/statement.pyx":599 + * def __set__(self, unsigned long value): + * if value < 1: + * raise ValueError('must prefetch at least 1 row') # <<<<<<<<<<<<<< + * self._prefetch_rows = value + * if _oursqlx_stmt_set_prefetch_rows(self.stmt, + */ + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[4]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + + /* "oursqlx/statement.pyx":600 + * if value < 1: + * raise ValueError('must prefetch at least 1 row') + * self._prefetch_rows = value # <<<<<<<<<<<<<< + * if _oursqlx_stmt_set_prefetch_rows(self.stmt, + * &self._prefetch_rows): + */ + __pyx_v_self->_prefetch_rows = __pyx_v_value; + + /* "oursqlx/statement.pyx":601 + * raise ValueError('must prefetch at least 1 row') + * self._prefetch_rows = value + * if _oursqlx_stmt_set_prefetch_rows(self.stmt, # <<<<<<<<<<<<<< + * &self._prefetch_rows): + * self._raise_error() + */ + __pyx_t_1 = (_oursqlx_stmt_set_prefetch_rows(__pyx_v_self->stmt, (&__pyx_v_self->_prefetch_rows)) != 0); + if (__pyx_t_1) { + + /* "oursqlx/statement.pyx":603 + * if _oursqlx_stmt_set_prefetch_rows(self.stmt, + * &self._prefetch_rows): + * self._raise_error() # <<<<<<<<<<<<<< + * + * _DictStatement = type('_DictStatement', (_DictWhateverMixin, _Statement), + */ + __pyx_t_3 = ((struct __pyx_vtabstruct_6oursql__Statement *)__pyx_v_self->__pyx_vtab)->_raise_error(__pyx_v_self); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L4; + } + __pyx_L4:; + + /* "oursqlx/statement.pyx":597 + * return self._prefetch_rows + * + * def __set__(self, unsigned long value): # <<<<<<<<<<<<<< + * if value < 1: + * raise ValueError('must prefetch at least 1 row') + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("oursql._Statement.prefetch_rows.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/statement.pyx":99 + * cdef int buffered, data_waiting, show_table, exhausted + * cdef Connection conn + * cdef public object warnings # <<<<<<<<<<<<<< + * + * def __cinit__(self, Connection connection not None, + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_10_Statement_8warnings_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6oursql_10_Statement_8warnings_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_10_Statement_8warnings___get__(((struct __pyx_obj_6oursql__Statement *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_10_Statement_8warnings___get__(struct __pyx_obj_6oursql__Statement *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->warnings); + __pyx_r = __pyx_v_self->warnings; + goto __pyx_L0; + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6oursql_10_Statement_8warnings_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_6oursql_10_Statement_8warnings_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_10_Statement_8warnings_2__set__(((struct __pyx_obj_6oursql__Statement *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6oursql_10_Statement_8warnings_2__set__(struct __pyx_obj_6oursql__Statement *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__", 0); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->warnings); + __Pyx_DECREF(__pyx_v_self->warnings); + __pyx_v_self->warnings = __pyx_v_value; + + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6oursql_10_Statement_8warnings_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_6oursql_10_Statement_8warnings_5__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_10_Statement_8warnings_4__del__(((struct __pyx_obj_6oursql__Statement *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6oursql_10_Statement_8warnings_4__del__(struct __pyx_obj_6oursql__Statement *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->warnings); + __Pyx_DECREF(__pyx_v_self->warnings); + __pyx_v_self->warnings = Py_None; + + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/statement.pyx":624 + * cdef int done + * + * def __cinit__(self, _Statement stmt not None, unsigned int index, # <<<<<<<<<<<<<< + * unsigned int length): + * self.stmt = stmt + */ + +/* Python wrapper */ +static int __pyx_pw_6oursql_19_ResultStringStream_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_6oursql_19_ResultStringStream_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_6oursql__Statement *__pyx_v_stmt = 0; + unsigned int __pyx_v_index; + unsigned int __pyx_v_length; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_stmt,&__pyx_n_s_index,&__pyx_n_s_length,0}; + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_stmt)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_index)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_length)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + } + __pyx_v_stmt = ((struct __pyx_obj_6oursql__Statement *)values[0]); + __pyx_v_index = __Pyx_PyInt_As_unsigned_int(values[1]); if (unlikely((__pyx_v_index == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_length = __Pyx_PyInt_As_unsigned_int(values[2]); if (unlikely((__pyx_v_length == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("oursql._ResultStringStream.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_stmt), __pyx_ptype_6oursql__Statement, 0, "stmt", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_6oursql_19_ResultStringStream___cinit__(((struct __pyx_obj_6oursql__ResultStringStream *)__pyx_v_self), __pyx_v_stmt, __pyx_v_index, __pyx_v_length); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6oursql_19_ResultStringStream___cinit__(struct __pyx_obj_6oursql__ResultStringStream *__pyx_v_self, struct __pyx_obj_6oursql__Statement *__pyx_v_stmt, unsigned int __pyx_v_index, unsigned int __pyx_v_length) { + int __pyx_r; + __Pyx_RefNannyDeclarations + unsigned int __pyx_t_1; + __Pyx_RefNannySetupContext("__cinit__", 0); + + /* "oursqlx/statement.pyx":626 + * def __cinit__(self, _Statement stmt not None, unsigned int index, + * unsigned int length): + * self.stmt = stmt # <<<<<<<<<<<<<< + * self.stmt_fetched = stmt.fetched + * self.index = index + */ + __Pyx_INCREF(((PyObject *)__pyx_v_stmt)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_stmt)); + __Pyx_GOTREF(__pyx_v_self->stmt); + __Pyx_DECREF(((PyObject *)__pyx_v_self->stmt)); + __pyx_v_self->stmt = __pyx_v_stmt; + + /* "oursqlx/statement.pyx":627 + * unsigned int length): + * self.stmt = stmt + * self.stmt_fetched = stmt.fetched # <<<<<<<<<<<<<< + * self.index = index + * self.length = length + */ + __pyx_t_1 = __pyx_v_stmt->fetched; + __pyx_v_self->stmt_fetched = __pyx_t_1; + + /* "oursqlx/statement.pyx":628 + * self.stmt = stmt + * self.stmt_fetched = stmt.fetched + * self.index = index # <<<<<<<<<<<<<< + * self.length = length + * self.offset = 0 + */ + __pyx_v_self->index = __pyx_v_index; + + /* "oursqlx/statement.pyx":629 + * self.stmt_fetched = stmt.fetched + * self.index = index + * self.length = length # <<<<<<<<<<<<<< + * self.offset = 0 + * memset(&self.bind, 0, sizeof(MYSQL_BIND)) + */ + __pyx_v_self->length = __pyx_v_length; + + /* "oursqlx/statement.pyx":630 + * self.index = index + * self.length = length + * self.offset = 0 # <<<<<<<<<<<<<< + * memset(&self.bind, 0, sizeof(MYSQL_BIND)) + * self.bind.buffer_type = MYSQL_TYPE_BLOB + */ + __pyx_v_self->offset = 0; + + /* "oursqlx/statement.pyx":631 + * self.length = length + * self.offset = 0 + * memset(&self.bind, 0, sizeof(MYSQL_BIND)) # <<<<<<<<<<<<<< + * self.bind.buffer_type = MYSQL_TYPE_BLOB + * self.bind.length = &self.length + */ + memset((&__pyx_v_self->bind), 0, (sizeof(MYSQL_BIND))); + + /* "oursqlx/statement.pyx":632 + * self.offset = 0 + * memset(&self.bind, 0, sizeof(MYSQL_BIND)) + * self.bind.buffer_type = MYSQL_TYPE_BLOB # <<<<<<<<<<<<<< + * self.bind.length = &self.length + * self.done = False + */ + __pyx_v_self->bind.buffer_type = MYSQL_TYPE_BLOB; + + /* "oursqlx/statement.pyx":633 + * memset(&self.bind, 0, sizeof(MYSQL_BIND)) + * self.bind.buffer_type = MYSQL_TYPE_BLOB + * self.bind.length = &self.length # <<<<<<<<<<<<<< + * self.done = False + * + */ + __pyx_v_self->bind.length = (&__pyx_v_self->length); + + /* "oursqlx/statement.pyx":634 + * self.bind.buffer_type = MYSQL_TYPE_BLOB + * self.bind.length = &self.length + * self.done = False # <<<<<<<<<<<<<< + * + * def read(self, Py_ssize_t size=-1): + */ + __pyx_v_self->done = 0; + + /* "oursqlx/statement.pyx":624 + * cdef int done + * + * def __cinit__(self, _Statement stmt not None, unsigned int index, # <<<<<<<<<<<<<< + * unsigned int length): + * self.stmt = stmt + */ + + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/statement.pyx":636 + * self.done = False + * + * def read(self, Py_ssize_t size=-1): # <<<<<<<<<<<<<< + * """read(size=-1) -> str + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_19_ResultStringStream_3read(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6oursql_19_ResultStringStream_2read[] = "read(size=-1) -> str\n \n Read some bytes from the database. Reading -1 bytes will attempt to \n fetch all remaining bytes.\n "; +static PyObject *__pyx_pw_6oursql_19_ResultStringStream_3read(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + Py_ssize_t __pyx_v_size; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("read (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_size,0}; + PyObject* values[1] = {0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_size); + if (value) { values[0] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "read") < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + } + if (values[0]) { + __pyx_v_size = __Pyx_PyIndex_AsSsize_t(values[0]); if (unlikely((__pyx_v_size == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_size = ((Py_ssize_t)-1); + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("read", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("oursql._ResultStringStream.read", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6oursql_19_ResultStringStream_2read(((struct __pyx_obj_6oursql__ResultStringStream *)__pyx_v_self), __pyx_v_size); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_19_ResultStringStream_2read(struct __pyx_obj_6oursql__ResultStringStream *__pyx_v_self, Py_ssize_t __pyx_v_size) { + Py_ssize_t __pyx_v_left; + PyObject *__pyx_v_ret = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("read", 0); + + /* "oursqlx/statement.pyx":643 + * """ + * cdef Py_ssize_t left + * if self.done: # <<<<<<<<<<<<<< + * return '' + * self.stmt._check_closed() + */ + __pyx_t_1 = (__pyx_v_self->done != 0); + if (__pyx_t_1) { + + /* "oursqlx/statement.pyx":644 + * cdef Py_ssize_t left + * if self.done: + * return '' # <<<<<<<<<<<<<< + * self.stmt._check_closed() + * if self.stmt.fetched != self.stmt_fetched: + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_kp_s__20); + __pyx_r = __pyx_kp_s__20; + goto __pyx_L0; + } + + /* "oursqlx/statement.pyx":645 + * if self.done: + * return '' + * self.stmt._check_closed() # <<<<<<<<<<<<<< + * if self.stmt.fetched != self.stmt_fetched: + * raise ProgrammingError('row no longer available from database') + */ + __pyx_t_2 = ((struct __pyx_vtabstruct_6oursql__Statement *)__pyx_v_self->stmt->__pyx_vtab)->_check_closed(__pyx_v_self->stmt); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "oursqlx/statement.pyx":646 + * return '' + * self.stmt._check_closed() + * if self.stmt.fetched != self.stmt_fetched: # <<<<<<<<<<<<<< + * raise ProgrammingError('row no longer available from database') + * left = self.length - self.offset + */ + __pyx_t_1 = ((__pyx_v_self->stmt->fetched != __pyx_v_self->stmt_fetched) != 0); + if (__pyx_t_1) { + + /* "oursqlx/statement.pyx":647 + * self.stmt._check_closed() + * if self.stmt.fetched != self.stmt_fetched: + * raise ProgrammingError('row no longer available from database') # <<<<<<<<<<<<<< + * left = self.length - self.offset + * if size == -1 or size > left: + */ + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_ProgrammingError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[4]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + + /* "oursqlx/statement.pyx":648 + * if self.stmt.fetched != self.stmt_fetched: + * raise ProgrammingError('row no longer available from database') + * left = self.length - self.offset # <<<<<<<<<<<<<< + * if size == -1 or size > left: + * size = left + */ + __pyx_v_left = (__pyx_v_self->length - __pyx_v_self->offset); + + /* "oursqlx/statement.pyx":649 + * raise ProgrammingError('row no longer available from database') + * left = self.length - self.offset + * if size == -1 or size > left: # <<<<<<<<<<<<<< + * size = left + * elif size < 0: + */ + __pyx_t_5 = ((__pyx_v_size == -1) != 0); + if (!__pyx_t_5) { + } else { + __pyx_t_1 = __pyx_t_5; + goto __pyx_L6_bool_binop_done; + } + __pyx_t_5 = ((__pyx_v_size > __pyx_v_left) != 0); + __pyx_t_1 = __pyx_t_5; + __pyx_L6_bool_binop_done:; + if (__pyx_t_1) { + + /* "oursqlx/statement.pyx":650 + * left = self.length - self.offset + * if size == -1 or size > left: + * size = left # <<<<<<<<<<<<<< + * elif size < 0: + * raise ValueError("can't read negative bytes") + */ + __pyx_v_size = __pyx_v_left; + goto __pyx_L5; + } + + /* "oursqlx/statement.pyx":651 + * if size == -1 or size > left: + * size = left + * elif size < 0: # <<<<<<<<<<<<<< + * raise ValueError("can't read negative bytes") + * ret = PyString_FromStringAndSize(NULL, size) + */ + __pyx_t_1 = ((__pyx_v_size < 0) != 0); + if (__pyx_t_1) { + + /* "oursqlx/statement.pyx":652 + * size = left + * elif size < 0: + * raise ValueError("can't read negative bytes") # <<<<<<<<<<<<<< + * ret = PyString_FromStringAndSize(NULL, size) + * self.bind.buffer_length = size + */ + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[4]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L5:; + + /* "oursqlx/statement.pyx":653 + * elif size < 0: + * raise ValueError("can't read negative bytes") + * ret = PyString_FromStringAndSize(NULL, size) # <<<<<<<<<<<<<< + * self.bind.buffer_length = size + * self.bind.buffer = PyString_AS_STRING(ret) + */ + __pyx_t_4 = PyString_FromStringAndSize(NULL, __pyx_v_size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_v_ret = __pyx_t_4; + __pyx_t_4 = 0; + + /* "oursqlx/statement.pyx":654 + * raise ValueError("can't read negative bytes") + * ret = PyString_FromStringAndSize(NULL, size) + * self.bind.buffer_length = size # <<<<<<<<<<<<<< + * self.bind.buffer = PyString_AS_STRING(ret) + * if mysql_stmt_fetch_column(self.stmt.stmt, + */ + __pyx_v_self->bind.buffer_length = __pyx_v_size; + + /* "oursqlx/statement.pyx":655 + * ret = PyString_FromStringAndSize(NULL, size) + * self.bind.buffer_length = size + * self.bind.buffer = PyString_AS_STRING(ret) # <<<<<<<<<<<<<< + * if mysql_stmt_fetch_column(self.stmt.stmt, + * &self.bind, self.index, self.offset): + */ + __pyx_v_self->bind.buffer = PyString_AS_STRING(__pyx_v_ret); + + /* "oursqlx/statement.pyx":656 + * self.bind.buffer_length = size + * self.bind.buffer = PyString_AS_STRING(ret) + * if mysql_stmt_fetch_column(self.stmt.stmt, # <<<<<<<<<<<<<< + * &self.bind, self.index, self.offset): + * self.stmt._raise_error() + */ + __pyx_t_1 = (__pyx_f_6oursql_mysql_stmt_fetch_column(__pyx_v_self->stmt->stmt, (&__pyx_v_self->bind), __pyx_v_self->index, __pyx_v_self->offset) != 0); + if (__pyx_t_1) { + + /* "oursqlx/statement.pyx":658 + * if mysql_stmt_fetch_column(self.stmt.stmt, + * &self.bind, self.index, self.offset): + * self.stmt._raise_error() # <<<<<<<<<<<<<< + * self.offset += size + * left = self.length - self.offset + */ + __pyx_t_2 = ((struct __pyx_vtabstruct_6oursql__Statement *)__pyx_v_self->stmt->__pyx_vtab)->_raise_error(__pyx_v_self->stmt); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 658; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; + } + __pyx_L8:; + + /* "oursqlx/statement.pyx":659 + * &self.bind, self.index, self.offset): + * self.stmt._raise_error() + * self.offset += size # <<<<<<<<<<<<<< + * left = self.length - self.offset + * assert left >= 0, 'size remaining should be >= 0' + */ + __pyx_v_self->offset = (__pyx_v_self->offset + __pyx_v_size); + + /* "oursqlx/statement.pyx":660 + * self.stmt._raise_error() + * self.offset += size + * left = self.length - self.offset # <<<<<<<<<<<<<< + * assert left >= 0, 'size remaining should be >= 0' + * if left == 0: + */ + __pyx_v_left = (__pyx_v_self->length - __pyx_v_self->offset); + + /* "oursqlx/statement.pyx":661 + * self.offset += size + * left = self.length - self.offset + * assert left >= 0, 'size remaining should be >= 0' # <<<<<<<<<<<<<< + * if left == 0: + * self.done = True + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(!Py_OptimizeFlag)) { + if (unlikely(!((__pyx_v_left >= 0) != 0))) { + PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_size_remaining_should_be_0); + {__pyx_filename = __pyx_f[4]; __pyx_lineno = 661; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif + + /* "oursqlx/statement.pyx":662 + * left = self.length - self.offset + * assert left >= 0, 'size remaining should be >= 0' + * if left == 0: # <<<<<<<<<<<<<< + * self.done = True + * return ret + */ + __pyx_t_1 = ((__pyx_v_left == 0) != 0); + if (__pyx_t_1) { + + /* "oursqlx/statement.pyx":663 + * assert left >= 0, 'size remaining should be >= 0' + * if left == 0: + * self.done = True # <<<<<<<<<<<<<< + * return ret + */ + __pyx_v_self->done = 1; + goto __pyx_L9; + } + __pyx_L9:; + + /* "oursqlx/statement.pyx":664 + * if left == 0: + * self.done = True + * return ret # <<<<<<<<<<<<<< + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_ret); + __pyx_r = __pyx_v_ret; + goto __pyx_L0; + + /* "oursqlx/statement.pyx":636 + * self.done = False + * + * def read(self, Py_ssize_t size=-1): # <<<<<<<<<<<<<< + * """read(size=-1) -> str + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("oursql._ResultStringStream.read", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_ret); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/query.pyx":21 + * conversions_dict = _conversions + * + * def __cinit__(self, Connection conn not None, bint show_table=False, # <<<<<<<<<<<<<< + * **kwargs): + * cdef my_ulonglong res + */ + +/* Python wrapper */ +static int __pyx_pw_6oursql_10_ResultSet_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_6oursql_10_ResultSet_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_6oursql_Connection *__pyx_v_conn = 0; + CYTHON_UNUSED int __pyx_v_show_table; + CYTHON_UNUSED PyObject *__pyx_v_kwargs = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1; + __Pyx_GOTREF(__pyx_v_kwargs); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_conn,&__pyx_n_s_show_table,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_conn)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_show_table); + if (value) { values[1] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_conn = ((struct __pyx_obj_6oursql_Connection *)values[0]); + if (values[1]) { + __pyx_v_show_table = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_show_table == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_show_table = ((int)0); + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; + __Pyx_AddTraceback("oursql._ResultSet.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_conn), __pyx_ptype_6oursql_Connection, 0, "conn", 0))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_6oursql_10_ResultSet___cinit__(((struct __pyx_obj_6oursql__ResultSet *)__pyx_v_self), __pyx_v_conn, __pyx_v_show_table, __pyx_v_kwargs); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_kwargs); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6oursql_10_ResultSet___cinit__(struct __pyx_obj_6oursql__ResultSet *__pyx_v_self, struct __pyx_obj_6oursql_Connection *__pyx_v_conn, CYTHON_UNUSED int __pyx_v_show_table, CYTHON_UNUSED PyObject *__pyx_v_kwargs) { + my_ulonglong __pyx_v_res; + PyObject *__pyx_v_d = NULL; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + Py_ssize_t __pyx_t_6; + PyObject *(*__pyx_t_7)(PyObject *); + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__cinit__", 0); + + /* "oursqlx/query.pyx":24 + * **kwargs): + * cdef my_ulonglong res + * conn._check_closed() # <<<<<<<<<<<<<< + * self.conn = conn + * self.fields = mysql_field_count(self.conn.conn) + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_6oursql_Connection *)__pyx_v_conn->__pyx_vtab)->_check_closed(__pyx_v_conn); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "oursqlx/query.pyx":25 + * cdef my_ulonglong res + * conn._check_closed() + * self.conn = conn # <<<<<<<<<<<<<< + * self.fields = mysql_field_count(self.conn.conn) + * self.res = mysql_store_result(self.conn.conn) + */ + __Pyx_INCREF(((PyObject *)__pyx_v_conn)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_conn)); + __Pyx_GOTREF(__pyx_v_self->conn); + __Pyx_DECREF(((PyObject *)__pyx_v_self->conn)); + __pyx_v_self->conn = __pyx_v_conn; + + /* "oursqlx/query.pyx":26 + * conn._check_closed() + * self.conn = conn + * self.fields = mysql_field_count(self.conn.conn) # <<<<<<<<<<<<<< + * self.res = mysql_store_result(self.conn.conn) + * if not self.res and self.fields != 0: + */ + __pyx_v_self->fields = mysql_field_count(__pyx_v_self->conn->conn); + + /* "oursqlx/query.pyx":27 + * self.conn = conn + * self.fields = mysql_field_count(self.conn.conn) + * self.res = mysql_store_result(self.conn.conn) # <<<<<<<<<<<<<< + * if not self.res and self.fields != 0: + * self._raise_error() + */ + __pyx_v_self->res = __pyx_f_6oursql_mysql_store_result(__pyx_v_self->conn->conn); + + /* "oursqlx/query.pyx":28 + * self.fields = mysql_field_count(self.conn.conn) + * self.res = mysql_store_result(self.conn.conn) + * if not self.res and self.fields != 0: # <<<<<<<<<<<<<< + * self._raise_error() + * + */ + __pyx_t_3 = ((!(__pyx_v_self->res != 0)) != 0); + if (__pyx_t_3) { + } else { + __pyx_t_2 = __pyx_t_3; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_3 = ((__pyx_v_self->fields != 0) != 0); + __pyx_t_2 = __pyx_t_3; + __pyx_L4_bool_binop_done:; + if (__pyx_t_2) { + + /* "oursqlx/query.pyx":29 + * self.res = mysql_store_result(self.conn.conn) + * if not self.res and self.fields != 0: + * self._raise_error() # <<<<<<<<<<<<<< + * + * res = mysql_affected_rows(self.conn.conn) + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_6oursql__ResultSet *)__pyx_v_self->__pyx_vtab)->_raise_error(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "oursqlx/query.pyx":31 + * self._raise_error() + * + * res = mysql_affected_rows(self.conn.conn) # <<<<<<<<<<<<<< + * if res == ull_negone: + * self.rowcount = -1 + */ + __pyx_v_res = mysql_affected_rows(__pyx_v_self->conn->conn); + + /* "oursqlx/query.pyx":32 + * + * res = mysql_affected_rows(self.conn.conn) + * if res == ull_negone: # <<<<<<<<<<<<<< + * self.rowcount = -1 + * else: + */ + __pyx_t_2 = ((__pyx_v_res == __pyx_v_6oursql_ull_negone) != 0); + if (__pyx_t_2) { + + /* "oursqlx/query.pyx":33 + * res = mysql_affected_rows(self.conn.conn) + * if res == ull_negone: + * self.rowcount = -1 # <<<<<<<<<<<<<< + * else: + * self.rowcount = res + */ + __Pyx_INCREF(__pyx_int_neg_1); + __Pyx_GIVEREF(__pyx_int_neg_1); + __Pyx_GOTREF(__pyx_v_self->rowcount); + __Pyx_DECREF(__pyx_v_self->rowcount); + __pyx_v_self->rowcount = __pyx_int_neg_1; + goto __pyx_L6; + } + /*else*/ { + + /* "oursqlx/query.pyx":35 + * self.rowcount = -1 + * else: + * self.rowcount = res # <<<<<<<<<<<<<< + * res = mysql_insert_id(self.conn.conn) + * if res == 0: + */ + __pyx_t_4 = __Pyx_PyInt_From_my_ulonglong(__pyx_v_res); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_v_self->rowcount); + __Pyx_DECREF(__pyx_v_self->rowcount); + __pyx_v_self->rowcount = __pyx_t_4; + __pyx_t_4 = 0; + } + __pyx_L6:; + + /* "oursqlx/query.pyx":36 + * else: + * self.rowcount = res + * res = mysql_insert_id(self.conn.conn) # <<<<<<<<<<<<<< + * if res == 0: + * self.lastrowid = None + */ + __pyx_v_res = mysql_insert_id(__pyx_v_self->conn->conn); + + /* "oursqlx/query.pyx":37 + * self.rowcount = res + * res = mysql_insert_id(self.conn.conn) + * if res == 0: # <<<<<<<<<<<<<< + * self.lastrowid = None + * else: + */ + __pyx_t_2 = ((__pyx_v_res == 0) != 0); + if (__pyx_t_2) { + + /* "oursqlx/query.pyx":38 + * res = mysql_insert_id(self.conn.conn) + * if res == 0: + * self.lastrowid = None # <<<<<<<<<<<<<< + * else: + * self.lastrowid = res + */ + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->lastrowid); + __Pyx_DECREF(__pyx_v_self->lastrowid); + __pyx_v_self->lastrowid = Py_None; + goto __pyx_L7; + } + /*else*/ { + + /* "oursqlx/query.pyx":40 + * self.lastrowid = None + * else: + * self.lastrowid = res # <<<<<<<<<<<<<< + * + * if self.fields: + */ + __pyx_t_4 = __Pyx_PyInt_From_my_ulonglong(__pyx_v_res); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_v_self->lastrowid); + __Pyx_DECREF(__pyx_v_self->lastrowid); + __pyx_v_self->lastrowid = __pyx_t_4; + __pyx_t_4 = 0; + } + __pyx_L7:; + + /* "oursqlx/query.pyx":42 + * self.lastrowid = res + * + * if self.fields: # <<<<<<<<<<<<<< + * self.description = description_from_res( + * self.res, self.fields, self.show_table) + */ + __pyx_t_2 = (__pyx_v_self->fields != 0); + if (__pyx_t_2) { + + /* "oursqlx/query.pyx":43 + * + * if self.fields: + * self.description = description_from_res( # <<<<<<<<<<<<<< + * self.res, self.fields, self.show_table) + * self.conversion_info = conversion_info_from_res( + */ + __pyx_t_4 = __pyx_f_6oursql_description_from_res(__pyx_v_self->res, __pyx_v_self->fields, __pyx_v_self->show_table); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_v_self->description); + __Pyx_DECREF(__pyx_v_self->description); + __pyx_v_self->description = __pyx_t_4; + __pyx_t_4 = 0; + + /* "oursqlx/query.pyx":45 + * self.description = description_from_res( + * self.res, self.fields, self.show_table) + * self.conversion_info = conversion_info_from_res( # <<<<<<<<<<<<<< + * self.res, self.fields) + * self.column_names = [d[0] for d in self.description] + */ + __pyx_t_4 = __pyx_f_6oursql_conversion_info_from_res(__pyx_v_self->res, __pyx_v_self->fields); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_v_self->conversion_info); + __Pyx_DECREF(__pyx_v_self->conversion_info); + __pyx_v_self->conversion_info = __pyx_t_4; + __pyx_t_4 = 0; + + /* "oursqlx/query.pyx":47 + * self.conversion_info = conversion_info_from_res( + * self.res, self.fields) + * self.column_names = [d[0] for d in self.description] # <<<<<<<<<<<<<< + * else: + * self.description = self.column_names = None + */ + __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (likely(PyList_CheckExact(__pyx_v_self->description)) || PyTuple_CheckExact(__pyx_v_self->description)) { + __pyx_t_5 = __pyx_v_self->description; __Pyx_INCREF(__pyx_t_5); __pyx_t_6 = 0; + __pyx_t_7 = NULL; + } else { + __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_self->description); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + for (;;) { + if (likely(!__pyx_t_7)) { + if (likely(PyList_CheckExact(__pyx_t_5))) { + if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_8 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_8 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_5)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_8 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } + } else { + __pyx_t_8 = __pyx_t_7(__pyx_t_5); + if (unlikely(!__pyx_t_8)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_8); + } + __Pyx_XDECREF_SET(__pyx_v_d, __pyx_t_8); + __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_d, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_8 == NULL)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __Pyx_GOTREF(__pyx_t_8); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_t_8))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_v_self->column_names); + __Pyx_DECREF(__pyx_v_self->column_names); + __pyx_v_self->column_names = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L8; + } + /*else*/ { + + /* "oursqlx/query.pyx":49 + * self.column_names = [d[0] for d in self.description] + * else: + * self.description = self.column_names = None # <<<<<<<<<<<<<< + * + * if self.conn.warning_count(): + */ + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->description); + __Pyx_DECREF(__pyx_v_self->description); + __pyx_v_self->description = Py_None; + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->column_names); + __Pyx_DECREF(__pyx_v_self->column_names); + __pyx_v_self->column_names = Py_None; + } + __pyx_L8:; + + /* "oursqlx/query.pyx":51 + * self.description = self.column_names = None + * + * if self.conn.warning_count(): # <<<<<<<<<<<<<< + * self.warnings = _do_warnings_query(self.conn) + * else: + */ + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->conn), __pyx_n_s_warning_count); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_8 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_8)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + } + } + if (__pyx_t_8) { + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_8); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } else { + __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_2) { + + /* "oursqlx/query.pyx":52 + * + * if self.conn.warning_count(): + * self.warnings = _do_warnings_query(self.conn) # <<<<<<<<<<<<<< + * else: + * self.warnings = [] + */ + __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_do_warnings_query); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_8 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_8)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + } + } + if (!__pyx_t_8) { + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, ((PyObject *)__pyx_v_self->conn)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + } else { + __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); __pyx_t_8 = NULL; + __Pyx_INCREF(((PyObject *)__pyx_v_self->conn)); + PyTuple_SET_ITEM(__pyx_t_9, 0+1, ((PyObject *)__pyx_v_self->conn)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self->conn)); + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_v_self->warnings); + __Pyx_DECREF(__pyx_v_self->warnings); + __pyx_v_self->warnings = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L11; + } + /*else*/ { + + /* "oursqlx/query.pyx":54 + * self.warnings = _do_warnings_query(self.conn) + * else: + * self.warnings = [] # <<<<<<<<<<<<<< + * + * def __dealloc__(self): + */ + __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_v_self->warnings); + __Pyx_DECREF(__pyx_v_self->warnings); + __pyx_v_self->warnings = __pyx_t_4; + __pyx_t_4 = 0; + } + __pyx_L11:; + + /* "oursqlx/query.pyx":21 + * conversions_dict = _conversions + * + * def __cinit__(self, Connection conn not None, bint show_table=False, # <<<<<<<<<<<<<< + * **kwargs): + * cdef my_ulonglong res + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("oursql._ResultSet.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_d); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/query.pyx":56 + * self.warnings = [] + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * self.close() + * + */ + +/* Python wrapper */ +static void __pyx_pw_6oursql_10_ResultSet_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pw_6oursql_10_ResultSet_3__dealloc__(PyObject *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_pf_6oursql_10_ResultSet_2__dealloc__(((struct __pyx_obj_6oursql__ResultSet *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +static void __pyx_pf_6oursql_10_ResultSet_2__dealloc__(struct __pyx_obj_6oursql__ResultSet *__pyx_v_self) { + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__dealloc__", 0); + + /* "oursqlx/query.pyx":57 + * + * def __dealloc__(self): + * self.close() # <<<<<<<<<<<<<< + * + * def close(self): + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_close); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "oursqlx/query.pyx":56 + * self.warnings = [] + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * self.close() + * + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_WriteUnraisable("oursql._ResultSet.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 0); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* "oursqlx/query.pyx":59 + * self.close() + * + * def close(self): # <<<<<<<<<<<<<< + * if self.res: + * mysql_free_result(self.res) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_10_ResultSet_5close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6oursql_10_ResultSet_5close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("close (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_10_ResultSet_4close(((struct __pyx_obj_6oursql__ResultSet *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_10_ResultSet_4close(struct __pyx_obj_6oursql__ResultSet *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("close", 0); + + /* "oursqlx/query.pyx":60 + * + * def close(self): + * if self.res: # <<<<<<<<<<<<<< + * mysql_free_result(self.res) + * self.res = NULL + */ + __pyx_t_1 = (__pyx_v_self->res != 0); + if (__pyx_t_1) { + + /* "oursqlx/query.pyx":61 + * def close(self): + * if self.res: + * mysql_free_result(self.res) # <<<<<<<<<<<<<< + * self.res = NULL + * + */ + mysql_free_result(__pyx_v_self->res); + + /* "oursqlx/query.pyx":62 + * if self.res: + * mysql_free_result(self.res) + * self.res = NULL # <<<<<<<<<<<<<< + * + * cdef int _raise_error(self) except -1: + */ + __pyx_v_self->res = NULL; + goto __pyx_L3; + } + __pyx_L3:; + + /* "oursqlx/query.pyx":59 + * self.close() + * + * def close(self): # <<<<<<<<<<<<<< + * if self.res: + * mysql_free_result(self.res) + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/query.pyx":64 + * self.res = NULL + * + * cdef int _raise_error(self) except -1: # <<<<<<<<<<<<<< + * return self.conn._raise_error() + * + */ + +static int __pyx_f_6oursql_10_ResultSet__raise_error(struct __pyx_obj_6oursql__ResultSet *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_raise_error", 0); + + /* "oursqlx/query.pyx":65 + * + * cdef int _raise_error(self) except -1: + * return self.conn._raise_error() # <<<<<<<<<<<<<< + * + * cdef int _check_closed(self) except -1: + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_6oursql_Connection *)__pyx_v_self->conn->__pyx_vtab)->_raise_error(__pyx_v_self->conn); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_t_1; + goto __pyx_L0; + + /* "oursqlx/query.pyx":64 + * self.res = NULL + * + * cdef int _raise_error(self) except -1: # <<<<<<<<<<<<<< + * return self.conn._raise_error() + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("oursql._ResultSet._raise_error", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/query.pyx":67 + * return self.conn._raise_error() + * + * cdef int _check_closed(self) except -1: # <<<<<<<<<<<<<< + * if not self.conn.conn: + * if self.res: + */ + +static int __pyx_f_6oursql_10_ResultSet__check_closed(struct __pyx_obj_6oursql__ResultSet *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_check_closed", 0); + + /* "oursqlx/query.pyx":68 + * + * cdef int _check_closed(self) except -1: + * if not self.conn.conn: # <<<<<<<<<<<<<< + * if self.res: + * self.close() + */ + __pyx_t_1 = ((!(__pyx_v_self->conn->conn != 0)) != 0); + if (__pyx_t_1) { + + /* "oursqlx/query.pyx":69 + * cdef int _check_closed(self) except -1: + * if not self.conn.conn: + * if self.res: # <<<<<<<<<<<<<< + * self.close() + * raise ProgrammingError('connection closed') + */ + __pyx_t_1 = (__pyx_v_self->res != 0); + if (__pyx_t_1) { + + /* "oursqlx/query.pyx":70 + * if not self.conn.conn: + * if self.res: + * self.close() # <<<<<<<<<<<<<< + * raise ProgrammingError('connection closed') + * if not self.res: + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_close); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (__pyx_t_4) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else { + __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L4; + } + __pyx_L4:; + + /* "oursqlx/query.pyx":71 + * if self.res: + * self.close() + * raise ProgrammingError('connection closed') # <<<<<<<<<<<<<< + * if not self.res: + * raise ProgrammingError('query closed') + */ + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_ProgrammingError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[5]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + + /* "oursqlx/query.pyx":72 + * self.close() + * raise ProgrammingError('connection closed') + * if not self.res: # <<<<<<<<<<<<<< + * raise ProgrammingError('query closed') + * + */ + __pyx_t_1 = ((!(__pyx_v_self->res != 0)) != 0); + if (__pyx_t_1) { + + /* "oursqlx/query.pyx":73 + * raise ProgrammingError('connection closed') + * if not self.res: + * raise ProgrammingError('query closed') # <<<<<<<<<<<<<< + * + * property has_result: + */ + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_ProgrammingError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[5]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + + /* "oursqlx/query.pyx":67 + * return self.conn._raise_error() + * + * cdef int _check_closed(self) except -1: # <<<<<<<<<<<<<< + * if not self.conn.conn: + * if self.res: + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("oursql._ResultSet._check_closed", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/query.pyx":76 + * + * property has_result: + * def __get__(self): # <<<<<<<<<<<<<< + * return self.fields != 0 + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_10_ResultSet_10has_result_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6oursql_10_ResultSet_10has_result_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_10_ResultSet_10has_result___get__(((struct __pyx_obj_6oursql__ResultSet *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_10_ResultSet_10has_result___get__(struct __pyx_obj_6oursql__ResultSet *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "oursqlx/query.pyx":77 + * property has_result: + * def __get__(self): + * return self.fields != 0 # <<<<<<<<<<<<<< + * + * def fetchone(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_self->fields != 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "oursqlx/query.pyx":76 + * + * property has_result: + * def __get__(self): # <<<<<<<<<<<<<< + * return self.fields != 0 + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("oursql._ResultSet.has_result.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/query.pyx":79 + * return self.fields != 0 + * + * def fetchone(self): # <<<<<<<<<<<<<< + * cdef MYSQL_ROW row + * cdef unsigned int i + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_10_ResultSet_7fetchone(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6oursql_10_ResultSet_7fetchone(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("fetchone (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_10_ResultSet_6fetchone(((struct __pyx_obj_6oursql__ResultSet *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_10_ResultSet_6fetchone(struct __pyx_obj_6oursql__ResultSet *__pyx_v_self) { + MYSQL_ROW __pyx_v_row; + unsigned int __pyx_v_i; + unsigned long *__pyx_v_lengths; + PyObject *__pyx_v_ret = NULL; + PyObject *__pyx_v_d = NULL; + PyObject *__pyx_v_field_type = NULL; + CYTHON_UNUSED PyObject *__pyx_v_flags = NULL; + PyObject *__pyx_v_charsetnr = NULL; + PyObject *__pyx_v_converter = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + unsigned int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *(*__pyx_t_9)(PyObject *); + int __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("fetchone", 0); + + /* "oursqlx/query.pyx":83 + * cdef unsigned int i + * cdef unsigned long *lengths + * self._check_closed() # <<<<<<<<<<<<<< + * row = mysql_fetch_row(self.res) + * if not row: + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_6oursql__ResultSet *)__pyx_v_self->__pyx_vtab)->_check_closed(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "oursqlx/query.pyx":84 + * cdef unsigned long *lengths + * self._check_closed() + * row = mysql_fetch_row(self.res) # <<<<<<<<<<<<<< + * if not row: + * return None + */ + __pyx_v_row = __pyx_f_6oursql_mysql_fetch_row(__pyx_v_self->res); + + /* "oursqlx/query.pyx":85 + * self._check_closed() + * row = mysql_fetch_row(self.res) + * if not row: # <<<<<<<<<<<<<< + * return None + * lengths = mysql_fetch_lengths(self.res) + */ + __pyx_t_2 = ((!(__pyx_v_row != 0)) != 0); + if (__pyx_t_2) { + + /* "oursqlx/query.pyx":86 + * row = mysql_fetch_row(self.res) + * if not row: + * return None # <<<<<<<<<<<<<< + * lengths = mysql_fetch_lengths(self.res) + * if not lengths: + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + } + + /* "oursqlx/query.pyx":87 + * if not row: + * return None + * lengths = mysql_fetch_lengths(self.res) # <<<<<<<<<<<<<< + * if not lengths: + * self._raise_error() + */ + __pyx_v_lengths = mysql_fetch_lengths(__pyx_v_self->res); + + /* "oursqlx/query.pyx":88 + * return None + * lengths = mysql_fetch_lengths(self.res) + * if not lengths: # <<<<<<<<<<<<<< + * self._raise_error() + * ret = PyTuple_New(self.fields) + */ + __pyx_t_2 = ((!(__pyx_v_lengths != 0)) != 0); + if (__pyx_t_2) { + + /* "oursqlx/query.pyx":89 + * lengths = mysql_fetch_lengths(self.res) + * if not lengths: + * self._raise_error() # <<<<<<<<<<<<<< + * ret = PyTuple_New(self.fields) + * # Cache the connection charset. + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_6oursql__ResultSet *)__pyx_v_self->__pyx_vtab)->_raise_error(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L4; + } + __pyx_L4:; + + /* "oursqlx/query.pyx":90 + * if not lengths: + * self._raise_error() + * ret = PyTuple_New(self.fields) # <<<<<<<<<<<<<< + * # Cache the connection charset. + * self.conn.charset + */ + __pyx_t_3 = PyTuple_New(__pyx_v_self->fields); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_v_ret = __pyx_t_3; + __pyx_t_3 = 0; + + /* "oursqlx/query.pyx":92 + * ret = PyTuple_New(self.fields) + * # Cache the connection charset. + * self.conn.charset # <<<<<<<<<<<<<< + * for 0 <= i < self.fields: + * if not row[i]: + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->conn), __pyx_n_s_charset); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "oursqlx/query.pyx":93 + * # Cache the connection charset. + * self.conn.charset + * for 0 <= i < self.fields: # <<<<<<<<<<<<<< + * if not row[i]: + * d = None + */ + __pyx_t_4 = __pyx_v_self->fields; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_4; __pyx_v_i++) { + + /* "oursqlx/query.pyx":94 + * self.conn.charset + * for 0 <= i < self.fields: + * if not row[i]: # <<<<<<<<<<<<<< + * d = None + * else: + */ + __pyx_t_2 = ((!((__pyx_v_row[__pyx_v_i]) != 0)) != 0); + if (__pyx_t_2) { + + /* "oursqlx/query.pyx":95 + * for 0 <= i < self.fields: + * if not row[i]: + * d = None # <<<<<<<<<<<<<< + * else: + * d = PyString_FromStringAndSize(row[i], lengths[i]) + */ + __Pyx_INCREF(Py_None); + __Pyx_XDECREF_SET(__pyx_v_d, Py_None); + goto __pyx_L7; + } + /*else*/ { + + /* "oursqlx/query.pyx":97 + * d = None + * else: + * d = PyString_FromStringAndSize(row[i], lengths[i]) # <<<<<<<<<<<<<< + * field_type, flags, charsetnr = self.conversion_info[i] + * converter = self.conversions_dict.get(field_type) + */ + __pyx_t_3 = PyString_FromStringAndSize((__pyx_v_row[__pyx_v_i]), (__pyx_v_lengths[__pyx_v_i])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_XDECREF_SET(__pyx_v_d, __pyx_t_3); + __pyx_t_3 = 0; + + /* "oursqlx/query.pyx":98 + * else: + * d = PyString_FromStringAndSize(row[i], lengths[i]) + * field_type, flags, charsetnr = self.conversion_info[i] # <<<<<<<<<<<<<< + * converter = self.conversions_dict.get(field_type) + * if converter: + */ + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_self->conversion_info, __pyx_v_i, unsigned int, 0, __Pyx_PyInt_From_unsigned_int, 0, 0, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __Pyx_GOTREF(__pyx_t_3); + if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) { + PyObject* sequence = __pyx_t_3; + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 3)) { + if (size > 3) __Pyx_RaiseTooManyValuesError(3); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[5]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); + __pyx_t_7 = PyTuple_GET_ITEM(sequence, 2); + } else { + __pyx_t_5 = PyList_GET_ITEM(sequence, 0); + __pyx_t_6 = PyList_GET_ITEM(sequence, 1); + __pyx_t_7 = PyList_GET_ITEM(sequence, 2); + } + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); + #else + __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + #endif + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_8 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext; + index = 0; __pyx_t_5 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_5)) goto __pyx_L8_unpacking_failed; + __Pyx_GOTREF(__pyx_t_5); + index = 1; __pyx_t_6 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L8_unpacking_failed; + __Pyx_GOTREF(__pyx_t_6); + index = 2; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L8_unpacking_failed; + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 3) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = NULL; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L9_unpacking_done; + __pyx_L8_unpacking_failed:; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_9 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[5]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L9_unpacking_done:; + } + __Pyx_XDECREF_SET(__pyx_v_field_type, __pyx_t_5); + __pyx_t_5 = 0; + __Pyx_XDECREF_SET(__pyx_v_flags, __pyx_t_6); + __pyx_t_6 = 0; + __Pyx_XDECREF_SET(__pyx_v_charsetnr, __pyx_t_7); + __pyx_t_7 = 0; + + /* "oursqlx/query.pyx":99 + * d = PyString_FromStringAndSize(row[i], lengths[i]) + * field_type, flags, charsetnr = self.conversion_info[i] + * converter = self.conversions_dict.get(field_type) # <<<<<<<<<<<<<< + * if converter: + * d = converter(d) + */ + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_conversions_dict); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_get); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + } + } + if (!__pyx_t_7) { + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_field_type); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + } else { + __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = NULL; + __Pyx_INCREF(__pyx_v_field_type); + PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_field_type); + __Pyx_GIVEREF(__pyx_v_field_type); + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF_SET(__pyx_v_converter, __pyx_t_3); + __pyx_t_3 = 0; + + /* "oursqlx/query.pyx":100 + * field_type, flags, charsetnr = self.conversion_info[i] + * converter = self.conversions_dict.get(field_type) + * if converter: # <<<<<<<<<<<<<< + * d = converter(d) + * elif self.conn.use_unicode and charsetnr != CS_BINARY: + */ + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_converter); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_2) { + + /* "oursqlx/query.pyx":101 + * converter = self.conversions_dict.get(field_type) + * if converter: + * d = converter(d) # <<<<<<<<<<<<<< + * elif self.conn.use_unicode and charsetnr != CS_BINARY: + * d = d.decode(self.conn._charset) + */ + __Pyx_INCREF(__pyx_v_converter); + __pyx_t_6 = __pyx_v_converter; __pyx_t_5 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + } + } + if (!__pyx_t_5) { + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_d); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + } else { + __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL; + __Pyx_INCREF(__pyx_v_d); + PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_d); + __Pyx_GIVEREF(__pyx_v_d); + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF_SET(__pyx_v_d, __pyx_t_3); + __pyx_t_3 = 0; + goto __pyx_L10; + } + + /* "oursqlx/query.pyx":102 + * if converter: + * d = converter(d) + * elif self.conn.use_unicode and charsetnr != CS_BINARY: # <<<<<<<<<<<<<< + * d = d.decode(self.conn._charset) + * Py_INCREF(d) + */ + __pyx_t_10 = (__pyx_v_self->conn->use_unicode != 0); + if (__pyx_t_10) { + } else { + __pyx_t_2 = __pyx_t_10; + goto __pyx_L11_bool_binop_done; + } + __pyx_t_3 = PyObject_RichCompare(__pyx_v_charsetnr, __pyx_int_63, Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = __pyx_t_10; + __pyx_L11_bool_binop_done:; + if (__pyx_t_2) { + + /* "oursqlx/query.pyx":103 + * d = converter(d) + * elif self.conn.use_unicode and charsetnr != CS_BINARY: + * d = d.decode(self.conn._charset) # <<<<<<<<<<<<<< + * Py_INCREF(d) + * PyTuple_SET_ITEM(ret, i, d) + */ + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_d, __pyx_n_s_decode); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + } + } + if (!__pyx_t_7) { + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_self->conn->_charset); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + } else { + __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = NULL; + __Pyx_INCREF(__pyx_v_self->conn->_charset); + PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_self->conn->_charset); + __Pyx_GIVEREF(__pyx_v_self->conn->_charset); + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF_SET(__pyx_v_d, __pyx_t_3); + __pyx_t_3 = 0; + goto __pyx_L10; + } + __pyx_L10:; + } + __pyx_L7:; + + /* "oursqlx/query.pyx":104 + * elif self.conn.use_unicode and charsetnr != CS_BINARY: + * d = d.decode(self.conn._charset) + * Py_INCREF(d) # <<<<<<<<<<<<<< + * PyTuple_SET_ITEM(ret, i, d) + * return ret + */ + Py_INCREF(__pyx_v_d); + + /* "oursqlx/query.pyx":105 + * d = d.decode(self.conn._charset) + * Py_INCREF(d) + * PyTuple_SET_ITEM(ret, i, d) # <<<<<<<<<<<<<< + * return ret + * + */ + PyTuple_SET_ITEM(__pyx_v_ret, __pyx_v_i, __pyx_v_d); + } + + /* "oursqlx/query.pyx":106 + * Py_INCREF(d) + * PyTuple_SET_ITEM(ret, i, d) + * return ret # <<<<<<<<<<<<<< + * + * def fetchall(self): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_ret); + __pyx_r = __pyx_v_ret; + goto __pyx_L0; + + /* "oursqlx/query.pyx":79 + * return self.fields != 0 + * + * def fetchone(self): # <<<<<<<<<<<<<< + * cdef MYSQL_ROW row + * cdef unsigned int i + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("oursql._ResultSet.fetchone", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_ret); + __Pyx_XDECREF(__pyx_v_d); + __Pyx_XDECREF(__pyx_v_field_type); + __Pyx_XDECREF(__pyx_v_flags); + __Pyx_XDECREF(__pyx_v_charsetnr); + __Pyx_XDECREF(__pyx_v_converter); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/query.pyx":108 + * return ret + * + * def fetchall(self): # <<<<<<<<<<<<<< + * self._check_closed() + * return PySequence_List(self) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_10_ResultSet_9fetchall(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6oursql_10_ResultSet_9fetchall(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("fetchall (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_10_ResultSet_8fetchall(((struct __pyx_obj_6oursql__ResultSet *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_10_ResultSet_8fetchall(struct __pyx_obj_6oursql__ResultSet *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("fetchall", 0); + + /* "oursqlx/query.pyx":109 + * + * def fetchall(self): + * self._check_closed() # <<<<<<<<<<<<<< + * return PySequence_List(self) + * + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_6oursql__ResultSet *)__pyx_v_self->__pyx_vtab)->_check_closed(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "oursqlx/query.pyx":110 + * def fetchall(self): + * self._check_closed() + * return PySequence_List(self) # <<<<<<<<<<<<<< + * + * def __iter__(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PySequence_List(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "oursqlx/query.pyx":108 + * return ret + * + * def fetchall(self): # <<<<<<<<<<<<<< + * self._check_closed() + * return PySequence_List(self) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("oursql._ResultSet.fetchall", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/query.pyx":112 + * return PySequence_List(self) + * + * def __iter__(self): # <<<<<<<<<<<<<< + * self._check_closed() + * return PyCallIter_New(self.fetchone, None) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_10_ResultSet_11__iter__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6oursql_10_ResultSet_11__iter__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_10_ResultSet_10__iter__(((struct __pyx_obj_6oursql__ResultSet *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_10_ResultSet_10__iter__(struct __pyx_obj_6oursql__ResultSet *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__iter__", 0); + + /* "oursqlx/query.pyx":113 + * + * def __iter__(self): + * self._check_closed() # <<<<<<<<<<<<<< + * return PyCallIter_New(self.fetchone, None) + * + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_6oursql__ResultSet *)__pyx_v_self->__pyx_vtab)->_check_closed(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "oursqlx/query.pyx":114 + * def __iter__(self): + * self._check_closed() + * return PyCallIter_New(self.fetchone, None) # <<<<<<<<<<<<<< + * + * cdef class _Query: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_fetchone); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyCallIter_New(__pyx_t_2, Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "oursqlx/query.pyx":112 + * return PySequence_List(self) + * + * def __iter__(self): # <<<<<<<<<<<<<< + * self._check_closed() + * return PyCallIter_New(self.fetchone, None) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("oursql._ResultSet.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/query.pyx":15 + * cdef unsigned int fields + * cdef object conversion_info + * cdef readonly object rowcount, lastrowid, description, column_names # <<<<<<<<<<<<<< + * cdef public object warnings + * cdef int show_table + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_10_ResultSet_8rowcount_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6oursql_10_ResultSet_8rowcount_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_10_ResultSet_8rowcount___get__(((struct __pyx_obj_6oursql__ResultSet *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_10_ResultSet_8rowcount___get__(struct __pyx_obj_6oursql__ResultSet *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->rowcount); + __pyx_r = __pyx_v_self->rowcount; + goto __pyx_L0; + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_10_ResultSet_9lastrowid_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6oursql_10_ResultSet_9lastrowid_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_10_ResultSet_9lastrowid___get__(((struct __pyx_obj_6oursql__ResultSet *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_10_ResultSet_9lastrowid___get__(struct __pyx_obj_6oursql__ResultSet *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->lastrowid); + __pyx_r = __pyx_v_self->lastrowid; + goto __pyx_L0; + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_10_ResultSet_11description_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6oursql_10_ResultSet_11description_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_10_ResultSet_11description___get__(((struct __pyx_obj_6oursql__ResultSet *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_10_ResultSet_11description___get__(struct __pyx_obj_6oursql__ResultSet *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->description); + __pyx_r = __pyx_v_self->description; + goto __pyx_L0; + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_10_ResultSet_12column_names_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6oursql_10_ResultSet_12column_names_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_10_ResultSet_12column_names___get__(((struct __pyx_obj_6oursql__ResultSet *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_10_ResultSet_12column_names___get__(struct __pyx_obj_6oursql__ResultSet *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->column_names); + __pyx_r = __pyx_v_self->column_names; + goto __pyx_L0; + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/query.pyx":16 + * cdef object conversion_info + * cdef readonly object rowcount, lastrowid, description, column_names + * cdef public object warnings # <<<<<<<<<<<<<< + * cdef int show_table + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_10_ResultSet_8warnings_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6oursql_10_ResultSet_8warnings_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_10_ResultSet_8warnings___get__(((struct __pyx_obj_6oursql__ResultSet *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_10_ResultSet_8warnings___get__(struct __pyx_obj_6oursql__ResultSet *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->warnings); + __pyx_r = __pyx_v_self->warnings; + goto __pyx_L0; + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6oursql_10_ResultSet_8warnings_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_6oursql_10_ResultSet_8warnings_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_10_ResultSet_8warnings_2__set__(((struct __pyx_obj_6oursql__ResultSet *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6oursql_10_ResultSet_8warnings_2__set__(struct __pyx_obj_6oursql__ResultSet *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__", 0); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->warnings); + __Pyx_DECREF(__pyx_v_self->warnings); + __pyx_v_self->warnings = __pyx_v_value; + + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6oursql_10_ResultSet_8warnings_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_6oursql_10_ResultSet_8warnings_5__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_10_ResultSet_8warnings_4__del__(((struct __pyx_obj_6oursql__ResultSet *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6oursql_10_ResultSet_8warnings_4__del__(struct __pyx_obj_6oursql__ResultSet *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->warnings); + __Pyx_DECREF(__pyx_v_self->warnings); + __pyx_v_self->warnings = Py_None; + + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/query.pyx":128 + * cdef readonly object rowcount, lastrowid, description, warnings, has_result + * + * def __cinit__(self, Connection conn not None, query, *a, **kw): # <<<<<<<<<<<<<< + * cdef char *qstr + * cdef Py_ssize_t qlen + */ + +/* Python wrapper */ +static int __pyx_pw_6oursql_6_Query_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_6oursql_6_Query_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_6oursql_Connection *__pyx_v_conn = 0; + PyObject *__pyx_v_query = 0; + PyObject *__pyx_v_a = 0; + PyObject *__pyx_v_kw = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + __pyx_v_kw = PyDict_New(); if (unlikely(!__pyx_v_kw)) return -1; + __Pyx_GOTREF(__pyx_v_kw); + if (PyTuple_GET_SIZE(__pyx_args) > 2) { + __pyx_v_a = PyTuple_GetSlice(__pyx_args, 2, PyTuple_GET_SIZE(__pyx_args)); + if (unlikely(!__pyx_v_a)) { + __Pyx_DECREF(__pyx_v_kw); __pyx_v_kw = 0; + __Pyx_RefNannyFinishContext(); + return -1; + } + __Pyx_GOTREF(__pyx_v_a); + } else { + __pyx_v_a = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple); + } + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_conn,&__pyx_n_s_query,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + default: + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_conn)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_query)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 2, 1); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t used_pos_args = (pos_args < 2) ? pos_args : 2; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kw, values, used_pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) < 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_conn = ((struct __pyx_obj_6oursql_Connection *)values[0]); + __pyx_v_query = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_DECREF(__pyx_v_a); __pyx_v_a = 0; + __Pyx_DECREF(__pyx_v_kw); __pyx_v_kw = 0; + __Pyx_AddTraceback("oursql._Query.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_conn), __pyx_ptype_6oursql_Connection, 0, "conn", 0))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_6oursql_6_Query___cinit__(((struct __pyx_obj_6oursql__Query *)__pyx_v_self), __pyx_v_conn, __pyx_v_query, __pyx_v_a, __pyx_v_kw); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_a); + __Pyx_XDECREF(__pyx_v_kw); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6oursql_6_Query___cinit__(struct __pyx_obj_6oursql__Query *__pyx_v_self, struct __pyx_obj_6oursql_Connection *__pyx_v_conn, PyObject *__pyx_v_query, PyObject *__pyx_v_a, PyObject *__pyx_v_kw) { + char *__pyx_v_qstr; + Py_ssize_t __pyx_v_qlen; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__cinit__", 0); + __Pyx_INCREF(__pyx_v_query); + + /* "oursqlx/query.pyx":131 + * cdef char *qstr + * cdef Py_ssize_t qlen + * conn._check_closed() # <<<<<<<<<<<<<< + * self.conn = conn + * if PyUnicode_Check(query): + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_6oursql_Connection *)__pyx_v_conn->__pyx_vtab)->_check_closed(__pyx_v_conn); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "oursqlx/query.pyx":132 + * cdef Py_ssize_t qlen + * conn._check_closed() + * self.conn = conn # <<<<<<<<<<<<<< + * if PyUnicode_Check(query): + * query = query.encode(self.conn.charset) + */ + __Pyx_INCREF(((PyObject *)__pyx_v_conn)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_conn)); + __Pyx_GOTREF(__pyx_v_self->conn); + __Pyx_DECREF(((PyObject *)__pyx_v_self->conn)); + __pyx_v_self->conn = __pyx_v_conn; + + /* "oursqlx/query.pyx":133 + * conn._check_closed() + * self.conn = conn + * if PyUnicode_Check(query): # <<<<<<<<<<<<<< + * query = query.encode(self.conn.charset) + * PyString_AsStringAndSize(query, &qstr, &qlen) + */ + __pyx_t_2 = (PyUnicode_Check(__pyx_v_query) != 0); + if (__pyx_t_2) { + + /* "oursqlx/query.pyx":134 + * self.conn = conn + * if PyUnicode_Check(query): + * query = query.encode(self.conn.charset) # <<<<<<<<<<<<<< + * PyString_AsStringAndSize(query, &qstr, &qlen) + * if mysql_real_query(self.conn.conn, qstr, qlen): + */ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_query, __pyx_n_s_encode); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->conn), __pyx_n_s_charset); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + if (!__pyx_t_6) { + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_3); + } else { + __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL; + PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF_SET(__pyx_v_query, __pyx_t_3); + __pyx_t_3 = 0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "oursqlx/query.pyx":135 + * if PyUnicode_Check(query): + * query = query.encode(self.conn.charset) + * PyString_AsStringAndSize(query, &qstr, &qlen) # <<<<<<<<<<<<<< + * if mysql_real_query(self.conn.conn, qstr, qlen): + * self._raise_error() + */ + __pyx_t_1 = PyString_AsStringAndSize(__pyx_v_query, (&__pyx_v_qstr), (&__pyx_v_qlen)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "oursqlx/query.pyx":136 + * query = query.encode(self.conn.charset) + * PyString_AsStringAndSize(query, &qstr, &qlen) + * if mysql_real_query(self.conn.conn, qstr, qlen): # <<<<<<<<<<<<<< + * self._raise_error() + * self.res_a, self.res_kw = a, kw + */ + __pyx_t_2 = (__pyx_f_6oursql_mysql_real_query(__pyx_v_self->conn->conn, __pyx_v_qstr, __pyx_v_qlen) != 0); + if (__pyx_t_2) { + + /* "oursqlx/query.pyx":137 + * PyString_AsStringAndSize(query, &qstr, &qlen) + * if mysql_real_query(self.conn.conn, qstr, qlen): + * self._raise_error() # <<<<<<<<<<<<<< + * self.res_a, self.res_kw = a, kw + * self.warnings = [] + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_6oursql__Query *)__pyx_v_self->__pyx_vtab)->_raise_error(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L4; + } + __pyx_L4:; + + /* "oursqlx/query.pyx":138 + * if mysql_real_query(self.conn.conn, qstr, qlen): + * self._raise_error() + * self.res_a, self.res_kw = a, kw # <<<<<<<<<<<<<< + * self.warnings = [] + * self.new_result() + */ + __pyx_t_3 = __pyx_v_a; + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = __pyx_v_kw; + __Pyx_INCREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_v_self->res_a); + __Pyx_DECREF(__pyx_v_self->res_a); + __pyx_v_self->res_a = __pyx_t_3; + __pyx_t_3 = 0; + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_v_self->res_kw); + __Pyx_DECREF(__pyx_v_self->res_kw); + __pyx_v_self->res_kw = __pyx_t_4; + __pyx_t_4 = 0; + + /* "oursqlx/query.pyx":139 + * self._raise_error() + * self.res_a, self.res_kw = a, kw + * self.warnings = [] # <<<<<<<<<<<<<< + * self.new_result() + * # XXX: support multiple result sets. + */ + __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_v_self->warnings); + __Pyx_DECREF(__pyx_v_self->warnings); + __pyx_v_self->warnings = __pyx_t_4; + __pyx_t_4 = 0; + + /* "oursqlx/query.pyx":140 + * self.res_a, self.res_kw = a, kw + * self.warnings = [] + * self.new_result() # <<<<<<<<<<<<<< + * # XXX: support multiple result sets. + * self.has_result = self.result.has_result + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_new_result); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_7 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (__pyx_t_7) { + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_7); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } else { + __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "oursqlx/query.pyx":142 + * self.new_result() + * # XXX: support multiple result sets. + * self.has_result = self.result.has_result # <<<<<<<<<<<<<< + * + * _result_class = _ResultSet + */ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->result, __pyx_n_s_has_result); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_v_self->has_result); + __Pyx_DECREF(__pyx_v_self->has_result); + __pyx_v_self->has_result = __pyx_t_4; + __pyx_t_4 = 0; + + /* "oursqlx/query.pyx":128 + * cdef readonly object rowcount, lastrowid, description, warnings, has_result + * + * def __cinit__(self, Connection conn not None, query, *a, **kw): # <<<<<<<<<<<<<< + * cdef char *qstr + * cdef Py_ssize_t qlen + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("oursql._Query.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_query); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/query.pyx":145 + * + * _result_class = _ResultSet + * def new_result(self): # <<<<<<<<<<<<<< + * res = self._result_class(self.conn, *self.res_a, **self.res_kw) + * self.warnings.extend(res.warnings) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_6_Query_3new_result(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6oursql_6_Query_3new_result(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("new_result (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_6_Query_2new_result(((struct __pyx_obj_6oursql__Query *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_6_Query_2new_result(struct __pyx_obj_6oursql__Query *__pyx_v_self) { + PyObject *__pyx_v_res = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("new_result", 0); + + /* "oursqlx/query.pyx":146 + * _result_class = _ResultSet + * def new_result(self): + * res = self._result_class(self.conn, *self.res_a, **self.res_kw) # <<<<<<<<<<<<<< + * self.warnings.extend(res.warnings) + * self.rowcount = res.rowcount + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_result_class); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_v_self->conn)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self->conn)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self->conn)); + __pyx_t_3 = PySequence_Tuple(__pyx_v_self->res_a); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyNumber_Add(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(__pyx_v_self->res_kw == Py_None)) { + PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType"); + {__pyx_filename = __pyx_f[5]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + if (likely(PyDict_Check(__pyx_v_self->res_kw))) { + __pyx_t_3 = __pyx_v_self->res_kw; + __Pyx_INCREF(__pyx_t_3); + } else { + __pyx_t_3 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_self->res_kw, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + } + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_res = __pyx_t_2; + __pyx_t_2 = 0; + + /* "oursqlx/query.pyx":147 + * def new_result(self): + * res = self._result_class(self.conn, *self.res_a, **self.res_kw) + * self.warnings.extend(res.warnings) # <<<<<<<<<<<<<< + * self.rowcount = res.rowcount + * self.lastrowid = res.lastrowid + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->warnings, __pyx_n_s_extend); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_res, __pyx_n_s_warnings); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_1)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_1); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (!__pyx_t_1) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_2); + } else { + __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = NULL; + PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "oursqlx/query.pyx":148 + * res = self._result_class(self.conn, *self.res_a, **self.res_kw) + * self.warnings.extend(res.warnings) + * self.rowcount = res.rowcount # <<<<<<<<<<<<<< + * self.lastrowid = res.lastrowid + * self.description = res.description + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_res, __pyx_n_s_rowcount); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_v_self->rowcount); + __Pyx_DECREF(__pyx_v_self->rowcount); + __pyx_v_self->rowcount = __pyx_t_2; + __pyx_t_2 = 0; + + /* "oursqlx/query.pyx":149 + * self.warnings.extend(res.warnings) + * self.rowcount = res.rowcount + * self.lastrowid = res.lastrowid # <<<<<<<<<<<<<< + * self.description = res.description + * self.result = res + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_res, __pyx_n_s_lastrowid); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_v_self->lastrowid); + __Pyx_DECREF(__pyx_v_self->lastrowid); + __pyx_v_self->lastrowid = __pyx_t_2; + __pyx_t_2 = 0; + + /* "oursqlx/query.pyx":150 + * self.rowcount = res.rowcount + * self.lastrowid = res.lastrowid + * self.description = res.description # <<<<<<<<<<<<<< + * self.result = res + * + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_res, __pyx_n_s_description); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_v_self->description); + __Pyx_DECREF(__pyx_v_self->description); + __pyx_v_self->description = __pyx_t_2; + __pyx_t_2 = 0; + + /* "oursqlx/query.pyx":151 + * self.lastrowid = res.lastrowid + * self.description = res.description + * self.result = res # <<<<<<<<<<<<<< + * + * cdef int _raise_error(self) except -1: + */ + __Pyx_INCREF(__pyx_v_res); + __Pyx_GIVEREF(__pyx_v_res); + __Pyx_GOTREF(__pyx_v_self->result); + __Pyx_DECREF(__pyx_v_self->result); + __pyx_v_self->result = __pyx_v_res; + + /* "oursqlx/query.pyx":145 + * + * _result_class = _ResultSet + * def new_result(self): # <<<<<<<<<<<<<< + * res = self._result_class(self.conn, *self.res_a, **self.res_kw) + * self.warnings.extend(res.warnings) + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("oursql._Query.new_result", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_res); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/query.pyx":153 + * self.result = res + * + * cdef int _raise_error(self) except -1: # <<<<<<<<<<<<<< + * return self.conn._raise_error() + * + */ + +static int __pyx_f_6oursql_6_Query__raise_error(struct __pyx_obj_6oursql__Query *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_raise_error", 0); + + /* "oursqlx/query.pyx":154 + * + * cdef int _raise_error(self) except -1: + * return self.conn._raise_error() # <<<<<<<<<<<<<< + * + * def nextset(self): + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_6oursql_Connection *)__pyx_v_self->conn->__pyx_vtab)->_raise_error(__pyx_v_self->conn); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_t_1; + goto __pyx_L0; + + /* "oursqlx/query.pyx":153 + * self.result = res + * + * cdef int _raise_error(self) except -1: # <<<<<<<<<<<<<< + * return self.conn._raise_error() + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("oursql._Query._raise_error", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/query.pyx":156 + * return self.conn._raise_error() + * + * def nextset(self): # <<<<<<<<<<<<<< + * cdef int res + * # XXX: support multiple result sets. + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_6_Query_5nextset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6oursql_6_Query_5nextset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("nextset (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_6_Query_4nextset(((struct __pyx_obj_6oursql__Query *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_6_Query_4nextset(struct __pyx_obj_6oursql__Query *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("nextset", 0); + + /* "oursqlx/query.pyx":159 + * cdef int res + * # XXX: support multiple result sets. + * self.result = None # <<<<<<<<<<<<<< + * return False + * + */ + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->result); + __Pyx_DECREF(__pyx_v_self->result); + __pyx_v_self->result = Py_None; + + /* "oursqlx/query.pyx":160 + * # XXX: support multiple result sets. + * self.result = None + * return False # <<<<<<<<<<<<<< + * + * if not self.result: + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_False); + __pyx_r = Py_False; + goto __pyx_L0; + + /* "oursqlx/query.pyx":156 + * return self.conn._raise_error() + * + * def nextset(self): # <<<<<<<<<<<<<< + * cdef int res + * # XXX: support multiple result sets. + */ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/query.pyx":175 + * return True + * + * def fetchone(self): # <<<<<<<<<<<<<< + * while self.result is not None: + * if self.result.has_result: + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_6_Query_7fetchone(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6oursql_6_Query_7fetchone(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("fetchone (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_6_Query_6fetchone(((struct __pyx_obj_6oursql__Query *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_6_Query_6fetchone(struct __pyx_obj_6oursql__Query *__pyx_v_self) { + PyObject *__pyx_v_row = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("fetchone", 0); + + /* "oursqlx/query.pyx":176 + * + * def fetchone(self): + * while self.result is not None: # <<<<<<<<<<<<<< + * if self.result.has_result: + * row = self.result.fetchone() + */ + while (1) { + __pyx_t_1 = (__pyx_v_self->result != Py_None); + __pyx_t_2 = (__pyx_t_1 != 0); + if (!__pyx_t_2) break; + + /* "oursqlx/query.pyx":177 + * def fetchone(self): + * while self.result is not None: + * if self.result.has_result: # <<<<<<<<<<<<<< + * row = self.result.fetchone() + * if row is not None: + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->result, __pyx_n_s_has_result); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_2) { + + /* "oursqlx/query.pyx":178 + * while self.result is not None: + * if self.result.has_result: + * row = self.result.fetchone() # <<<<<<<<<<<<<< + * if row is not None: + * return row + */ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->result, __pyx_n_s_fetchone); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + if (__pyx_t_5) { + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } else { + __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF_SET(__pyx_v_row, __pyx_t_3); + __pyx_t_3 = 0; + + /* "oursqlx/query.pyx":179 + * if self.result.has_result: + * row = self.result.fetchone() + * if row is not None: # <<<<<<<<<<<<<< + * return row + * self.nextset() + */ + __pyx_t_2 = (__pyx_v_row != Py_None); + __pyx_t_1 = (__pyx_t_2 != 0); + if (__pyx_t_1) { + + /* "oursqlx/query.pyx":180 + * row = self.result.fetchone() + * if row is not None: + * return row # <<<<<<<<<<<<<< + * self.nextset() + * return None + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_row); + __pyx_r = __pyx_v_row; + goto __pyx_L0; + } + goto __pyx_L5; + } + __pyx_L5:; + + /* "oursqlx/query.pyx":181 + * if row is not None: + * return row + * self.nextset() # <<<<<<<<<<<<<< + * return None + * + */ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_nextset); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + if (__pyx_t_5) { + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } else { + __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + + /* "oursqlx/query.pyx":182 + * return row + * self.nextset() + * return None # <<<<<<<<<<<<<< + * + * def __iter__(self): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + + /* "oursqlx/query.pyx":175 + * return True + * + * def fetchone(self): # <<<<<<<<<<<<<< + * while self.result is not None: + * if self.result.has_result: + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("oursql._Query.fetchone", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_row); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/query.pyx":184 + * return None + * + * def __iter__(self): # <<<<<<<<<<<<<< + * return PyCallIter_New(self.fetchone, None) + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_6_Query_9__iter__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6oursql_6_Query_9__iter__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_6_Query_8__iter__(((struct __pyx_obj_6oursql__Query *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_6_Query_8__iter__(struct __pyx_obj_6oursql__Query *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__iter__", 0); + + /* "oursqlx/query.pyx":185 + * + * def __iter__(self): + * return PyCallIter_New(self.fetchone, None) # <<<<<<<<<<<<<< + * + * def fetchall(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_fetchone); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyCallIter_New(__pyx_t_1, Py_None); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "oursqlx/query.pyx":184 + * return None + * + * def __iter__(self): # <<<<<<<<<<<<<< + * return PyCallIter_New(self.fetchone, None) + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("oursql._Query.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/query.pyx":187 + * return PyCallIter_New(self.fetchone, None) + * + * def fetchall(self): # <<<<<<<<<<<<<< + * return PySequence_List(self) + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_6_Query_11fetchall(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6oursql_6_Query_11fetchall(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("fetchall (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_6_Query_10fetchall(((struct __pyx_obj_6oursql__Query *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_6_Query_10fetchall(struct __pyx_obj_6oursql__Query *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("fetchall", 0); + + /* "oursqlx/query.pyx":188 + * + * def fetchall(self): + * return PySequence_List(self) # <<<<<<<<<<<<<< + * + * # Cython should support multiple inheritance one of these days. + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PySequence_List(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "oursqlx/query.pyx":187 + * return PyCallIter_New(self.fetchone, None) + * + * def fetchall(self): # <<<<<<<<<<<<<< + * return PySequence_List(self) + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("oursql._Query.fetchall", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/query.pyx":126 + * cdef Connection conn + * cdef object result, res_a, res_kw + * cdef readonly object rowcount, lastrowid, description, warnings, has_result # <<<<<<<<<<<<<< + * + * def __cinit__(self, Connection conn not None, query, *a, **kw): + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_6_Query_8rowcount_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6oursql_6_Query_8rowcount_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_6_Query_8rowcount___get__(((struct __pyx_obj_6oursql__Query *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_6_Query_8rowcount___get__(struct __pyx_obj_6oursql__Query *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->rowcount); + __pyx_r = __pyx_v_self->rowcount; + goto __pyx_L0; + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_6_Query_9lastrowid_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6oursql_6_Query_9lastrowid_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_6_Query_9lastrowid___get__(((struct __pyx_obj_6oursql__Query *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_6_Query_9lastrowid___get__(struct __pyx_obj_6oursql__Query *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->lastrowid); + __pyx_r = __pyx_v_self->lastrowid; + goto __pyx_L0; + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_6_Query_11description_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6oursql_6_Query_11description_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_6_Query_11description___get__(((struct __pyx_obj_6oursql__Query *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_6_Query_11description___get__(struct __pyx_obj_6oursql__Query *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->description); + __pyx_r = __pyx_v_self->description; + goto __pyx_L0; + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_6_Query_8warnings_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6oursql_6_Query_8warnings_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_6_Query_8warnings___get__(((struct __pyx_obj_6oursql__Query *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_6_Query_8warnings___get__(struct __pyx_obj_6oursql__Query *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->warnings); + __pyx_r = __pyx_v_self->warnings; + goto __pyx_L0; + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_6_Query_10has_result_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6oursql_6_Query_10has_result_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_6_Query_10has_result___get__(((struct __pyx_obj_6oursql__Query *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_6_Query_10has_result___get__(struct __pyx_obj_6oursql__Query *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->has_result); + __pyx_r = __pyx_v_self->has_result; + goto __pyx_L0; + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/cursor.pyx":38 + * _query_class = _Query + * + * def __cinit__(self, Connection conn not None, bint try_plain_query=True, # <<<<<<<<<<<<<< + * **kwargs): + * self.conn = conn + */ + +/* Python wrapper */ +static int __pyx_pw_6oursql_6Cursor_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_6oursql_6Cursor_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_6oursql_Connection *__pyx_v_conn = 0; + int __pyx_v_try_plain_query; + PyObject *__pyx_v_kwargs = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1; + __Pyx_GOTREF(__pyx_v_kwargs); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_conn,&__pyx_n_s_try_plain_query,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_conn)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_try_plain_query); + if (value) { values[1] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_conn = ((struct __pyx_obj_6oursql_Connection *)values[0]); + if (values[1]) { + __pyx_v_try_plain_query = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_try_plain_query == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_try_plain_query = ((int)1); + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; + __Pyx_AddTraceback("oursql.Cursor.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_conn), __pyx_ptype_6oursql_Connection, 0, "conn", 0))) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_6oursql_6Cursor___cinit__(((struct __pyx_obj_6oursql_Cursor *)__pyx_v_self), __pyx_v_conn, __pyx_v_try_plain_query, __pyx_v_kwargs); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_kwargs); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6oursql_6Cursor___cinit__(struct __pyx_obj_6oursql_Cursor *__pyx_v_self, struct __pyx_obj_6oursql_Connection *__pyx_v_conn, int __pyx_v_try_plain_query, PyObject *__pyx_v_kwargs) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__cinit__", 0); + + /* "oursqlx/cursor.pyx":40 + * def __cinit__(self, Connection conn not None, bint try_plain_query=True, + * **kwargs): + * self.conn = conn # <<<<<<<<<<<<<< + * self._stmt_kwargs = kwargs + * self._statements = collections.deque() + */ + __Pyx_INCREF(((PyObject *)__pyx_v_conn)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_conn)); + __Pyx_GOTREF(__pyx_v_self->conn); + __Pyx_DECREF(((PyObject *)__pyx_v_self->conn)); + __pyx_v_self->conn = __pyx_v_conn; + + /* "oursqlx/cursor.pyx":41 + * **kwargs): + * self.conn = conn + * self._stmt_kwargs = kwargs # <<<<<<<<<<<<<< + * self._statements = collections.deque() + * self.messages = [] + */ + __Pyx_INCREF(__pyx_v_kwargs); + __Pyx_GIVEREF(__pyx_v_kwargs); + __Pyx_GOTREF(__pyx_v_self->_stmt_kwargs); + __Pyx_DECREF(__pyx_v_self->_stmt_kwargs); + __pyx_v_self->_stmt_kwargs = __pyx_v_kwargs; + + /* "oursqlx/cursor.pyx":42 + * self.conn = conn + * self._stmt_kwargs = kwargs + * self._statements = collections.deque() # <<<<<<<<<<<<<< + * self.messages = [] + * self.closed = False + */ + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_collections); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_deque); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (__pyx_t_2) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } else { + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->_statements); + __Pyx_DECREF(__pyx_v_self->_statements); + __pyx_v_self->_statements = __pyx_t_1; + __pyx_t_1 = 0; + + /* "oursqlx/cursor.pyx":43 + * self._stmt_kwargs = kwargs + * self._statements = collections.deque() + * self.messages = [] # <<<<<<<<<<<<<< + * self.closed = False + * self.rowcount = -1 + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->messages); + __Pyx_DECREF(__pyx_v_self->messages); + __pyx_v_self->messages = __pyx_t_1; + __pyx_t_1 = 0; + + /* "oursqlx/cursor.pyx":44 + * self._statements = collections.deque() + * self.messages = [] + * self.closed = False # <<<<<<<<<<<<<< + * self.rowcount = -1 + * self.arraysize = 1 + */ + __pyx_v_self->closed = 0; + + /* "oursqlx/cursor.pyx":45 + * self.messages = [] + * self.closed = False + * self.rowcount = -1 # <<<<<<<<<<<<<< + * self.arraysize = 1 + * self.try_plain_query = try_plain_query + */ + __Pyx_INCREF(__pyx_int_neg_1); + __Pyx_GIVEREF(__pyx_int_neg_1); + __Pyx_GOTREF(__pyx_v_self->rowcount); + __Pyx_DECREF(__pyx_v_self->rowcount); + __pyx_v_self->rowcount = __pyx_int_neg_1; + + /* "oursqlx/cursor.pyx":46 + * self.closed = False + * self.rowcount = -1 + * self.arraysize = 1 # <<<<<<<<<<<<<< + * self.try_plain_query = try_plain_query + * + */ + __pyx_v_self->arraysize = 1; + + /* "oursqlx/cursor.pyx":47 + * self.rowcount = -1 + * self.arraysize = 1 + * self.try_plain_query = try_plain_query # <<<<<<<<<<<<<< + * + * cdef int _check_closed(self) except -1: + */ + __pyx_v_self->try_plain_query = __pyx_v_try_plain_query; + + /* "oursqlx/cursor.pyx":38 + * _query_class = _Query + * + * def __cinit__(self, Connection conn not None, bint try_plain_query=True, # <<<<<<<<<<<<<< + * **kwargs): + * self.conn = conn + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("oursql.Cursor.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/cursor.pyx":49 + * self.try_plain_query = try_plain_query + * + * cdef int _check_closed(self) except -1: # <<<<<<<<<<<<<< + * if not self.conn.conn: + * raise ProgrammingError('connection closed') + */ + +static int __pyx_f_6oursql_6Cursor__check_closed(struct __pyx_obj_6oursql_Cursor *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_check_closed", 0); + + /* "oursqlx/cursor.pyx":50 + * + * cdef int _check_closed(self) except -1: + * if not self.conn.conn: # <<<<<<<<<<<<<< + * raise ProgrammingError('connection closed') + * if self.closed: + */ + __pyx_t_1 = ((!(__pyx_v_self->conn->conn != 0)) != 0); + if (__pyx_t_1) { + + /* "oursqlx/cursor.pyx":51 + * cdef int _check_closed(self) except -1: + * if not self.conn.conn: + * raise ProgrammingError('connection closed') # <<<<<<<<<<<<<< + * if self.closed: + * raise ProgrammingError('cursor closed') + */ + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_ProgrammingError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[6]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + + /* "oursqlx/cursor.pyx":52 + * if not self.conn.conn: + * raise ProgrammingError('connection closed') + * if self.closed: # <<<<<<<<<<<<<< + * raise ProgrammingError('cursor closed') + * + */ + __pyx_t_1 = (__pyx_v_self->closed != 0); + if (__pyx_t_1) { + + /* "oursqlx/cursor.pyx":53 + * raise ProgrammingError('connection closed') + * if self.closed: + * raise ProgrammingError('cursor closed') # <<<<<<<<<<<<<< + * + * def close(self): + */ + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_ProgrammingError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__26, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[6]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + + /* "oursqlx/cursor.pyx":49 + * self.try_plain_query = try_plain_query + * + * cdef int _check_closed(self) except -1: # <<<<<<<<<<<<<< + * if not self.conn.conn: + * raise ProgrammingError('connection closed') + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("oursql.Cursor._check_closed", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/cursor.pyx":55 + * raise ProgrammingError('cursor closed') + * + * def close(self): # <<<<<<<<<<<<<< + * """close() + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_6Cursor_3close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_6oursql_6Cursor_2close[] = "close()\n \n Close the cursor and discard the rest of the results. The cursor will\n immediately become unusable.\n "; +static PyObject *__pyx_pw_6oursql_6Cursor_3close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("close (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_6Cursor_2close(((struct __pyx_obj_6oursql_Cursor *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_6Cursor_2close(struct __pyx_obj_6oursql_Cursor *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("close", 0); + + /* "oursqlx/cursor.pyx":61 + * immediately become unusable. + * """ + * self.closed = True # <<<<<<<<<<<<<< + * self._statements.clear() + * + */ + __pyx_v_self->closed = 1; + + /* "oursqlx/cursor.pyx":62 + * """ + * self.closed = True + * self._statements.clear() # <<<<<<<<<<<<<< + * + * def _new_statement(self): + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_statements, __pyx_n_s_clear); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "oursqlx/cursor.pyx":55 + * raise ProgrammingError('cursor closed') + * + * def close(self): # <<<<<<<<<<<<<< + * """close() + * + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("oursql.Cursor.close", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/cursor.pyx":64 + * self._statements.clear() + * + * def _new_statement(self): # <<<<<<<<<<<<<< + * stmt = self._statement_class(self.conn, **self._stmt_kwargs) + * stmt.prefetch_rows = self.arraysize + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_6Cursor_5_new_statement(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6oursql_6Cursor_5_new_statement(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_new_statement (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_6Cursor_4_new_statement(((struct __pyx_obj_6oursql_Cursor *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_6Cursor_4_new_statement(struct __pyx_obj_6oursql_Cursor *__pyx_v_self) { + PyObject *__pyx_v_stmt = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_new_statement", 0); + + /* "oursqlx/cursor.pyx":65 + * + * def _new_statement(self): + * stmt = self._statement_class(self.conn, **self._stmt_kwargs) # <<<<<<<<<<<<<< + * stmt.prefetch_rows = self.arraysize + * return stmt + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_statement_class); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_v_self->conn)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self->conn)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self->conn)); + if (unlikely(__pyx_v_self->_stmt_kwargs == Py_None)) { + PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType"); + {__pyx_filename = __pyx_f[6]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + if (likely(PyDict_Check(__pyx_v_self->_stmt_kwargs))) { + __pyx_t_3 = __pyx_v_self->_stmt_kwargs; + __Pyx_INCREF(__pyx_t_3); + } else { + __pyx_t_3 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_self->_stmt_kwargs, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + } + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_stmt = __pyx_t_4; + __pyx_t_4 = 0; + + /* "oursqlx/cursor.pyx":66 + * def _new_statement(self): + * stmt = self._statement_class(self.conn, **self._stmt_kwargs) + * stmt.prefetch_rows = self.arraysize # <<<<<<<<<<<<<< + * return stmt + * + */ + __pyx_t_4 = __Pyx_PyInt_From_unsigned_long(__pyx_v_self->arraysize); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_stmt, __pyx_n_s_prefetch_rows, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "oursqlx/cursor.pyx":67 + * stmt = self._statement_class(self.conn, **self._stmt_kwargs) + * stmt.prefetch_rows = self.arraysize + * return stmt # <<<<<<<<<<<<<< + * + * def _new_query(self, query): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_stmt); + __pyx_r = __pyx_v_stmt; + goto __pyx_L0; + + /* "oursqlx/cursor.pyx":64 + * self._statements.clear() + * + * def _new_statement(self): # <<<<<<<<<<<<<< + * stmt = self._statement_class(self.conn, **self._stmt_kwargs) + * stmt.prefetch_rows = self.arraysize + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("oursql.Cursor._new_statement", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_stmt); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/cursor.pyx":69 + * return stmt + * + * def _new_query(self, query): # <<<<<<<<<<<<<< + * return self._query_class(self.conn, query, **self._stmt_kwargs) + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_6Cursor_7_new_query(PyObject *__pyx_v_self, PyObject *__pyx_v_query); /*proto*/ +static PyObject *__pyx_pw_6oursql_6Cursor_7_new_query(PyObject *__pyx_v_self, PyObject *__pyx_v_query) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_new_query (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_6Cursor_6_new_query(((struct __pyx_obj_6oursql_Cursor *)__pyx_v_self), ((PyObject *)__pyx_v_query)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_6Cursor_6_new_query(struct __pyx_obj_6oursql_Cursor *__pyx_v_self, PyObject *__pyx_v_query) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_new_query", 0); + + /* "oursqlx/cursor.pyx":70 + * + * def _new_query(self, query): + * return self._query_class(self.conn, query, **self._stmt_kwargs) # <<<<<<<<<<<<<< + * + * def callproc(self, procname, params=()): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_query_class); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_v_self->conn)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self->conn)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self->conn)); + __Pyx_INCREF(__pyx_v_query); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_query); + __Pyx_GIVEREF(__pyx_v_query); + if (unlikely(__pyx_v_self->_stmt_kwargs == Py_None)) { + PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType"); + {__pyx_filename = __pyx_f[6]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + if (likely(PyDict_Check(__pyx_v_self->_stmt_kwargs))) { + __pyx_t_3 = __pyx_v_self->_stmt_kwargs; + __Pyx_INCREF(__pyx_t_3); + } else { + __pyx_t_3 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_self->_stmt_kwargs, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + } + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + + /* "oursqlx/cursor.pyx":69 + * return stmt + * + * def _new_query(self, query): # <<<<<<<<<<<<<< + * return self._query_class(self.conn, query, **self._stmt_kwargs) + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("oursql.Cursor._new_query", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/cursor.pyx":72 + * return self._query_class(self.conn, query, **self._stmt_kwargs) + * + * def callproc(self, procname, params=()): # <<<<<<<<<<<<<< + * """callproc(procname, params=()) + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_6Cursor_9callproc(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6oursql_6Cursor_8callproc[] = "callproc(procname, params=())\n \n Supposedly, run a stored procedure. MySQL's C API has no direct call\n for this; you need to execute stored procedures with the CALL statement\n instead. Calling this method always raises an exception.\n "; +static PyObject *__pyx_pw_6oursql_6Cursor_9callproc(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + CYTHON_UNUSED PyObject *__pyx_v_procname = 0; + CYTHON_UNUSED PyObject *__pyx_v_params = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("callproc (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_procname,&__pyx_n_s_params,0}; + PyObject* values[2] = {0,0}; + values[1] = ((PyObject *)__pyx_empty_tuple); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_procname)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_params); + if (value) { values[1] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "callproc") < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_procname = values[0]; + __pyx_v_params = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("callproc", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("oursql.Cursor.callproc", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6oursql_6Cursor_8callproc(((struct __pyx_obj_6oursql_Cursor *)__pyx_v_self), __pyx_v_procname, __pyx_v_params); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_6Cursor_8callproc(CYTHON_UNUSED struct __pyx_obj_6oursql_Cursor *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_procname, CYTHON_UNUSED PyObject *__pyx_v_params) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("callproc", 0); + + /* "oursqlx/cursor.pyx":81 + * # This is slightly irritating, but not too horribly bad. The horribly + * # bad part is getting the results from a procedure. + * raise NotSupportedError('use the CALL statement with the execute ' # <<<<<<<<<<<<<< + * 'method to call stored procedures') + * + */ + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_NotSupportedError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__27, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[6]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "oursqlx/cursor.pyx":72 + * return self._query_class(self.conn, query, **self._stmt_kwargs) + * + * def callproc(self, procname, params=()): # <<<<<<<<<<<<<< + * """callproc(procname, params=()) + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("oursql.Cursor.callproc", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/cursor.pyx":84 + * 'method to call stored procedures') + * + * def _do_autoping(self): # <<<<<<<<<<<<<< + * if self.conn.autoping: + * self.conn.ping() + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_6Cursor_11_do_autoping(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6oursql_6Cursor_11_do_autoping(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_do_autoping (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_6Cursor_10_do_autoping(((struct __pyx_obj_6oursql_Cursor *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_6Cursor_10_do_autoping(struct __pyx_obj_6oursql_Cursor *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_do_autoping", 0); + + /* "oursqlx/cursor.pyx":85 + * + * def _do_autoping(self): + * if self.conn.autoping: # <<<<<<<<<<<<<< + * self.conn.ping() + * + */ + __pyx_t_1 = (__pyx_v_self->conn->autoping != 0); + if (__pyx_t_1) { + + /* "oursqlx/cursor.pyx":86 + * def _do_autoping(self): + * if self.conn.autoping: + * self.conn.ping() # <<<<<<<<<<<<<< + * + * def execute(self, query, params=(), plain_query=False): + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->conn), __pyx_n_s_ping); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (__pyx_t_4) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else { + __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "oursqlx/cursor.pyx":84 + * 'method to call stored procedures') + * + * def _do_autoping(self): # <<<<<<<<<<<<<< + * if self.conn.autoping: + * self.conn.ping() + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("oursql.Cursor._do_autoping", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/cursor.pyx":88 + * self.conn.ping() + * + * def execute(self, query, params=(), plain_query=False): # <<<<<<<<<<<<<< + * """execute(query, params=(), plain_query=False) + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_6Cursor_13execute(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6oursql_6Cursor_12execute[] = "execute(query, params=(), plain_query=False)\n \n Execute a query. If plain_query is true, run a plain, unparameterized\n query. MySQL cannot parameterize all kinds of statements, which makes\n it sometimes necessary to execute a plain query. If plain_query is true\n and params is true, an exception will be raised as plain queries cannot\n be parameterized.\n "; +static PyObject *__pyx_pw_6oursql_6Cursor_13execute(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_query = 0; + PyObject *__pyx_v_params = 0; + PyObject *__pyx_v_plain_query = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("execute (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_query,&__pyx_n_s_params,&__pyx_n_s_plain_query,0}; + PyObject* values[3] = {0,0,0}; + values[1] = ((PyObject *)__pyx_empty_tuple); + values[2] = ((PyObject *)Py_False); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_query)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_params); + if (value) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_plain_query); + if (value) { values[2] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "execute") < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_query = values[0]; + __pyx_v_params = values[1]; + __pyx_v_plain_query = values[2]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("execute", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("oursql.Cursor.execute", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6oursql_6Cursor_12execute(((struct __pyx_obj_6oursql_Cursor *)__pyx_v_self), __pyx_v_query, __pyx_v_params, __pyx_v_plain_query); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_6Cursor_12execute(struct __pyx_obj_6oursql_Cursor *__pyx_v_self, PyObject *__pyx_v_query, PyObject *__pyx_v_params, PyObject *__pyx_v_plain_query) { + PyObject *__pyx_v_stmt = NULL; + PyObject *__pyx_v_e = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + int __pyx_t_10; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + PyObject *__pyx_t_13 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("execute", 0); + + /* "oursqlx/cursor.pyx":97 + * be parameterized. + * """ + * self._check_closed() # <<<<<<<<<<<<<< + * self._do_autoping() + * # This, on the other hand, is just plain stupid. + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_6oursql_Cursor *)__pyx_v_self->__pyx_vtab)->_check_closed(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "oursqlx/cursor.pyx":98 + * """ + * self._check_closed() + * self._do_autoping() # <<<<<<<<<<<<<< + * # This, on the other hand, is just plain stupid. + * if plain_query: + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_do_autoping); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (__pyx_t_4) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else { + __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "oursqlx/cursor.pyx":100 + * self._do_autoping() + * # This, on the other hand, is just plain stupid. + * if plain_query: # <<<<<<<<<<<<<< + * if params: + * # I *really* don't want to write an escaping API. Anything + */ + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_plain_query); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_5) { + + /* "oursqlx/cursor.pyx":101 + * # This, on the other hand, is just plain stupid. + * if plain_query: + * if params: # <<<<<<<<<<<<<< + * # I *really* don't want to write an escaping API. Anything + * # worth parameterizing supports the prepared statement API + */ + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_params); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_5) { + + /* "oursqlx/cursor.pyx":105 + * # worth parameterizing supports the prepared statement API + * # anyway, so this shouldn't matter too much. + * raise ProgrammingError("can't call execute with both " # <<<<<<<<<<<<<< + * "parameters and a plain query") + * stmt = self._new_query(query) + */ + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_ProgrammingError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[6]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + + /* "oursqlx/cursor.pyx":107 + * raise ProgrammingError("can't call execute with both " + * "parameters and a plain query") + * stmt = self._new_query(query) # <<<<<<<<<<<<<< + * else: + * stmt = self._new_statement() + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_new_query); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (!__pyx_t_4) { + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_query); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + } else { + __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL; + __Pyx_INCREF(__pyx_v_query); + PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_query); + __Pyx_GIVEREF(__pyx_v_query); + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_stmt = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L3; + } + /*else*/ { + + /* "oursqlx/cursor.pyx":109 + * stmt = self._new_query(query) + * else: + * stmt = self._new_statement() # <<<<<<<<<<<<<< + * try: + * stmt.prepare(query) + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_new_statement); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (__pyx_t_6) { + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } else { + __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_stmt = __pyx_t_3; + __pyx_t_3 = 0; + + /* "oursqlx/cursor.pyx":110 + * else: + * stmt = self._new_statement() + * try: # <<<<<<<<<<<<<< + * stmt.prepare(query) + * except Error, e: + */ + { + __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9); + __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_9); + /*try:*/ { + + /* "oursqlx/cursor.pyx":111 + * stmt = self._new_statement() + * try: + * stmt.prepare(query) # <<<<<<<<<<<<<< + * except Error, e: + * # So, if MySQL refuses to parameterize the query, we optionally + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_stmt, __pyx_n_s_prepare); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (!__pyx_t_6) { + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_query); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_3); + } else { + __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL; + __Pyx_INCREF(__pyx_v_query); + PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_query); + __Pyx_GIVEREF(__pyx_v_query); + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L5_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + /*else:*/ { + + /* "oursqlx/cursor.pyx":122 + * raise + * else: + * stmt.execute(*params) # <<<<<<<<<<<<<< + * self._update_fields(stmt) + * + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_stmt, __pyx_n_s_execute); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PySequence_Tuple(__pyx_v_params); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + goto __pyx_L12_try_end; + __pyx_L5_error:; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "oursqlx/cursor.pyx":112 + * try: + * stmt.prepare(query) + * except Error, e: # <<<<<<<<<<<<<< + * # So, if MySQL refuses to parameterize the query, we optionally + * # try it again through the stupid query API. This is optional + */ + __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_Error); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyErr_ExceptionMatches(__pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_1) { + __Pyx_AddTraceback("oursql.Cursor.execute", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_2, &__pyx_t_3) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __pyx_v_e = __pyx_t_2; + + /* "oursqlx/cursor.pyx":117 + * # because you can lose state data if this is always done + * # implicitly. + * if self.try_plain_query and e.errno == ER_UNSUPPORTED_PS: # <<<<<<<<<<<<<< + * return self.execute(query, params, plain_query=True) + * else: + */ + __pyx_t_10 = (__pyx_v_self->try_plain_query != 0); + if (__pyx_t_10) { + } else { + __pyx_t_5 = __pyx_t_10; + goto __pyx_L16_bool_binop_done; + } + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_e, __pyx_n_s_errno); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_11 = __Pyx_PyInt_From_int(ER_UNSUPPORTED_PS); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_12 = PyObject_RichCompare(__pyx_t_6, __pyx_t_11, Py_EQ); __Pyx_XGOTREF(__pyx_t_12); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_5 = __pyx_t_10; + __pyx_L16_bool_binop_done:; + if (__pyx_t_5) { + + /* "oursqlx/cursor.pyx":118 + * # implicitly. + * if self.try_plain_query and e.errno == ER_UNSUPPORTED_PS: + * return self.execute(query, params, plain_query=True) # <<<<<<<<<<<<<< + * else: + * raise + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_execute); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_INCREF(__pyx_v_query); + PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_query); + __Pyx_GIVEREF(__pyx_v_query); + __Pyx_INCREF(__pyx_v_params); + PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_v_params); + __Pyx_GIVEREF(__pyx_v_params); + __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(__pyx_t_6); + if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_plain_query, Py_True) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_11, __pyx_t_6); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_r = __pyx_t_13; + __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + goto __pyx_L8_except_return; + } + /*else*/ { + + /* "oursqlx/cursor.pyx":120 + * return self.execute(query, params, plain_query=True) + * else: + * raise # <<<<<<<<<<<<<< + * else: + * stmt.execute(*params) + */ + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ErrRestore(__pyx_t_4, __pyx_t_2, __pyx_t_3); + __pyx_t_4 = 0; __pyx_t_2 = 0; __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[6]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;} + } + } + goto __pyx_L7_except_error; + __pyx_L7_except_error:; + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9); + goto __pyx_L1_error; + __pyx_L8_except_return:; + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9); + goto __pyx_L0; + __pyx_L12_try_end:; + } + } + __pyx_L3:; + + /* "oursqlx/cursor.pyx":123 + * else: + * stmt.execute(*params) + * self._update_fields(stmt) # <<<<<<<<<<<<<< + * + * def executemany(self, query, parambatch): + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_6oursql_Cursor *)__pyx_v_self->__pyx_vtab)->_update_fields(__pyx_v_self, __pyx_v_stmt, NULL); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "oursqlx/cursor.pyx":88 + * self.conn.ping() + * + * def execute(self, query, params=(), plain_query=False): # <<<<<<<<<<<<<< + * """execute(query, params=(), plain_query=False) + * + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_XDECREF(__pyx_t_13); + __Pyx_AddTraceback("oursql.Cursor.execute", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_stmt); + __Pyx_XDECREF(__pyx_v_e); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/cursor.pyx":125 + * self._update_fields(stmt) + * + * def executemany(self, query, parambatch): # <<<<<<<<<<<<<< + * """executemany(query, parambatch) + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_6Cursor_15executemany(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6oursql_6Cursor_14executemany[] = "executemany(query, parambatch)\n \n Execute the same query with different sets of parameters. This is more\n efficient than calling execute many times with the same query.\n "; +static PyObject *__pyx_pw_6oursql_6Cursor_15executemany(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_query = 0; + PyObject *__pyx_v_parambatch = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("executemany (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_query,&__pyx_n_s_parambatch,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_query)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_parambatch)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("executemany", 1, 2, 2, 1); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "executemany") < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_query = values[0]; + __pyx_v_parambatch = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("executemany", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("oursql.Cursor.executemany", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6oursql_6Cursor_14executemany(((struct __pyx_obj_6oursql_Cursor *)__pyx_v_self), __pyx_v_query, __pyx_v_parambatch); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_6Cursor_14executemany(struct __pyx_obj_6oursql_Cursor *__pyx_v_self, PyObject *__pyx_v_query, PyObject *__pyx_v_parambatch) { + PyObject *__pyx_v_stmt = NULL; + PyObject *__pyx_v_rowcount = NULL; + PyObject *__pyx_v_params = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + Py_ssize_t __pyx_t_6; + PyObject *(*__pyx_t_7)(PyObject *); + int __pyx_t_8; + struct __pyx_opt_args_6oursql_6Cursor__update_fields __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("executemany", 0); + + /* "oursqlx/cursor.pyx":131 + * efficient than calling execute many times with the same query. + * """ + * self._check_closed() # <<<<<<<<<<<<<< + * self._do_autoping() + * # No plain queries because they can't be parameterized anyway. + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_6oursql_Cursor *)__pyx_v_self->__pyx_vtab)->_check_closed(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "oursqlx/cursor.pyx":132 + * """ + * self._check_closed() + * self._do_autoping() # <<<<<<<<<<<<<< + * # No plain queries because they can't be parameterized anyway. + * stmt = self._new_statement() + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_do_autoping); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (__pyx_t_4) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else { + __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "oursqlx/cursor.pyx":134 + * self._do_autoping() + * # No plain queries because they can't be parameterized anyway. + * stmt = self._new_statement() # <<<<<<<<<<<<<< + * stmt.prepare(query) + * rowcount = 0 + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_new_statement); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (__pyx_t_4) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else { + __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_stmt = __pyx_t_2; + __pyx_t_2 = 0; + + /* "oursqlx/cursor.pyx":135 + * # No plain queries because they can't be parameterized anyway. + * stmt = self._new_statement() + * stmt.prepare(query) # <<<<<<<<<<<<<< + * rowcount = 0 + * for params in parambatch: + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_stmt, __pyx_n_s_prepare); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (!__pyx_t_4) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_query); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + } else { + __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL; + __Pyx_INCREF(__pyx_v_query); + PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_query); + __Pyx_GIVEREF(__pyx_v_query); + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "oursqlx/cursor.pyx":136 + * stmt = self._new_statement() + * stmt.prepare(query) + * rowcount = 0 # <<<<<<<<<<<<<< + * for params in parambatch: + * stmt.execute(*params) + */ + __Pyx_INCREF(__pyx_int_0); + __pyx_v_rowcount = __pyx_int_0; + + /* "oursqlx/cursor.pyx":137 + * stmt.prepare(query) + * rowcount = 0 + * for params in parambatch: # <<<<<<<<<<<<<< + * stmt.execute(*params) + * # There's probably a better way to do this, but whatever. As far as + */ + if (likely(PyList_CheckExact(__pyx_v_parambatch)) || PyTuple_CheckExact(__pyx_v_parambatch)) { + __pyx_t_2 = __pyx_v_parambatch; __Pyx_INCREF(__pyx_t_2); __pyx_t_6 = 0; + __pyx_t_7 = NULL; + } else { + __pyx_t_6 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_parambatch); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + for (;;) { + if (likely(!__pyx_t_7)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } + } else { + __pyx_t_3 = __pyx_t_7(__pyx_t_2); + if (unlikely(!__pyx_t_3)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[6]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_3); + } + __Pyx_XDECREF_SET(__pyx_v_params, __pyx_t_3); + __pyx_t_3 = 0; + + /* "oursqlx/cursor.pyx":138 + * rowcount = 0 + * for params in parambatch: + * stmt.execute(*params) # <<<<<<<<<<<<<< + * # There's probably a better way to do this, but whatever. As far as + * # I know we should get all values -1 or all values >= 0. + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_stmt, __pyx_n_s_execute); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PySequence_Tuple(__pyx_v_params); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "oursqlx/cursor.pyx":141 + * # There's probably a better way to do this, but whatever. As far as + * # I know we should get all values -1 or all values >= 0. + * rowcount += stmt.rowcount # <<<<<<<<<<<<<< + * # Whatevs. + * if rowcount < 0: + */ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_stmt, __pyx_n_s_rowcount); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_rowcount, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF_SET(__pyx_v_rowcount, __pyx_t_5); + __pyx_t_5 = 0; + + /* "oursqlx/cursor.pyx":137 + * stmt.prepare(query) + * rowcount = 0 + * for params in parambatch: # <<<<<<<<<<<<<< + * stmt.execute(*params) + * # There's probably a better way to do this, but whatever. As far as + */ + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "oursqlx/cursor.pyx":143 + * rowcount += stmt.rowcount + * # Whatevs. + * if rowcount < 0: # <<<<<<<<<<<<<< + * rowcount = -1 + * self._update_fields(stmt, rowcount) + */ + __pyx_t_2 = PyObject_RichCompare(__pyx_v_rowcount, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_8) { + + /* "oursqlx/cursor.pyx":144 + * # Whatevs. + * if rowcount < 0: + * rowcount = -1 # <<<<<<<<<<<<<< + * self._update_fields(stmt, rowcount) + * + */ + __Pyx_INCREF(__pyx_int_neg_1); + __Pyx_DECREF_SET(__pyx_v_rowcount, __pyx_int_neg_1); + goto __pyx_L5; + } + __pyx_L5:; + + /* "oursqlx/cursor.pyx":145 + * if rowcount < 0: + * rowcount = -1 + * self._update_fields(stmt, rowcount) # <<<<<<<<<<<<<< + * + * cdef int _update_fields(self, stmt, rowcount=None) except -1: + */ + __pyx_t_9.__pyx_n = 1; + __pyx_t_9.rowcount = __pyx_v_rowcount; + __pyx_t_1 = ((struct __pyx_vtabstruct_6oursql_Cursor *)__pyx_v_self->__pyx_vtab)->_update_fields(__pyx_v_self, __pyx_v_stmt, &__pyx_t_9); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "oursqlx/cursor.pyx":125 + * self._update_fields(stmt) + * + * def executemany(self, query, parambatch): # <<<<<<<<<<<<<< + * """executemany(query, parambatch) + * + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("oursql.Cursor.executemany", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_stmt); + __Pyx_XDECREF(__pyx_v_rowcount); + __Pyx_XDECREF(__pyx_v_params); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/cursor.pyx":147 + * self._update_fields(stmt, rowcount) + * + * cdef int _update_fields(self, stmt, rowcount=None) except -1: # <<<<<<<<<<<<<< + * self.messages.extend(stmt.warnings) + * if rowcount is None: + */ + +static int __pyx_f_6oursql_6Cursor__update_fields(struct __pyx_obj_6oursql_Cursor *__pyx_v_self, PyObject *__pyx_v_stmt, struct __pyx_opt_args_6oursql_6Cursor__update_fields *__pyx_optional_args) { + PyObject *__pyx_v_rowcount = ((PyObject *)Py_None); + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_update_fields", 0); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_rowcount = __pyx_optional_args->rowcount; + } + } + + /* "oursqlx/cursor.pyx":148 + * + * cdef int _update_fields(self, stmt, rowcount=None) except -1: + * self.messages.extend(stmt.warnings) # <<<<<<<<<<<<<< + * if rowcount is None: + * self.rowcount = stmt.rowcount + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->messages, __pyx_n_s_extend); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_stmt, __pyx_n_s_warnings); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (!__pyx_t_4) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else { + __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL; + PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "oursqlx/cursor.pyx":149 + * cdef int _update_fields(self, stmt, rowcount=None) except -1: + * self.messages.extend(stmt.warnings) + * if rowcount is None: # <<<<<<<<<<<<<< + * self.rowcount = stmt.rowcount + * else: + */ + __pyx_t_6 = (__pyx_v_rowcount == Py_None); + __pyx_t_7 = (__pyx_t_6 != 0); + if (__pyx_t_7) { + + /* "oursqlx/cursor.pyx":150 + * self.messages.extend(stmt.warnings) + * if rowcount is None: + * self.rowcount = stmt.rowcount # <<<<<<<<<<<<<< + * else: + * self.rowcount = rowcount + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_stmt, __pyx_n_s_rowcount); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->rowcount); + __Pyx_DECREF(__pyx_v_self->rowcount); + __pyx_v_self->rowcount = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L3; + } + /*else*/ { + + /* "oursqlx/cursor.pyx":152 + * self.rowcount = stmt.rowcount + * else: + * self.rowcount = rowcount # <<<<<<<<<<<<<< + * self.lastrowid = stmt.lastrowid + * self.description = stmt.description + */ + __Pyx_INCREF(__pyx_v_rowcount); + __Pyx_GIVEREF(__pyx_v_rowcount); + __Pyx_GOTREF(__pyx_v_self->rowcount); + __Pyx_DECREF(__pyx_v_self->rowcount); + __pyx_v_self->rowcount = __pyx_v_rowcount; + } + __pyx_L3:; + + /* "oursqlx/cursor.pyx":153 + * else: + * self.rowcount = rowcount + * self.lastrowid = stmt.lastrowid # <<<<<<<<<<<<<< + * self.description = stmt.description + * if stmt.has_result: + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_stmt, __pyx_n_s_lastrowid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->lastrowid); + __Pyx_DECREF(__pyx_v_self->lastrowid); + __pyx_v_self->lastrowid = __pyx_t_1; + __pyx_t_1 = 0; + + /* "oursqlx/cursor.pyx":154 + * self.rowcount = rowcount + * self.lastrowid = stmt.lastrowid + * self.description = stmt.description # <<<<<<<<<<<<<< + * if stmt.has_result: + * self._statements.append(stmt) + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_stmt, __pyx_n_s_description); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->description); + __Pyx_DECREF(__pyx_v_self->description); + __pyx_v_self->description = __pyx_t_1; + __pyx_t_1 = 0; + + /* "oursqlx/cursor.pyx":155 + * self.lastrowid = stmt.lastrowid + * self.description = stmt.description + * if stmt.has_result: # <<<<<<<<<<<<<< + * self._statements.append(stmt) + * + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_stmt, __pyx_n_s_has_result); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_7) { + + /* "oursqlx/cursor.pyx":156 + * self.description = stmt.description + * if stmt.has_result: + * self._statements.append(stmt) # <<<<<<<<<<<<<< + * + * cdef int _check_statements(self) except -1: + */ + __pyx_t_8 = __Pyx_PyObject_Append(__pyx_v_self->_statements, __pyx_v_stmt); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L4; + } + __pyx_L4:; + + /* "oursqlx/cursor.pyx":147 + * self._update_fields(stmt, rowcount) + * + * cdef int _update_fields(self, stmt, rowcount=None) except -1: # <<<<<<<<<<<<<< + * self.messages.extend(stmt.warnings) + * if rowcount is None: + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("oursql.Cursor._update_fields", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/cursor.pyx":158 + * self._statements.append(stmt) + * + * cdef int _check_statements(self) except -1: # <<<<<<<<<<<<<< + * self._check_closed() + * if not self._statements: + */ + +static int __pyx_f_6oursql_6Cursor__check_statements(struct __pyx_obj_6oursql_Cursor *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_check_statements", 0); + + /* "oursqlx/cursor.pyx":159 + * + * cdef int _check_statements(self) except -1: + * self._check_closed() # <<<<<<<<<<<<<< + * if not self._statements: + * raise ProgrammingError('no results available') + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_6oursql_Cursor *)__pyx_v_self->__pyx_vtab)->_check_closed(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "oursqlx/cursor.pyx":160 + * cdef int _check_statements(self) except -1: + * self._check_closed() + * if not self._statements: # <<<<<<<<<<<<<< + * raise ProgrammingError('no results available') + * + */ + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_self->_statements); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = ((!__pyx_t_2) != 0); + if (__pyx_t_3) { + + /* "oursqlx/cursor.pyx":161 + * self._check_closed() + * if not self._statements: + * raise ProgrammingError('no results available') # <<<<<<<<<<<<<< + * + * def nextset(self): + */ + __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_ProgrammingError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__29, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[6]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + + /* "oursqlx/cursor.pyx":158 + * self._statements.append(stmt) + * + * cdef int _check_statements(self) except -1: # <<<<<<<<<<<<<< + * self._check_closed() + * if not self._statements: + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("oursql.Cursor._check_statements", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/cursor.pyx":163 + * raise ProgrammingError('no results available') + * + * def nextset(self): # <<<<<<<<<<<<<< + * """nextset() -> True or None. + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_6Cursor_17nextset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_6oursql_6Cursor_16nextset[] = "nextset() -> True or None.\n \n Move to the next result set. If there are any result sets left, this\n returns True. Otherwise, None.\n "; +static PyObject *__pyx_pw_6oursql_6Cursor_17nextset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("nextset (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_6Cursor_16nextset(((struct __pyx_obj_6oursql_Cursor *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_6Cursor_16nextset(struct __pyx_obj_6oursql_Cursor *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("nextset", 0); + + /* "oursqlx/cursor.pyx":169 + * returns True. Otherwise, None. + * """ + * self._check_statements() # <<<<<<<<<<<<<< + * if self._statements[0].nextset(): + * return True + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_6oursql_Cursor *)__pyx_v_self->__pyx_vtab)->_check_statements(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "oursqlx/cursor.pyx":170 + * """ + * self._check_statements() + * if self._statements[0].nextset(): # <<<<<<<<<<<<<< + * return True + * self._statements.popleft() + */ + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_self->_statements, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_nextset); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + if (__pyx_t_3) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_5) { + + /* "oursqlx/cursor.pyx":171 + * self._check_statements() + * if self._statements[0].nextset(): + * return True # <<<<<<<<<<<<<< + * self._statements.popleft() + * # DB-API, you so wacky. + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_True); + __pyx_r = Py_True; + goto __pyx_L0; + } + + /* "oursqlx/cursor.pyx":172 + * if self._statements[0].nextset(): + * return True + * self._statements.popleft() # <<<<<<<<<<<<<< + * # DB-API, you so wacky. + * return True if self._statements else None + */ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_statements, __pyx_n_s_popleft); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + if (__pyx_t_3) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "oursqlx/cursor.pyx":174 + * self._statements.popleft() + * # DB-API, you so wacky. + * return True if self._statements else None # <<<<<<<<<<<<<< + * + * def fetchone(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_self->_statements); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_5) { + __Pyx_INCREF(Py_True); + __pyx_t_2 = Py_True; + } else { + __Pyx_INCREF(Py_None); + __pyx_t_2 = Py_None; + } + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "oursqlx/cursor.pyx":163 + * raise ProgrammingError('no results available') + * + * def nextset(self): # <<<<<<<<<<<<<< + * """nextset() -> True or None. + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("oursql.Cursor.nextset", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/cursor.pyx":176 + * return True if self._statements else None + * + * def fetchone(self): # <<<<<<<<<<<<<< + * """fetchone() -> row. + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_6Cursor_19fetchone(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_6oursql_6Cursor_18fetchone[] = "fetchone() -> row.\n \n Fetch one row from the current result set. If the result set was\n exhausted, this returns None. If there were no result sets, a \n ProgrammingError is raised.\n "; +static PyObject *__pyx_pw_6oursql_6Cursor_19fetchone(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("fetchone (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_6Cursor_18fetchone(((struct __pyx_obj_6oursql_Cursor *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_6Cursor_18fetchone(struct __pyx_obj_6oursql_Cursor *__pyx_v_self) { + PyObject *__pyx_v_ret = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("fetchone", 0); + + /* "oursqlx/cursor.pyx":183 + * ProgrammingError is raised. + * """ + * self._check_statements() # <<<<<<<<<<<<<< + * self._do_autoping() + * ret = self._statements[0].fetchone() + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_6oursql_Cursor *)__pyx_v_self->__pyx_vtab)->_check_statements(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "oursqlx/cursor.pyx":184 + * """ + * self._check_statements() + * self._do_autoping() # <<<<<<<<<<<<<< + * ret = self._statements[0].fetchone() + * if ret is None: + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_do_autoping); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (__pyx_t_4) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else { + __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "oursqlx/cursor.pyx":185 + * self._check_statements() + * self._do_autoping() + * ret = self._statements[0].fetchone() # <<<<<<<<<<<<<< + * if ret is None: + * self.nextset() + */ + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_self->_statements, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_fetchone); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + if (__pyx_t_3) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_ret = __pyx_t_2; + __pyx_t_2 = 0; + + /* "oursqlx/cursor.pyx":186 + * self._do_autoping() + * ret = self._statements[0].fetchone() + * if ret is None: # <<<<<<<<<<<<<< + * self.nextset() + * return ret + */ + __pyx_t_5 = (__pyx_v_ret == Py_None); + __pyx_t_6 = (__pyx_t_5 != 0); + if (__pyx_t_6) { + + /* "oursqlx/cursor.pyx":187 + * ret = self._statements[0].fetchone() + * if ret is None: + * self.nextset() # <<<<<<<<<<<<<< + * return ret + * + */ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_nextset); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + if (__pyx_t_3) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "oursqlx/cursor.pyx":188 + * if ret is None: + * self.nextset() + * return ret # <<<<<<<<<<<<<< + * + * def fetchmany(self, size=None): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_ret); + __pyx_r = __pyx_v_ret; + goto __pyx_L0; + + /* "oursqlx/cursor.pyx":176 + * return True if self._statements else None + * + * def fetchone(self): # <<<<<<<<<<<<<< + * """fetchone() -> row. + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("oursql.Cursor.fetchone", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_ret); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/cursor.pyx":190 + * return ret + * + * def fetchmany(self, size=None): # <<<<<<<<<<<<<< + * """fetchmany(size=self.arraysize) -> list of rows. + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_6Cursor_21fetchmany(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6oursql_6Cursor_20fetchmany[] = "fetchmany(size=self.arraysize) -> list of rows.\n \n Fetch up to 'size' rows. If there aren't that many rows available in \n the database, this returns as many as were available. If there were no \n result sets, a ProgrammingError is raised.\n "; +static PyObject *__pyx_pw_6oursql_6Cursor_21fetchmany(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_size = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("fetchmany (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_size,0}; + PyObject* values[1] = {0}; + values[0] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_size); + if (value) { values[0] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fetchmany") < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_size = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("fetchmany", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("oursql.Cursor.fetchmany", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6oursql_6Cursor_20fetchmany(((struct __pyx_obj_6oursql_Cursor *)__pyx_v_self), __pyx_v_size); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_6Cursor_20fetchmany(struct __pyx_obj_6oursql_Cursor *__pyx_v_self, PyObject *__pyx_v_size) { + unsigned int __pyx_v_i; + PyObject *__pyx_v_ret = NULL; + PyObject *__pyx_v_resultset = NULL; + PyObject *__pyx_v_row = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_t_6; + unsigned int __pyx_t_7; + int __pyx_t_8; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("fetchmany", 0); + __Pyx_INCREF(__pyx_v_size); + + /* "oursqlx/cursor.pyx":198 + * """ + * cdef unsigned int i + * self._check_statements() # <<<<<<<<<<<<<< + * self._do_autoping() + * if size is None: + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_6oursql_Cursor *)__pyx_v_self->__pyx_vtab)->_check_statements(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "oursqlx/cursor.pyx":199 + * cdef unsigned int i + * self._check_statements() + * self._do_autoping() # <<<<<<<<<<<<<< + * if size is None: + * size = self.arraysize + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_do_autoping); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (__pyx_t_4) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else { + __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "oursqlx/cursor.pyx":200 + * self._check_statements() + * self._do_autoping() + * if size is None: # <<<<<<<<<<<<<< + * size = self.arraysize + * ret = [] + */ + __pyx_t_5 = (__pyx_v_size == Py_None); + __pyx_t_6 = (__pyx_t_5 != 0); + if (__pyx_t_6) { + + /* "oursqlx/cursor.pyx":201 + * self._do_autoping() + * if size is None: + * size = self.arraysize # <<<<<<<<<<<<<< + * ret = [] + * resultset = self._statements[0] + */ + __pyx_t_2 = __Pyx_PyInt_From_unsigned_long(__pyx_v_self->arraysize); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF_SET(__pyx_v_size, __pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "oursqlx/cursor.pyx":202 + * if size is None: + * size = self.arraysize + * ret = [] # <<<<<<<<<<<<<< + * resultset = self._statements[0] + * # This is a little bit wacky for DB-API compliance. If there's fewer + */ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_ret = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + + /* "oursqlx/cursor.pyx":203 + * size = self.arraysize + * ret = [] + * resultset = self._statements[0] # <<<<<<<<<<<<<< + * # This is a little bit wacky for DB-API compliance. If there's fewer + * # rows available than requested, return everything available without + */ + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_self->_statements, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_resultset = __pyx_t_2; + __pyx_t_2 = 0; + + /* "oursqlx/cursor.pyx":209 + * # result set at all, *then* switch to the next result set and return an + * # empty sequence. + * for 0 <= i < size: # <<<<<<<<<<<<<< + * row = resultset.fetchone() + * if row is None: + */ + __pyx_t_7 = __Pyx_PyInt_As_unsigned_int(__pyx_v_size); if (unlikely((__pyx_t_7 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_7; __pyx_v_i++) { + + /* "oursqlx/cursor.pyx":210 + * # empty sequence. + * for 0 <= i < size: + * row = resultset.fetchone() # <<<<<<<<<<<<<< + * if row is None: + * if i == 0: + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_resultset, __pyx_n_s_fetchone); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (__pyx_t_4) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else { + __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF_SET(__pyx_v_row, __pyx_t_2); + __pyx_t_2 = 0; + + /* "oursqlx/cursor.pyx":211 + * for 0 <= i < size: + * row = resultset.fetchone() + * if row is None: # <<<<<<<<<<<<<< + * if i == 0: + * self.nextset() + */ + __pyx_t_6 = (__pyx_v_row == Py_None); + __pyx_t_5 = (__pyx_t_6 != 0); + if (__pyx_t_5) { + + /* "oursqlx/cursor.pyx":212 + * row = resultset.fetchone() + * if row is None: + * if i == 0: # <<<<<<<<<<<<<< + * self.nextset() + * return ret + */ + __pyx_t_5 = ((__pyx_v_i == 0) != 0); + if (__pyx_t_5) { + + /* "oursqlx/cursor.pyx":213 + * if row is None: + * if i == 0: + * self.nextset() # <<<<<<<<<<<<<< + * return ret + * ret.append(row) + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_nextset); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (__pyx_t_4) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else { + __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L7; + } + __pyx_L7:; + + /* "oursqlx/cursor.pyx":214 + * if i == 0: + * self.nextset() + * return ret # <<<<<<<<<<<<<< + * ret.append(row) + * return ret + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_ret); + __pyx_r = __pyx_v_ret; + goto __pyx_L0; + } + + /* "oursqlx/cursor.pyx":215 + * self.nextset() + * return ret + * ret.append(row) # <<<<<<<<<<<<<< + * return ret + * + */ + __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_ret, __pyx_v_row); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + + /* "oursqlx/cursor.pyx":216 + * return ret + * ret.append(row) + * return ret # <<<<<<<<<<<<<< + * + * def fetchall(self): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_ret); + __pyx_r = __pyx_v_ret; + goto __pyx_L0; + + /* "oursqlx/cursor.pyx":190 + * return ret + * + * def fetchmany(self, size=None): # <<<<<<<<<<<<<< + * """fetchmany(size=self.arraysize) -> list of rows. + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("oursql.Cursor.fetchmany", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_ret); + __Pyx_XDECREF(__pyx_v_resultset); + __Pyx_XDECREF(__pyx_v_row); + __Pyx_XDECREF(__pyx_v_size); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/cursor.pyx":218 + * return ret + * + * def fetchall(self): # <<<<<<<<<<<<<< + * """fetchall() -> list of rows. + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_6Cursor_23fetchall(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_6oursql_6Cursor_22fetchall[] = "fetchall() -> list of rows.\n \n Fetch all available rows from the database. If there were no result \n sets, a ProgrammingError is raised.\n "; +static PyObject *__pyx_pw_6oursql_6Cursor_23fetchall(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("fetchall (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_6Cursor_22fetchall(((struct __pyx_obj_6oursql_Cursor *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_6Cursor_22fetchall(struct __pyx_obj_6oursql_Cursor *__pyx_v_self) { + PyObject *__pyx_v_ret = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("fetchall", 0); + + /* "oursqlx/cursor.pyx":224 + * sets, a ProgrammingError is raised. + * """ + * self._check_statements() # <<<<<<<<<<<<<< + * self._do_autoping() + * ret = [] + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_6oursql_Cursor *)__pyx_v_self->__pyx_vtab)->_check_statements(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "oursqlx/cursor.pyx":225 + * """ + * self._check_statements() + * self._do_autoping() # <<<<<<<<<<<<<< + * ret = [] + * while self._statements: + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_do_autoping); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (__pyx_t_4) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else { + __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "oursqlx/cursor.pyx":226 + * self._check_statements() + * self._do_autoping() + * ret = [] # <<<<<<<<<<<<<< + * while self._statements: + * ret.extend(self._statements.popleft().fetchall()) + */ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_ret = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + + /* "oursqlx/cursor.pyx":227 + * self._do_autoping() + * ret = [] + * while self._statements: # <<<<<<<<<<<<<< + * ret.extend(self._statements.popleft().fetchall()) + * return ret + */ + while (1) { + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_self->_statements); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!__pyx_t_5) break; + + /* "oursqlx/cursor.pyx":228 + * ret = [] + * while self._statements: + * ret.extend(self._statements.popleft().fetchall()) # <<<<<<<<<<<<<< + * return ret + * + */ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_statements, __pyx_n_s_popleft); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + if (__pyx_t_6) { + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } else { + __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_fetchall); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + if (__pyx_t_3) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_7 = __Pyx_PyList_Extend(__pyx_v_ret, __pyx_t_2); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + + /* "oursqlx/cursor.pyx":229 + * while self._statements: + * ret.extend(self._statements.popleft().fetchall()) + * return ret # <<<<<<<<<<<<<< + * + * def __iter__(self): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_ret); + __pyx_r = __pyx_v_ret; + goto __pyx_L0; + + /* "oursqlx/cursor.pyx":218 + * return ret + * + * def fetchall(self): # <<<<<<<<<<<<<< + * """fetchall() -> list of rows. + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("oursql.Cursor.fetchall", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_ret); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/cursor.pyx":231 + * return ret + * + * def __iter__(self): # <<<<<<<<<<<<<< + * self._check_closed() + * return PyCallIter_New(self.fetchone, None) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_6Cursor_25__iter__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6oursql_6Cursor_25__iter__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_6Cursor_24__iter__(((struct __pyx_obj_6oursql_Cursor *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_6Cursor_24__iter__(struct __pyx_obj_6oursql_Cursor *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__iter__", 0); + + /* "oursqlx/cursor.pyx":232 + * + * def __iter__(self): + * self._check_closed() # <<<<<<<<<<<<<< + * return PyCallIter_New(self.fetchone, None) + * + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_6oursql_Cursor *)__pyx_v_self->__pyx_vtab)->_check_closed(__pyx_v_self); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "oursqlx/cursor.pyx":233 + * def __iter__(self): + * self._check_closed() + * return PyCallIter_New(self.fetchone, None) # <<<<<<<<<<<<<< + * + * property connection: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_fetchone); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyCallIter_New(__pyx_t_2, Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "oursqlx/cursor.pyx":231 + * return ret + * + * def __iter__(self): # <<<<<<<<<<<<<< + * self._check_closed() + * return PyCallIter_New(self.fetchone, None) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("oursql.Cursor.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/cursor.pyx":236 + * + * property connection: + * def __get__(self): # <<<<<<<<<<<<<< + * return self.conn + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_6Cursor_10connection_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6oursql_6Cursor_10connection_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_6Cursor_10connection___get__(((struct __pyx_obj_6oursql_Cursor *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_6Cursor_10connection___get__(struct __pyx_obj_6oursql_Cursor *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + + /* "oursqlx/cursor.pyx":237 + * property connection: + * def __get__(self): + * return self.conn # <<<<<<<<<<<<<< + * + * def setinputsizes(self, sizes): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self->conn)); + __pyx_r = ((PyObject *)__pyx_v_self->conn); + goto __pyx_L0; + + /* "oursqlx/cursor.pyx":236 + * + * property connection: + * def __get__(self): # <<<<<<<<<<<<<< + * return self.conn + * + */ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/cursor.pyx":239 + * return self.conn + * + * def setinputsizes(self, sizes): # <<<<<<<<<<<<<< + * """setinputsizes(sizes) + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_6Cursor_27setinputsizes(PyObject *__pyx_v_self, PyObject *__pyx_v_sizes); /*proto*/ +static char __pyx_doc_6oursql_6Cursor_26setinputsizes[] = "setinputsizes(sizes)\n \n Do nothing; this operation is not supported by oursql.\n "; +static PyObject *__pyx_pw_6oursql_6Cursor_27setinputsizes(PyObject *__pyx_v_self, PyObject *__pyx_v_sizes) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("setinputsizes (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_6Cursor_26setinputsizes(((struct __pyx_obj_6oursql_Cursor *)__pyx_v_self), ((PyObject *)__pyx_v_sizes)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_6Cursor_26setinputsizes(CYTHON_UNUSED struct __pyx_obj_6oursql_Cursor *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_sizes) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("setinputsizes", 0); + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/cursor.pyx":248 + * pass + * + * def setoutputsize(self, size, column=None): # <<<<<<<<<<<<<< + * """setoutputsize(size, column=None) + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_6Cursor_29setoutputsize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6oursql_6Cursor_28setoutputsize[] = "setoutputsize(size, column=None)\n \n Do nothing; this operation is not supported by oursql.\n "; +static PyObject *__pyx_pw_6oursql_6Cursor_29setoutputsize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + CYTHON_UNUSED PyObject *__pyx_v_size = 0; + CYTHON_UNUSED PyObject *__pyx_v_column = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("setoutputsize (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_size,&__pyx_n_s_column,0}; + PyObject* values[2] = {0,0}; + values[1] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_size)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_column); + if (value) { values[1] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setoutputsize") < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_size = values[0]; + __pyx_v_column = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("setoutputsize", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("oursql.Cursor.setoutputsize", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6oursql_6Cursor_28setoutputsize(((struct __pyx_obj_6oursql_Cursor *)__pyx_v_self), __pyx_v_size, __pyx_v_column); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_6Cursor_28setoutputsize(CYTHON_UNUSED struct __pyx_obj_6oursql_Cursor *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_size, CYTHON_UNUSED PyObject *__pyx_v_column) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("setoutputsize", 0); + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/cursor.pyx":255 + * pass + * + * def __enter__(self): # <<<<<<<<<<<<<< + * return self + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_6Cursor_31__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6oursql_6Cursor_31__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__enter__ (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_6Cursor_30__enter__(((struct __pyx_obj_6oursql_Cursor *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_6Cursor_30__enter__(struct __pyx_obj_6oursql_Cursor *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__enter__", 0); + + /* "oursqlx/cursor.pyx":256 + * + * def __enter__(self): + * return self # <<<<<<<<<<<<<< + * + * def __exit__(self, exc, value, tb): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "oursqlx/cursor.pyx":255 + * pass + * + * def __enter__(self): # <<<<<<<<<<<<<< + * return self + * + */ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/cursor.pyx":258 + * return self + * + * def __exit__(self, exc, value, tb): # <<<<<<<<<<<<<< + * if exc: + * self.conn.rollback() + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_6Cursor_33__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_6oursql_6Cursor_33__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_exc = 0; + CYTHON_UNUSED PyObject *__pyx_v_value = 0; + CYTHON_UNUSED PyObject *__pyx_v_tb = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__exit__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_exc,&__pyx_n_s_value,&__pyx_n_s_tb,0}; + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_exc)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_tb)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__exit__") < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + } + __pyx_v_exc = values[0]; + __pyx_v_value = values[1]; + __pyx_v_tb = values[2]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("oursql.Cursor.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6oursql_6Cursor_32__exit__(((struct __pyx_obj_6oursql_Cursor *)__pyx_v_self), __pyx_v_exc, __pyx_v_value, __pyx_v_tb); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_6Cursor_32__exit__(struct __pyx_obj_6oursql_Cursor *__pyx_v_self, PyObject *__pyx_v_exc, CYTHON_UNUSED PyObject *__pyx_v_value, CYTHON_UNUSED PyObject *__pyx_v_tb) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__exit__", 0); + + /* "oursqlx/cursor.pyx":259 + * + * def __exit__(self, exc, value, tb): + * if exc: # <<<<<<<<<<<<<< + * self.conn.rollback() + * else: + */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_exc); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + + /* "oursqlx/cursor.pyx":260 + * def __exit__(self, exc, value, tb): + * if exc: + * self.conn.rollback() # <<<<<<<<<<<<<< + * else: + * self.conn.commit() + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->conn), __pyx_n_s_rollback); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (__pyx_t_4) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else { + __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L3; + } + /*else*/ { + + /* "oursqlx/cursor.pyx":262 + * self.conn.rollback() + * else: + * self.conn.commit() # <<<<<<<<<<<<<< + * self.close() + * + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->conn), __pyx_n_s_commit); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (__pyx_t_4) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else { + __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __pyx_L3:; + + /* "oursqlx/cursor.pyx":263 + * else: + * self.conn.commit() + * self.close() # <<<<<<<<<<<<<< + * + * cdef class DictCursor(Cursor): + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_close); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (__pyx_t_4) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else { + __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "oursqlx/cursor.pyx":258 + * return self + * + * def __exit__(self, exc, value, tb): # <<<<<<<<<<<<<< + * if exc: + * self.conn.rollback() + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("oursql.Cursor.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/cursor.pyx":29 + * """ + * + * cdef readonly object _statements, _stmt_kwargs # <<<<<<<<<<<<<< + * cdef Connection conn + * cdef int closed, try_plain_query + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_6Cursor_11_statements_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6oursql_6Cursor_11_statements_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_6Cursor_11_statements___get__(((struct __pyx_obj_6oursql_Cursor *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_6Cursor_11_statements___get__(struct __pyx_obj_6oursql_Cursor *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->_statements); + __pyx_r = __pyx_v_self->_statements; + goto __pyx_L0; + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_6Cursor_12_stmt_kwargs_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6oursql_6Cursor_12_stmt_kwargs_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_6Cursor_12_stmt_kwargs___get__(((struct __pyx_obj_6oursql_Cursor *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_6Cursor_12_stmt_kwargs___get__(struct __pyx_obj_6oursql_Cursor *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->_stmt_kwargs); + __pyx_r = __pyx_v_self->_stmt_kwargs; + goto __pyx_L0; + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/cursor.pyx":32 + * cdef Connection conn + * cdef int closed, try_plain_query + * cdef readonly object rowcount, lastrowid, description, messages # <<<<<<<<<<<<<< + * cdef public unsigned long arraysize + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_6Cursor_8rowcount_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6oursql_6Cursor_8rowcount_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_6Cursor_8rowcount___get__(((struct __pyx_obj_6oursql_Cursor *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_6Cursor_8rowcount___get__(struct __pyx_obj_6oursql_Cursor *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->rowcount); + __pyx_r = __pyx_v_self->rowcount; + goto __pyx_L0; + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_6Cursor_9lastrowid_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6oursql_6Cursor_9lastrowid_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_6Cursor_9lastrowid___get__(((struct __pyx_obj_6oursql_Cursor *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_6Cursor_9lastrowid___get__(struct __pyx_obj_6oursql_Cursor *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->lastrowid); + __pyx_r = __pyx_v_self->lastrowid; + goto __pyx_L0; + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_6Cursor_11description_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6oursql_6Cursor_11description_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_6Cursor_11description___get__(((struct __pyx_obj_6oursql_Cursor *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_6Cursor_11description___get__(struct __pyx_obj_6oursql_Cursor *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->description); + __pyx_r = __pyx_v_self->description; + goto __pyx_L0; + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_6Cursor_8messages_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6oursql_6Cursor_8messages_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_6Cursor_8messages___get__(((struct __pyx_obj_6oursql_Cursor *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_6Cursor_8messages___get__(struct __pyx_obj_6oursql_Cursor *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->messages); + __pyx_r = __pyx_v_self->messages; + goto __pyx_L0; + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursqlx/cursor.pyx":33 + * cdef int closed, try_plain_query + * cdef readonly object rowcount, lastrowid, description, messages + * cdef public unsigned long arraysize # <<<<<<<<<<<<<< + * + * _statement_class = _Statement + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_6Cursor_9arraysize_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6oursql_6Cursor_9arraysize_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_6Cursor_9arraysize___get__(((struct __pyx_obj_6oursql_Cursor *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_6Cursor_9arraysize___get__(struct __pyx_obj_6oursql_Cursor *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_From_unsigned_long(__pyx_v_self->arraysize); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("oursql.Cursor.arraysize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6oursql_6Cursor_9arraysize_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_6oursql_6Cursor_9arraysize_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_6Cursor_9arraysize_2__set__(((struct __pyx_obj_6oursql_Cursor *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6oursql_6Cursor_9arraysize_2__set__(struct __pyx_obj_6oursql_Cursor *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + unsigned long __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + __pyx_t_1 = __Pyx_PyInt_As_unsigned_long(__pyx_v_value); if (unlikely((__pyx_t_1 == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_self->arraysize = __pyx_t_1; + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("oursql.Cursor.arraysize.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursql.pyx":99 + * cdef readonly object values + * + * def __init__(self, *values): # <<<<<<<<<<<<<< + * self.values = frozenset(values) + * + */ + +/* Python wrapper */ +static int __pyx_pw_6oursql_16_DBAPITypeObject_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_6oursql_16_DBAPITypeObject_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_values = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1; + __Pyx_INCREF(__pyx_args); + __pyx_v_values = __pyx_args; + __pyx_r = __pyx_pf_6oursql_16_DBAPITypeObject___init__(((struct __pyx_obj_6oursql__DBAPITypeObject *)__pyx_v_self), __pyx_v_values); + + /* function exit code */ + __Pyx_XDECREF(__pyx_v_values); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6oursql_16_DBAPITypeObject___init__(struct __pyx_obj_6oursql__DBAPITypeObject *__pyx_v_self, PyObject *__pyx_v_values) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__init__", 0); + + /* "oursql.pyx":100 + * + * def __init__(self, *values): + * self.values = frozenset(values) # <<<<<<<<<<<<<< + * + * def __richcmp__(self, other, int op): + */ + __pyx_t_1 = __Pyx_PyFrozenSet_New(__pyx_v_values); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->values); + __Pyx_DECREF(__pyx_v_self->values); + __pyx_v_self->values = __pyx_t_1; + __pyx_t_1 = 0; + + /* "oursql.pyx":99 + * cdef readonly object values + * + * def __init__(self, *values): # <<<<<<<<<<<<<< + * self.values = frozenset(values) + * + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("oursql._DBAPITypeObject.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursql.pyx":102 + * self.values = frozenset(values) + * + * def __richcmp__(self, other, int op): # <<<<<<<<<<<<<< + * if op == Py_EQ: + * return other in self.values + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_16_DBAPITypeObject_3__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op); /*proto*/ +static PyObject *__pyx_pw_6oursql_16_DBAPITypeObject_3__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__richcmp__ (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_16_DBAPITypeObject_2__richcmp__(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_other), ((int)__pyx_v_op)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_16_DBAPITypeObject_2__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__richcmp__", 0); + + /* "oursql.pyx":103 + * + * def __richcmp__(self, other, int op): + * if op == Py_EQ: # <<<<<<<<<<<<<< + * return other in self.values + * elif op == Py_NE: + */ + __pyx_t_1 = ((__pyx_v_op == Py_EQ) != 0); + if (__pyx_t_1) { + + /* "oursql.pyx":104 + * def __richcmp__(self, other, int op): + * if op == Py_EQ: + * return other in self.values # <<<<<<<<<<<<<< + * elif op == Py_NE: + * return other not in self.values + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_values); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = (__Pyx_PySequence_Contains(__pyx_v_other, __pyx_t_2, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + } + + /* "oursql.pyx":105 + * if op == Py_EQ: + * return other in self.values + * elif op == Py_NE: # <<<<<<<<<<<<<< + * return other not in self.values + * else: + */ + __pyx_t_1 = ((__pyx_v_op == Py_NE) != 0); + if (__pyx_t_1) { + + /* "oursql.pyx":106 + * return other in self.values + * elif op == Py_NE: + * return other not in self.values # <<<<<<<<<<<<<< + * else: + * raise TypeError('unorderable types: %r and %r' % ( + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_values); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = (__Pyx_PySequence_Contains(__pyx_v_other, __pyx_t_2, Py_NE)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + } + /*else*/ { + + /* "oursql.pyx":109 + * else: + * raise TypeError('unorderable types: %r and %r' % ( + * type(self), type(other))) # <<<<<<<<<<<<<< + * + * def __repr__(self): + */ + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_self))); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)Py_TYPE(__pyx_v_self))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(__pyx_v_self))); + __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_other))); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)Py_TYPE(__pyx_v_other))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(__pyx_v_other))); + + /* "oursql.pyx":108 + * return other not in self.values + * else: + * raise TypeError('unorderable types: %r and %r' % ( # <<<<<<<<<<<<<< + * type(self), type(other))) + * + */ + __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_unorderable_types_r_and_r, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + + /* "oursql.pyx":102 + * self.values = frozenset(values) + * + * def __richcmp__(self, other, int op): # <<<<<<<<<<<<<< + * if op == Py_EQ: + * return other in self.values + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("oursql._DBAPITypeObject.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursql.pyx":111 + * type(self), type(other))) + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return '<_DBAPITypeObject representing %r at %#x>' % ( + * self.values, id(self)) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_16_DBAPITypeObject_5__repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6oursql_16_DBAPITypeObject_5__repr__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_16_DBAPITypeObject_4__repr__(((struct __pyx_obj_6oursql__DBAPITypeObject *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_16_DBAPITypeObject_4__repr__(struct __pyx_obj_6oursql__DBAPITypeObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__repr__", 0); + + /* "oursql.pyx":112 + * + * def __repr__(self): + * return '<_DBAPITypeObject representing %r at %#x>' % ( # <<<<<<<<<<<<<< + * self.values, id(self)) + * + */ + __Pyx_XDECREF(__pyx_r); + + /* "oursql.pyx":113 + * def __repr__(self): + * return '<_DBAPITypeObject representing %r at %#x>' % ( + * self.values, id(self)) # <<<<<<<<<<<<<< + * + * STRING = _DBAPITypeObject( + */ + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_id, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_self->values); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->values); + __Pyx_GIVEREF(__pyx_v_self->values); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + + /* "oursql.pyx":112 + * + * def __repr__(self): + * return '<_DBAPITypeObject representing %r at %#x>' % ( # <<<<<<<<<<<<<< + * self.values, id(self)) + * + */ + __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_DBAPITypeObject_representing_r, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "oursql.pyx":111 + * type(self), type(other))) + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return '<_DBAPITypeObject representing %r at %#x>' % ( + * self.values, id(self)) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("oursql._DBAPITypeObject.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "oursql.pyx":97 + * + * cdef class _DBAPITypeObject: + * cdef readonly object values # <<<<<<<<<<<<<< + * + * def __init__(self, *values): + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6oursql_16_DBAPITypeObject_6values_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6oursql_16_DBAPITypeObject_6values_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6oursql_16_DBAPITypeObject_6values___get__(((struct __pyx_obj_6oursql__DBAPITypeObject *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6oursql_16_DBAPITypeObject_6values___get__(struct __pyx_obj_6oursql__DBAPITypeObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->values); + __pyx_r = __pyx_v_self->values; + goto __pyx_L0; + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +static struct __pyx_vtabstruct_6oursql_Connection __pyx_vtable_6oursql_Connection; + +static PyObject *__pyx_tp_new_6oursql_Connection(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_6oursql_Connection *p; + PyObject *o; + if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_6oursql_Connection *)o); + p->__pyx_vtab = __pyx_vtabptr_6oursql_Connection; + p->_charset = Py_None; Py_INCREF(Py_None); + p->_context_cursors = Py_None; Py_INCREF(Py_None); + p->default_cursor = Py_None; Py_INCREF(Py_None); + if (unlikely(__pyx_pw_6oursql_10Connection_1__cinit__(o, a, k) < 0)) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_6oursql_Connection(PyObject *o) { + struct __pyx_obj_6oursql_Connection *p = (struct __pyx_obj_6oursql_Connection *)o; + #if PY_VERSION_HEX >= 0x030400a1 + if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + PyObject_GC_UnTrack(o); + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + ++Py_REFCNT(o); + __pyx_pw_6oursql_10Connection_7__dealloc__(o); + --Py_REFCNT(o); + PyErr_Restore(etype, eval, etb); + } + if (p->__weakref__) PyObject_ClearWeakRefs(o); + Py_CLEAR(p->_charset); + Py_CLEAR(p->_context_cursors); + Py_CLEAR(p->default_cursor); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_6oursql_Connection(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_6oursql_Connection *p = (struct __pyx_obj_6oursql_Connection *)o; + if (p->_charset) { + e = (*v)(p->_charset, a); if (e) return e; + } + if (p->_context_cursors) { + e = (*v)(p->_context_cursors, a); if (e) return e; + } + if (p->default_cursor) { + e = (*v)(p->default_cursor, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_6oursql_Connection(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_6oursql_Connection *p = (struct __pyx_obj_6oursql_Connection *)o; + tmp = ((PyObject*)p->_charset); + p->_charset = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->_context_cursors); + p->_context_cursors = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->default_cursor); + p->default_cursor = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_getprop_6oursql_10Connection_charset(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6oursql_10Connection_7charset_1__get__(o); +} + +static int __pyx_setprop_6oursql_10Connection_charset(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_6oursql_10Connection_7charset_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_6oursql_10Connection_server_info(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6oursql_10Connection_11server_info_1__get__(o); +} + +static PyObject *__pyx_getprop_6oursql_10Connection_ssl_cipher(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6oursql_10Connection_10ssl_cipher_1__get__(o); +} + +static PyObject *__pyx_getprop_6oursql_10Connection_use_unicode(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6oursql_10Connection_11use_unicode_1__get__(o); +} + +static PyObject *__pyx_getprop_6oursql_10Connection_autoping(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6oursql_10Connection_8autoping_1__get__(o); +} + +static PyObject *__pyx_getprop_6oursql_10Connection_raise_on_warnings(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6oursql_10Connection_17raise_on_warnings_1__get__(o); +} + +static PyObject *__pyx_getprop_6oursql_10Connection_default_cursor(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6oursql_10Connection_14default_cursor_1__get__(o); +} + +static int __pyx_setprop_6oursql_10Connection_default_cursor(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_6oursql_10Connection_14default_cursor_3__set__(o, v); + } + else { + return __pyx_pw_6oursql_10Connection_14default_cursor_5__del__(o); + } +} + +static PyMethodDef __pyx_methods_6oursql_Connection[] = { + {"_setup_ssl_options", (PyCFunction)__pyx_pw_6oursql_10Connection_3_setup_ssl_options, METH_VARARGS|METH_KEYWORDS, 0}, + {"close", (PyCFunction)__pyx_pw_6oursql_10Connection_5close, METH_NOARGS, __pyx_doc_6oursql_10Connection_4close}, + {"ping", (PyCFunction)__pyx_pw_6oursql_10Connection_9ping, METH_NOARGS, __pyx_doc_6oursql_10Connection_8ping}, + {"commit", (PyCFunction)__pyx_pw_6oursql_10Connection_11commit, METH_NOARGS, __pyx_doc_6oursql_10Connection_10commit}, + {"rollback", (PyCFunction)__pyx_pw_6oursql_10Connection_13rollback, METH_NOARGS, __pyx_doc_6oursql_10Connection_12rollback}, + {"warning_count", (PyCFunction)__pyx_pw_6oursql_10Connection_15warning_count, METH_NOARGS, __pyx_doc_6oursql_10Connection_14warning_count}, + {"cursor", (PyCFunction)__pyx_pw_6oursql_10Connection_17cursor, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6oursql_10Connection_16cursor}, + {"__enter__", (PyCFunction)__pyx_pw_6oursql_10Connection_19__enter__, METH_NOARGS, 0}, + {"__exit__", (PyCFunction)__pyx_pw_6oursql_10Connection_21__exit__, METH_VARARGS|METH_KEYWORDS, 0}, + {"_escape_string", (PyCFunction)__pyx_pw_6oursql_10Connection_23_escape_string, METH_O, __pyx_doc_6oursql_10Connection_22_escape_string}, + {"_escape_unicode_string", (PyCFunction)__pyx_pw_6oursql_10Connection_25_escape_unicode_string, METH_O, __pyx_doc_6oursql_10Connection_24_escape_unicode_string}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_6oursql_Connection[] = { + {(char *)"charset", __pyx_getprop_6oursql_10Connection_charset, __pyx_setprop_6oursql_10Connection_charset, __pyx_k_charset_str_Get_or_set_the_conne, 0}, + {(char *)"server_info", __pyx_getprop_6oursql_10Connection_server_info, 0, 0, 0}, + {(char *)"ssl_cipher", __pyx_getprop_6oursql_10Connection_ssl_cipher, 0, 0, 0}, + {(char *)"use_unicode", __pyx_getprop_6oursql_10Connection_use_unicode, 0, 0, 0}, + {(char *)"autoping", __pyx_getprop_6oursql_10Connection_autoping, 0, 0, 0}, + {(char *)"raise_on_warnings", __pyx_getprop_6oursql_10Connection_raise_on_warnings, 0, 0, 0}, + {(char *)"default_cursor", __pyx_getprop_6oursql_10Connection_default_cursor, __pyx_setprop_6oursql_10Connection_default_cursor, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_6oursql_Connection = { + PyVarObject_HEAD_INIT(0, 0) + "oursql.Connection", /*tp_name*/ + sizeof(struct __pyx_obj_6oursql_Connection), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_6oursql_Connection, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + "Connection([host, user, passwd,] db=None, port=0, unix_socket=None, \n connect_timeout=None, read_timeout=None, write_timeout=None, \n protocol=None, ssl=None, read_default_file=None, \n read_default_group=None, init_command=None, charset_dir=None, \n shared_memory_base_name=None, local_infile=False, \n require_secure_auth=False, report_truncation=True, compress=False, \n found_rows=True, use_unicode=True, charset='utf8', autoping=False, \n default_cursor=None, raise_on_warnings=True, autoreconnect=False)\n \n Connect to the MySQL database. The first three parameters may be passed by \n position, but the rest may only be passed by keyword. All options except \n 'use_unicode', 'charset', 'autoping', 'default_cursor', and \n 'raise_on_warnings' correspond with parameters or flags to the \n mysql_real_connect function, or options to the mysql_options function. \n \n 'protocol' can be one of None, 'tcp', 'socket', 'pipe', or 'memory'. A\n 'protocol' of None will use the default protocol, and values otherwise \n correspond with the potential values of the 'protocol' option in the option \n file.\n \n 'ssl' can either be None or a dict where each key corresponds to a \n parameter of the mysql_ssl_set function, e.g. {'capath': '/etc/ssl/ca', \n 'cipher': 'DHE-RSA-AES256-SHA'}. Unspecified keys are the same as passing\n NULL to that parameter.\n \n If 'use_unicode' is true, oursql will attempt to return unicode wherever \n feasible. If 'charset' is not None, oursql will set the connection charset \n to the value provided. 'charset' defaults to using utf-8. If 'autoping' is \n true, oursql will run the 'ping' method before executing queries or \n fetching results to attempt to prevent connection timeout errors. \n 'default_cursor', if provided, will be used as the default cursor class \n when calling the 'cursor' method. If 'raise_on_warnings' is true, oursql\n will raise a CollatedWarningsError exception if there were any warnings\n produced by running a query.\n \n Connections and their cursors can also be used as context managers.\n \n with some_connection.cursor() as cursor:\n do_something_with(cursor)\n \n Can also be written as:\n \n with some_connection as cursor:\n do_something_with(cursor)\n \n And both are equivalent to:\n \n cursor = some_connection.cursor()\n try:\n do_something_with(cursor)\n except:\n some_connection.rollback()\n raise\n else:\n some_connection.commit()\n finally:\n cursor.close()\n \n ", /*tp_doc*/ + __pyx_tp_traverse_6oursql_Connection, /*tp_traverse*/ + __pyx_tp_clear_6oursql_Connection, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_6oursql_Connection, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_6oursql_Connection, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_6oursql_Connection, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif +}; + +static PyObject *__pyx_tp_new_6oursql__DictWhateverMixin(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + PyObject *o; + if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } + if (unlikely(!o)) return 0; + return o; +} + +static void __pyx_tp_dealloc_6oursql__DictWhateverMixin(PyObject *o) { + #if PY_VERSION_HEX >= 0x030400a1 + if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + (*Py_TYPE(o)->tp_free)(o); +} + +static PyMethodDef __pyx_methods_6oursql__DictWhateverMixin[] = { + {"fetchone", (PyCFunction)__pyx_pw_6oursql_18_DictWhateverMixin_1fetchone, METH_NOARGS, 0}, + {0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_6oursql__DictWhateverMixin = { + PyVarObject_HEAD_INIT(0, 0) + "oursql._DictWhateverMixin", /*tp_name*/ + sizeof(struct __pyx_obj_6oursql__DictWhateverMixin), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_6oursql__DictWhateverMixin, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + 0, /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_6oursql__DictWhateverMixin, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_6oursql__DictWhateverMixin, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif +}; + +static PyObject *__pyx_tp_new_6oursql__AbstractIterWrapper(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + PyObject *o; + if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } + if (unlikely(!o)) return 0; + return o; +} + +static void __pyx_tp_dealloc_6oursql__AbstractIterWrapper(PyObject *o) { + #if PY_VERSION_HEX >= 0x030400a1 + if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + (*Py_TYPE(o)->tp_free)(o); +} + +static PyMethodDef __pyx_methods_6oursql__AbstractIterWrapper[] = { + {0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_6oursql__AbstractIterWrapper = { + PyVarObject_HEAD_INIT(0, 0) + "oursql._AbstractIterWrapper", /*tp_name*/ + sizeof(struct __pyx_obj_6oursql__AbstractIterWrapper), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_6oursql__AbstractIterWrapper, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + 0, /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + __pyx_pw_6oursql_20_AbstractIterWrapper_1__iter__, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_6oursql__AbstractIterWrapper, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_6oursql__AbstractIterWrapper, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif +}; + +static PyObject *__pyx_tp_new_6oursql__BinaryWhateverMixin(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + PyObject *o; + if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } + if (unlikely(!o)) return 0; + return o; +} + +static void __pyx_tp_dealloc_6oursql__BinaryWhateverMixin(PyObject *o) { + #if PY_VERSION_HEX >= 0x030400a1 + if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + (*Py_TYPE(o)->tp_free)(o); +} + +static PyMethodDef __pyx_methods_6oursql__BinaryWhateverMixin[] = { + {"__next__", (PyCFunction)__pyx_pw_6oursql_20_BinaryWhateverMixin_1__next__, METH_NOARGS|METH_COEXIST, 0}, + {0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_6oursql__BinaryWhateverMixin = { + PyVarObject_HEAD_INIT(0, 0) + "oursql._BinaryWhateverMixin", /*tp_name*/ + sizeof(struct __pyx_obj_6oursql__BinaryWhateverMixin), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_6oursql__BinaryWhateverMixin, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + 0, /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + __pyx_pw_6oursql_20_BinaryWhateverMixin_1__next__, /*tp_iternext*/ + __pyx_methods_6oursql__BinaryWhateverMixin, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_6oursql__BinaryWhateverMixin, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif +}; + +static PyObject *__pyx_tp_new_6oursql_IterWrapper(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_6oursql_IterWrapper *p; + PyObject *o = __pyx_tp_new_6oursql__AbstractIterWrapper(t, a, k); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_6oursql_IterWrapper *)o); + p->iterobj = Py_None; Py_INCREF(Py_None); + p->nextfunc = Py_None; Py_INCREF(Py_None); + if (unlikely(__pyx_pw_6oursql_11IterWrapper_1__cinit__(o, a, k) < 0)) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_6oursql_IterWrapper(PyObject *o) { + struct __pyx_obj_6oursql_IterWrapper *p = (struct __pyx_obj_6oursql_IterWrapper *)o; + #if PY_VERSION_HEX >= 0x030400a1 + if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->iterobj); + Py_CLEAR(p->nextfunc); + #if CYTHON_COMPILING_IN_CPYTHON + if (PyType_IS_GC(Py_TYPE(o)->tp_base)) + #endif + PyObject_GC_Track(o); + __pyx_tp_dealloc_6oursql__AbstractIterWrapper(o); +} + +static int __pyx_tp_traverse_6oursql_IterWrapper(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_6oursql_IterWrapper *p = (struct __pyx_obj_6oursql_IterWrapper *)o; + e = ((likely(__pyx_ptype_6oursql__AbstractIterWrapper)) ? ((__pyx_ptype_6oursql__AbstractIterWrapper->tp_traverse) ? __pyx_ptype_6oursql__AbstractIterWrapper->tp_traverse(o, v, a) : 0) : __Pyx_call_next_tp_traverse(o, v, a, __pyx_tp_traverse_6oursql_IterWrapper)); if (e) return e; + if (p->iterobj) { + e = (*v)(p->iterobj, a); if (e) return e; + } + if (p->nextfunc) { + e = (*v)(p->nextfunc, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_6oursql_IterWrapper(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_6oursql_IterWrapper *p = (struct __pyx_obj_6oursql_IterWrapper *)o; + if (likely(__pyx_ptype_6oursql__AbstractIterWrapper)) { if (__pyx_ptype_6oursql__AbstractIterWrapper->tp_clear) __pyx_ptype_6oursql__AbstractIterWrapper->tp_clear(o); } else __Pyx_call_next_tp_clear(o, __pyx_tp_clear_6oursql_IterWrapper); + tmp = ((PyObject*)p->iterobj); + p->iterobj = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->nextfunc); + p->nextfunc = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_6oursql_IterWrapper[] = { + {"__next__", (PyCFunction)__pyx_pw_6oursql_11IterWrapper_3__next__, METH_NOARGS|METH_COEXIST, 0}, + {0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_6oursql_IterWrapper = { + PyVarObject_HEAD_INIT(0, 0) + "oursql.IterWrapper", /*tp_name*/ + sizeof(struct __pyx_obj_6oursql_IterWrapper), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_6oursql_IterWrapper, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + "IterWrapper(iterobj)\n \n IterWrapper is a wrapper class for arbitrary string-yielding iterable \n objects so that their contents can be streamed over the wire as a bound \n parameter for a query. The strings are assumed to be text and not arbitrary\n bytes.\n ", /*tp_doc*/ + __pyx_tp_traverse_6oursql_IterWrapper, /*tp_traverse*/ + __pyx_tp_clear_6oursql_IterWrapper, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_6oursql_20_AbstractIterWrapper_1__iter__, /*tp_iter*/ + #else + 0, /*tp_iter*/ + #endif + __pyx_pw_6oursql_11IterWrapper_3__next__, /*tp_iternext*/ + __pyx_methods_6oursql_IterWrapper, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_6oursql_IterWrapper, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif +}; + +static PyObject *__pyx_tp_new_6oursql_FileWrapper(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_6oursql_FileWrapper *p; + PyObject *o = __pyx_tp_new_6oursql__AbstractIterWrapper(t, a, k); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_6oursql_FileWrapper *)o); + p->fileobj = Py_None; Py_INCREF(Py_None); + p->chunksize = Py_None; Py_INCREF(Py_None); + p->readfunc = Py_None; Py_INCREF(Py_None); + if (unlikely(__pyx_pw_6oursql_11FileWrapper_1__cinit__(o, a, k) < 0)) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_6oursql_FileWrapper(PyObject *o) { + struct __pyx_obj_6oursql_FileWrapper *p = (struct __pyx_obj_6oursql_FileWrapper *)o; + #if PY_VERSION_HEX >= 0x030400a1 + if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->fileobj); + Py_CLEAR(p->chunksize); + Py_CLEAR(p->readfunc); + #if CYTHON_COMPILING_IN_CPYTHON + if (PyType_IS_GC(Py_TYPE(o)->tp_base)) + #endif + PyObject_GC_Track(o); + __pyx_tp_dealloc_6oursql__AbstractIterWrapper(o); +} + +static int __pyx_tp_traverse_6oursql_FileWrapper(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_6oursql_FileWrapper *p = (struct __pyx_obj_6oursql_FileWrapper *)o; + e = ((likely(__pyx_ptype_6oursql__AbstractIterWrapper)) ? ((__pyx_ptype_6oursql__AbstractIterWrapper->tp_traverse) ? __pyx_ptype_6oursql__AbstractIterWrapper->tp_traverse(o, v, a) : 0) : __Pyx_call_next_tp_traverse(o, v, a, __pyx_tp_traverse_6oursql_FileWrapper)); if (e) return e; + if (p->fileobj) { + e = (*v)(p->fileobj, a); if (e) return e; + } + if (p->chunksize) { + e = (*v)(p->chunksize, a); if (e) return e; + } + if (p->readfunc) { + e = (*v)(p->readfunc, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_6oursql_FileWrapper(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_6oursql_FileWrapper *p = (struct __pyx_obj_6oursql_FileWrapper *)o; + if (likely(__pyx_ptype_6oursql__AbstractIterWrapper)) { if (__pyx_ptype_6oursql__AbstractIterWrapper->tp_clear) __pyx_ptype_6oursql__AbstractIterWrapper->tp_clear(o); } else __Pyx_call_next_tp_clear(o, __pyx_tp_clear_6oursql_FileWrapper); + tmp = ((PyObject*)p->fileobj); + p->fileobj = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->chunksize); + p->chunksize = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->readfunc); + p->readfunc = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_6oursql_FileWrapper[] = { + {"__next__", (PyCFunction)__pyx_pw_6oursql_11FileWrapper_3__next__, METH_NOARGS|METH_COEXIST, 0}, + {0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_6oursql_FileWrapper = { + PyVarObject_HEAD_INIT(0, 0) + "oursql.FileWrapper", /*tp_name*/ + sizeof(struct __pyx_obj_6oursql_FileWrapper), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_6oursql_FileWrapper, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + "FileWrapper(fileobj, chunksize=8192, doclose=False)\n \n FileWrapper is a wrapper class for file-like objects so that their contents\n can be streamed over the wire as a bound parameter for a query. Strings \n read from the wrapped file are assumed to be text and not arbitrary bytes.\n \n Strings will be read by calling the 'read' method on the file object with\n the 'chunksize' parameter until it returns the empty string. If 'doclose'\n is true, the file will have its 'close' method called once it has been \n exhausted.\n ", /*tp_doc*/ + __pyx_tp_traverse_6oursql_FileWrapper, /*tp_traverse*/ + __pyx_tp_clear_6oursql_FileWrapper, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_6oursql_20_AbstractIterWrapper_1__iter__, /*tp_iter*/ + #else + 0, /*tp_iter*/ + #endif + __pyx_pw_6oursql_11FileWrapper_3__next__, /*tp_iternext*/ + __pyx_methods_6oursql_FileWrapper, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_6oursql_FileWrapper, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif +}; +static struct __pyx_vtabstruct_6oursql__Statement __pyx_vtable_6oursql__Statement; + +static PyObject *__pyx_tp_new_6oursql__Statement(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_6oursql__Statement *p; + PyObject *o; + if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_6oursql__Statement *)o); + p->__pyx_vtab = __pyx_vtabptr_6oursql__Statement; + p->conn = ((struct __pyx_obj_6oursql_Connection *)Py_None); Py_INCREF(Py_None); + p->warnings = Py_None; Py_INCREF(Py_None); + if (unlikely(__pyx_pw_6oursql_10_Statement_1__cinit__(o, a, k) < 0)) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_6oursql__Statement(PyObject *o) { + struct __pyx_obj_6oursql__Statement *p = (struct __pyx_obj_6oursql__Statement *)o; + #if PY_VERSION_HEX >= 0x030400a1 + if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + PyObject_GC_UnTrack(o); + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + ++Py_REFCNT(o); + __pyx_pw_6oursql_10_Statement_3__dealloc__(o); + --Py_REFCNT(o); + PyErr_Restore(etype, eval, etb); + } + if (p->__weakref__) PyObject_ClearWeakRefs(o); + Py_CLEAR(p->conn); + Py_CLEAR(p->warnings); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_6oursql__Statement(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_6oursql__Statement *p = (struct __pyx_obj_6oursql__Statement *)o; + if (p->conn) { + e = (*v)(((PyObject*)p->conn), a); if (e) return e; + } + if (p->warnings) { + e = (*v)(p->warnings, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_6oursql__Statement(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_6oursql__Statement *p = (struct __pyx_obj_6oursql__Statement *)o; + tmp = ((PyObject*)p->conn); + p->conn = ((struct __pyx_obj_6oursql_Connection *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->warnings); + p->warnings = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_getprop_6oursql_10_Statement_string_limit(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6oursql_10_Statement_12string_limit_1__get__(o); +} + +static int __pyx_setprop_6oursql_10_Statement_string_limit(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_6oursql_10_Statement_12string_limit_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_6oursql_10_Statement_has_result(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6oursql_10_Statement_10has_result_1__get__(o); +} + +static PyObject *__pyx_getprop_6oursql_10_Statement_description(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6oursql_10_Statement_11description_1__get__(o); +} + +static PyObject *__pyx_getprop_6oursql_10_Statement_column_names(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6oursql_10_Statement_12column_names_1__get__(o); +} + +static PyObject *__pyx_getprop_6oursql_10_Statement_rowcount(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6oursql_10_Statement_8rowcount_1__get__(o); +} + +static PyObject *__pyx_getprop_6oursql_10_Statement_lastrowid(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6oursql_10_Statement_9lastrowid_1__get__(o); +} + +static PyObject *__pyx_getprop_6oursql_10_Statement_prefetch_rows(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6oursql_10_Statement_13prefetch_rows_1__get__(o); +} + +static int __pyx_setprop_6oursql_10_Statement_prefetch_rows(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_6oursql_10_Statement_13prefetch_rows_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_6oursql_10_Statement_warnings(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6oursql_10_Statement_8warnings_1__get__(o); +} + +static int __pyx_setprop_6oursql_10_Statement_warnings(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_6oursql_10_Statement_8warnings_3__set__(o, v); + } + else { + return __pyx_pw_6oursql_10_Statement_8warnings_5__del__(o); + } +} + +static PyMethodDef __pyx_methods_6oursql__Statement[] = { + {"close", (PyCFunction)__pyx_pw_6oursql_10_Statement_5close, METH_NOARGS, 0}, + {"prepare", (PyCFunction)__pyx_pw_6oursql_10_Statement_7prepare, METH_O, 0}, + {"execute", (PyCFunction)__pyx_pw_6oursql_10_Statement_9execute, METH_VARARGS|METH_KEYWORDS, 0}, + {"fetchone", (PyCFunction)__pyx_pw_6oursql_10_Statement_11fetchone, METH_NOARGS, 0}, + {"fetchall", (PyCFunction)__pyx_pw_6oursql_10_Statement_13fetchall, METH_NOARGS, 0}, + {"buffer_results", (PyCFunction)__pyx_pw_6oursql_10_Statement_15buffer_results, METH_NOARGS, 0}, + {"nextset", (PyCFunction)__pyx_pw_6oursql_10_Statement_17nextset, METH_NOARGS, 0}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_6oursql__Statement[] = { + {(char *)"string_limit", __pyx_getprop_6oursql_10_Statement_string_limit, __pyx_setprop_6oursql_10_Statement_string_limit, 0, 0}, + {(char *)"has_result", __pyx_getprop_6oursql_10_Statement_has_result, 0, 0, 0}, + {(char *)"description", __pyx_getprop_6oursql_10_Statement_description, 0, 0, 0}, + {(char *)"column_names", __pyx_getprop_6oursql_10_Statement_column_names, 0, 0, 0}, + {(char *)"rowcount", __pyx_getprop_6oursql_10_Statement_rowcount, 0, 0, 0}, + {(char *)"lastrowid", __pyx_getprop_6oursql_10_Statement_lastrowid, 0, 0, 0}, + {(char *)"prefetch_rows", __pyx_getprop_6oursql_10_Statement_prefetch_rows, __pyx_setprop_6oursql_10_Statement_prefetch_rows, 0, 0}, + {(char *)"warnings", __pyx_getprop_6oursql_10_Statement_warnings, __pyx_setprop_6oursql_10_Statement_warnings, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_6oursql__Statement = { + PyVarObject_HEAD_INIT(0, 0) + "oursql._Statement", /*tp_name*/ + sizeof(struct __pyx_obj_6oursql__Statement), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_6oursql__Statement, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + "_Statement(...)\n \n A class that represents a prepared statement. You should probably avoid\n touching this, even if it's more stable than _Query/_ResultSet.\n ", /*tp_doc*/ + __pyx_tp_traverse_6oursql__Statement, /*tp_traverse*/ + __pyx_tp_clear_6oursql__Statement, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + __pyx_pw_6oursql_10_Statement_19__iter__, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_6oursql__Statement, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_6oursql__Statement, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_6oursql__Statement, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif +}; + +static PyObject *__pyx_tp_new_6oursql__ResultStringStream(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_6oursql__ResultStringStream *p; + PyObject *o; + if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_6oursql__ResultStringStream *)o); + p->stmt = ((struct __pyx_obj_6oursql__Statement *)Py_None); Py_INCREF(Py_None); + if (unlikely(__pyx_pw_6oursql_19_ResultStringStream_1__cinit__(o, a, k) < 0)) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_6oursql__ResultStringStream(PyObject *o) { + struct __pyx_obj_6oursql__ResultStringStream *p = (struct __pyx_obj_6oursql__ResultStringStream *)o; + #if PY_VERSION_HEX >= 0x030400a1 + if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->stmt); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_6oursql__ResultStringStream(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_6oursql__ResultStringStream *p = (struct __pyx_obj_6oursql__ResultStringStream *)o; + if (p->stmt) { + e = (*v)(((PyObject*)p->stmt), a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_6oursql__ResultStringStream(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_6oursql__ResultStringStream *p = (struct __pyx_obj_6oursql__ResultStringStream *)o; + tmp = ((PyObject*)p->stmt); + p->stmt = ((struct __pyx_obj_6oursql__Statement *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_6oursql__ResultStringStream[] = { + {"read", (PyCFunction)__pyx_pw_6oursql_19_ResultStringStream_3read, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6oursql_19_ResultStringStream_2read}, + {0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_6oursql__ResultStringStream = { + PyVarObject_HEAD_INIT(0, 0) + "oursql._ResultStringStream", /*tp_name*/ + sizeof(struct __pyx_obj_6oursql__ResultStringStream), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_6oursql__ResultStringStream, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + "_ResultStringStream(...)\n \n _ResultStringStream represents an incoming stream of binary data from the\n database. You should never ever instantiate this class yourself.\n \n A _ResultStringStream must be used immediately; fetching any additional \n rows from the database will cause it to go out of sync and become unusable.\n ", /*tp_doc*/ + __pyx_tp_traverse_6oursql__ResultStringStream, /*tp_traverse*/ + __pyx_tp_clear_6oursql__ResultStringStream, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_6oursql__ResultStringStream, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_6oursql__ResultStringStream, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif +}; +static struct __pyx_vtabstruct_6oursql__ResultSet __pyx_vtable_6oursql__ResultSet; + +static PyObject *__pyx_tp_new_6oursql__ResultSet(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_6oursql__ResultSet *p; + PyObject *o; + if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_6oursql__ResultSet *)o); + p->__pyx_vtab = __pyx_vtabptr_6oursql__ResultSet; + p->conn = ((struct __pyx_obj_6oursql_Connection *)Py_None); Py_INCREF(Py_None); + p->conversion_info = Py_None; Py_INCREF(Py_None); + p->rowcount = Py_None; Py_INCREF(Py_None); + p->lastrowid = Py_None; Py_INCREF(Py_None); + p->description = Py_None; Py_INCREF(Py_None); + p->column_names = Py_None; Py_INCREF(Py_None); + p->warnings = Py_None; Py_INCREF(Py_None); + if (unlikely(__pyx_pw_6oursql_10_ResultSet_1__cinit__(o, a, k) < 0)) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_6oursql__ResultSet(PyObject *o) { + struct __pyx_obj_6oursql__ResultSet *p = (struct __pyx_obj_6oursql__ResultSet *)o; + #if PY_VERSION_HEX >= 0x030400a1 + if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + PyObject_GC_UnTrack(o); + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + ++Py_REFCNT(o); + __pyx_pw_6oursql_10_ResultSet_3__dealloc__(o); + --Py_REFCNT(o); + PyErr_Restore(etype, eval, etb); + } + Py_CLEAR(p->conn); + Py_CLEAR(p->conversion_info); + Py_CLEAR(p->rowcount); + Py_CLEAR(p->lastrowid); + Py_CLEAR(p->description); + Py_CLEAR(p->column_names); + Py_CLEAR(p->warnings); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_6oursql__ResultSet(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_6oursql__ResultSet *p = (struct __pyx_obj_6oursql__ResultSet *)o; + if (p->conn) { + e = (*v)(((PyObject*)p->conn), a); if (e) return e; + } + if (p->conversion_info) { + e = (*v)(p->conversion_info, a); if (e) return e; + } + if (p->rowcount) { + e = (*v)(p->rowcount, a); if (e) return e; + } + if (p->lastrowid) { + e = (*v)(p->lastrowid, a); if (e) return e; + } + if (p->description) { + e = (*v)(p->description, a); if (e) return e; + } + if (p->column_names) { + e = (*v)(p->column_names, a); if (e) return e; + } + if (p->warnings) { + e = (*v)(p->warnings, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_6oursql__ResultSet(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_6oursql__ResultSet *p = (struct __pyx_obj_6oursql__ResultSet *)o; + tmp = ((PyObject*)p->conn); + p->conn = ((struct __pyx_obj_6oursql_Connection *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->conversion_info); + p->conversion_info = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->rowcount); + p->rowcount = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->lastrowid); + p->lastrowid = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->description); + p->description = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->column_names); + p->column_names = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->warnings); + p->warnings = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_getprop_6oursql_10_ResultSet_has_result(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6oursql_10_ResultSet_10has_result_1__get__(o); +} + +static PyObject *__pyx_getprop_6oursql_10_ResultSet_rowcount(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6oursql_10_ResultSet_8rowcount_1__get__(o); +} + +static PyObject *__pyx_getprop_6oursql_10_ResultSet_lastrowid(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6oursql_10_ResultSet_9lastrowid_1__get__(o); +} + +static PyObject *__pyx_getprop_6oursql_10_ResultSet_description(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6oursql_10_ResultSet_11description_1__get__(o); +} + +static PyObject *__pyx_getprop_6oursql_10_ResultSet_column_names(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6oursql_10_ResultSet_12column_names_1__get__(o); +} + +static PyObject *__pyx_getprop_6oursql_10_ResultSet_warnings(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6oursql_10_ResultSet_8warnings_1__get__(o); +} + +static int __pyx_setprop_6oursql_10_ResultSet_warnings(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_6oursql_10_ResultSet_8warnings_3__set__(o, v); + } + else { + return __pyx_pw_6oursql_10_ResultSet_8warnings_5__del__(o); + } +} + +static PyMethodDef __pyx_methods_6oursql__ResultSet[] = { + {"close", (PyCFunction)__pyx_pw_6oursql_10_ResultSet_5close, METH_NOARGS, 0}, + {"fetchone", (PyCFunction)__pyx_pw_6oursql_10_ResultSet_7fetchone, METH_NOARGS, 0}, + {"fetchall", (PyCFunction)__pyx_pw_6oursql_10_ResultSet_9fetchall, METH_NOARGS, 0}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_6oursql__ResultSet[] = { + {(char *)"has_result", __pyx_getprop_6oursql_10_ResultSet_has_result, 0, 0, 0}, + {(char *)"rowcount", __pyx_getprop_6oursql_10_ResultSet_rowcount, 0, 0, 0}, + {(char *)"lastrowid", __pyx_getprop_6oursql_10_ResultSet_lastrowid, 0, 0, 0}, + {(char *)"description", __pyx_getprop_6oursql_10_ResultSet_description, 0, 0, 0}, + {(char *)"column_names", __pyx_getprop_6oursql_10_ResultSet_column_names, 0, 0, 0}, + {(char *)"warnings", __pyx_getprop_6oursql_10_ResultSet_warnings, __pyx_setprop_6oursql_10_ResultSet_warnings, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_6oursql__ResultSet = { + PyVarObject_HEAD_INIT(0, 0) + "oursql._ResultSet", /*tp_name*/ + sizeof(struct __pyx_obj_6oursql__ResultSet), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_6oursql__ResultSet, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + "_ResultSet(...)\n \n You should never ever instantiate a _ResultSet yourself unless you really\n know what you're doing. \n ", /*tp_doc*/ + __pyx_tp_traverse_6oursql__ResultSet, /*tp_traverse*/ + __pyx_tp_clear_6oursql__ResultSet, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + __pyx_pw_6oursql_10_ResultSet_11__iter__, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_6oursql__ResultSet, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_6oursql__ResultSet, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_6oursql__ResultSet, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif +}; +static struct __pyx_vtabstruct_6oursql__Query __pyx_vtable_6oursql__Query; + +static PyObject *__pyx_tp_new_6oursql__Query(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_6oursql__Query *p; + PyObject *o; + if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_6oursql__Query *)o); + p->__pyx_vtab = __pyx_vtabptr_6oursql__Query; + p->conn = ((struct __pyx_obj_6oursql_Connection *)Py_None); Py_INCREF(Py_None); + p->result = Py_None; Py_INCREF(Py_None); + p->res_a = Py_None; Py_INCREF(Py_None); + p->res_kw = Py_None; Py_INCREF(Py_None); + p->rowcount = Py_None; Py_INCREF(Py_None); + p->lastrowid = Py_None; Py_INCREF(Py_None); + p->description = Py_None; Py_INCREF(Py_None); + p->warnings = Py_None; Py_INCREF(Py_None); + p->has_result = Py_None; Py_INCREF(Py_None); + if (unlikely(__pyx_pw_6oursql_6_Query_1__cinit__(o, a, k) < 0)) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_6oursql__Query(PyObject *o) { + struct __pyx_obj_6oursql__Query *p = (struct __pyx_obj_6oursql__Query *)o; + #if PY_VERSION_HEX >= 0x030400a1 + if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->conn); + Py_CLEAR(p->result); + Py_CLEAR(p->res_a); + Py_CLEAR(p->res_kw); + Py_CLEAR(p->rowcount); + Py_CLEAR(p->lastrowid); + Py_CLEAR(p->description); + Py_CLEAR(p->warnings); + Py_CLEAR(p->has_result); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_6oursql__Query(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_6oursql__Query *p = (struct __pyx_obj_6oursql__Query *)o; + if (p->conn) { + e = (*v)(((PyObject*)p->conn), a); if (e) return e; + } + if (p->result) { + e = (*v)(p->result, a); if (e) return e; + } + if (p->res_a) { + e = (*v)(p->res_a, a); if (e) return e; + } + if (p->res_kw) { + e = (*v)(p->res_kw, a); if (e) return e; + } + if (p->rowcount) { + e = (*v)(p->rowcount, a); if (e) return e; + } + if (p->lastrowid) { + e = (*v)(p->lastrowid, a); if (e) return e; + } + if (p->description) { + e = (*v)(p->description, a); if (e) return e; + } + if (p->warnings) { + e = (*v)(p->warnings, a); if (e) return e; + } + if (p->has_result) { + e = (*v)(p->has_result, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_6oursql__Query(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_6oursql__Query *p = (struct __pyx_obj_6oursql__Query *)o; + tmp = ((PyObject*)p->conn); + p->conn = ((struct __pyx_obj_6oursql_Connection *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->result); + p->result = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->res_a); + p->res_a = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->res_kw); + p->res_kw = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->rowcount); + p->rowcount = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->lastrowid); + p->lastrowid = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->description); + p->description = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->warnings); + p->warnings = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->has_result); + p->has_result = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_getprop_6oursql_6_Query_rowcount(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6oursql_6_Query_8rowcount_1__get__(o); +} + +static PyObject *__pyx_getprop_6oursql_6_Query_lastrowid(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6oursql_6_Query_9lastrowid_1__get__(o); +} + +static PyObject *__pyx_getprop_6oursql_6_Query_description(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6oursql_6_Query_11description_1__get__(o); +} + +static PyObject *__pyx_getprop_6oursql_6_Query_warnings(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6oursql_6_Query_8warnings_1__get__(o); +} + +static PyObject *__pyx_getprop_6oursql_6_Query_has_result(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6oursql_6_Query_10has_result_1__get__(o); +} + +static PyMethodDef __pyx_methods_6oursql__Query[] = { + {"new_result", (PyCFunction)__pyx_pw_6oursql_6_Query_3new_result, METH_NOARGS, 0}, + {"nextset", (PyCFunction)__pyx_pw_6oursql_6_Query_5nextset, METH_NOARGS, 0}, + {"fetchone", (PyCFunction)__pyx_pw_6oursql_6_Query_7fetchone, METH_NOARGS, 0}, + {"fetchall", (PyCFunction)__pyx_pw_6oursql_6_Query_11fetchall, METH_NOARGS, 0}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_6oursql__Query[] = { + {(char *)"rowcount", __pyx_getprop_6oursql_6_Query_rowcount, 0, 0, 0}, + {(char *)"lastrowid", __pyx_getprop_6oursql_6_Query_lastrowid, 0, 0, 0}, + {(char *)"description", __pyx_getprop_6oursql_6_Query_description, 0, 0, 0}, + {(char *)"warnings", __pyx_getprop_6oursql_6_Query_warnings, 0, 0, 0}, + {(char *)"has_result", __pyx_getprop_6oursql_6_Query_has_result, 0, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_6oursql__Query = { + PyVarObject_HEAD_INIT(0, 0) + "oursql._Query", /*tp_name*/ + sizeof(struct __pyx_obj_6oursql__Query), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_6oursql__Query, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + "_Query(...)\n \n _Queries generate _ResultSets. Eventually they will also support generating\n multiple _ResultSets when dealing with queries that produce multiple result\n sets.\n ", /*tp_doc*/ + __pyx_tp_traverse_6oursql__Query, /*tp_traverse*/ + __pyx_tp_clear_6oursql__Query, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + __pyx_pw_6oursql_6_Query_9__iter__, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_6oursql__Query, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_6oursql__Query, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_6oursql__Query, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif +}; +static struct __pyx_vtabstruct_6oursql__DictQuery __pyx_vtable_6oursql__DictQuery; + +static PyObject *__pyx_tp_new_6oursql__DictQuery(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_6oursql__DictQuery *p; + PyObject *o = __pyx_tp_new_6oursql__Query(t, a, k); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_6oursql__DictQuery *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_6oursql__Query*)__pyx_vtabptr_6oursql__DictQuery; + return o; +} + +static PyTypeObject __pyx_type_6oursql__DictQuery = { + PyVarObject_HEAD_INIT(0, 0) + "oursql._DictQuery", /*tp_name*/ + sizeof(struct __pyx_obj_6oursql__DictQuery), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_6oursql__Query, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_6oursql__Query, /*tp_traverse*/ + __pyx_tp_clear_6oursql__Query, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_6oursql_6_Query_9__iter__, /*tp_iter*/ + #else + 0, /*tp_iter*/ + #endif + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_6oursql__DictQuery, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif +}; +static struct __pyx_vtabstruct_6oursql_Cursor __pyx_vtable_6oursql_Cursor; + +static PyObject *__pyx_tp_new_6oursql_Cursor(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_6oursql_Cursor *p; + PyObject *o; + if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_6oursql_Cursor *)o); + p->__pyx_vtab = __pyx_vtabptr_6oursql_Cursor; + p->_statements = Py_None; Py_INCREF(Py_None); + p->_stmt_kwargs = Py_None; Py_INCREF(Py_None); + p->conn = ((struct __pyx_obj_6oursql_Connection *)Py_None); Py_INCREF(Py_None); + p->rowcount = Py_None; Py_INCREF(Py_None); + p->lastrowid = Py_None; Py_INCREF(Py_None); + p->description = Py_None; Py_INCREF(Py_None); + p->messages = Py_None; Py_INCREF(Py_None); + if (unlikely(__pyx_pw_6oursql_6Cursor_1__cinit__(o, a, k) < 0)) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_6oursql_Cursor(PyObject *o) { + struct __pyx_obj_6oursql_Cursor *p = (struct __pyx_obj_6oursql_Cursor *)o; + #if PY_VERSION_HEX >= 0x030400a1 + if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->_statements); + Py_CLEAR(p->_stmt_kwargs); + Py_CLEAR(p->conn); + Py_CLEAR(p->rowcount); + Py_CLEAR(p->lastrowid); + Py_CLEAR(p->description); + Py_CLEAR(p->messages); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_6oursql_Cursor(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_6oursql_Cursor *p = (struct __pyx_obj_6oursql_Cursor *)o; + if (p->_statements) { + e = (*v)(p->_statements, a); if (e) return e; + } + if (p->_stmt_kwargs) { + e = (*v)(p->_stmt_kwargs, a); if (e) return e; + } + if (p->conn) { + e = (*v)(((PyObject*)p->conn), a); if (e) return e; + } + if (p->rowcount) { + e = (*v)(p->rowcount, a); if (e) return e; + } + if (p->lastrowid) { + e = (*v)(p->lastrowid, a); if (e) return e; + } + if (p->description) { + e = (*v)(p->description, a); if (e) return e; + } + if (p->messages) { + e = (*v)(p->messages, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_6oursql_Cursor(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_6oursql_Cursor *p = (struct __pyx_obj_6oursql_Cursor *)o; + tmp = ((PyObject*)p->_statements); + p->_statements = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->_stmt_kwargs); + p->_stmt_kwargs = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->conn); + p->conn = ((struct __pyx_obj_6oursql_Connection *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->rowcount); + p->rowcount = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->lastrowid); + p->lastrowid = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->description); + p->description = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->messages); + p->messages = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_getprop_6oursql_6Cursor_connection(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6oursql_6Cursor_10connection_1__get__(o); +} + +static PyObject *__pyx_getprop_6oursql_6Cursor__statements(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6oursql_6Cursor_11_statements_1__get__(o); +} + +static PyObject *__pyx_getprop_6oursql_6Cursor__stmt_kwargs(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6oursql_6Cursor_12_stmt_kwargs_1__get__(o); +} + +static PyObject *__pyx_getprop_6oursql_6Cursor_rowcount(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6oursql_6Cursor_8rowcount_1__get__(o); +} + +static PyObject *__pyx_getprop_6oursql_6Cursor_lastrowid(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6oursql_6Cursor_9lastrowid_1__get__(o); +} + +static PyObject *__pyx_getprop_6oursql_6Cursor_description(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6oursql_6Cursor_11description_1__get__(o); +} + +static PyObject *__pyx_getprop_6oursql_6Cursor_messages(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6oursql_6Cursor_8messages_1__get__(o); +} + +static PyObject *__pyx_getprop_6oursql_6Cursor_arraysize(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6oursql_6Cursor_9arraysize_1__get__(o); +} + +static int __pyx_setprop_6oursql_6Cursor_arraysize(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_6oursql_6Cursor_9arraysize_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyMethodDef __pyx_methods_6oursql_Cursor[] = { + {"close", (PyCFunction)__pyx_pw_6oursql_6Cursor_3close, METH_NOARGS, __pyx_doc_6oursql_6Cursor_2close}, + {"_new_statement", (PyCFunction)__pyx_pw_6oursql_6Cursor_5_new_statement, METH_NOARGS, 0}, + {"_new_query", (PyCFunction)__pyx_pw_6oursql_6Cursor_7_new_query, METH_O, 0}, + {"callproc", (PyCFunction)__pyx_pw_6oursql_6Cursor_9callproc, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6oursql_6Cursor_8callproc}, + {"_do_autoping", (PyCFunction)__pyx_pw_6oursql_6Cursor_11_do_autoping, METH_NOARGS, 0}, + {"execute", (PyCFunction)__pyx_pw_6oursql_6Cursor_13execute, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6oursql_6Cursor_12execute}, + {"executemany", (PyCFunction)__pyx_pw_6oursql_6Cursor_15executemany, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6oursql_6Cursor_14executemany}, + {"nextset", (PyCFunction)__pyx_pw_6oursql_6Cursor_17nextset, METH_NOARGS, __pyx_doc_6oursql_6Cursor_16nextset}, + {"fetchone", (PyCFunction)__pyx_pw_6oursql_6Cursor_19fetchone, METH_NOARGS, __pyx_doc_6oursql_6Cursor_18fetchone}, + {"fetchmany", (PyCFunction)__pyx_pw_6oursql_6Cursor_21fetchmany, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6oursql_6Cursor_20fetchmany}, + {"fetchall", (PyCFunction)__pyx_pw_6oursql_6Cursor_23fetchall, METH_NOARGS, __pyx_doc_6oursql_6Cursor_22fetchall}, + {"setinputsizes", (PyCFunction)__pyx_pw_6oursql_6Cursor_27setinputsizes, METH_O, __pyx_doc_6oursql_6Cursor_26setinputsizes}, + {"setoutputsize", (PyCFunction)__pyx_pw_6oursql_6Cursor_29setoutputsize, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6oursql_6Cursor_28setoutputsize}, + {"__enter__", (PyCFunction)__pyx_pw_6oursql_6Cursor_31__enter__, METH_NOARGS, 0}, + {"__exit__", (PyCFunction)__pyx_pw_6oursql_6Cursor_33__exit__, METH_VARARGS|METH_KEYWORDS, 0}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_6oursql_Cursor[] = { + {(char *)"connection", __pyx_getprop_6oursql_6Cursor_connection, 0, 0, 0}, + {(char *)"_statements", __pyx_getprop_6oursql_6Cursor__statements, 0, 0, 0}, + {(char *)"_stmt_kwargs", __pyx_getprop_6oursql_6Cursor__stmt_kwargs, 0, 0, 0}, + {(char *)"rowcount", __pyx_getprop_6oursql_6Cursor_rowcount, 0, 0, 0}, + {(char *)"lastrowid", __pyx_getprop_6oursql_6Cursor_lastrowid, 0, 0, 0}, + {(char *)"description", __pyx_getprop_6oursql_6Cursor_description, 0, 0, 0}, + {(char *)"messages", __pyx_getprop_6oursql_6Cursor_messages, 0, 0, 0}, + {(char *)"arraysize", __pyx_getprop_6oursql_6Cursor_arraysize, __pyx_setprop_6oursql_6Cursor_arraysize, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_6oursql_Cursor = { + PyVarObject_HEAD_INIT(0, 0) + "oursql.Cursor", /*tp_name*/ + sizeof(struct __pyx_obj_6oursql_Cursor), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_6oursql_Cursor, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + "Cursor(...)\n \n Cursors should never be instantiated directly. They may be passed other \n options via the Connection.cursor method:\n \n - try_plain_query=True: If this is true, oursql will first attempt to run\n queries as prepared statements, and then fall back to the plain query \n API if MySQL refuses to parameterize the query. Otherwise, oursql will \n only run plain queries if explicitly asked.\n \n - show_table=False: If this is true, the name of the table will be \n prepended to the name of the column in the 'description' attribute of\n the cursor.\n \n - string_limit=0: Set a limit on the size of the buffer oursql will \n allocate when fetching strings over the wire. If the string_limit is \n nonzero, file-like objects will always be returned instead of strings. \n If the size of the string value is greater than the string_limit, the \n string will be streamed as necessary instead of fetched all at once.\n Note: plain queries buffer incoming result differently, and are \n therefore unaffected by the string_limit.\n \n Cursor instances yield tuples to represent rows.\n ", /*tp_doc*/ + __pyx_tp_traverse_6oursql_Cursor, /*tp_traverse*/ + __pyx_tp_clear_6oursql_Cursor, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + __pyx_pw_6oursql_6Cursor_25__iter__, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_6oursql_Cursor, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_6oursql_Cursor, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_6oursql_Cursor, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif +}; +static struct __pyx_vtabstruct_6oursql_DictCursor __pyx_vtable_6oursql_DictCursor; + +static PyObject *__pyx_tp_new_6oursql_DictCursor(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_6oursql_DictCursor *p; + PyObject *o = __pyx_tp_new_6oursql_Cursor(t, a, k); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_6oursql_DictCursor *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_6oursql_Cursor*)__pyx_vtabptr_6oursql_DictCursor; + return o; +} + +static PyTypeObject __pyx_type_6oursql_DictCursor = { + PyVarObject_HEAD_INIT(0, 0) + "oursql.DictCursor", /*tp_name*/ + sizeof(struct __pyx_obj_6oursql_DictCursor), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_6oursql_Cursor, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + "DictCursor(...)\n \n Cursors should never be instantiated directly. They may be passed other \n options via the Connection.cursor method. See the documentation for the\n Cursor class for details.\n \n DictCursor instances represent rows as dicts mapping column names or \n aliases to values. These key names are taken from the 'description' \n attribute of the cursor, and are therefore affected by the 'show_table'\n cursor option. A ProgrammingError is raised when fetching a row if there \n were duplicate keys with inequal values.\n ", /*tp_doc*/ + __pyx_tp_traverse_6oursql_Cursor, /*tp_traverse*/ + __pyx_tp_clear_6oursql_Cursor, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_6oursql_6Cursor_25__iter__, /*tp_iter*/ + #else + 0, /*tp_iter*/ + #endif + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_6oursql_DictCursor, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif +}; + +static PyObject *__pyx_tp_new_6oursql__DBAPITypeObject(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_6oursql__DBAPITypeObject *p; + PyObject *o; + if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_6oursql__DBAPITypeObject *)o); + p->values = Py_None; Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_6oursql__DBAPITypeObject(PyObject *o) { + struct __pyx_obj_6oursql__DBAPITypeObject *p = (struct __pyx_obj_6oursql__DBAPITypeObject *)o; + #if PY_VERSION_HEX >= 0x030400a1 + if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->values); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_6oursql__DBAPITypeObject(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_6oursql__DBAPITypeObject *p = (struct __pyx_obj_6oursql__DBAPITypeObject *)o; + if (p->values) { + e = (*v)(p->values, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_6oursql__DBAPITypeObject(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_6oursql__DBAPITypeObject *p = (struct __pyx_obj_6oursql__DBAPITypeObject *)o; + tmp = ((PyObject*)p->values); + p->values = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_getprop_6oursql_16_DBAPITypeObject_values(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6oursql_16_DBAPITypeObject_6values_1__get__(o); +} + +static PyMethodDef __pyx_methods_6oursql__DBAPITypeObject[] = { + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_6oursql__DBAPITypeObject[] = { + {(char *)"values", __pyx_getprop_6oursql_16_DBAPITypeObject_values, 0, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_6oursql__DBAPITypeObject = { + PyVarObject_HEAD_INIT(0, 0) + "oursql._DBAPITypeObject", /*tp_name*/ + sizeof(struct __pyx_obj_6oursql__DBAPITypeObject), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_6oursql__DBAPITypeObject, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + __pyx_pw_6oursql_16_DBAPITypeObject_5__repr__, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_6oursql__DBAPITypeObject, /*tp_traverse*/ + __pyx_tp_clear_6oursql__DBAPITypeObject, /*tp_clear*/ + __pyx_pw_6oursql_16_DBAPITypeObject_3__richcmp__, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_6oursql__DBAPITypeObject, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_6oursql__DBAPITypeObject, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pw_6oursql_16_DBAPITypeObject_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_6oursql__DBAPITypeObject, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif +}; + +static PyMethodDef __pyx_methods[] = { + {0, 0, 0, 0} +}; + +#if PY_MAJOR_VERSION >= 3 +static struct PyModuleDef __pyx_moduledef = { + #if PY_VERSION_HEX < 0x03020000 + { PyObject_HEAD_INIT(NULL) NULL, 0, NULL }, + #else + PyModuleDef_HEAD_INIT, + #endif + "oursql", + __pyx_k_oursql_python_bindings_for_MySQL, /* m_doc */ + -1, /* m_size */ + __pyx_methods /* m_methods */, + NULL, /* m_reload */ + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ +}; +#endif + +static __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_kp_s_0_9_3, __pyx_k_0_9_3, sizeof(__pyx_k_0_9_3), 0, 0, 1, 0}, + {&__pyx_kp_s_2_0, __pyx_k_2_0, sizeof(__pyx_k_2_0), 0, 0, 1, 0}, + {&__pyx_kp_s_Aaron_Gallagher_habnabit_gmail_c, __pyx_k_Aaron_Gallagher_habnabit_gmail_c, sizeof(__pyx_k_Aaron_Gallagher_habnabit_gmail_c), 0, 0, 1, 0}, + {&__pyx_n_s_BINARY, __pyx_k_BINARY, sizeof(__pyx_k_BINARY), 0, 0, 1, 1}, + {&__pyx_n_s_Binary, __pyx_k_Binary, sizeof(__pyx_k_Binary), 0, 0, 1, 1}, + {&__pyx_n_s_BinaryFileWrapper, __pyx_k_BinaryFileWrapper, sizeof(__pyx_k_BinaryFileWrapper), 0, 0, 1, 1}, + {&__pyx_kp_s_BinaryFileWrapper_fileobj_chunks, __pyx_k_BinaryFileWrapper_fileobj_chunks, sizeof(__pyx_k_BinaryFileWrapper_fileobj_chunks), 0, 0, 1, 0}, + {&__pyx_n_s_BinaryIterWrapper, __pyx_k_BinaryIterWrapper, sizeof(__pyx_k_BinaryIterWrapper), 0, 0, 1, 1}, + {&__pyx_kp_s_BinaryIterWrapper_iterobj_Binary, __pyx_k_BinaryIterWrapper_iterobj_Binary, sizeof(__pyx_k_BinaryIterWrapper_iterobj_Binary), 0, 0, 1, 0}, + {&__pyx_n_s_CollatedWarningsError, __pyx_k_CollatedWarningsError, sizeof(__pyx_k_CollatedWarningsError), 0, 0, 1, 1}, + {&__pyx_n_s_DATE, __pyx_k_DATE, sizeof(__pyx_k_DATE), 0, 0, 1, 1}, + {&__pyx_n_s_DATETIME, __pyx_k_DATETIME, sizeof(__pyx_k_DATETIME), 0, 0, 1, 1}, + {&__pyx_kp_s_DBAPITypeObject_representing_r, __pyx_k_DBAPITypeObject_representing_r, sizeof(__pyx_k_DBAPITypeObject_representing_r), 0, 0, 1, 0}, + {&__pyx_n_s_DataError, __pyx_k_DataError, sizeof(__pyx_k_DataError), 0, 0, 1, 1}, + {&__pyx_n_s_DatabaseError, __pyx_k_DatabaseError, sizeof(__pyx_k_DatabaseError), 0, 0, 1, 1}, + {&__pyx_n_s_Date, __pyx_k_Date, sizeof(__pyx_k_Date), 0, 0, 1, 1}, + {&__pyx_n_s_DateFromTicks, __pyx_k_DateFromTicks, sizeof(__pyx_k_DateFromTicks), 0, 0, 1, 1}, + {&__pyx_n_s_Decimal, __pyx_k_Decimal, sizeof(__pyx_k_Decimal), 0, 0, 1, 1}, + {&__pyx_n_s_DictResultSet, __pyx_k_DictResultSet, sizeof(__pyx_k_DictResultSet), 0, 0, 1, 1}, + {&__pyx_n_s_DictStatement, __pyx_k_DictStatement, sizeof(__pyx_k_DictStatement), 0, 0, 1, 1}, + {&__pyx_n_s_Error, __pyx_k_Error, sizeof(__pyx_k_Error), 0, 0, 1, 1}, + {&__pyx_n_s_Error___init, __pyx_k_Error___init, sizeof(__pyx_k_Error___init), 0, 0, 1, 1}, + {&__pyx_kp_s_H_M_S, __pyx_k_H_M_S, sizeof(__pyx_k_H_M_S), 0, 0, 1, 0}, + {&__pyx_n_s_IntegrityError, __pyx_k_IntegrityError, sizeof(__pyx_k_IntegrityError), 0, 0, 1, 1}, + {&__pyx_n_s_InterfaceError, __pyx_k_InterfaceError, sizeof(__pyx_k_InterfaceError), 0, 0, 1, 1}, + {&__pyx_n_s_InternalError, __pyx_k_InternalError, sizeof(__pyx_k_InternalError), 0, 0, 1, 1}, + {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1}, + {&__pyx_n_s_NUMBER, __pyx_k_NUMBER, sizeof(__pyx_k_NUMBER), 0, 0, 1, 1}, + {&__pyx_n_s_NotSupportedError, __pyx_k_NotSupportedError, sizeof(__pyx_k_NotSupportedError), 0, 0, 1, 1}, + {&__pyx_n_s_Note, __pyx_k_Note, sizeof(__pyx_k_Note), 0, 0, 1, 1}, + {&__pyx_n_s_OperationalError, __pyx_k_OperationalError, sizeof(__pyx_k_OperationalError), 0, 0, 1, 1}, + {&__pyx_n_s_PermissionsError, __pyx_k_PermissionsError, sizeof(__pyx_k_PermissionsError), 0, 0, 1, 1}, + {&__pyx_n_s_ProgrammingError, __pyx_k_ProgrammingError, sizeof(__pyx_k_ProgrammingError), 0, 0, 1, 1}, + {&__pyx_n_s_ROWID, __pyx_k_ROWID, sizeof(__pyx_k_ROWID), 0, 0, 1, 1}, + {&__pyx_kp_s_SHOW_WARNINGS, __pyx_k_SHOW_WARNINGS, sizeof(__pyx_k_SHOW_WARNINGS), 0, 0, 1, 0}, + {&__pyx_n_s_STRING, __pyx_k_STRING, sizeof(__pyx_k_STRING), 0, 0, 1, 1}, + {&__pyx_n_s_StandardError, __pyx_k_StandardError, sizeof(__pyx_k_StandardError), 0, 0, 1, 1}, + {&__pyx_n_s_StopIteration, __pyx_k_StopIteration, sizeof(__pyx_k_StopIteration), 0, 0, 1, 1}, + {&__pyx_n_s_StringIO, __pyx_k_StringIO, sizeof(__pyx_k_StringIO), 0, 0, 1, 1}, + {&__pyx_n_s_TIME, __pyx_k_TIME, sizeof(__pyx_k_TIME), 0, 0, 1, 1}, + {&__pyx_n_s_TIMESTAMP, __pyx_k_TIMESTAMP, sizeof(__pyx_k_TIMESTAMP), 0, 0, 1, 1}, + {&__pyx_n_s_Time, __pyx_k_Time, sizeof(__pyx_k_Time), 0, 0, 1, 1}, + {&__pyx_n_s_TimeFromTicks, __pyx_k_TimeFromTicks, sizeof(__pyx_k_TimeFromTicks), 0, 0, 1, 1}, + {&__pyx_n_s_Timestamp, __pyx_k_Timestamp, sizeof(__pyx_k_Timestamp), 0, 0, 1, 1}, + {&__pyx_n_s_TimestampFromTicks, __pyx_k_TimestampFromTicks, sizeof(__pyx_k_TimestampFromTicks), 0, 0, 1, 1}, + {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1}, + {&__pyx_n_s_UnknownError, __pyx_k_UnknownError, sizeof(__pyx_k_UnknownError), 0, 0, 1, 1}, + {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1}, + {&__pyx_n_s_Warning, __pyx_k_Warning, sizeof(__pyx_k_Warning), 0, 0, 1, 1}, + {&__pyx_kp_s_Y_m_d, __pyx_k_Y_m_d, sizeof(__pyx_k_Y_m_d), 0, 0, 1, 0}, + {&__pyx_kp_s_Y_m_d_H_M_S, __pyx_k_Y_m_d_H_M_S, sizeof(__pyx_k_Y_m_d_H_M_S), 0, 0, 1, 0}, + {&__pyx_kp_s__20, __pyx_k__20, sizeof(__pyx_k__20), 0, 0, 1, 0}, + {&__pyx_kp_s_alloc_of_bind_parameters_failed, __pyx_k_alloc_of_bind_parameters_failed, sizeof(__pyx_k_alloc_of_bind_parameters_failed), 0, 0, 1, 0}, + {&__pyx_kp_s_alloc_of_conn_object_failed, __pyx_k_alloc_of_conn_object_failed, sizeof(__pyx_k_alloc_of_conn_object_failed), 0, 0, 1, 0}, + {&__pyx_kp_s_alloc_of_result_bind_structure_f, __pyx_k_alloc_of_result_bind_structure_f, sizeof(__pyx_k_alloc_of_result_bind_structure_f), 0, 0, 1, 0}, + {&__pyx_kp_s_alloc_of_result_buffers_failed, __pyx_k_alloc_of_result_buffers_failed, sizeof(__pyx_k_alloc_of_result_buffers_failed), 0, 0, 1, 0}, + {&__pyx_kp_s_alloc_of_statement_failed, __pyx_k_alloc_of_statement_failed, sizeof(__pyx_k_alloc_of_statement_failed), 0, 0, 1, 0}, + {&__pyx_n_s_apilevel, __pyx_k_apilevel, sizeof(__pyx_k_apilevel), 0, 0, 1, 1}, + {&__pyx_n_s_append, __pyx_k_append, sizeof(__pyx_k_append), 0, 0, 1, 1}, + {&__pyx_n_s_author, __pyx_k_author, sizeof(__pyx_k_author), 0, 0, 1, 1}, + {&__pyx_n_s_autoping, __pyx_k_autoping, sizeof(__pyx_k_autoping), 0, 0, 1, 1}, + {&__pyx_n_s_autoreconnect, __pyx_k_autoreconnect, sizeof(__pyx_k_autoreconnect), 0, 0, 1, 1}, + {&__pyx_kp_s_binding_this_query_would_cause_r, __pyx_k_binding_this_query_would_cause_r, sizeof(__pyx_k_binding_this_query_would_cause_r), 0, 0, 1, 0}, + {&__pyx_n_s_bitval_from_string, __pyx_k_bitval_from_string, sizeof(__pyx_k_bitval_from_string), 0, 0, 1, 1}, + {&__pyx_n_s_buffer, __pyx_k_buffer, sizeof(__pyx_k_buffer), 0, 0, 1, 1}, + {&__pyx_n_s_buffer_results, __pyx_k_buffer_results, sizeof(__pyx_k_buffer_results), 0, 0, 1, 1}, + {&__pyx_n_s_cStringIO, __pyx_k_cStringIO, sizeof(__pyx_k_cStringIO), 0, 0, 1, 1}, + {&__pyx_n_s_ca, __pyx_k_ca, sizeof(__pyx_k_ca), 0, 0, 1, 1}, + {&__pyx_kp_s_can_t_call_execute_with_both_par, __pyx_k_can_t_call_execute_with_both_par, sizeof(__pyx_k_can_t_call_execute_with_both_par), 0, 0, 1, 0}, + {&__pyx_kp_s_can_t_read_negative_bytes, __pyx_k_can_t_read_negative_bytes, sizeof(__pyx_k_can_t_read_negative_bytes), 0, 0, 1, 0}, + {&__pyx_kp_s_cannot_bind_r_object, __pyx_k_cannot_bind_r_object, sizeof(__pyx_k_cannot_bind_r_object), 0, 0, 1, 0}, + {&__pyx_n_s_capath, __pyx_k_capath, sizeof(__pyx_k_capath), 0, 0, 1, 1}, + {&__pyx_n_s_cert, __pyx_k_cert, sizeof(__pyx_k_cert), 0, 0, 1, 1}, + {&__pyx_n_s_charset, __pyx_k_charset, sizeof(__pyx_k_charset), 0, 0, 1, 1}, + {&__pyx_n_s_charset_dir, __pyx_k_charset_dir, sizeof(__pyx_k_charset_dir), 0, 0, 1, 1}, + {&__pyx_n_s_chunksize, __pyx_k_chunksize, sizeof(__pyx_k_chunksize), 0, 0, 1, 1}, + {&__pyx_n_s_cipher, __pyx_k_cipher, sizeof(__pyx_k_cipher), 0, 0, 1, 1}, + {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1}, + {&__pyx_n_s_clear, __pyx_k_clear, sizeof(__pyx_k_clear), 0, 0, 1, 1}, + {&__pyx_n_s_client_info, __pyx_k_client_info, sizeof(__pyx_k_client_info), 0, 0, 1, 1}, + {&__pyx_n_s_close, __pyx_k_close, sizeof(__pyx_k_close), 0, 0, 1, 1}, + {&__pyx_n_s_codecs, __pyx_k_codecs, sizeof(__pyx_k_codecs), 0, 0, 1, 1}, + {&__pyx_n_s_collections, __pyx_k_collections, sizeof(__pyx_k_collections), 0, 0, 1, 1}, + {&__pyx_n_s_column, __pyx_k_column, sizeof(__pyx_k_column), 0, 0, 1, 1}, + {&__pyx_n_s_column_names, __pyx_k_column_names, sizeof(__pyx_k_column_names), 0, 0, 1, 1}, + {&__pyx_kp_s_column_s_appears_more_than_once, __pyx_k_column_s_appears_more_than_once, sizeof(__pyx_k_column_s_appears_more_than_once), 0, 0, 1, 0}, + {&__pyx_n_s_commit, __pyx_k_commit, sizeof(__pyx_k_commit), 0, 0, 1, 1}, + {&__pyx_n_s_compress, __pyx_k_compress, sizeof(__pyx_k_compress), 0, 0, 1, 1}, + {&__pyx_n_s_conn, __pyx_k_conn, sizeof(__pyx_k_conn), 0, 0, 1, 1}, + {&__pyx_n_s_connect, __pyx_k_connect, sizeof(__pyx_k_connect), 0, 0, 1, 1}, + {&__pyx_n_s_connect_timeout, __pyx_k_connect_timeout, sizeof(__pyx_k_connect_timeout), 0, 0, 1, 1}, + {&__pyx_n_s_connection, __pyx_k_connection, sizeof(__pyx_k_connection), 0, 0, 1, 1}, + {&__pyx_kp_s_connection_closed, __pyx_k_connection_closed, sizeof(__pyx_k_connection_closed), 0, 0, 1, 0}, + {&__pyx_n_s_conversions, __pyx_k_conversions, sizeof(__pyx_k_conversions), 0, 0, 1, 1}, + {&__pyx_n_s_conversions_dict, __pyx_k_conversions_dict, sizeof(__pyx_k_conversions_dict), 0, 0, 1, 1}, + {&__pyx_kp_s_could_not_initialize_mysql, __pyx_k_could_not_initialize_mysql, sizeof(__pyx_k_could_not_initialize_mysql), 0, 0, 1, 0}, + {&__pyx_n_s_cursor, __pyx_k_cursor, sizeof(__pyx_k_cursor), 0, 0, 1, 1}, + {&__pyx_n_s_cursor_class, __pyx_k_cursor_class, sizeof(__pyx_k_cursor_class), 0, 0, 1, 1}, + {&__pyx_kp_s_cursor_closed, __pyx_k_cursor_closed, sizeof(__pyx_k_cursor_closed), 0, 0, 1, 0}, + {&__pyx_kp_s_d_parameters_expected_d_given, __pyx_k_d_parameters_expected_d_given, sizeof(__pyx_k_d_parameters_expected_d_given), 0, 0, 1, 0}, + {&__pyx_n_s_date, __pyx_k_date, sizeof(__pyx_k_date), 0, 0, 1, 1}, + {&__pyx_n_s_date_from_string, __pyx_k_date_from_string, sizeof(__pyx_k_date_from_string), 0, 0, 1, 1}, + {&__pyx_n_s_datetime, __pyx_k_datetime, sizeof(__pyx_k_datetime), 0, 0, 1, 1}, + {&__pyx_n_s_datetime_from_string, __pyx_k_datetime_from_string, sizeof(__pyx_k_datetime_from_string), 0, 0, 1, 1}, + {&__pyx_n_s_day, __pyx_k_day, sizeof(__pyx_k_day), 0, 0, 1, 1}, + {&__pyx_n_s_db, __pyx_k_db, sizeof(__pyx_k_db), 0, 0, 1, 1}, + {&__pyx_n_s_decimal, __pyx_k_decimal, sizeof(__pyx_k_decimal), 0, 0, 1, 1}, + {&__pyx_n_s_decode, __pyx_k_decode, sizeof(__pyx_k_decode), 0, 0, 1, 1}, + {&__pyx_n_s_default_cursor, __pyx_k_default_cursor, sizeof(__pyx_k_default_cursor), 0, 0, 1, 1}, + {&__pyx_n_s_deque, __pyx_k_deque, sizeof(__pyx_k_deque), 0, 0, 1, 1}, + {&__pyx_n_s_description, __pyx_k_description, sizeof(__pyx_k_description), 0, 0, 1, 1}, + {&__pyx_n_s_do_autoping, __pyx_k_do_autoping, sizeof(__pyx_k_do_autoping), 0, 0, 1, 1}, + {&__pyx_n_s_do_warnings_query, __pyx_k_do_warnings_query, sizeof(__pyx_k_do_warnings_query), 0, 0, 1, 1}, + {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1}, + {&__pyx_n_s_doclose, __pyx_k_doclose, sizeof(__pyx_k_doclose), 0, 0, 1, 1}, + {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1}, + {&__pyx_n_s_enter, __pyx_k_enter, sizeof(__pyx_k_enter), 0, 0, 1, 1}, + {&__pyx_n_s_err, __pyx_k_err, sizeof(__pyx_k_err), 0, 0, 1, 1}, + {&__pyx_n_s_errno, __pyx_k_errno, sizeof(__pyx_k_errno), 0, 0, 1, 1}, + {&__pyx_n_s_errnos, __pyx_k_errnos, sizeof(__pyx_k_errnos), 0, 0, 1, 1}, + {&__pyx_n_s_escape_string, __pyx_k_escape_string, sizeof(__pyx_k_escape_string), 0, 0, 1, 1}, + {&__pyx_n_s_exc, __pyx_k_exc, sizeof(__pyx_k_exc), 0, 0, 1, 1}, + {&__pyx_n_s_exception_enum_map, __pyx_k_exception_enum_map, sizeof(__pyx_k_exception_enum_map), 0, 0, 1, 1}, + {&__pyx_n_s_exception_from_errno, __pyx_k_exception_from_errno, sizeof(__pyx_k_exception_from_errno), 0, 0, 1, 1}, + {&__pyx_n_s_exceptions, __pyx_k_exceptions, sizeof(__pyx_k_exceptions), 0, 0, 1, 1}, + {&__pyx_n_s_execute, __pyx_k_execute, sizeof(__pyx_k_execute), 0, 0, 1, 1}, + {&__pyx_kp_s_executing_this_query_would_cause, __pyx_k_executing_this_query_would_cause, sizeof(__pyx_k_executing_this_query_would_cause), 0, 0, 1, 0}, + {&__pyx_n_s_exit, __pyx_k_exit, sizeof(__pyx_k_exit), 0, 0, 1, 1}, + {&__pyx_n_s_extend, __pyx_k_extend, sizeof(__pyx_k_extend), 0, 0, 1, 1}, + {&__pyx_n_s_extra, __pyx_k_extra, sizeof(__pyx_k_extra), 0, 0, 1, 1}, + {&__pyx_n_s_fetchall, __pyx_k_fetchall, sizeof(__pyx_k_fetchall), 0, 0, 1, 1}, + {&__pyx_n_s_fetchone, __pyx_k_fetchone, sizeof(__pyx_k_fetchone), 0, 0, 1, 1}, + {&__pyx_n_s_fileobj, __pyx_k_fileobj, sizeof(__pyx_k_fileobj), 0, 0, 1, 1}, + {&__pyx_n_s_found_rows, __pyx_k_found_rows, sizeof(__pyx_k_found_rows), 0, 0, 1, 1}, + {&__pyx_n_s_get, __pyx_k_get, sizeof(__pyx_k_get), 0, 0, 1, 1}, + {&__pyx_n_s_getreader, __pyx_k_getreader, sizeof(__pyx_k_getreader), 0, 0, 1, 1}, + {&__pyx_n_s_has_result, __pyx_k_has_result, sizeof(__pyx_k_has_result), 0, 0, 1, 1}, + {&__pyx_n_s_host, __pyx_k_host, sizeof(__pyx_k_host), 0, 0, 1, 1}, + {&__pyx_n_s_hour, __pyx_k_hour, sizeof(__pyx_k_hour), 0, 0, 1, 1}, + {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1}, + {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, + {&__pyx_n_s_index, __pyx_k_index, sizeof(__pyx_k_index), 0, 0, 1, 1}, + {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1}, + {&__pyx_n_s_init_command, __pyx_k_init_command, sizeof(__pyx_k_init_command), 0, 0, 1, 1}, + {&__pyx_n_s_iterobj, __pyx_k_iterobj, sizeof(__pyx_k_iterobj), 0, 0, 1, 1}, + {&__pyx_n_s_itertools, __pyx_k_itertools, sizeof(__pyx_k_itertools), 0, 0, 1, 1}, + {&__pyx_n_s_key, __pyx_k_key, sizeof(__pyx_k_key), 0, 0, 1, 1}, + {&__pyx_n_s_kind, __pyx_k_kind, sizeof(__pyx_k_kind), 0, 0, 1, 1}, + {&__pyx_n_s_lastrowid, __pyx_k_lastrowid, sizeof(__pyx_k_lastrowid), 0, 0, 1, 1}, + {&__pyx_n_s_length, __pyx_k_length, sizeof(__pyx_k_length), 0, 0, 1, 1}, + {&__pyx_n_s_local_infile, __pyx_k_local_infile, sizeof(__pyx_k_local_infile), 0, 0, 1, 1}, + {&__pyx_n_s_localtime, __pyx_k_localtime, sizeof(__pyx_k_localtime), 0, 0, 1, 1}, + {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, + {&__pyx_n_s_memory, __pyx_k_memory, sizeof(__pyx_k_memory), 0, 0, 1, 1}, + {&__pyx_n_s_message, __pyx_k_message, sizeof(__pyx_k_message), 0, 0, 1, 1}, + {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1}, + {&__pyx_n_s_microsecond, __pyx_k_microsecond, sizeof(__pyx_k_microsecond), 0, 0, 1, 1}, + {&__pyx_n_s_minute, __pyx_k_minute, sizeof(__pyx_k_minute), 0, 0, 1, 1}, + {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1}, + {&__pyx_n_s_month, __pyx_k_month, sizeof(__pyx_k_month), 0, 0, 1, 1}, + {&__pyx_n_s_multi_results, __pyx_k_multi_results, sizeof(__pyx_k_multi_results), 0, 0, 1, 1}, + {&__pyx_n_s_multi_statements, __pyx_k_multi_statements, sizeof(__pyx_k_multi_statements), 0, 0, 1, 1}, + {&__pyx_kp_s_must_prefetch_at_least_1_row, __pyx_k_must_prefetch_at_least_1_row, sizeof(__pyx_k_must_prefetch_at_least_1_row), 0, 0, 1, 0}, + {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, + {&__pyx_n_s_new_query, __pyx_k_new_query, sizeof(__pyx_k_new_query), 0, 0, 1, 1}, + {&__pyx_n_s_new_result, __pyx_k_new_result, sizeof(__pyx_k_new_result), 0, 0, 1, 1}, + {&__pyx_n_s_new_statement, __pyx_k_new_statement, sizeof(__pyx_k_new_statement), 0, 0, 1, 1}, + {&__pyx_n_s_next, __pyx_k_next, sizeof(__pyx_k_next), 0, 0, 1, 1}, + {&__pyx_n_s_nextset, __pyx_k_nextset, sizeof(__pyx_k_nextset), 0, 0, 1, 1}, + {&__pyx_kp_s_no_results_available, __pyx_k_no_results_available, sizeof(__pyx_k_no_results_available), 0, 0, 1, 0}, + {&__pyx_n_s_oursql, __pyx_k_oursql, sizeof(__pyx_k_oursql), 0, 0, 1, 1}, + {&__pyx_n_s_parambatch, __pyx_k_parambatch, sizeof(__pyx_k_parambatch), 0, 0, 1, 1}, + {&__pyx_n_s_params, __pyx_k_params, sizeof(__pyx_k_params), 0, 0, 1, 1}, + {&__pyx_n_s_paramstyle, __pyx_k_paramstyle, sizeof(__pyx_k_paramstyle), 0, 0, 1, 1}, + {&__pyx_n_s_passwd, __pyx_k_passwd, sizeof(__pyx_k_passwd), 0, 0, 1, 1}, + {&__pyx_n_s_ping, __pyx_k_ping, sizeof(__pyx_k_ping), 0, 0, 1, 1}, + {&__pyx_n_s_pipe, __pyx_k_pipe, sizeof(__pyx_k_pipe), 0, 0, 1, 1}, + {&__pyx_n_s_plain_query, __pyx_k_plain_query, sizeof(__pyx_k_plain_query), 0, 0, 1, 1}, + {&__pyx_n_s_pop, __pyx_k_pop, sizeof(__pyx_k_pop), 0, 0, 1, 1}, + {&__pyx_n_s_popleft, __pyx_k_popleft, sizeof(__pyx_k_popleft), 0, 0, 1, 1}, + {&__pyx_n_s_port, __pyx_k_port, sizeof(__pyx_k_port), 0, 0, 1, 1}, + {&__pyx_n_s_prefetch_rows, __pyx_k_prefetch_rows, sizeof(__pyx_k_prefetch_rows), 0, 0, 1, 1}, + {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1}, + {&__pyx_n_s_prepare_2, __pyx_k_prepare_2, sizeof(__pyx_k_prepare_2), 0, 0, 1, 1}, + {&__pyx_n_s_procname, __pyx_k_procname, sizeof(__pyx_k_procname), 0, 0, 1, 1}, + {&__pyx_n_s_protocol, __pyx_k_protocol, sizeof(__pyx_k_protocol), 0, 0, 1, 1}, + {&__pyx_n_s_protocol_enum_map, __pyx_k_protocol_enum_map, sizeof(__pyx_k_protocol_enum_map), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1}, + {&__pyx_n_s_q, __pyx_k_q, sizeof(__pyx_k_q), 0, 0, 1, 1}, + {&__pyx_n_s_qmark, __pyx_k_qmark, sizeof(__pyx_k_qmark), 0, 0, 1, 1}, + {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1}, + {&__pyx_n_s_query, __pyx_k_query, sizeof(__pyx_k_query), 0, 0, 1, 1}, + {&__pyx_kp_s_query_caused_warnings, __pyx_k_query_caused_warnings, sizeof(__pyx_k_query_caused_warnings), 0, 0, 1, 0}, + {&__pyx_n_s_query_class, __pyx_k_query_class, sizeof(__pyx_k_query_class), 0, 0, 1, 1}, + {&__pyx_kp_s_query_closed, __pyx_k_query_closed, sizeof(__pyx_k_query_closed), 0, 0, 1, 0}, + {&__pyx_n_s_raise_on_warnings, __pyx_k_raise_on_warnings, sizeof(__pyx_k_raise_on_warnings), 0, 0, 1, 1}, + {&__pyx_n_s_read, __pyx_k_read, sizeof(__pyx_k_read), 0, 0, 1, 1}, + {&__pyx_n_s_read_default_file, __pyx_k_read_default_file, sizeof(__pyx_k_read_default_file), 0, 0, 1, 1}, + {&__pyx_n_s_read_default_group, __pyx_k_read_default_group, sizeof(__pyx_k_read_default_group), 0, 0, 1, 1}, + {&__pyx_n_s_read_timeout, __pyx_k_read_timeout, sizeof(__pyx_k_read_timeout), 0, 0, 1, 1}, + {&__pyx_n_s_report_truncation, __pyx_k_report_truncation, sizeof(__pyx_k_report_truncation), 0, 0, 1, 1}, + {&__pyx_n_s_require_secure_auth, __pyx_k_require_secure_auth, sizeof(__pyx_k_require_secure_auth), 0, 0, 1, 1}, + {&__pyx_n_s_result_class, __pyx_k_result_class, sizeof(__pyx_k_result_class), 0, 0, 1, 1}, + {&__pyx_n_s_ret, __pyx_k_ret, sizeof(__pyx_k_ret), 0, 0, 1, 1}, + {&__pyx_n_s_rollback, __pyx_k_rollback, sizeof(__pyx_k_rollback), 0, 0, 1, 1}, + {&__pyx_kp_s_row_no_longer_available_from_dat, __pyx_k_row_no_longer_available_from_dat, sizeof(__pyx_k_row_no_longer_available_from_dat), 0, 0, 1, 0}, + {&__pyx_n_s_rowcount, __pyx_k_rowcount, sizeof(__pyx_k_rowcount), 0, 0, 1, 1}, + {&__pyx_n_s_s, __pyx_k_s, sizeof(__pyx_k_s), 0, 0, 1, 1}, + {&__pyx_n_s_second, __pyx_k_second, sizeof(__pyx_k_second), 0, 0, 1, 1}, + {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1}, + {&__pyx_n_s_setup_ssl_options, __pyx_k_setup_ssl_options, sizeof(__pyx_k_setup_ssl_options), 0, 0, 1, 1}, + {&__pyx_n_s_shared_memory_base_name, __pyx_k_shared_memory_base_name, sizeof(__pyx_k_shared_memory_base_name), 0, 0, 1, 1}, + {&__pyx_n_s_should_raise, __pyx_k_should_raise, sizeof(__pyx_k_should_raise), 0, 0, 1, 1}, + {&__pyx_n_s_show_table, __pyx_k_show_table, sizeof(__pyx_k_show_table), 0, 0, 1, 1}, + {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1}, + {&__pyx_kp_s_size_remaining_should_be_0, __pyx_k_size_remaining_should_be_0, sizeof(__pyx_k_size_remaining_should_be_0), 0, 0, 1, 0}, + {&__pyx_n_s_socket, __pyx_k_socket, sizeof(__pyx_k_socket), 0, 0, 1, 1}, + {&__pyx_n_s_ss, __pyx_k_ss, sizeof(__pyx_k_ss), 0, 0, 1, 1}, + {&__pyx_n_s_ssl, __pyx_k_ssl, sizeof(__pyx_k_ssl), 0, 0, 1, 1}, + {&__pyx_n_s_statement_class, __pyx_k_statement_class, sizeof(__pyx_k_statement_class), 0, 0, 1, 1}, + {&__pyx_kp_s_statement_closed, __pyx_k_statement_closed, sizeof(__pyx_k_statement_closed), 0, 0, 1, 0}, + {&__pyx_n_s_stmt, __pyx_k_stmt, sizeof(__pyx_k_stmt), 0, 0, 1, 1}, + {&__pyx_n_s_string_limit, __pyx_k_string_limit, sizeof(__pyx_k_string_limit), 0, 0, 1, 1}, + {&__pyx_kp_s_string_limit_must_be_0, __pyx_k_string_limit_must_be_0, sizeof(__pyx_k_string_limit_must_be_0), 0, 0, 1, 0}, + {&__pyx_n_s_strptime, __pyx_k_strptime, sizeof(__pyx_k_strptime), 0, 0, 1, 1}, + {&__pyx_n_s_super, __pyx_k_super, sizeof(__pyx_k_super), 0, 0, 1, 1}, + {&__pyx_n_s_tb, __pyx_k_tb, sizeof(__pyx_k_tb), 0, 0, 1, 1}, + {&__pyx_n_s_tcp, __pyx_k_tcp, sizeof(__pyx_k_tcp), 0, 0, 1, 1}, + {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, + {&__pyx_n_s_threadsafety, __pyx_k_threadsafety, sizeof(__pyx_k_threadsafety), 0, 0, 1, 1}, + {&__pyx_n_s_ticks, __pyx_k_ticks, sizeof(__pyx_k_ticks), 0, 0, 1, 1}, + {&__pyx_n_s_time, __pyx_k_time, sizeof(__pyx_k_time), 0, 0, 1, 1}, + {&__pyx_n_s_time_from_string, __pyx_k_time_from_string, sizeof(__pyx_k_time_from_string), 0, 0, 1, 1}, + {&__pyx_kp_s_truncated_column_d_type_d, __pyx_k_truncated_column_d_type_d, sizeof(__pyx_k_truncated_column_d_type_d), 0, 0, 1, 0}, + {&__pyx_n_s_try_plain_query, __pyx_k_try_plain_query, sizeof(__pyx_k_try_plain_query), 0, 0, 1, 1}, + {&__pyx_n_s_tt, __pyx_k_tt, sizeof(__pyx_k_tt), 0, 0, 1, 1}, + {&__pyx_n_s_unix_socket, __pyx_k_unix_socket, sizeof(__pyx_k_unix_socket), 0, 0, 1, 1}, + {&__pyx_kp_s_unknown_kind_of_warning_r, __pyx_k_unknown_kind_of_warning_r, sizeof(__pyx_k_unknown_kind_of_warning_r), 0, 0, 1, 0}, + {&__pyx_kp_s_unknown_protocol_r, __pyx_k_unknown_protocol_r, sizeof(__pyx_k_unknown_protocol_r), 0, 0, 1, 0}, + {&__pyx_kp_s_unorderable_types_r_and_r, __pyx_k_unorderable_types_r_and_r, sizeof(__pyx_k_unorderable_types_r_and_r), 0, 0, 1, 0}, + {&__pyx_kp_s_use_the_CALL_statement_with_the, __pyx_k_use_the_CALL_statement_with_the, sizeof(__pyx_k_use_the_CALL_statement_with_the), 0, 0, 1, 0}, + {&__pyx_n_s_use_unicode, __pyx_k_use_unicode, sizeof(__pyx_k_use_unicode), 0, 0, 1, 1}, + {&__pyx_n_s_user, __pyx_k_user, sizeof(__pyx_k_user), 0, 0, 1, 1}, + {&__pyx_kp_s_usr_local_src_Python_SQL_oursql, __pyx_k_usr_local_src_Python_SQL_oursql, sizeof(__pyx_k_usr_local_src_Python_SQL_oursql), 0, 0, 1, 0}, + {&__pyx_kp_s_usr_local_src_Python_SQL_oursql_2, __pyx_k_usr_local_src_Python_SQL_oursql_2, sizeof(__pyx_k_usr_local_src_Python_SQL_oursql_2), 0, 0, 1, 0}, + {&__pyx_kp_s_usr_local_src_Python_SQL_oursql_3, __pyx_k_usr_local_src_Python_SQL_oursql_3, sizeof(__pyx_k_usr_local_src_Python_SQL_oursql_3), 0, 0, 1, 0}, + {&__pyx_n_s_utf8, __pyx_k_utf8, sizeof(__pyx_k_utf8), 0, 0, 1, 1}, + {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1}, + {&__pyx_n_s_values, __pyx_k_values, sizeof(__pyx_k_values), 0, 0, 1, 1}, + {&__pyx_n_s_version, __pyx_k_version, sizeof(__pyx_k_version), 0, 0, 1, 1}, + {&__pyx_n_s_warning_count, __pyx_k_warning_count, sizeof(__pyx_k_warning_count), 0, 0, 1, 1}, + {&__pyx_n_s_warnings, __pyx_k_warnings, sizeof(__pyx_k_warnings), 0, 0, 1, 1}, + {&__pyx_n_s_write_timeout, __pyx_k_write_timeout, sizeof(__pyx_k_write_timeout), 0, 0, 1, 1}, + {&__pyx_n_s_year, __pyx_k_year, sizeof(__pyx_k_year), 0, 0, 1, 1}, + {&__pyx_n_s_zip, __pyx_k_zip, sizeof(__pyx_k_zip), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} +}; +static int __Pyx_InitCachedBuiltins(void) { + __pyx_builtin_buffer = __Pyx_GetBuiltinName(__pyx_n_s_buffer); if (!__pyx_builtin_buffer) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_StandardError = __Pyx_GetBuiltinName(__pyx_n_s_StandardError); if (!__pyx_builtin_StandardError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_super = __Pyx_GetBuiltinName(__pyx_n_s_super); if (!__pyx_builtin_super) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_zip = __Pyx_GetBuiltinName(__pyx_n_s_zip); if (!__pyx_builtin_zip) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_StopIteration = __Pyx_GetBuiltinName(__pyx_n_s_StopIteration); if (!__pyx_builtin_StopIteration) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + return 0; + __pyx_L1_error:; + return -1; +} + +static int __Pyx_InitCachedConstants(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); + + /* "oursqlx/util.pyx":91 + * ret.append((kind, (message, err))) + * if should_raise and conn.raise_on_warnings: + * raise CollatedWarningsError('query caused warnings', extra=ret) # <<<<<<<<<<<<<< + * return ret + */ + __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_query_caused_warnings); if (unlikely(!__pyx_tuple_)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple_); + __Pyx_GIVEREF(__pyx_tuple_); + + /* "oursqlx/conversions.pyx":11 + * def _datetime_from_string(s): + * tt = time.strptime(s, '%Y-%m-%d %H:%M:%S') + * return datetime.datetime(*tt[:6]) # <<<<<<<<<<<<<< + * + * def _date_from_string(s): + */ + __pyx_slice__2 = PySlice_New(Py_None, __pyx_int_6, Py_None); if (unlikely(!__pyx_slice__2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_slice__2); + __Pyx_GIVEREF(__pyx_slice__2); + + /* "oursqlx/conversions.pyx":15 + * def _date_from_string(s): + * tt = time.strptime(s, '%Y-%m-%d') + * return datetime.date(*tt[:3]) # <<<<<<<<<<<<<< + * + * def _time_from_string(s): + */ + __pyx_slice__3 = PySlice_New(Py_None, __pyx_int_3, Py_None); if (unlikely(!__pyx_slice__3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_slice__3); + __Pyx_GIVEREF(__pyx_slice__3); + + /* "oursqlx/conversions.pyx":19 + * def _time_from_string(s): + * tt = time.strptime(s, '%H:%M:%S') + * return datetime.time(*tt[3:6]) # <<<<<<<<<<<<<< + * + * _conversions = { + */ + __pyx_slice__4 = PySlice_New(__pyx_int_3, __pyx_int_6, Py_None); if (unlikely(!__pyx_slice__4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_slice__4); + __Pyx_GIVEREF(__pyx_slice__4); + + /* "oursqlx/conversions.pyx":60 + * Convert a time in seconds since the epoch into a Timestamp. + * """ + * return Timestamp(*time.localtime(ticks)[:6]) # <<<<<<<<<<<<<< + * + * def DateFromTicks(ticks): + */ + __pyx_slice__5 = PySlice_New(Py_None, __pyx_int_6, Py_None); if (unlikely(!__pyx_slice__5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_slice__5); + __Pyx_GIVEREF(__pyx_slice__5); + + /* "oursqlx/conversions.pyx":67 + * Convert a time in seconds since the epoch into a Date. + * """ + * return Date(*time.localtime(ticks)[:3]) # <<<<<<<<<<<<<< + * + * def TimeFromTicks(ticks): + */ + __pyx_slice__6 = PySlice_New(Py_None, __pyx_int_3, Py_None); if (unlikely(!__pyx_slice__6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_slice__6); + __Pyx_GIVEREF(__pyx_slice__6); + + /* "oursqlx/conversions.pyx":74 + * Convert a time in seconds since the epoch into a Time. + * """ + * return Time(*time.localtime(ticks)[3:6]) # <<<<<<<<<<<<<< + */ + __pyx_slice__7 = PySlice_New(__pyx_int_3, __pyx_int_6, Py_None); if (unlikely(!__pyx_slice__7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_slice__7); + __Pyx_GIVEREF(__pyx_slice__7); + + /* "oursqlx/connection.pyx":103 + * self.conn = mysql_init(NULL) + * if not self.conn: + * raise MemoryError('alloc of conn object failed') # <<<<<<<<<<<<<< + * if protocol not in _protocol_enum_map: + * raise ProgrammingError('unknown protocol %r' % (protocol,)) + */ + __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_alloc_of_conn_object_failed); if (unlikely(!__pyx_tuple__8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__8); + __Pyx_GIVEREF(__pyx_tuple__8); + + /* "oursqlx/connection.pyx":187 + * cdef int _check_closed(self) except -1: + * if not self.conn: + * raise ProgrammingError('connection closed') # <<<<<<<<<<<<<< + * + * def ping(self): + */ + __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_connection_closed); if (unlikely(!__pyx_tuple__9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__9); + __Pyx_GIVEREF(__pyx_tuple__9); + + /* "oursqlx/statement.pyx":106 + * self.stmt = mysql_stmt_init(self.conn.conn) + * if not self.stmt: + * raise MemoryError('alloc of statement failed') # <<<<<<<<<<<<<< + * self.string_limit = string_limit + * self.show_table = show_table + */ + __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_alloc_of_statement_failed); if (unlikely(!__pyx_tuple__10)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__10); + __Pyx_GIVEREF(__pyx_tuple__10); + + /* "oursqlx/statement.pyx":133 + * if self.stmt: + * self.close() + * raise ProgrammingError('connection closed') # <<<<<<<<<<<<<< + * if not self.stmt: + * raise ProgrammingError('statement closed') + */ + __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_connection_closed); if (unlikely(!__pyx_tuple__11)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__11); + __Pyx_GIVEREF(__pyx_tuple__11); + + /* "oursqlx/statement.pyx":135 + * raise ProgrammingError('connection closed') + * if not self.stmt: + * raise ProgrammingError('statement closed') # <<<<<<<<<<<<<< + * + * property string_limit: + */ + __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_statement_closed); if (unlikely(!__pyx_tuple__12)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__12); + __Pyx_GIVEREF(__pyx_tuple__12); + + /* "oursqlx/statement.pyx":143 + * def __set__(self, unsigned long value): + * if value < 0: + * raise ValueError('string limit must be >= 0') # <<<<<<<<<<<<<< + * self.string_limit = value + * + */ + __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_string_limit_must_be_0); if (unlikely(!__pyx_tuple__13)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__13); + __Pyx_GIVEREF(__pyx_tuple__13); + + /* "oursqlx/statement.pyx":151 + * self._check_closed() + * if self.data_waiting: + * raise ProgrammingError('binding this query would cause rows to ' # <<<<<<<<<<<<<< + * 'become unfetchable') + * if PyUnicode_Check(statement): + */ + __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_binding_this_query_would_cause_r); if (unlikely(!__pyx_tuple__14)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__14); + __Pyx_GIVEREF(__pyx_tuple__14); + + /* "oursqlx/statement.pyx":186 + * bind = PyMem_Malloc(sizeof(MYSQL_BIND) * fields) + * if not bind: + * raise MemoryError('alloc of result bind structure failed') # <<<<<<<<<<<<<< + * memset(bind, 0, sizeof(MYSQL_BIND) * fields) + * result_data = PyMem_Malloc( + */ + __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_alloc_of_result_bind_structure_f); if (unlikely(!__pyx_tuple__15)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__15); + __Pyx_GIVEREF(__pyx_tuple__15); + + /* "oursqlx/statement.pyx":191 + * sizeof(column_output) * fields) + * if not result_data: + * raise MemoryError('alloc of result buffers failed') # <<<<<<<<<<<<<< + * memset(result_data, 0, sizeof(column_output) * fields) + * except: + */ + __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_alloc_of_result_buffers_failed); if (unlikely(!__pyx_tuple__16)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__16); + __Pyx_GIVEREF(__pyx_tuple__16); + + /* "oursqlx/statement.pyx":278 + * self._check_closed() + * if self.data_waiting: + * raise ProgrammingError('executing this query would cause rows to ' # <<<<<<<<<<<<<< + * 'become unfetchable') + * n_params = PyTuple_GET_SIZE(parameters) + */ + __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_executing_this_query_would_cause); if (unlikely(!__pyx_tuple__17)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__17); + __Pyx_GIVEREF(__pyx_tuple__17); + + /* "oursqlx/statement.pyx":293 + * (sizeof(MYSQL_BIND) + sizeof(column_data)) * n_params) + * if not buf: + * raise MemoryError('alloc of bind parameters failed') # <<<<<<<<<<<<<< + * bind = buf + * memset(bind, 0, sizeof(MYSQL_BIND) * n_params) + */ + __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_alloc_of_bind_parameters_failed); if (unlikely(!__pyx_tuple__18)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__18); + __Pyx_GIVEREF(__pyx_tuple__18); + + /* "oursqlx/statement.pyx":599 + * def __set__(self, unsigned long value): + * if value < 1: + * raise ValueError('must prefetch at least 1 row') # <<<<<<<<<<<<<< + * self._prefetch_rows = value + * if _oursqlx_stmt_set_prefetch_rows(self.stmt, + */ + __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_must_prefetch_at_least_1_row); if (unlikely(!__pyx_tuple__19)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__19); + __Pyx_GIVEREF(__pyx_tuple__19); + + /* "oursqlx/statement.pyx":647 + * self.stmt._check_closed() + * if self.stmt.fetched != self.stmt_fetched: + * raise ProgrammingError('row no longer available from database') # <<<<<<<<<<<<<< + * left = self.length - self.offset + * if size == -1 or size > left: + */ + __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_row_no_longer_available_from_dat); if (unlikely(!__pyx_tuple__21)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__21); + __Pyx_GIVEREF(__pyx_tuple__21); + + /* "oursqlx/statement.pyx":652 + * size = left + * elif size < 0: + * raise ValueError("can't read negative bytes") # <<<<<<<<<<<<<< + * ret = PyString_FromStringAndSize(NULL, size) + * self.bind.buffer_length = size + */ + __pyx_tuple__22 = PyTuple_Pack(1, __pyx_kp_s_can_t_read_negative_bytes); if (unlikely(!__pyx_tuple__22)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__22); + __Pyx_GIVEREF(__pyx_tuple__22); + + /* "oursqlx/query.pyx":71 + * if self.res: + * self.close() + * raise ProgrammingError('connection closed') # <<<<<<<<<<<<<< + * if not self.res: + * raise ProgrammingError('query closed') + */ + __pyx_tuple__23 = PyTuple_Pack(1, __pyx_kp_s_connection_closed); if (unlikely(!__pyx_tuple__23)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__23); + __Pyx_GIVEREF(__pyx_tuple__23); + + /* "oursqlx/query.pyx":73 + * raise ProgrammingError('connection closed') + * if not self.res: + * raise ProgrammingError('query closed') # <<<<<<<<<<<<<< + * + * property has_result: + */ + __pyx_tuple__24 = PyTuple_Pack(1, __pyx_kp_s_query_closed); if (unlikely(!__pyx_tuple__24)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__24); + __Pyx_GIVEREF(__pyx_tuple__24); + + /* "oursqlx/cursor.pyx":51 + * cdef int _check_closed(self) except -1: + * if not self.conn.conn: + * raise ProgrammingError('connection closed') # <<<<<<<<<<<<<< + * if self.closed: + * raise ProgrammingError('cursor closed') + */ + __pyx_tuple__25 = PyTuple_Pack(1, __pyx_kp_s_connection_closed); if (unlikely(!__pyx_tuple__25)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__25); + __Pyx_GIVEREF(__pyx_tuple__25); + + /* "oursqlx/cursor.pyx":53 + * raise ProgrammingError('connection closed') + * if self.closed: + * raise ProgrammingError('cursor closed') # <<<<<<<<<<<<<< + * + * def close(self): + */ + __pyx_tuple__26 = PyTuple_Pack(1, __pyx_kp_s_cursor_closed); if (unlikely(!__pyx_tuple__26)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__26); + __Pyx_GIVEREF(__pyx_tuple__26); + + /* "oursqlx/cursor.pyx":81 + * # This is slightly irritating, but not too horribly bad. The horribly + * # bad part is getting the results from a procedure. + * raise NotSupportedError('use the CALL statement with the execute ' # <<<<<<<<<<<<<< + * 'method to call stored procedures') + * + */ + __pyx_tuple__27 = PyTuple_Pack(1, __pyx_kp_s_use_the_CALL_statement_with_the); if (unlikely(!__pyx_tuple__27)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__27); + __Pyx_GIVEREF(__pyx_tuple__27); + + /* "oursqlx/cursor.pyx":105 + * # worth parameterizing supports the prepared statement API + * # anyway, so this shouldn't matter too much. + * raise ProgrammingError("can't call execute with both " # <<<<<<<<<<<<<< + * "parameters and a plain query") + * stmt = self._new_query(query) + */ + __pyx_tuple__28 = PyTuple_Pack(1, __pyx_kp_s_can_t_call_execute_with_both_par); if (unlikely(!__pyx_tuple__28)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__28); + __Pyx_GIVEREF(__pyx_tuple__28); + + /* "oursqlx/cursor.pyx":161 + * self._check_closed() + * if not self._statements: + * raise ProgrammingError('no results available') # <<<<<<<<<<<<<< + * + * def nextset(self): + */ + __pyx_tuple__29 = PyTuple_Pack(1, __pyx_kp_s_no_results_available); if (unlikely(!__pyx_tuple__29)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__29); + __Pyx_GIVEREF(__pyx_tuple__29); + + /* "oursql.pyx":56 + * + * class Error(exceptions.StandardError): + * def __init__(self, message, errno=None, extra=None): # <<<<<<<<<<<<<< + * StandardError.__init__(self, errno, message, extra) + * self.errno = errno + */ + __pyx_tuple__30 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_message, __pyx_n_s_errno, __pyx_n_s_extra); if (unlikely(!__pyx_tuple__30)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__30); + __Pyx_GIVEREF(__pyx_tuple__30); + __pyx_codeobj__31 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__30, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr_local_src_Python_SQL_oursql, __pyx_n_s_init, 56, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__31)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__32 = PyTuple_Pack(2, ((PyObject *)Py_None), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__32)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__32); + __Pyx_GIVEREF(__pyx_tuple__32); + + /* "oursqlx/util.pyx":71 + * _oursqlx_UnknownError: UnknownError, + * } + * def _exception_from_errno(int err): # <<<<<<<<<<<<<< + * return _exception_enum_map[_oursqlx_exc_from_errno(err)] + * + */ + __pyx_tuple__33 = PyTuple_Pack(2, __pyx_n_s_err, __pyx_n_s_err); if (unlikely(!__pyx_tuple__33)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__33); + __Pyx_GIVEREF(__pyx_tuple__33); + __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__33, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr_local_src_Python_SQL_oursql_2, __pyx_n_s_exception_from_errno, 71, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "oursqlx/util.pyx":74 + * return _exception_enum_map[_oursqlx_exc_from_errno(err)] + * + * def _do_warnings_query(Connection conn not None): # <<<<<<<<<<<<<< + * cdef int should_raise = False + * q = _Query(conn, 'SHOW WARNINGS') + */ + __pyx_tuple__35 = PyTuple_Pack(7, __pyx_n_s_conn, __pyx_n_s_should_raise, __pyx_n_s_q, __pyx_n_s_ret, __pyx_n_s_kind, __pyx_n_s_err, __pyx_n_s_message); if (unlikely(!__pyx_tuple__35)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__35); + __Pyx_GIVEREF(__pyx_tuple__35); + __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(1, 0, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr_local_src_Python_SQL_oursql_2, __pyx_n_s_do_warnings_query, 74, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "oursqlx/conversions.pyx":3 + * import decimal, datetime, time + * + * def _bitval_from_string(s): # <<<<<<<<<<<<<< + * cdef Py_ssize_t length + * cdef unsigned char *ss + */ + __pyx_tuple__37 = PyTuple_Pack(3, __pyx_n_s_s, __pyx_n_s_length, __pyx_n_s_ss); if (unlikely(!__pyx_tuple__37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__37); + __Pyx_GIVEREF(__pyx_tuple__37); + __pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__37, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr_local_src_Python_SQL_oursql_3, __pyx_n_s_bitval_from_string, 3, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__38)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "oursqlx/conversions.pyx":9 + * return bitval_from_char_p(ss, length) + * + * def _datetime_from_string(s): # <<<<<<<<<<<<<< + * tt = time.strptime(s, '%Y-%m-%d %H:%M:%S') + * return datetime.datetime(*tt[:6]) + */ + __pyx_tuple__39 = PyTuple_Pack(2, __pyx_n_s_s, __pyx_n_s_tt); if (unlikely(!__pyx_tuple__39)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__39); + __Pyx_GIVEREF(__pyx_tuple__39); + __pyx_codeobj__40 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__39, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr_local_src_Python_SQL_oursql_3, __pyx_n_s_datetime_from_string, 9, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__40)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "oursqlx/conversions.pyx":13 + * return datetime.datetime(*tt[:6]) + * + * def _date_from_string(s): # <<<<<<<<<<<<<< + * tt = time.strptime(s, '%Y-%m-%d') + * return datetime.date(*tt[:3]) + */ + __pyx_tuple__41 = PyTuple_Pack(2, __pyx_n_s_s, __pyx_n_s_tt); if (unlikely(!__pyx_tuple__41)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__41); + __Pyx_GIVEREF(__pyx_tuple__41); + __pyx_codeobj__42 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__41, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr_local_src_Python_SQL_oursql_3, __pyx_n_s_date_from_string, 13, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__42)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "oursqlx/conversions.pyx":17 + * return datetime.date(*tt[:3]) + * + * def _time_from_string(s): # <<<<<<<<<<<<<< + * tt = time.strptime(s, '%H:%M:%S') + * return datetime.time(*tt[3:6]) + */ + __pyx_tuple__43 = PyTuple_Pack(2, __pyx_n_s_s, __pyx_n_s_tt); if (unlikely(!__pyx_tuple__43)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__43); + __Pyx_GIVEREF(__pyx_tuple__43); + __pyx_codeobj__44 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__43, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr_local_src_Python_SQL_oursql_3, __pyx_n_s_time_from_string, 17, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__44)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "oursqlx/conversions.pyx":55 + * Binary = buffer + * + * def TimestampFromTicks(ticks): # <<<<<<<<<<<<<< + * """TimestampFromTicks(ticks) -> Timestamp. + * + */ + __pyx_tuple__45 = PyTuple_Pack(1, __pyx_n_s_ticks); if (unlikely(!__pyx_tuple__45)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__45); + __Pyx_GIVEREF(__pyx_tuple__45); + __pyx_codeobj__46 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__45, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr_local_src_Python_SQL_oursql_3, __pyx_n_s_TimestampFromTicks, 55, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__46)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "oursqlx/conversions.pyx":62 + * return Timestamp(*time.localtime(ticks)[:6]) + * + * def DateFromTicks(ticks): # <<<<<<<<<<<<<< + * """DateFromTicks(ticks) -> Date. + * + */ + __pyx_tuple__47 = PyTuple_Pack(1, __pyx_n_s_ticks); if (unlikely(!__pyx_tuple__47)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__47); + __Pyx_GIVEREF(__pyx_tuple__47); + __pyx_codeobj__48 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__47, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr_local_src_Python_SQL_oursql_3, __pyx_n_s_DateFromTicks, 62, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__48)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "oursqlx/conversions.pyx":69 + * return Date(*time.localtime(ticks)[:3]) + * + * def TimeFromTicks(ticks): # <<<<<<<<<<<<<< + * """TimeFromTicks(ticks) -> Time. + * + */ + __pyx_tuple__49 = PyTuple_Pack(1, __pyx_n_s_ticks); if (unlikely(!__pyx_tuple__49)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__49); + __Pyx_GIVEREF(__pyx_tuple__49); + __pyx_codeobj__50 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__49, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr_local_src_Python_SQL_oursql_3, __pyx_n_s_TimeFromTicks, 69, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__50)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "oursql.pyx":89 + * # time, so it's threadsafe to call this. + * if mysql_library_init(0, NULL, NULL): + * raise InterfaceError('could not initialize mysql') # <<<<<<<<<<<<<< + * + * paramstyle = 'qmark' + */ + __pyx_tuple__51 = PyTuple_Pack(1, __pyx_kp_s_could_not_initialize_mysql); if (unlikely(!__pyx_tuple__51)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__51); + __Pyx_GIVEREF(__pyx_tuple__51); + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_InitGlobals(void) { + if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_int_6 = PyInt_FromLong(6); if (unlikely(!__pyx_int_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_int_63 = PyInt_FromLong(63); if (unlikely(!__pyx_int_63)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_int_8192 = PyInt_FromLong(8192); if (unlikely(!__pyx_int_8192)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + return 0; + __pyx_L1_error:; + return -1; +} + +#if PY_MAJOR_VERSION < 3 +PyMODINIT_FUNC initoursql(void); /*proto*/ +PyMODINIT_FUNC initoursql(void) +#else +PyMODINIT_FUNC PyInit_oursql(void); /*proto*/ +PyMODINIT_FUNC PyInit_oursql(void) +#endif +{ + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + #if CYTHON_REFNANNY + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); + if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); + } + #endif + __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_oursql(void)", 0); + if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifdef __Pyx_CyFunction_USED + if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_FusedFunction_USED + if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_Generator_USED + if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + /*--- Library function declarations ---*/ + /*--- Threads initialization code ---*/ + #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + #ifdef WITH_THREAD /* Python build with threading support? */ + PyEval_InitThreads(); + #endif + #endif + /*--- Module creation code ---*/ + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4("oursql", __pyx_methods, __pyx_k_oursql_python_bindings_for_MySQL, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + #endif + if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + Py_INCREF(__pyx_d); + __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if CYTHON_COMPILING_IN_PYPY + Py_INCREF(__pyx_b); + #endif + if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + /*--- Initialize various global constants etc. ---*/ + if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) + if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + if (__pyx_module_is_main_oursql) { + if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + } + #if PY_MAJOR_VERSION >= 3 + { + PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!PyDict_GetItemString(modules, "oursql")) { + if (unlikely(PyDict_SetItemString(modules, "oursql", __pyx_m) < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif + /*--- Builtin init code ---*/ + if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Constants init code ---*/ + if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Global init code ---*/ + /*--- Variable export code ---*/ + /*--- Function export code ---*/ + /*--- Type init code ---*/ + __pyx_vtabptr_6oursql_Connection = &__pyx_vtable_6oursql_Connection; + __pyx_vtable_6oursql_Connection._raise_error = (int (*)(struct __pyx_obj_6oursql_Connection *))__pyx_f_6oursql_10Connection__raise_error; + __pyx_vtable_6oursql_Connection._check_closed = (int (*)(struct __pyx_obj_6oursql_Connection *))__pyx_f_6oursql_10Connection__check_closed; + if (PyType_Ready(&__pyx_type_6oursql_Connection) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_6oursql_Connection.tp_print = 0; + if (__Pyx_SetVtable(__pyx_type_6oursql_Connection.tp_dict, __pyx_vtabptr_6oursql_Connection) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttrString(__pyx_m, "Connection", (PyObject *)&__pyx_type_6oursql_Connection) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_type_6oursql_Connection.tp_weaklistoffset == 0) __pyx_type_6oursql_Connection.tp_weaklistoffset = offsetof(struct __pyx_obj_6oursql_Connection, __weakref__); + __pyx_ptype_6oursql_Connection = &__pyx_type_6oursql_Connection; + if (PyType_Ready(&__pyx_type_6oursql__DictWhateverMixin) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_6oursql__DictWhateverMixin.tp_print = 0; + if (PyObject_SetAttrString(__pyx_m, "_DictWhateverMixin", (PyObject *)&__pyx_type_6oursql__DictWhateverMixin) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_6oursql__DictWhateverMixin = &__pyx_type_6oursql__DictWhateverMixin; + if (PyType_Ready(&__pyx_type_6oursql__AbstractIterWrapper) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_6oursql__AbstractIterWrapper.tp_print = 0; + if (PyObject_SetAttrString(__pyx_m, "_AbstractIterWrapper", (PyObject *)&__pyx_type_6oursql__AbstractIterWrapper) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_6oursql__AbstractIterWrapper = &__pyx_type_6oursql__AbstractIterWrapper; + if (PyType_Ready(&__pyx_type_6oursql__BinaryWhateverMixin) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_6oursql__BinaryWhateverMixin.tp_print = 0; + if (PyObject_SetAttrString(__pyx_m, "_BinaryWhateverMixin", (PyObject *)&__pyx_type_6oursql__BinaryWhateverMixin) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_6oursql__BinaryWhateverMixin = &__pyx_type_6oursql__BinaryWhateverMixin; + __pyx_type_6oursql_IterWrapper.tp_base = __pyx_ptype_6oursql__AbstractIterWrapper; + if (PyType_Ready(&__pyx_type_6oursql_IterWrapper) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_6oursql_IterWrapper.tp_print = 0; + if (PyObject_SetAttrString(__pyx_m, "IterWrapper", (PyObject *)&__pyx_type_6oursql_IterWrapper) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_6oursql_IterWrapper = &__pyx_type_6oursql_IterWrapper; + __pyx_type_6oursql_FileWrapper.tp_base = __pyx_ptype_6oursql__AbstractIterWrapper; + if (PyType_Ready(&__pyx_type_6oursql_FileWrapper) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_6oursql_FileWrapper.tp_print = 0; + if (PyObject_SetAttrString(__pyx_m, "FileWrapper", (PyObject *)&__pyx_type_6oursql_FileWrapper) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_6oursql_FileWrapper = &__pyx_type_6oursql_FileWrapper; + __pyx_vtabptr_6oursql__Statement = &__pyx_vtable_6oursql__Statement; + __pyx_vtable_6oursql__Statement._raise_error = (int (*)(struct __pyx_obj_6oursql__Statement *))__pyx_f_6oursql_10_Statement__raise_error; + __pyx_vtable_6oursql__Statement._check_closed = (int (*)(struct __pyx_obj_6oursql__Statement *))__pyx_f_6oursql_10_Statement__check_closed; + __pyx_vtable_6oursql__Statement._alloc_buffer = (int (*)(struct __pyx_obj_6oursql__Statement *))__pyx_f_6oursql_10_Statement__alloc_buffer; + __pyx_vtable_6oursql__Statement._bind_buffer = (int (*)(struct __pyx_obj_6oursql__Statement *))__pyx_f_6oursql_10_Statement__bind_buffer; + if (PyType_Ready(&__pyx_type_6oursql__Statement) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_6oursql__Statement.tp_print = 0; + if (__Pyx_SetVtable(__pyx_type_6oursql__Statement.tp_dict, __pyx_vtabptr_6oursql__Statement) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttrString(__pyx_m, "_Statement", (PyObject *)&__pyx_type_6oursql__Statement) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_type_6oursql__Statement.tp_weaklistoffset == 0) __pyx_type_6oursql__Statement.tp_weaklistoffset = offsetof(struct __pyx_obj_6oursql__Statement, __weakref__); + __pyx_ptype_6oursql__Statement = &__pyx_type_6oursql__Statement; + if (PyType_Ready(&__pyx_type_6oursql__ResultStringStream) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_6oursql__ResultStringStream.tp_print = 0; + if (PyObject_SetAttrString(__pyx_m, "_ResultStringStream", (PyObject *)&__pyx_type_6oursql__ResultStringStream) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_6oursql__ResultStringStream = &__pyx_type_6oursql__ResultStringStream; + __pyx_vtabptr_6oursql__ResultSet = &__pyx_vtable_6oursql__ResultSet; + __pyx_vtable_6oursql__ResultSet._raise_error = (int (*)(struct __pyx_obj_6oursql__ResultSet *))__pyx_f_6oursql_10_ResultSet__raise_error; + __pyx_vtable_6oursql__ResultSet._check_closed = (int (*)(struct __pyx_obj_6oursql__ResultSet *))__pyx_f_6oursql_10_ResultSet__check_closed; + if (PyType_Ready(&__pyx_type_6oursql__ResultSet) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_6oursql__ResultSet.tp_print = 0; + if (__Pyx_SetVtable(__pyx_type_6oursql__ResultSet.tp_dict, __pyx_vtabptr_6oursql__ResultSet) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttrString(__pyx_m, "_ResultSet", (PyObject *)&__pyx_type_6oursql__ResultSet) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_6oursql__ResultSet = &__pyx_type_6oursql__ResultSet; + __pyx_vtabptr_6oursql__Query = &__pyx_vtable_6oursql__Query; + __pyx_vtable_6oursql__Query._raise_error = (int (*)(struct __pyx_obj_6oursql__Query *))__pyx_f_6oursql_6_Query__raise_error; + if (PyType_Ready(&__pyx_type_6oursql__Query) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_6oursql__Query.tp_print = 0; + if (__Pyx_SetVtable(__pyx_type_6oursql__Query.tp_dict, __pyx_vtabptr_6oursql__Query) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttrString(__pyx_m, "_Query", (PyObject *)&__pyx_type_6oursql__Query) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_6oursql__Query = &__pyx_type_6oursql__Query; + __pyx_vtabptr_6oursql__DictQuery = &__pyx_vtable_6oursql__DictQuery; + __pyx_vtable_6oursql__DictQuery.__pyx_base = *__pyx_vtabptr_6oursql__Query; + __pyx_type_6oursql__DictQuery.tp_base = __pyx_ptype_6oursql__Query; + if (PyType_Ready(&__pyx_type_6oursql__DictQuery) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_6oursql__DictQuery.tp_print = 0; + if (__Pyx_SetVtable(__pyx_type_6oursql__DictQuery.tp_dict, __pyx_vtabptr_6oursql__DictQuery) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttrString(__pyx_m, "_DictQuery", (PyObject *)&__pyx_type_6oursql__DictQuery) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_6oursql__DictQuery = &__pyx_type_6oursql__DictQuery; + __pyx_vtabptr_6oursql_Cursor = &__pyx_vtable_6oursql_Cursor; + __pyx_vtable_6oursql_Cursor._check_closed = (int (*)(struct __pyx_obj_6oursql_Cursor *))__pyx_f_6oursql_6Cursor__check_closed; + __pyx_vtable_6oursql_Cursor._update_fields = (int (*)(struct __pyx_obj_6oursql_Cursor *, PyObject *, struct __pyx_opt_args_6oursql_6Cursor__update_fields *__pyx_optional_args))__pyx_f_6oursql_6Cursor__update_fields; + __pyx_vtable_6oursql_Cursor._check_statements = (int (*)(struct __pyx_obj_6oursql_Cursor *))__pyx_f_6oursql_6Cursor__check_statements; + if (PyType_Ready(&__pyx_type_6oursql_Cursor) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_6oursql_Cursor.tp_print = 0; + if (__Pyx_SetVtable(__pyx_type_6oursql_Cursor.tp_dict, __pyx_vtabptr_6oursql_Cursor) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttrString(__pyx_m, "Cursor", (PyObject *)&__pyx_type_6oursql_Cursor) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_6oursql_Cursor = &__pyx_type_6oursql_Cursor; + __pyx_vtabptr_6oursql_DictCursor = &__pyx_vtable_6oursql_DictCursor; + __pyx_vtable_6oursql_DictCursor.__pyx_base = *__pyx_vtabptr_6oursql_Cursor; + __pyx_type_6oursql_DictCursor.tp_base = __pyx_ptype_6oursql_Cursor; + if (PyType_Ready(&__pyx_type_6oursql_DictCursor) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_6oursql_DictCursor.tp_print = 0; + if (__Pyx_SetVtable(__pyx_type_6oursql_DictCursor.tp_dict, __pyx_vtabptr_6oursql_DictCursor) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttrString(__pyx_m, "DictCursor", (PyObject *)&__pyx_type_6oursql_DictCursor) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_6oursql_DictCursor = &__pyx_type_6oursql_DictCursor; + if (PyType_Ready(&__pyx_type_6oursql__DBAPITypeObject) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_6oursql__DBAPITypeObject.tp_print = 0; + if (PyObject_SetAttrString(__pyx_m, "_DBAPITypeObject", (PyObject *)&__pyx_type_6oursql__DBAPITypeObject) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_6oursql__DBAPITypeObject = &__pyx_type_6oursql__DBAPITypeObject; + /*--- Type import code ---*/ + /*--- Variable import code ---*/ + /*--- Function import code ---*/ + /*--- Execution code ---*/ + + /* "oursql.pyx":7 + * """ + * + * __author__ = 'Aaron Gallagher ' # <<<<<<<<<<<<<< + * __version__ = '0.9.3' + * + */ + if (PyDict_SetItem(__pyx_d, __pyx_n_s_author, __pyx_kp_s_Aaron_Gallagher_habnabit_gmail_c) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "oursql.pyx":8 + * + * __author__ = 'Aaron Gallagher ' + * __version__ = '0.9.3' # <<<<<<<<<<<<<< + * + * include "oursql.pxi" + */ + if (PyDict_SetItem(__pyx_d, __pyx_n_s_version, __pyx_kp_s_0_9_3) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "oursql.pyx":13 + * include "nogil.pyx" + * + * cdef unsigned int UNSIGNED_NUM_FLAG = UNSIGNED_FLAG | NUM_FLAG # <<<<<<<<<<<<<< + * + * cdef union column_data: + */ + __pyx_v_6oursql_UNSIGNED_NUM_FLAG = (UNSIGNED_FLAG | NUM_FLAG); + + /* "oursql.pyx":50 + * column_data buf + * + * import exceptions # <<<<<<<<<<<<<< + * + * class Warning(exceptions.Warning): pass + */ + __pyx_t_1 = __Pyx_Import(__pyx_n_s_exceptions, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_exceptions, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "oursql.pyx":52 + * import exceptions + * + * class Warning(exceptions.Warning): pass # <<<<<<<<<<<<<< + * class Note(Warning): pass + * + */ + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_exceptions); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Warning); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_n_s_Warning, __pyx_n_s_Warning, (PyObject *) NULL, __pyx_n_s_oursql, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_Warning, __pyx_t_1, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_Warning, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "oursql.pyx":53 + * + * class Warning(exceptions.Warning): pass + * class Note(Warning): pass # <<<<<<<<<<<<<< + * + * class Error(exceptions.StandardError): + */ + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_Warning); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_2, __pyx_n_s_Note, __pyx_n_s_Note, (PyObject *) NULL, __pyx_n_s_oursql, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_Note, __pyx_t_2, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_Note, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "oursql.pyx":55 + * class Note(Warning): pass + * + * class Error(exceptions.StandardError): # <<<<<<<<<<<<<< + * def __init__(self, message, errno=None, extra=None): + * StandardError.__init__(self, errno, message, extra) + */ + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_exceptions); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_StandardError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_2, __pyx_n_s_Error, __pyx_n_s_Error, (PyObject *) NULL, __pyx_n_s_oursql, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + + /* "oursql.pyx":56 + * + * class Error(exceptions.StandardError): + * def __init__(self, message, errno=None, extra=None): # <<<<<<<<<<<<<< + * StandardError.__init__(self, errno, message, extra) + * self.errno = errno + */ + __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6oursql_5Error_1__init__, 0, __pyx_n_s_Error___init, NULL, __pyx_n_s_oursql, __pyx_d, ((PyObject *)__pyx_codeobj__31)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_tuple__32); + if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_init, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "oursql.pyx":55 + * class Note(Warning): pass + * + * class Error(exceptions.StandardError): # <<<<<<<<<<<<<< + * def __init__(self, message, errno=None, extra=None): + * StandardError.__init__(self, errno, message, extra) + */ + __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_Error, __pyx_t_2, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_Error, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "oursql.pyx":61 + * self.extra = extra + * + * class InterfaceError(Error): pass # <<<<<<<<<<<<<< + * class DatabaseError(Error): pass + * class DataError(DatabaseError): pass + */ + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_Error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_n_s_InterfaceError, __pyx_n_s_InterfaceError, (PyObject *) NULL, __pyx_n_s_oursql, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_InterfaceError, __pyx_t_1, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_InterfaceError, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "oursql.pyx":62 + * + * class InterfaceError(Error): pass + * class DatabaseError(Error): pass # <<<<<<<<<<<<<< + * class DataError(DatabaseError): pass + * class OperationalError(DatabaseError): pass + */ + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_Error); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_2, __pyx_n_s_DatabaseError, __pyx_n_s_DatabaseError, (PyObject *) NULL, __pyx_n_s_oursql, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_DatabaseError, __pyx_t_2, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_DatabaseError, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "oursql.pyx":63 + * class InterfaceError(Error): pass + * class DatabaseError(Error): pass + * class DataError(DatabaseError): pass # <<<<<<<<<<<<<< + * class OperationalError(DatabaseError): pass + * class IntegrityError(DatabaseError): pass + */ + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_DatabaseError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_n_s_DataError, __pyx_n_s_DataError, (PyObject *) NULL, __pyx_n_s_oursql, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_DataError, __pyx_t_1, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_DataError, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "oursql.pyx":64 + * class DatabaseError(Error): pass + * class DataError(DatabaseError): pass + * class OperationalError(DatabaseError): pass # <<<<<<<<<<<<<< + * class IntegrityError(DatabaseError): pass + * class InternalError(DatabaseError): pass + */ + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_DatabaseError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_2, __pyx_n_s_OperationalError, __pyx_n_s_OperationalError, (PyObject *) NULL, __pyx_n_s_oursql, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_OperationalError, __pyx_t_2, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_OperationalError, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "oursql.pyx":65 + * class DataError(DatabaseError): pass + * class OperationalError(DatabaseError): pass + * class IntegrityError(DatabaseError): pass # <<<<<<<<<<<<<< + * class InternalError(DatabaseError): pass + * class ProgrammingError(DatabaseError): pass + */ + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_DatabaseError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_n_s_IntegrityError, __pyx_n_s_IntegrityError, (PyObject *) NULL, __pyx_n_s_oursql, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_IntegrityError, __pyx_t_1, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_IntegrityError, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "oursql.pyx":66 + * class OperationalError(DatabaseError): pass + * class IntegrityError(DatabaseError): pass + * class InternalError(DatabaseError): pass # <<<<<<<<<<<<<< + * class ProgrammingError(DatabaseError): pass + * class CollatedWarningsError(ProgrammingError): pass + */ + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_DatabaseError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_2, __pyx_n_s_InternalError, __pyx_n_s_InternalError, (PyObject *) NULL, __pyx_n_s_oursql, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_InternalError, __pyx_t_2, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_InternalError, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "oursql.pyx":67 + * class IntegrityError(DatabaseError): pass + * class InternalError(DatabaseError): pass + * class ProgrammingError(DatabaseError): pass # <<<<<<<<<<<<<< + * class CollatedWarningsError(ProgrammingError): pass + * class NotSupportedError(DatabaseError): pass + */ + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_DatabaseError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_n_s_ProgrammingError, __pyx_n_s_ProgrammingError, (PyObject *) NULL, __pyx_n_s_oursql, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_ProgrammingError, __pyx_t_1, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_ProgrammingError, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "oursql.pyx":68 + * class InternalError(DatabaseError): pass + * class ProgrammingError(DatabaseError): pass + * class CollatedWarningsError(ProgrammingError): pass # <<<<<<<<<<<<<< + * class NotSupportedError(DatabaseError): pass + * class PermissionsError(DatabaseError): pass + */ + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_ProgrammingError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_2, __pyx_n_s_CollatedWarningsError, __pyx_n_s_CollatedWarningsError, (PyObject *) NULL, __pyx_n_s_oursql, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_CollatedWarningsError, __pyx_t_2, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_CollatedWarningsError, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "oursql.pyx":69 + * class ProgrammingError(DatabaseError): pass + * class CollatedWarningsError(ProgrammingError): pass + * class NotSupportedError(DatabaseError): pass # <<<<<<<<<<<<<< + * class PermissionsError(DatabaseError): pass + * + */ + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_DatabaseError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_n_s_NotSupportedError, __pyx_n_s_NotSupportedError, (PyObject *) NULL, __pyx_n_s_oursql, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_NotSupportedError, __pyx_t_1, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_NotSupportedError, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "oursql.pyx":70 + * class CollatedWarningsError(ProgrammingError): pass + * class NotSupportedError(DatabaseError): pass + * class PermissionsError(DatabaseError): pass # <<<<<<<<<<<<<< + * + * # This exception type is specifically for _exception_from_errno. I think this + */ + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_DatabaseError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_2, __pyx_n_s_PermissionsError, __pyx_n_s_PermissionsError, (PyObject *) NULL, __pyx_n_s_oursql, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_PermissionsError, __pyx_t_2, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_PermissionsError, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "oursql.pyx":75 + * # is a good compromise: if the errno you get isn't valid, return something to + * # indicate that while also being functional. + * class UnknownError(Error): pass # <<<<<<<<<<<<<< + * + * cdef class Connection + */ + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_Error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_n_s_UnknownError, __pyx_n_s_UnknownError, (PyObject *) NULL, __pyx_n_s_oursql, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_UnknownError, __pyx_t_1, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_UnknownError, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "oursqlx/util.pyx":60 + * return ret + * + * _exception_enum_map = { # <<<<<<<<<<<<<< + * _oursqlx_InterfaceError: InterfaceError, + * _oursqlx_DataError: DataError, + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + + /* "oursqlx/util.pyx":61 + * + * _exception_enum_map = { + * _oursqlx_InterfaceError: InterfaceError, # <<<<<<<<<<<<<< + * _oursqlx_DataError: DataError, + * _oursqlx_OperationalError: OperationalError, + */ + __pyx_t_2 = PyInt_FromLong(_oursqlx_InterfaceError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_InterfaceError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "oursqlx/util.pyx":62 + * _exception_enum_map = { + * _oursqlx_InterfaceError: InterfaceError, + * _oursqlx_DataError: DataError, # <<<<<<<<<<<<<< + * _oursqlx_OperationalError: OperationalError, + * _oursqlx_IntegrityError: IntegrityError, + */ + __pyx_t_3 = PyInt_FromLong(_oursqlx_DataError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_DataError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_t_3, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "oursqlx/util.pyx":63 + * _oursqlx_InterfaceError: InterfaceError, + * _oursqlx_DataError: DataError, + * _oursqlx_OperationalError: OperationalError, # <<<<<<<<<<<<<< + * _oursqlx_IntegrityError: IntegrityError, + * _oursqlx_InternalError: InternalError, + */ + __pyx_t_2 = PyInt_FromLong(_oursqlx_OperationalError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_OperationalError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "oursqlx/util.pyx":64 + * _oursqlx_DataError: DataError, + * _oursqlx_OperationalError: OperationalError, + * _oursqlx_IntegrityError: IntegrityError, # <<<<<<<<<<<<<< + * _oursqlx_InternalError: InternalError, + * _oursqlx_ProgrammingError: ProgrammingError, + */ + __pyx_t_3 = PyInt_FromLong(_oursqlx_IntegrityError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_IntegrityError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_t_3, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "oursqlx/util.pyx":65 + * _oursqlx_OperationalError: OperationalError, + * _oursqlx_IntegrityError: IntegrityError, + * _oursqlx_InternalError: InternalError, # <<<<<<<<<<<<<< + * _oursqlx_ProgrammingError: ProgrammingError, + * _oursqlx_NotSupportedError: NotSupportedError, + */ + __pyx_t_2 = PyInt_FromLong(_oursqlx_InternalError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_InternalError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "oursqlx/util.pyx":66 + * _oursqlx_IntegrityError: IntegrityError, + * _oursqlx_InternalError: InternalError, + * _oursqlx_ProgrammingError: ProgrammingError, # <<<<<<<<<<<<<< + * _oursqlx_NotSupportedError: NotSupportedError, + * _oursqlx_PermissionsError: PermissionsError, + */ + __pyx_t_3 = PyInt_FromLong(_oursqlx_ProgrammingError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_ProgrammingError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_t_3, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "oursqlx/util.pyx":67 + * _oursqlx_InternalError: InternalError, + * _oursqlx_ProgrammingError: ProgrammingError, + * _oursqlx_NotSupportedError: NotSupportedError, # <<<<<<<<<<<<<< + * _oursqlx_PermissionsError: PermissionsError, + * _oursqlx_UnknownError: UnknownError, + */ + __pyx_t_2 = PyInt_FromLong(_oursqlx_NotSupportedError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_NotSupportedError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "oursqlx/util.pyx":68 + * _oursqlx_ProgrammingError: ProgrammingError, + * _oursqlx_NotSupportedError: NotSupportedError, + * _oursqlx_PermissionsError: PermissionsError, # <<<<<<<<<<<<<< + * _oursqlx_UnknownError: UnknownError, + * } + */ + __pyx_t_3 = PyInt_FromLong(_oursqlx_PermissionsError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_PermissionsError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_t_3, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "oursqlx/util.pyx":69 + * _oursqlx_NotSupportedError: NotSupportedError, + * _oursqlx_PermissionsError: PermissionsError, + * _oursqlx_UnknownError: UnknownError, # <<<<<<<<<<<<<< + * } + * def _exception_from_errno(int err): + */ + __pyx_t_2 = PyInt_FromLong(_oursqlx_UnknownError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_UnknownError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_exception_enum_map, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "oursqlx/util.pyx":71 + * _oursqlx_UnknownError: UnknownError, + * } + * def _exception_from_errno(int err): # <<<<<<<<<<<<<< + * return _exception_enum_map[_oursqlx_exc_from_errno(err)] + * + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6oursql_1_exception_from_errno, NULL, __pyx_n_s_oursql); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_exception_from_errno, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "oursqlx/util.pyx":74 + * return _exception_enum_map[_oursqlx_exc_from_errno(err)] + * + * def _do_warnings_query(Connection conn not None): # <<<<<<<<<<<<<< + * cdef int should_raise = False + * q = _Query(conn, 'SHOW WARNINGS') + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6oursql_3_do_warnings_query, NULL, __pyx_n_s_oursql); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_do_warnings_query, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "oursqlx/conversions.pyx":1 + * import decimal, datetime, time # <<<<<<<<<<<<<< + * + * def _bitval_from_string(s): + */ + __pyx_t_1 = __Pyx_Import(__pyx_n_s_decimal, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_decimal, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_Import(__pyx_n_s_datetime, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_datetime, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_Import(__pyx_n_s_time, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_time, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "oursqlx/conversions.pyx":3 + * import decimal, datetime, time + * + * def _bitval_from_string(s): # <<<<<<<<<<<<<< + * cdef Py_ssize_t length + * cdef unsigned char *ss + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6oursql_5_bitval_from_string, NULL, __pyx_n_s_oursql); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_bitval_from_string, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "oursqlx/conversions.pyx":9 + * return bitval_from_char_p(ss, length) + * + * def _datetime_from_string(s): # <<<<<<<<<<<<<< + * tt = time.strptime(s, '%Y-%m-%d %H:%M:%S') + * return datetime.datetime(*tt[:6]) + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6oursql_7_datetime_from_string, NULL, __pyx_n_s_oursql); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_datetime_from_string, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "oursqlx/conversions.pyx":13 + * return datetime.datetime(*tt[:6]) + * + * def _date_from_string(s): # <<<<<<<<<<<<<< + * tt = time.strptime(s, '%Y-%m-%d') + * return datetime.date(*tt[:3]) + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6oursql_9_date_from_string, NULL, __pyx_n_s_oursql); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_date_from_string, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "oursqlx/conversions.pyx":17 + * return datetime.date(*tt[:3]) + * + * def _time_from_string(s): # <<<<<<<<<<<<<< + * tt = time.strptime(s, '%H:%M:%S') + * return datetime.time(*tt[3:6]) + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6oursql_11_time_from_string, NULL, __pyx_n_s_oursql); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_time_from_string, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "oursqlx/conversions.pyx":21 + * return datetime.time(*tt[3:6]) + * + * _conversions = { # <<<<<<<<<<<<<< + * MYSQL_TYPE_TINY: int, + * MYSQL_TYPE_SHORT: int, + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + + /* "oursqlx/conversions.pyx":22 + * + * _conversions = { + * MYSQL_TYPE_TINY: int, # <<<<<<<<<<<<<< + * MYSQL_TYPE_SHORT: int, + * MYSQL_TYPE_LONG: long, + */ + __pyx_t_3 = PyInt_FromLong(MYSQL_TYPE_TINY); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_1, __pyx_t_3, ((PyObject *)((PyObject*)(&PyInt_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "oursqlx/conversions.pyx":23 + * _conversions = { + * MYSQL_TYPE_TINY: int, + * MYSQL_TYPE_SHORT: int, # <<<<<<<<<<<<<< + * MYSQL_TYPE_LONG: long, + * MYSQL_TYPE_FLOAT: float, + */ + __pyx_t_3 = PyInt_FromLong(MYSQL_TYPE_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_1, __pyx_t_3, ((PyObject *)((PyObject*)(&PyInt_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "oursqlx/conversions.pyx":24 + * MYSQL_TYPE_TINY: int, + * MYSQL_TYPE_SHORT: int, + * MYSQL_TYPE_LONG: long, # <<<<<<<<<<<<<< + * MYSQL_TYPE_FLOAT: float, + * MYSQL_TYPE_DOUBLE: float, + */ + __pyx_t_3 = PyInt_FromLong(MYSQL_TYPE_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_1, __pyx_t_3, ((PyObject *)((PyObject*)(&PyLong_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "oursqlx/conversions.pyx":25 + * MYSQL_TYPE_SHORT: int, + * MYSQL_TYPE_LONG: long, + * MYSQL_TYPE_FLOAT: float, # <<<<<<<<<<<<<< + * MYSQL_TYPE_DOUBLE: float, + * MYSQL_TYPE_DECIMAL: float, + */ + __pyx_t_3 = PyInt_FromLong(MYSQL_TYPE_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_1, __pyx_t_3, ((PyObject *)((PyObject*)(&PyFloat_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "oursqlx/conversions.pyx":26 + * MYSQL_TYPE_LONG: long, + * MYSQL_TYPE_FLOAT: float, + * MYSQL_TYPE_DOUBLE: float, # <<<<<<<<<<<<<< + * MYSQL_TYPE_DECIMAL: float, + * MYSQL_TYPE_NEWDECIMAL: float, + */ + __pyx_t_3 = PyInt_FromLong(MYSQL_TYPE_DOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_1, __pyx_t_3, ((PyObject *)((PyObject*)(&PyFloat_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "oursqlx/conversions.pyx":27 + * MYSQL_TYPE_FLOAT: float, + * MYSQL_TYPE_DOUBLE: float, + * MYSQL_TYPE_DECIMAL: float, # <<<<<<<<<<<<<< + * MYSQL_TYPE_NEWDECIMAL: float, + * MYSQL_TYPE_LONGLONG: long, + */ + __pyx_t_3 = PyInt_FromLong(MYSQL_TYPE_DECIMAL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_1, __pyx_t_3, ((PyObject *)((PyObject*)(&PyFloat_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "oursqlx/conversions.pyx":28 + * MYSQL_TYPE_DOUBLE: float, + * MYSQL_TYPE_DECIMAL: float, + * MYSQL_TYPE_NEWDECIMAL: float, # <<<<<<<<<<<<<< + * MYSQL_TYPE_LONGLONG: long, + * MYSQL_TYPE_INT24: int, + */ + __pyx_t_3 = PyInt_FromLong(MYSQL_TYPE_NEWDECIMAL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_1, __pyx_t_3, ((PyObject *)((PyObject*)(&PyFloat_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "oursqlx/conversions.pyx":29 + * MYSQL_TYPE_DECIMAL: float, + * MYSQL_TYPE_NEWDECIMAL: float, + * MYSQL_TYPE_LONGLONG: long, # <<<<<<<<<<<<<< + * MYSQL_TYPE_INT24: int, + * MYSQL_TYPE_YEAR: int, + */ + __pyx_t_3 = PyInt_FromLong(MYSQL_TYPE_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_1, __pyx_t_3, ((PyObject *)((PyObject*)(&PyLong_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "oursqlx/conversions.pyx":30 + * MYSQL_TYPE_NEWDECIMAL: float, + * MYSQL_TYPE_LONGLONG: long, + * MYSQL_TYPE_INT24: int, # <<<<<<<<<<<<<< + * MYSQL_TYPE_YEAR: int, + * MYSQL_TYPE_DECIMAL: decimal.Decimal, + */ + __pyx_t_3 = PyInt_FromLong(MYSQL_TYPE_INT24); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_1, __pyx_t_3, ((PyObject *)((PyObject*)(&PyInt_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "oursqlx/conversions.pyx":31 + * MYSQL_TYPE_LONGLONG: long, + * MYSQL_TYPE_INT24: int, + * MYSQL_TYPE_YEAR: int, # <<<<<<<<<<<<<< + * MYSQL_TYPE_DECIMAL: decimal.Decimal, + * MYSQL_TYPE_NEWDECIMAL: decimal.Decimal, + */ + __pyx_t_3 = PyInt_FromLong(MYSQL_TYPE_YEAR); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_1, __pyx_t_3, ((PyObject *)((PyObject*)(&PyInt_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "oursqlx/conversions.pyx":32 + * MYSQL_TYPE_INT24: int, + * MYSQL_TYPE_YEAR: int, + * MYSQL_TYPE_DECIMAL: decimal.Decimal, # <<<<<<<<<<<<<< + * MYSQL_TYPE_NEWDECIMAL: decimal.Decimal, + * MYSQL_TYPE_BIT: _bitval_from_string, + */ + __pyx_t_3 = PyInt_FromLong(MYSQL_TYPE_DECIMAL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_decimal); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_Decimal); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_t_1, __pyx_t_3, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "oursqlx/conversions.pyx":33 + * MYSQL_TYPE_YEAR: int, + * MYSQL_TYPE_DECIMAL: decimal.Decimal, + * MYSQL_TYPE_NEWDECIMAL: decimal.Decimal, # <<<<<<<<<<<<<< + * MYSQL_TYPE_BIT: _bitval_from_string, + * MYSQL_TYPE_TIMESTAMP: _datetime_from_string, + */ + __pyx_t_4 = PyInt_FromLong(MYSQL_TYPE_NEWDECIMAL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_decimal); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_Decimal); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_t_1, __pyx_t_4, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "oursqlx/conversions.pyx":34 + * MYSQL_TYPE_DECIMAL: decimal.Decimal, + * MYSQL_TYPE_NEWDECIMAL: decimal.Decimal, + * MYSQL_TYPE_BIT: _bitval_from_string, # <<<<<<<<<<<<<< + * MYSQL_TYPE_TIMESTAMP: _datetime_from_string, + * MYSQL_TYPE_DATETIME: _datetime_from_string, + */ + __pyx_t_2 = PyInt_FromLong(MYSQL_TYPE_BIT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_bitval_from_string); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "oursqlx/conversions.pyx":35 + * MYSQL_TYPE_NEWDECIMAL: decimal.Decimal, + * MYSQL_TYPE_BIT: _bitval_from_string, + * MYSQL_TYPE_TIMESTAMP: _datetime_from_string, # <<<<<<<<<<<<<< + * MYSQL_TYPE_DATETIME: _datetime_from_string, + * MYSQL_TYPE_DATE: _date_from_string, + */ + __pyx_t_4 = PyInt_FromLong(MYSQL_TYPE_TIMESTAMP); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_datetime_from_string); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_t_4, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "oursqlx/conversions.pyx":36 + * MYSQL_TYPE_BIT: _bitval_from_string, + * MYSQL_TYPE_TIMESTAMP: _datetime_from_string, + * MYSQL_TYPE_DATETIME: _datetime_from_string, # <<<<<<<<<<<<<< + * MYSQL_TYPE_DATE: _date_from_string, + * MYSQL_TYPE_TIME: _time_from_string, + */ + __pyx_t_2 = PyInt_FromLong(MYSQL_TYPE_DATETIME); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_datetime_from_string); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "oursqlx/conversions.pyx":37 + * MYSQL_TYPE_TIMESTAMP: _datetime_from_string, + * MYSQL_TYPE_DATETIME: _datetime_from_string, + * MYSQL_TYPE_DATE: _date_from_string, # <<<<<<<<<<<<<< + * MYSQL_TYPE_TIME: _time_from_string, + * + */ + __pyx_t_4 = PyInt_FromLong(MYSQL_TYPE_DATE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_date_from_string); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_t_4, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "oursqlx/conversions.pyx":38 + * MYSQL_TYPE_DATETIME: _datetime_from_string, + * MYSQL_TYPE_DATE: _date_from_string, + * MYSQL_TYPE_TIME: _time_from_string, # <<<<<<<<<<<<<< + * + * # None means to try to decode if we're using unicode and the field isn't + */ + __pyx_t_2 = PyInt_FromLong(MYSQL_TYPE_TIME); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_time_from_string); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "oursqlx/conversions.pyx":42 + * # None means to try to decode if we're using unicode and the field isn't + * # in 'binary' encoding. + * MYSQL_TYPE_BLOB: None, # <<<<<<<<<<<<<< + * MYSQL_TYPE_STRING: None, + * MYSQL_TYPE_VAR_STRING: None, + */ + __pyx_t_4 = PyInt_FromLong(MYSQL_TYPE_BLOB); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_1, __pyx_t_4, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "oursqlx/conversions.pyx":43 + * # in 'binary' encoding. + * MYSQL_TYPE_BLOB: None, + * MYSQL_TYPE_STRING: None, # <<<<<<<<<<<<<< + * MYSQL_TYPE_VAR_STRING: None, + * MYSQL_TYPE_VARCHAR: None, + */ + __pyx_t_4 = PyInt_FromLong(MYSQL_TYPE_STRING); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_1, __pyx_t_4, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "oursqlx/conversions.pyx":44 + * MYSQL_TYPE_BLOB: None, + * MYSQL_TYPE_STRING: None, + * MYSQL_TYPE_VAR_STRING: None, # <<<<<<<<<<<<<< + * MYSQL_TYPE_VARCHAR: None, + * # For consistency with the statement API. + */ + __pyx_t_4 = PyInt_FromLong(MYSQL_TYPE_VAR_STRING); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_1, __pyx_t_4, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "oursqlx/conversions.pyx":45 + * MYSQL_TYPE_STRING: None, + * MYSQL_TYPE_VAR_STRING: None, + * MYSQL_TYPE_VARCHAR: None, # <<<<<<<<<<<<<< + * # For consistency with the statement API. + * MYSQL_TYPE_SET: None, + */ + __pyx_t_4 = PyInt_FromLong(MYSQL_TYPE_VARCHAR); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_1, __pyx_t_4, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "oursqlx/conversions.pyx":47 + * MYSQL_TYPE_VARCHAR: None, + * # For consistency with the statement API. + * MYSQL_TYPE_SET: None, # <<<<<<<<<<<<<< + * } + * + */ + __pyx_t_4 = PyInt_FromLong(MYSQL_TYPE_SET); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_1, __pyx_t_4, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_conversions, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "oursqlx/conversions.pyx":50 + * } + * + * Timestamp = datetime.datetime # <<<<<<<<<<<<<< + * Date = datetime.date + * Time = datetime.time + */ + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_datetime); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_datetime); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_Timestamp, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "oursqlx/conversions.pyx":51 + * + * Timestamp = datetime.datetime + * Date = datetime.date # <<<<<<<<<<<<<< + * Time = datetime.time + * Binary = buffer + */ + __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_datetime); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_date); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_Date, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "oursqlx/conversions.pyx":52 + * Timestamp = datetime.datetime + * Date = datetime.date + * Time = datetime.time # <<<<<<<<<<<<<< + * Binary = buffer + * + */ + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_datetime); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_time); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_Time, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "oursqlx/conversions.pyx":53 + * Date = datetime.date + * Time = datetime.time + * Binary = buffer # <<<<<<<<<<<<<< + * + * def TimestampFromTicks(ticks): + */ + if (PyDict_SetItem(__pyx_d, __pyx_n_s_Binary, __pyx_builtin_buffer) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "oursqlx/conversions.pyx":55 + * Binary = buffer + * + * def TimestampFromTicks(ticks): # <<<<<<<<<<<<<< + * """TimestampFromTicks(ticks) -> Timestamp. + * + */ + __pyx_t_4 = PyCFunction_NewEx(&__pyx_mdef_6oursql_13TimestampFromTicks, NULL, __pyx_n_s_oursql); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_TimestampFromTicks, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "oursqlx/conversions.pyx":62 + * return Timestamp(*time.localtime(ticks)[:6]) + * + * def DateFromTicks(ticks): # <<<<<<<<<<<<<< + * """DateFromTicks(ticks) -> Date. + * + */ + __pyx_t_4 = PyCFunction_NewEx(&__pyx_mdef_6oursql_15DateFromTicks, NULL, __pyx_n_s_oursql); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_DateFromTicks, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "oursqlx/conversions.pyx":69 + * return Date(*time.localtime(ticks)[:3]) + * + * def TimeFromTicks(ticks): # <<<<<<<<<<<<<< + * """TimeFromTicks(ticks) -> Time. + * + */ + __pyx_t_4 = PyCFunction_NewEx(&__pyx_mdef_6oursql_17TimeFromTicks, NULL, __pyx_n_s_oursql); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_TimeFromTicks, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "oursqlx/connection.pyx":1 + * _protocol_enum_map = { # <<<<<<<<<<<<<< + * None: MYSQL_PROTOCOL_DEFAULT, + * 'tcp': MYSQL_PROTOCOL_TCP, + */ + __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + + /* "oursqlx/connection.pyx":2 + * _protocol_enum_map = { + * None: MYSQL_PROTOCOL_DEFAULT, # <<<<<<<<<<<<<< + * 'tcp': MYSQL_PROTOCOL_TCP, + * 'socket': MYSQL_PROTOCOL_SOCKET, + */ + __pyx_t_1 = PyInt_FromLong(MYSQL_PROTOCOL_DEFAULT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_4, Py_None, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "oursqlx/connection.pyx":3 + * _protocol_enum_map = { + * None: MYSQL_PROTOCOL_DEFAULT, + * 'tcp': MYSQL_PROTOCOL_TCP, # <<<<<<<<<<<<<< + * 'socket': MYSQL_PROTOCOL_SOCKET, + * 'pipe': MYSQL_PROTOCOL_PIPE, + */ + __pyx_t_1 = PyInt_FromLong(MYSQL_PROTOCOL_TCP); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_tcp, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "oursqlx/connection.pyx":4 + * None: MYSQL_PROTOCOL_DEFAULT, + * 'tcp': MYSQL_PROTOCOL_TCP, + * 'socket': MYSQL_PROTOCOL_SOCKET, # <<<<<<<<<<<<<< + * 'pipe': MYSQL_PROTOCOL_PIPE, + * 'memory': MYSQL_PROTOCOL_MEMORY, + */ + __pyx_t_1 = PyInt_FromLong(MYSQL_PROTOCOL_SOCKET); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_socket, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "oursqlx/connection.pyx":5 + * 'tcp': MYSQL_PROTOCOL_TCP, + * 'socket': MYSQL_PROTOCOL_SOCKET, + * 'pipe': MYSQL_PROTOCOL_PIPE, # <<<<<<<<<<<<<< + * 'memory': MYSQL_PROTOCOL_MEMORY, + * } + */ + __pyx_t_1 = PyInt_FromLong(MYSQL_PROTOCOL_PIPE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_pipe, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "oursqlx/connection.pyx":6 + * 'socket': MYSQL_PROTOCOL_SOCKET, + * 'pipe': MYSQL_PROTOCOL_PIPE, + * 'memory': MYSQL_PROTOCOL_MEMORY, # <<<<<<<<<<<<<< + * } + * + */ + __pyx_t_1 = PyInt_FromLong(MYSQL_PROTOCOL_MEMORY); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_memory, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_protocol_enum_map, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "oursqlx/statement.pyx":1 + * import cStringIO # <<<<<<<<<<<<<< + * import datetime + * import decimal + */ + __pyx_t_4 = __Pyx_Import(__pyx_n_s_cStringIO, 0, -1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_cStringIO, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "oursqlx/statement.pyx":2 + * import cStringIO + * import datetime # <<<<<<<<<<<<<< + * import decimal + * import codecs + */ + __pyx_t_4 = __Pyx_Import(__pyx_n_s_datetime, 0, -1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_datetime, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "oursqlx/statement.pyx":3 + * import cStringIO + * import datetime + * import decimal # <<<<<<<<<<<<<< + * import codecs + * + */ + __pyx_t_4 = __Pyx_Import(__pyx_n_s_decimal, 0, -1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_decimal, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "oursqlx/statement.pyx":4 + * import datetime + * import decimal + * import codecs # <<<<<<<<<<<<<< + * + * cdef my_ulonglong ull_negone = -1 + */ + __pyx_t_4 = __Pyx_Import(__pyx_n_s_codecs, 0, -1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_codecs, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "oursqlx/statement.pyx":6 + * import codecs + * + * cdef my_ulonglong ull_negone = -1 # <<<<<<<<<<<<<< + * + * cdef class _AbstractIterWrapper: + */ + __pyx_v_6oursql_ull_negone = ((my_ulonglong)-1); + + /* "oursqlx/statement.pyx":36 + * + * BinaryIterWrapper = type('BinaryIterWrapper', + * (_BinaryWhateverMixin, IterWrapper), {'__module__': __name__, '__doc__': # <<<<<<<<<<<<<< + * """BinaryIterWrapper(iterobj) + * + */ + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_6oursql__BinaryWhateverMixin))); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)((PyObject*)__pyx_ptype_6oursql__BinaryWhateverMixin))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_6oursql__BinaryWhateverMixin))); + __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_6oursql_IterWrapper))); + PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)((PyObject*)__pyx_ptype_6oursql_IterWrapper))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_6oursql_IterWrapper))); + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_module, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_doc, __pyx_kp_s_BinaryIterWrapper_iterobj_Binary) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "oursqlx/statement.pyx":35 + * return self.nextfunc() + * + * BinaryIterWrapper = type('BinaryIterWrapper', # <<<<<<<<<<<<<< + * (_BinaryWhateverMixin, IterWrapper), {'__module__': __name__, '__doc__': + * """BinaryIterWrapper(iterobj) + */ + __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_n_s_BinaryIterWrapper); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_BinaryIterWrapper); + __Pyx_GIVEREF(__pyx_n_s_BinaryIterWrapper); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_4 = 0; + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyType_Type))), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_BinaryIterWrapper, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "oursqlx/statement.pyx":78 + * + * BinaryFileWrapper = type('BinaryFileWrapper', + * (_BinaryWhateverMixin, FileWrapper), {'__module__': __name__, '__doc__': # <<<<<<<<<<<<<< + * """BinaryFileWrapper(fileobj, chunksize=8192, doclose=False) + * + */ + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_6oursql__BinaryWhateverMixin))); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_6oursql__BinaryWhateverMixin))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_6oursql__BinaryWhateverMixin))); + __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_6oursql_FileWrapper))); + PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)((PyObject*)__pyx_ptype_6oursql_FileWrapper))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_6oursql_FileWrapper))); + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_name); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_module, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_doc, __pyx_kp_s_BinaryFileWrapper_fileobj_chunks) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "oursqlx/statement.pyx":77 + * return ret + * + * BinaryFileWrapper = type('BinaryFileWrapper', # <<<<<<<<<<<<<< + * (_BinaryWhateverMixin, FileWrapper), {'__module__': __name__, '__doc__': + * """BinaryFileWrapper(fileobj, chunksize=8192, doclose=False) + */ + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_n_s_BinaryFileWrapper); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_n_s_BinaryFileWrapper); + __Pyx_GIVEREF(__pyx_n_s_BinaryFileWrapper); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyType_Type))), __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_BinaryFileWrapper, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "oursqlx/statement.pyx":605 + * self._raise_error() + * + * _DictStatement = type('_DictStatement', (_DictWhateverMixin, _Statement), # <<<<<<<<<<<<<< + * {'__module__': __name__}) + * + */ + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_6oursql__DictWhateverMixin))); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)((PyObject*)__pyx_ptype_6oursql__DictWhateverMixin))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_6oursql__DictWhateverMixin))); + __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_6oursql__Statement))); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)__pyx_ptype_6oursql__Statement))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_6oursql__Statement))); + + /* "oursqlx/statement.pyx":606 + * + * _DictStatement = type('_DictStatement', (_DictWhateverMixin, _Statement), + * {'__module__': __name__}) # <<<<<<<<<<<<<< + * + * cdef class _ResultStringStream: + */ + __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_module, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "oursqlx/statement.pyx":605 + * self._raise_error() + * + * _DictStatement = type('_DictStatement', (_DictWhateverMixin, _Statement), # <<<<<<<<<<<<<< + * {'__module__': __name__}) + * + */ + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_n_s_DictStatement); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_DictStatement); + __Pyx_GIVEREF(__pyx_n_s_DictStatement); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_2 = 0; + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyType_Type))), __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_DictStatement, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "oursqlx/query.pyx":19 + * cdef int show_table + * + * conversions_dict = _conversions # <<<<<<<<<<<<<< + * + * def __cinit__(self, Connection conn not None, bint show_table=False, + */ + __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_conversions); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem((PyObject *)__pyx_ptype_6oursql__ResultSet->tp_dict, __pyx_n_s_conversions_dict, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + PyType_Modified(__pyx_ptype_6oursql__ResultSet); + + /* "oursqlx/query.pyx":144 + * self.has_result = self.result.has_result + * + * _result_class = _ResultSet # <<<<<<<<<<<<<< + * def new_result(self): + * res = self._result_class(self.conn, *self.res_a, **self.res_kw) + */ + if (PyDict_SetItem((PyObject *)__pyx_ptype_6oursql__Query->tp_dict, __pyx_n_s_result_class, ((PyObject *)((PyObject*)__pyx_ptype_6oursql__ResultSet))) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyType_Modified(__pyx_ptype_6oursql__Query); + + /* "oursqlx/query.pyx":191 + * + * # Cython should support multiple inheritance one of these days. + * _DictResultSet = type('_DictResultSet', (_DictWhateverMixin, _ResultSet), # <<<<<<<<<<<<<< + * {'__module__': __name__}) + * + */ + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_6oursql__DictWhateverMixin))); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)((PyObject*)__pyx_ptype_6oursql__DictWhateverMixin))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_6oursql__DictWhateverMixin))); + __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_6oursql__ResultSet))); + PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)((PyObject*)__pyx_ptype_6oursql__ResultSet))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_6oursql__ResultSet))); + + /* "oursqlx/query.pyx":192 + * # Cython should support multiple inheritance one of these days. + * _DictResultSet = type('_DictResultSet', (_DictWhateverMixin, _ResultSet), + * {'__module__': __name__}) # <<<<<<<<<<<<<< + * + * cdef class _DictQuery(_Query): + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_module, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "oursqlx/query.pyx":191 + * + * # Cython should support multiple inheritance one of these days. + * _DictResultSet = type('_DictResultSet', (_DictWhateverMixin, _ResultSet), # <<<<<<<<<<<<<< + * {'__module__': __name__}) + * + */ + __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_n_s_DictResultSet); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_DictResultSet); + __Pyx_GIVEREF(__pyx_n_s_DictResultSet); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_4 = 0; + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyType_Type))), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_DictResultSet, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "oursqlx/query.pyx":195 + * + * cdef class _DictQuery(_Query): + * _result_class = _DictResultSet # <<<<<<<<<<<<<< + */ + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_DictResultSet); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem((PyObject *)__pyx_ptype_6oursql__DictQuery->tp_dict, __pyx_n_s_result_class, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + PyType_Modified(__pyx_ptype_6oursql__DictQuery); + + /* "oursqlx/cursor.pyx":1 + * import collections, itertools # <<<<<<<<<<<<<< + * + * cdef class Cursor: + */ + __pyx_t_1 = __Pyx_Import(__pyx_n_s_collections, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_collections, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_Import(__pyx_n_s_itertools, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_itertools, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "oursqlx/cursor.pyx":35 + * cdef public unsigned long arraysize + * + * _statement_class = _Statement # <<<<<<<<<<<<<< + * _query_class = _Query + * + */ + if (PyDict_SetItem((PyObject *)__pyx_ptype_6oursql_Cursor->tp_dict, __pyx_n_s_statement_class, ((PyObject *)((PyObject*)__pyx_ptype_6oursql__Statement))) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyType_Modified(__pyx_ptype_6oursql_Cursor); + + /* "oursqlx/cursor.pyx":36 + * + * _statement_class = _Statement + * _query_class = _Query # <<<<<<<<<<<<<< + * + * def __cinit__(self, Connection conn not None, bint try_plain_query=True, + */ + if (PyDict_SetItem((PyObject *)__pyx_ptype_6oursql_Cursor->tp_dict, __pyx_n_s_query_class, ((PyObject *)((PyObject*)__pyx_ptype_6oursql__Query))) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyType_Modified(__pyx_ptype_6oursql_Cursor); + + /* "oursqlx/cursor.pyx":279 + * """ + * + * _statement_class = _DictStatement # <<<<<<<<<<<<<< + * _query_class = _DictQuery + */ + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_DictStatement); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem((PyObject *)__pyx_ptype_6oursql_DictCursor->tp_dict, __pyx_n_s_statement_class, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + PyType_Modified(__pyx_ptype_6oursql_DictCursor); + + /* "oursqlx/cursor.pyx":280 + * + * _statement_class = _DictStatement + * _query_class = _DictQuery # <<<<<<<<<<<<<< + */ + if (PyDict_SetItem((PyObject *)__pyx_ptype_6oursql_DictCursor->tp_dict, __pyx_n_s_query_class, ((PyObject *)((PyObject*)__pyx_ptype_6oursql__DictQuery))) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyType_Modified(__pyx_ptype_6oursql_DictCursor); + + /* "oursql.pyx":88 + * # The global import lock is held while modules are being imported for the first + * # time, so it's threadsafe to call this. + * if mysql_library_init(0, NULL, NULL): # <<<<<<<<<<<<<< + * raise InterfaceError('could not initialize mysql') + * + */ + __pyx_t_5 = (mysql_library_init(0, NULL, NULL) != 0); + if (__pyx_t_5) { + + /* "oursql.pyx":89 + * # time, so it's threadsafe to call this. + * if mysql_library_init(0, NULL, NULL): + * raise InterfaceError('could not initialize mysql') # <<<<<<<<<<<<<< + * + * paramstyle = 'qmark' + */ + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_InterfaceError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__51, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + + /* "oursql.pyx":91 + * raise InterfaceError('could not initialize mysql') + * + * paramstyle = 'qmark' # <<<<<<<<<<<<<< + * threadsafety = 1 + * apilevel = '2.0' + */ + if (PyDict_SetItem(__pyx_d, __pyx_n_s_paramstyle, __pyx_n_s_qmark) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "oursql.pyx":92 + * + * paramstyle = 'qmark' + * threadsafety = 1 # <<<<<<<<<<<<<< + * apilevel = '2.0' + * connect = Connection + */ + if (PyDict_SetItem(__pyx_d, __pyx_n_s_threadsafety, __pyx_int_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "oursql.pyx":93 + * paramstyle = 'qmark' + * threadsafety = 1 + * apilevel = '2.0' # <<<<<<<<<<<<<< + * connect = Connection + * + */ + if (PyDict_SetItem(__pyx_d, __pyx_n_s_apilevel, __pyx_kp_s_2_0) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "oursql.pyx":94 + * threadsafety = 1 + * apilevel = '2.0' + * connect = Connection # <<<<<<<<<<<<<< + * + * cdef class _DBAPITypeObject: + */ + if (PyDict_SetItem(__pyx_d, __pyx_n_s_connect, ((PyObject *)((PyObject*)__pyx_ptype_6oursql_Connection))) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "oursql.pyx":116 + * + * STRING = _DBAPITypeObject( + * MYSQL_TYPE_ENUM, MYSQL_TYPE_STRING, MYSQL_TYPE_VAR_STRING) # <<<<<<<<<<<<<< + * BINARY = _DBAPITypeObject( + * MYSQL_TYPE_BLOB, MYSQL_TYPE_LONG_BLOB, + */ + __pyx_t_2 = PyInt_FromLong(MYSQL_TYPE_ENUM); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyInt_FromLong(MYSQL_TYPE_STRING); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyInt_FromLong(MYSQL_TYPE_VAR_STRING); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + + /* "oursql.pyx":115 + * self.values, id(self)) + * + * STRING = _DBAPITypeObject( # <<<<<<<<<<<<<< + * MYSQL_TYPE_ENUM, MYSQL_TYPE_STRING, MYSQL_TYPE_VAR_STRING) + * BINARY = _DBAPITypeObject( + */ + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_2 = 0; + __pyx_t_1 = 0; + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6oursql__DBAPITypeObject)), __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_STRING, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "oursql.pyx":118 + * MYSQL_TYPE_ENUM, MYSQL_TYPE_STRING, MYSQL_TYPE_VAR_STRING) + * BINARY = _DBAPITypeObject( + * MYSQL_TYPE_BLOB, MYSQL_TYPE_LONG_BLOB, # <<<<<<<<<<<<<< + * MYSQL_TYPE_MEDIUM_BLOB, MYSQL_TYPE_TINY_BLOB) + * NUMBER = _DBAPITypeObject( + */ + __pyx_t_4 = PyInt_FromLong(MYSQL_TYPE_BLOB); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyInt_FromLong(MYSQL_TYPE_LONG_BLOB); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + + /* "oursql.pyx":119 + * BINARY = _DBAPITypeObject( + * MYSQL_TYPE_BLOB, MYSQL_TYPE_LONG_BLOB, + * MYSQL_TYPE_MEDIUM_BLOB, MYSQL_TYPE_TINY_BLOB) # <<<<<<<<<<<<<< + * NUMBER = _DBAPITypeObject( + * MYSQL_TYPE_DECIMAL, MYSQL_TYPE_DOUBLE, MYSQL_TYPE_FLOAT, MYSQL_TYPE_INT24, + */ + __pyx_t_1 = PyInt_FromLong(MYSQL_TYPE_MEDIUM_BLOB); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyInt_FromLong(MYSQL_TYPE_TINY_BLOB); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + + /* "oursql.pyx":117 + * STRING = _DBAPITypeObject( + * MYSQL_TYPE_ENUM, MYSQL_TYPE_STRING, MYSQL_TYPE_VAR_STRING) + * BINARY = _DBAPITypeObject( # <<<<<<<<<<<<<< + * MYSQL_TYPE_BLOB, MYSQL_TYPE_LONG_BLOB, + * MYSQL_TYPE_MEDIUM_BLOB, MYSQL_TYPE_TINY_BLOB) + */ + __pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_4 = 0; + __pyx_t_3 = 0; + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6oursql__DBAPITypeObject)), __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_BINARY, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "oursql.pyx":121 + * MYSQL_TYPE_MEDIUM_BLOB, MYSQL_TYPE_TINY_BLOB) + * NUMBER = _DBAPITypeObject( + * MYSQL_TYPE_DECIMAL, MYSQL_TYPE_DOUBLE, MYSQL_TYPE_FLOAT, MYSQL_TYPE_INT24, # <<<<<<<<<<<<<< + * MYSQL_TYPE_LONG, MYSQL_TYPE_LONGLONG, MYSQL_TYPE_TINY, MYSQL_TYPE_YEAR) + * DATE = _DBAPITypeObject( + */ + __pyx_t_2 = PyInt_FromLong(MYSQL_TYPE_DECIMAL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = PyInt_FromLong(MYSQL_TYPE_DOUBLE); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_1 = PyInt_FromLong(MYSQL_TYPE_FLOAT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyInt_FromLong(MYSQL_TYPE_INT24); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + + /* "oursql.pyx":122 + * NUMBER = _DBAPITypeObject( + * MYSQL_TYPE_DECIMAL, MYSQL_TYPE_DOUBLE, MYSQL_TYPE_FLOAT, MYSQL_TYPE_INT24, + * MYSQL_TYPE_LONG, MYSQL_TYPE_LONGLONG, MYSQL_TYPE_TINY, MYSQL_TYPE_YEAR) # <<<<<<<<<<<<<< + * DATE = _DBAPITypeObject( + * MYSQL_TYPE_DATE, MYSQL_TYPE_NEWDATE) + */ + __pyx_t_4 = PyInt_FromLong(MYSQL_TYPE_LONG); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = PyInt_FromLong(MYSQL_TYPE_LONGLONG); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = PyInt_FromLong(MYSQL_TYPE_TINY); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = PyInt_FromLong(MYSQL_TYPE_YEAR); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + + /* "oursql.pyx":120 + * MYSQL_TYPE_BLOB, MYSQL_TYPE_LONG_BLOB, + * MYSQL_TYPE_MEDIUM_BLOB, MYSQL_TYPE_TINY_BLOB) + * NUMBER = _DBAPITypeObject( # <<<<<<<<<<<<<< + * MYSQL_TYPE_DECIMAL, MYSQL_TYPE_DOUBLE, MYSQL_TYPE_FLOAT, MYSQL_TYPE_INT24, + * MYSQL_TYPE_LONG, MYSQL_TYPE_LONGLONG, MYSQL_TYPE_TINY, MYSQL_TYPE_YEAR) + */ + __pyx_t_10 = PyTuple_New(8); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_10, 3, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_10, 4, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_10, 5, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_10, 6, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_10, 7, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + __pyx_t_2 = 0; + __pyx_t_6 = 0; + __pyx_t_1 = 0; + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_7 = 0; + __pyx_t_8 = 0; + __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6oursql__DBAPITypeObject)), __pyx_t_10, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_NUMBER, __pyx_t_9) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "oursql.pyx":124 + * MYSQL_TYPE_LONG, MYSQL_TYPE_LONGLONG, MYSQL_TYPE_TINY, MYSQL_TYPE_YEAR) + * DATE = _DBAPITypeObject( + * MYSQL_TYPE_DATE, MYSQL_TYPE_NEWDATE) # <<<<<<<<<<<<<< + * TIME = _DBAPITypeObject( + * MYSQL_TYPE_TIME) + */ + __pyx_t_9 = PyInt_FromLong(MYSQL_TYPE_DATE); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = PyInt_FromLong(MYSQL_TYPE_NEWDATE); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + + /* "oursql.pyx":123 + * MYSQL_TYPE_DECIMAL, MYSQL_TYPE_DOUBLE, MYSQL_TYPE_FLOAT, MYSQL_TYPE_INT24, + * MYSQL_TYPE_LONG, MYSQL_TYPE_LONGLONG, MYSQL_TYPE_TINY, MYSQL_TYPE_YEAR) + * DATE = _DBAPITypeObject( # <<<<<<<<<<<<<< + * MYSQL_TYPE_DATE, MYSQL_TYPE_NEWDATE) + * TIME = _DBAPITypeObject( + */ + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_10); + __Pyx_GIVEREF(__pyx_t_10); + __pyx_t_9 = 0; + __pyx_t_10 = 0; + __pyx_t_10 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6oursql__DBAPITypeObject)), __pyx_t_8, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_DATE, __pyx_t_10) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + + /* "oursql.pyx":126 + * MYSQL_TYPE_DATE, MYSQL_TYPE_NEWDATE) + * TIME = _DBAPITypeObject( + * MYSQL_TYPE_TIME) # <<<<<<<<<<<<<< + * DATETIME = TIMESTAMP = _DBAPITypeObject( + * MYSQL_TYPE_TIMESTAMP, MYSQL_TYPE_DATETIME) + */ + __pyx_t_10 = PyInt_FromLong(MYSQL_TYPE_TIME); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + + /* "oursql.pyx":125 + * DATE = _DBAPITypeObject( + * MYSQL_TYPE_DATE, MYSQL_TYPE_NEWDATE) + * TIME = _DBAPITypeObject( # <<<<<<<<<<<<<< + * MYSQL_TYPE_TIME) + * DATETIME = TIMESTAMP = _DBAPITypeObject( + */ + __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_10); + __Pyx_GIVEREF(__pyx_t_10); + __pyx_t_10 = 0; + __pyx_t_10 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6oursql__DBAPITypeObject)), __pyx_t_8, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_TIME, __pyx_t_10) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + + /* "oursql.pyx":128 + * MYSQL_TYPE_TIME) + * DATETIME = TIMESTAMP = _DBAPITypeObject( + * MYSQL_TYPE_TIMESTAMP, MYSQL_TYPE_DATETIME) # <<<<<<<<<<<<<< + * ROWID = _DBAPITypeObject() + * + */ + __pyx_t_10 = PyInt_FromLong(MYSQL_TYPE_TIMESTAMP); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_8 = PyInt_FromLong(MYSQL_TYPE_DATETIME); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + + /* "oursql.pyx":127 + * TIME = _DBAPITypeObject( + * MYSQL_TYPE_TIME) + * DATETIME = TIMESTAMP = _DBAPITypeObject( # <<<<<<<<<<<<<< + * MYSQL_TYPE_TIMESTAMP, MYSQL_TYPE_DATETIME) + * ROWID = _DBAPITypeObject() + */ + __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_10); + __Pyx_GIVEREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + __pyx_t_10 = 0; + __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6oursql__DBAPITypeObject)), __pyx_t_9, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_DATETIME, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s_TIMESTAMP, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + + /* "oursql.pyx":129 + * DATETIME = TIMESTAMP = _DBAPITypeObject( + * MYSQL_TYPE_TIMESTAMP, MYSQL_TYPE_DATETIME) + * ROWID = _DBAPITypeObject() # <<<<<<<<<<<<<< + * + * client_info = mysql_get_client_info() + */ + __pyx_t_8 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6oursql__DBAPITypeObject)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_ROWID, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + + /* "oursql.pyx":131 + * ROWID = _DBAPITypeObject() + * + * client_info = mysql_get_client_info() # <<<<<<<<<<<<<< + * errnos = _oursqlx_generate_errno_dict() + */ + __pyx_t_8 = __Pyx_PyBytes_FromString(mysql_get_client_info()); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_client_info, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + + /* "oursql.pyx":132 + * + * client_info = mysql_get_client_info() + * errnos = _oursqlx_generate_errno_dict() # <<<<<<<<<<<<<< + */ + __pyx_t_8 = _oursqlx_generate_errno_dict(); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_errnos, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + + /* "oursql.pyx":1 + * """oursql python bindings for MySQL. # <<<<<<<<<<<<<< + * + * This module is a new, better set of MySQL bindings for python, supporting novel + */ + __pyx_t_8 = PyDict_New(); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + + /*--- Wrapped vars code ---*/ + + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + if (__pyx_m) { + if (__pyx_d) { + __Pyx_AddTraceback("init oursql", __pyx_clineno, __pyx_lineno, __pyx_filename); + } + Py_DECREF(__pyx_m); __pyx_m = 0; + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init oursql"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if PY_MAJOR_VERSION < 3 + return; + #else + return __pyx_m; + #endif +} + +/* Runtime support code */ +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule((char *)modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; +} +#endif + +static PyObject *__Pyx_GetBuiltinName(PyObject *name) { + PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); + if (unlikely(!result)) { + PyErr_Format(PyExc_NameError, +#if PY_MAJOR_VERSION >= 3 + "name '%U' is not defined", name); +#else + "name '%.200s' is not defined", PyString_AS_STRING(name)); +#endif + } + return result; +} + +static void __Pyx_RaiseArgtupleInvalid( + const char* func_name, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, + Py_ssize_t num_found) +{ + Py_ssize_t num_expected; + const char *more_or_less; + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + PyErr_Format(PyExc_TypeError, + "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); + #else + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AsString(kw_name)); + #endif +} + +static int __Pyx_ParseOptionalKeywords( + PyObject *kwds, + PyObject **argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject *key = 0, *value = 0; + Py_ssize_t pos = 0; + PyObject*** name; + PyObject*** first_kw_arg = argnames + num_pos_args; + while (PyDict_Next(kwds, &pos, &key, &value)) { + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; + continue; + } + name = first_kw_arg; + #if PY_MAJOR_VERSION < 3 + if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { + while (*name) { + if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) + && _PyString_Eq(**name, key)) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + if ((**argname == key) || ( + (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) + && _PyString_Eq(**argname, key))) { + goto arg_passed_twice; + } + argname++; + } + } + } else + #endif + if (likely(PyUnicode_Check(key))) { + while (*name) { + int cmp = (**name == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**name, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + int cmp = (**argname == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**argname, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) goto arg_passed_twice; + argname++; + } + } + } else + goto invalid_keyword_type; + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; + } + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, key); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%.200s() keywords must be strings", function_name); + goto bad; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%.200s() got an unexpected keyword argument '%.200s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + return -1; +} + +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { + PyObject *result; + ternaryfunc call = func->ob_type->tp_call; + if (unlikely(!call)) + return PyObject_Call(func, arg, kw); + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) + return NULL; + result = (*call)(func, arg, kw); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); + } + return result; +} +#endif + +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { + PyObject *self, *result; + PyCFunction cfunc; + cfunc = PyCFunction_GET_FUNCTION(func); + self = PyCFunction_GET_SELF(func); + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) + return NULL; + result = cfunc(self, arg); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); + } + return result; +} +#endif + +#if CYTHON_COMPILING_IN_CPYTHON +static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { + PyObject *result; + PyObject *args = PyTuple_New(1); + if (unlikely(!args)) return NULL; + Py_INCREF(arg); + PyTuple_SET_ITEM(args, 0, arg); + result = __Pyx_PyObject_Call(func, args, NULL); + Py_DECREF(args); + return result; +} +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { +#ifdef __Pyx_CyFunction_USED + if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) { +#else + if (likely(PyCFunction_Check(func))) { +#endif + if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { + return __Pyx_PyObject_CallMethO(func, arg); + } + } + return __Pyx__PyObject_CallOneArg(func, arg); +} +#else +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { + PyObject* args = PyTuple_Pack(1, arg); + return (likely(args)) ? __Pyx_PyObject_Call(func, args, NULL) : NULL; +} +#endif + +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { +#ifdef __Pyx_CyFunction_USED + if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) { +#else + if (likely(PyCFunction_Check(func))) { +#endif + if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) { + return __Pyx_PyObject_CallMethO(func, NULL); + } + } + return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL); +} +#endif + +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + PyErr_Format(PyExc_ValueError, + "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); +} + +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack", + index, (index == 1) ? "" : "s"); +} + +static CYTHON_INLINE int __Pyx_IterFinish(void) { +#if CYTHON_COMPILING_IN_CPYTHON + PyThreadState *tstate = PyThreadState_GET(); + PyObject* exc_type = tstate->curexc_type; + if (unlikely(exc_type)) { + if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) { + PyObject *exc_value, *exc_tb; + exc_value = tstate->curexc_value; + exc_tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; + Py_DECREF(exc_type); + Py_XDECREF(exc_value); + Py_XDECREF(exc_tb); + return 0; + } else { + return -1; + } + } + return 0; +#else + if (unlikely(PyErr_Occurred())) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { + PyErr_Clear(); + return 0; + } else { + return -1; + } + } + return 0; +#endif +} + +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { + if (unlikely(retval)) { + Py_DECREF(retval); + __Pyx_RaiseTooManyValuesError(expected); + return -1; + } else { + return __Pyx_IterFinish(); + } + return 0; +} + +static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) { + PyObject *result; +#if CYTHON_COMPILING_IN_CPYTHON + result = PyDict_GetItem(__pyx_d, name); + if (likely(result)) { + Py_INCREF(result); + } else { +#else + result = PyObject_GetItem(__pyx_d, name); + if (!result) { + PyErr_Clear(); +#endif + result = __Pyx_GetBuiltinName(name); + } + return result; +} + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { +#if CYTHON_COMPILING_IN_CPYTHON + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#else + PyErr_Restore(type, value, tb); +#endif +} +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { +#if CYTHON_COMPILING_IN_CPYTHON + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +#else + PyErr_Fetch(type, value, tb); +#endif +} + +#if PY_MAJOR_VERSION < 3 +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, + CYTHON_UNUSED PyObject *cause) { + Py_XINCREF(type); + if (!value || value == Py_None) + value = NULL; + else + Py_INCREF(value); + if (!tb || tb == Py_None) + tb = NULL; + else { + Py_INCREF(tb); + if (!PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } + } + if (PyType_Check(type)) { +#if CYTHON_COMPILING_IN_PYPY + if (!value) { + Py_INCREF(Py_None); + value = Py_None; + } +#endif + PyErr_NormalizeException(&type, &value, &tb); + } else { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto raise_error; + } + value = type; + type = (PyObject*) Py_TYPE(type); + Py_INCREF(type); + if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto raise_error; + } + } + __Pyx_ErrRestore(type, value, tb); + return; +raise_error: + Py_XDECREF(value); + Py_XDECREF(type); + Py_XDECREF(tb); + return; +} +#else +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + PyObject* owned_instance = NULL; + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; + } + if (value == Py_None) + value = 0; + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (PyExceptionClass_Check(type)) { + PyObject *instance_class = NULL; + if (value && PyExceptionInstance_Check(value)) { + instance_class = (PyObject*) Py_TYPE(value); + if (instance_class != type) { + if (PyObject_IsSubclass(instance_class, type)) { + type = instance_class; + } else { + instance_class = NULL; + } + } + } + if (!instance_class) { + PyObject *args; + if (!value) + args = PyTuple_New(0); + else if (PyTuple_Check(value)) { + Py_INCREF(value); + args = value; + } else + args = PyTuple_Pack(1, value); + if (!args) + goto bad; + owned_instance = PyObject_Call(type, args, NULL); + Py_DECREF(args); + if (!owned_instance) + goto bad; + value = owned_instance; + if (!PyExceptionInstance_Check(value)) { + PyErr_Format(PyExc_TypeError, + "calling %R should have returned an instance of " + "BaseException, not %R", + type, Py_TYPE(value)); + goto bad; + } + } + } else { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } +#if PY_VERSION_HEX >= 0x03030000 + if (cause) { +#else + if (cause && cause != Py_None) { +#endif + PyObject *fixed_cause; + if (cause == Py_None) { + fixed_cause = NULL; + } else if (PyExceptionClass_Check(cause)) { + fixed_cause = PyObject_CallObject(cause, NULL); + if (fixed_cause == NULL) + goto bad; + } else if (PyExceptionInstance_Check(cause)) { + fixed_cause = cause; + Py_INCREF(fixed_cause); + } else { + PyErr_SetString(PyExc_TypeError, + "exception causes must derive from " + "BaseException"); + goto bad; + } + PyException_SetCause(value, fixed_cause); + } + PyErr_SetObject(type, value); + if (tb) { +#if CYTHON_COMPILING_IN_PYPY + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyErr_Fetch(tmp_type, tmp_value, tmp_tb); + Py_INCREF(tb); + PyErr_Restore(tmp_type, tmp_value, tb); + Py_XDECREF(tmp_tb); +#else + PyThreadState *tstate = PyThreadState_GET(); + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } +#endif + } +bad: + Py_XDECREF(owned_instance); + return; +} +#endif + +static void __Pyx_RaiseArgumentTypeInvalid(const char* name, PyObject *obj, PyTypeObject *type) { + PyErr_Format(PyExc_TypeError, + "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)", + name, type->tp_name, Py_TYPE(obj)->tp_name); +} +static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, + const char *name, int exact) +{ + if (unlikely(!type)) { + PyErr_SetString(PyExc_SystemError, "Missing type object"); + return 0; + } + if (none_allowed && obj == Py_None) return 1; + else if (exact) { + if (likely(Py_TYPE(obj) == type)) return 1; + #if PY_MAJOR_VERSION == 2 + else if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; + #endif + } + else { + if (likely(PyObject_TypeCheck(obj, type))) return 1; + } + __Pyx_RaiseArgumentTypeInvalid(name, obj, type); + return 0; +} + +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { +#if CYTHON_COMPILING_IN_PYPY + return PyObject_RichCompareBool(s1, s2, equals); +#else + if (s1 == s2) { + return (equals == Py_EQ); + } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { + const char *ps1, *ps2; + Py_ssize_t length = PyBytes_GET_SIZE(s1); + if (length != PyBytes_GET_SIZE(s2)) + return (equals == Py_NE); + ps1 = PyBytes_AS_STRING(s1); + ps2 = PyBytes_AS_STRING(s2); + if (ps1[0] != ps2[0]) { + return (equals == Py_NE); + } else if (length == 1) { + return (equals == Py_EQ); + } else { + int result = memcmp(ps1, ps2, (size_t)length); + return (equals == Py_EQ) ? (result == 0) : (result != 0); + } + } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { + return (equals == Py_NE); + } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { + return (equals == Py_NE); + } else { + int result; + PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + if (!py_result) + return -1; + result = __Pyx_PyObject_IsTrue(py_result); + Py_DECREF(py_result); + return result; + } +#endif +} + +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { +#if CYTHON_COMPILING_IN_PYPY + return PyObject_RichCompareBool(s1, s2, equals); +#else +#if PY_MAJOR_VERSION < 3 + PyObject* owned_ref = NULL; +#endif + int s1_is_unicode, s2_is_unicode; + if (s1 == s2) { + goto return_eq; + } + s1_is_unicode = PyUnicode_CheckExact(s1); + s2_is_unicode = PyUnicode_CheckExact(s2); +#if PY_MAJOR_VERSION < 3 + if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) { + owned_ref = PyUnicode_FromObject(s2); + if (unlikely(!owned_ref)) + return -1; + s2 = owned_ref; + s2_is_unicode = 1; + } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) { + owned_ref = PyUnicode_FromObject(s1); + if (unlikely(!owned_ref)) + return -1; + s1 = owned_ref; + s1_is_unicode = 1; + } else if (((!s2_is_unicode) & (!s1_is_unicode))) { + return __Pyx_PyBytes_Equals(s1, s2, equals); + } +#endif + if (s1_is_unicode & s2_is_unicode) { + Py_ssize_t length; + int kind; + void *data1, *data2; + if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0)) + return -1; + length = __Pyx_PyUnicode_GET_LENGTH(s1); + if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) { + goto return_ne; + } + kind = __Pyx_PyUnicode_KIND(s1); + if (kind != __Pyx_PyUnicode_KIND(s2)) { + goto return_ne; + } + data1 = __Pyx_PyUnicode_DATA(s1); + data2 = __Pyx_PyUnicode_DATA(s2); + if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) { + goto return_ne; + } else if (length == 1) { + goto return_eq; + } else { + int result = memcmp(data1, data2, (size_t)(length * kind)); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + return (equals == Py_EQ) ? (result == 0) : (result != 0); + } + } else if ((s1 == Py_None) & s2_is_unicode) { + goto return_ne; + } else if ((s2 == Py_None) & s1_is_unicode) { + goto return_ne; + } else { + int result; + PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + if (!py_result) + return -1; + result = __Pyx_PyObject_IsTrue(py_result); + Py_DECREF(py_result); + return result; + } +return_eq: + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + return (equals == Py_EQ); +return_ne: + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + return (equals == Py_NE); +#endif +} + +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice( + PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop, + PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice, + int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) { +#if CYTHON_COMPILING_IN_CPYTHON + PyMappingMethods* mp; +#if PY_MAJOR_VERSION < 3 + PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence; + if (likely(ms && ms->sq_slice)) { + if (!has_cstart) { + if (_py_start && (*_py_start != Py_None)) { + cstart = __Pyx_PyIndex_AsSsize_t(*_py_start); + if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; + } else + cstart = 0; + } + if (!has_cstop) { + if (_py_stop && (*_py_stop != Py_None)) { + cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop); + if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; + } else + cstop = PY_SSIZE_T_MAX; + } + if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) { + Py_ssize_t l = ms->sq_length(obj); + if (likely(l >= 0)) { + if (cstop < 0) { + cstop += l; + if (cstop < 0) cstop = 0; + } + if (cstart < 0) { + cstart += l; + if (cstart < 0) cstart = 0; + } + } else { + if (PyErr_ExceptionMatches(PyExc_OverflowError)) + PyErr_Clear(); + else + goto bad; + } + } + return ms->sq_slice(obj, cstart, cstop); + } +#endif + mp = Py_TYPE(obj)->tp_as_mapping; + if (likely(mp && mp->mp_subscript)) +#endif + { + PyObject* result; + PyObject *py_slice, *py_start, *py_stop; + if (_py_slice) { + py_slice = *_py_slice; + } else { + PyObject* owned_start = NULL; + PyObject* owned_stop = NULL; + if (_py_start) { + py_start = *_py_start; + } else { + if (has_cstart) { + owned_start = py_start = PyInt_FromSsize_t(cstart); + if (unlikely(!py_start)) goto bad; + } else + py_start = Py_None; + } + if (_py_stop) { + py_stop = *_py_stop; + } else { + if (has_cstop) { + owned_stop = py_stop = PyInt_FromSsize_t(cstop); + if (unlikely(!py_stop)) { + Py_XDECREF(owned_start); + goto bad; + } + } else + py_stop = Py_None; + } + py_slice = PySlice_New(py_start, py_stop, Py_None); + Py_XDECREF(owned_start); + Py_XDECREF(owned_stop); + if (unlikely(!py_slice)) goto bad; + } +#if CYTHON_COMPILING_IN_CPYTHON + result = mp->mp_subscript(obj, py_slice); +#else + result = PyObject_GetItem(obj, py_slice); +#endif + if (!_py_slice) { + Py_DECREF(py_slice); + } + return result; + } + PyErr_Format(PyExc_TypeError, + "'%.200s' object is unsliceable", Py_TYPE(obj)->tp_name); +bad: + return NULL; +} + +static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) { + PyObject *method, *result = NULL; + method = __Pyx_PyObject_GetAttrStr(obj, method_name); + if (unlikely(!method)) goto bad; +#if CYTHON_COMPILING_IN_CPYTHON + if (likely(PyMethod_Check(method))) { + PyObject *self = PyMethod_GET_SELF(method); + if (likely(self)) { + PyObject *args; + PyObject *function = PyMethod_GET_FUNCTION(method); + args = PyTuple_New(2); + if (unlikely(!args)) goto bad; + Py_INCREF(self); + PyTuple_SET_ITEM(args, 0, self); + Py_INCREF(arg); + PyTuple_SET_ITEM(args, 1, arg); + Py_INCREF(function); + Py_DECREF(method); method = NULL; + result = __Pyx_PyObject_Call(function, args, NULL); + Py_DECREF(args); + Py_DECREF(function); + return result; + } + } +#endif + result = __Pyx_PyObject_CallOneArg(method, arg); +bad: + Py_XDECREF(method); + return result; +} + +static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x) { + if (likely(PyList_CheckExact(L))) { + if (unlikely(__Pyx_PyList_Append(L, x) < 0)) return -1; + } else { + PyObject* retval = __Pyx_PyObject_CallMethod1(L, __pyx_n_s_append, x); + if (unlikely(!retval)) + return -1; + Py_DECREF(retval); + } + return 0; +} + +static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) { + PyObject *method, *result = NULL; + method = __Pyx_PyObject_GetAttrStr(obj, method_name); + if (unlikely(!method)) goto bad; +#if CYTHON_COMPILING_IN_CPYTHON + if (likely(PyMethod_Check(method))) { + PyObject *self = PyMethod_GET_SELF(method); + if (likely(self)) { + PyObject *function = PyMethod_GET_FUNCTION(method); + result = __Pyx_PyObject_CallOneArg(function, self); + Py_DECREF(method); + return result; + } + } +#endif + result = __Pyx_PyObject_CallNoArg(method); + Py_DECREF(method); +bad: + return result; +} + +static CYTHON_INLINE PyObject* __Pyx__PyObject_Pop(PyObject* L) { +#if CYTHON_COMPILING_IN_CPYTHON + if (Py_TYPE(L) == &PySet_Type) { + return PySet_Pop(L); + } +#endif + return __Pyx_PyObject_CallMethod0(L, __pyx_n_s_pop); +} +static CYTHON_INLINE PyObject* __Pyx_PyList_Pop(PyObject* L) { +#if CYTHON_COMPILING_IN_CPYTHON + if (likely(PyList_GET_SIZE(L) > (((PyListObject*)L)->allocated >> 1))) { + Py_SIZE(L) -= 1; + return PyList_GET_ITEM(L, PyList_GET_SIZE(L)); + } +#endif + return __Pyx_PyObject_CallMethod0(L, __pyx_n_s_pop); +} + +static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno, + CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename, + int full_traceback) { + PyObject *old_exc, *old_val, *old_tb; + PyObject *ctx; + __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); + if (full_traceback) { + Py_XINCREF(old_exc); + Py_XINCREF(old_val); + Py_XINCREF(old_tb); + __Pyx_ErrRestore(old_exc, old_val, old_tb); + PyErr_PrintEx(1); + } + #if PY_MAJOR_VERSION < 3 + ctx = PyString_FromString(name); + #else + ctx = PyUnicode_FromString(name); + #endif + __Pyx_ErrRestore(old_exc, old_val, old_tb); + if (!ctx) { + PyErr_WriteUnraisable(Py_None); + } else { + PyErr_WriteUnraisable(ctx); + Py_DECREF(ctx); + } +} + +static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) { +#if CYTHON_COMPILING_IN_CPYTHON + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->exc_type; + *value = tstate->exc_value; + *tb = tstate->exc_traceback; + Py_XINCREF(*type); + Py_XINCREF(*value); + Py_XINCREF(*tb); +#else + PyErr_GetExcInfo(type, value, tb); +#endif +} +static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) { +#if CYTHON_COMPILING_IN_CPYTHON + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = type; + tstate->exc_value = value; + tstate->exc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#else + PyErr_SetExcInfo(type, value, tb); +#endif +} + +static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) { + PyObject *local_type, *local_value, *local_tb; +#if CYTHON_COMPILING_IN_CPYTHON + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + local_type = tstate->curexc_type; + local_value = tstate->curexc_value; + local_tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +#else + PyErr_Fetch(&local_type, &local_value, &local_tb); +#endif + PyErr_NormalizeException(&local_type, &local_value, &local_tb); +#if CYTHON_COMPILING_IN_CPYTHON + if (unlikely(tstate->curexc_type)) +#else + if (unlikely(PyErr_Occurred())) +#endif + goto bad; + #if PY_MAJOR_VERSION >= 3 + if (local_tb) { + if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) + goto bad; + } + #endif + Py_XINCREF(local_tb); + Py_XINCREF(local_type); + Py_XINCREF(local_value); + *type = local_type; + *value = local_value; + *tb = local_tb; +#if CYTHON_COMPILING_IN_CPYTHON + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = local_type; + tstate->exc_value = local_value; + tstate->exc_traceback = local_tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#else + PyErr_SetExcInfo(local_type, local_value, local_tb); +#endif + return 0; +bad: + *type = 0; + *value = 0; + *tb = 0; + Py_XDECREF(local_type); + Py_XDECREF(local_value); + Py_XDECREF(local_tb); + return -1; +} + +static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; +#if CYTHON_COMPILING_IN_CPYTHON + PyThreadState *tstate = PyThreadState_GET(); + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = *type; + tstate->exc_value = *value; + tstate->exc_traceback = *tb; +#else + PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb); + PyErr_SetExcInfo(*type, *value, *tb); +#endif + *type = tmp_type; + *value = tmp_value; + *tb = tmp_tb; +} + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + PyObject *r; + if (!j) return NULL; + r = PyObject_GetItem(o, j); + Py_DECREF(j); + return r; +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck) { +#if CYTHON_COMPILING_IN_CPYTHON + if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o); + if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck) { +#if CYTHON_COMPILING_IN_CPYTHON + if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o); + if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, + int is_list, int wraparound, int boundscheck) { +#if CYTHON_COMPILING_IN_CPYTHON + if (is_list || PyList_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); + if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) { + PyObject *r = PyList_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } + } + else if (PyTuple_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); + if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } + } else { + PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; + if (likely(m && m->sq_item)) { + if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { + Py_ssize_t l = m->sq_length(o); + if (likely(l >= 0)) { + i += l; + } else { + if (PyErr_ExceptionMatches(PyExc_OverflowError)) + PyErr_Clear(); + else + return NULL; + } + } + return m->sq_item(o, i); + } + } +#else + if (is_list || PySequence_Check(o)) { + return PySequence_GetItem(o, i); + } +#endif + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +} + +static CYTHON_INLINE int __Pyx_CheckKeywordStrings( + PyObject *kwdict, + const char* function_name, + int kw_allowed) +{ + PyObject* key = 0; + Py_ssize_t pos = 0; +#if CYTHON_COMPILING_IN_PYPY + if (!kw_allowed && PyDict_Next(kwdict, &pos, &key, 0)) + goto invalid_keyword; + return 1; +#else + while (PyDict_Next(kwdict, &pos, &key, 0)) { + #if PY_MAJOR_VERSION < 3 + if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) + #endif + if (unlikely(!PyUnicode_Check(key))) + goto invalid_keyword_type; + } + if ((!kw_allowed) && unlikely(key)) + goto invalid_keyword; + return 1; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%.200s() keywords must be strings", function_name); + return 0; +#endif +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%.200s() got an unexpected keyword argument '%.200s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif + return 0; +} + +static int __Pyx_call_next_tp_traverse(PyObject* obj, visitproc v, void *a, traverseproc current_tp_traverse) { + PyTypeObject* type = Py_TYPE(obj); + while (type && type->tp_traverse != current_tp_traverse) + type = type->tp_base; + while (type && type->tp_traverse == current_tp_traverse) + type = type->tp_base; + if (type && type->tp_traverse) + return type->tp_traverse(obj, v, a); + return 0; +} + +static void __Pyx_call_next_tp_clear(PyObject* obj, inquiry current_tp_clear) { + PyTypeObject* type = Py_TYPE(obj); + while (type && type->tp_clear != current_tp_clear) + type = type->tp_base; + while (type && type->tp_clear == current_tp_clear) + type = type->tp_base; + if (type && type->tp_clear) + type->tp_clear(obj); +} + +static int __Pyx_SetVtable(PyObject *dict, void *vtable) { +#if PY_VERSION_HEX >= 0x02070000 + PyObject *ob = PyCapsule_New(vtable, 0, 0); +#else + PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); +#endif + if (!ob) + goto bad; + if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0) + goto bad; + Py_DECREF(ob); + return 0; +bad: + Py_XDECREF(ob); + return -1; +} + +static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) { + Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases); + for (i=0; i < nbases; i++) { + PyTypeObject *tmptype; + PyObject *tmp = PyTuple_GET_ITEM(bases, i); + tmptype = Py_TYPE(tmp); +#if PY_MAJOR_VERSION < 3 + if (tmptype == &PyClass_Type) + continue; +#endif + if (!metaclass) { + metaclass = tmptype; + continue; + } + if (PyType_IsSubtype(metaclass, tmptype)) + continue; + if (PyType_IsSubtype(tmptype, metaclass)) { + metaclass = tmptype; + continue; + } + PyErr_SetString(PyExc_TypeError, + "metaclass conflict: " + "the metaclass of a derived class " + "must be a (non-strict) subclass " + "of the metaclasses of all its bases"); + return NULL; + } + if (!metaclass) { +#if PY_MAJOR_VERSION < 3 + metaclass = &PyClass_Type; +#else + metaclass = &PyType_Type; +#endif + } + Py_INCREF((PyObject*) metaclass); + return (PyObject*) metaclass; +} + +static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, + PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) { + PyObject *ns; + if (metaclass) { + PyObject *prep = __Pyx_PyObject_GetAttrStr(metaclass, __pyx_n_s_prepare_2); + if (prep) { + PyObject *pargs = PyTuple_Pack(2, name, bases); + if (unlikely(!pargs)) { + Py_DECREF(prep); + return NULL; + } + ns = PyObject_Call(prep, pargs, mkw); + Py_DECREF(prep); + Py_DECREF(pargs); + } else { + if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError))) + return NULL; + PyErr_Clear(); + ns = PyDict_New(); + } + } else { + ns = PyDict_New(); + } + if (unlikely(!ns)) + return NULL; + if (unlikely(PyObject_SetItem(ns, __pyx_n_s_module, modname) < 0)) goto bad; + if (unlikely(PyObject_SetItem(ns, __pyx_n_s_qualname, qualname) < 0)) goto bad; + if (unlikely(doc && PyObject_SetItem(ns, __pyx_n_s_doc, doc) < 0)) goto bad; + return ns; +bad: + Py_DECREF(ns); + return NULL; +} +static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, + PyObject *dict, PyObject *mkw, + int calculate_metaclass, int allow_py2_metaclass) { + PyObject *result, *margs; + PyObject *owned_metaclass = NULL; + if (allow_py2_metaclass) { + owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass); + if (owned_metaclass) { + metaclass = owned_metaclass; + } else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) { + PyErr_Clear(); + } else { + return NULL; + } + } + if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) { + metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases); + Py_XDECREF(owned_metaclass); + if (unlikely(!metaclass)) + return NULL; + owned_metaclass = metaclass; + } + margs = PyTuple_Pack(3, name, bases, dict); + if (unlikely(!margs)) { + result = NULL; + } else { + result = PyObject_Call(metaclass, margs, mkw); + Py_DECREF(margs); + } + Py_XDECREF(owned_metaclass); + return result; +} + +static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) { + PyObject* fake_module; + PyTypeObject* cached_type = NULL; + fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI); + if (!fake_module) return NULL; + Py_INCREF(fake_module); + cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name); + if (cached_type) { + if (!PyType_Check((PyObject*)cached_type)) { + PyErr_Format(PyExc_TypeError, + "Shared Cython type %.200s is not a type object", + type->tp_name); + goto bad; + } + if (cached_type->tp_basicsize != type->tp_basicsize) { + PyErr_Format(PyExc_TypeError, + "Shared Cython type %.200s has the wrong size, try recompiling", + type->tp_name); + goto bad; + } + } else { + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; + PyErr_Clear(); + if (PyType_Ready(type) < 0) goto bad; + if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0) + goto bad; + Py_INCREF(type); + cached_type = type; + } +done: + Py_DECREF(fake_module); + return cached_type; +bad: + Py_XDECREF(cached_type); + cached_type = NULL; + goto done; +} + +static PyObject * +__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure) +{ + if (unlikely(op->func_doc == NULL)) { + if (op->func.m_ml->ml_doc) { +#if PY_MAJOR_VERSION >= 3 + op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc); +#else + op->func_doc = PyString_FromString(op->func.m_ml->ml_doc); +#endif + if (unlikely(op->func_doc == NULL)) + return NULL; + } else { + Py_INCREF(Py_None); + return Py_None; + } + } + Py_INCREF(op->func_doc); + return op->func_doc; +} +static int +__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value) +{ + PyObject *tmp = op->func_doc; + if (value == NULL) { + value = Py_None; + } + Py_INCREF(value); + op->func_doc = value; + Py_XDECREF(tmp); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op) +{ + if (unlikely(op->func_name == NULL)) { +#if PY_MAJOR_VERSION >= 3 + op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name); +#else + op->func_name = PyString_InternFromString(op->func.m_ml->ml_name); +#endif + if (unlikely(op->func_name == NULL)) + return NULL; + } + Py_INCREF(op->func_name); + return op->func_name; +} +static int +__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value) +{ + PyObject *tmp; +#if PY_MAJOR_VERSION >= 3 + if (unlikely(value == NULL || !PyUnicode_Check(value))) { +#else + if (unlikely(value == NULL || !PyString_Check(value))) { +#endif + PyErr_SetString(PyExc_TypeError, + "__name__ must be set to a string object"); + return -1; + } + tmp = op->func_name; + Py_INCREF(value); + op->func_name = value; + Py_XDECREF(tmp); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op) +{ + Py_INCREF(op->func_qualname); + return op->func_qualname; +} +static int +__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value) +{ + PyObject *tmp; +#if PY_MAJOR_VERSION >= 3 + if (unlikely(value == NULL || !PyUnicode_Check(value))) { +#else + if (unlikely(value == NULL || !PyString_Check(value))) { +#endif + PyErr_SetString(PyExc_TypeError, + "__qualname__ must be set to a string object"); + return -1; + } + tmp = op->func_qualname; + Py_INCREF(value); + op->func_qualname = value; + Py_XDECREF(tmp); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure) +{ + PyObject *self; + self = m->func_closure; + if (self == NULL) + self = Py_None; + Py_INCREF(self); + return self; +} +static PyObject * +__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op) +{ + if (unlikely(op->func_dict == NULL)) { + op->func_dict = PyDict_New(); + if (unlikely(op->func_dict == NULL)) + return NULL; + } + Py_INCREF(op->func_dict); + return op->func_dict; +} +static int +__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value) +{ + PyObject *tmp; + if (unlikely(value == NULL)) { + PyErr_SetString(PyExc_TypeError, + "function's dictionary may not be deleted"); + return -1; + } + if (unlikely(!PyDict_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "setting function's dictionary to a non-dict"); + return -1; + } + tmp = op->func_dict; + Py_INCREF(value); + op->func_dict = value; + Py_XDECREF(tmp); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op) +{ + Py_INCREF(op->func_globals); + return op->func_globals; +} +static PyObject * +__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op) +{ + Py_INCREF(Py_None); + return Py_None; +} +static PyObject * +__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op) +{ + PyObject* result = (op->func_code) ? op->func_code : Py_None; + Py_INCREF(result); + return result; +} +static int +__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) { + PyObject *res = op->defaults_getter((PyObject *) op); + if (unlikely(!res)) + return -1; + op->defaults_tuple = PyTuple_GET_ITEM(res, 0); + Py_INCREF(op->defaults_tuple); + op->defaults_kwdict = PyTuple_GET_ITEM(res, 1); + Py_INCREF(op->defaults_kwdict); + Py_DECREF(res); + return 0; +} +static int +__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value) { + PyObject* tmp; + if (!value) { + value = Py_None; + } else if (value != Py_None && !PyTuple_Check(value)) { + PyErr_SetString(PyExc_TypeError, + "__defaults__ must be set to a tuple object"); + return -1; + } + Py_INCREF(value); + tmp = op->defaults_tuple; + op->defaults_tuple = value; + Py_XDECREF(tmp); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op) { + PyObject* result = op->defaults_tuple; + if (unlikely(!result)) { + if (op->defaults_getter) { + if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL; + result = op->defaults_tuple; + } else { + result = Py_None; + } + } + Py_INCREF(result); + return result; +} +static int +__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value) { + PyObject* tmp; + if (!value) { + value = Py_None; + } else if (value != Py_None && !PyDict_Check(value)) { + PyErr_SetString(PyExc_TypeError, + "__kwdefaults__ must be set to a dict object"); + return -1; + } + Py_INCREF(value); + tmp = op->defaults_kwdict; + op->defaults_kwdict = value; + Py_XDECREF(tmp); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op) { + PyObject* result = op->defaults_kwdict; + if (unlikely(!result)) { + if (op->defaults_getter) { + if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL; + result = op->defaults_kwdict; + } else { + result = Py_None; + } + } + Py_INCREF(result); + return result; +} +static int +__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value) { + PyObject* tmp; + if (!value || value == Py_None) { + value = NULL; + } else if (!PyDict_Check(value)) { + PyErr_SetString(PyExc_TypeError, + "__annotations__ must be set to a dict object"); + return -1; + } + Py_XINCREF(value); + tmp = op->func_annotations; + op->func_annotations = value; + Py_XDECREF(tmp); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op) { + PyObject* result = op->func_annotations; + if (unlikely(!result)) { + result = PyDict_New(); + if (unlikely(!result)) return NULL; + op->func_annotations = result; + } + Py_INCREF(result); + return result; +} +static PyGetSetDef __pyx_CyFunction_getsets[] = { + {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, + {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, + {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, + {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, + {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0}, + {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0}, + {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, + {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, + {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, + {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, + {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, + {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, + {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, + {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, + {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, + {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, + {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0}, + {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0}, + {0, 0, 0, 0, 0} +}; +#ifndef PY_WRITE_RESTRICTED +#define PY_WRITE_RESTRICTED WRITE_RESTRICTED +#endif +static PyMemberDef __pyx_CyFunction_members[] = { + {(char *) "__module__", T_OBJECT, offsetof(__pyx_CyFunctionObject, func.m_module), PY_WRITE_RESTRICTED, 0}, + {0, 0, 0, 0, 0} +}; +static PyObject * +__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args) +{ +#if PY_MAJOR_VERSION >= 3 + return PyUnicode_FromString(m->func.m_ml->ml_name); +#else + return PyString_FromString(m->func.m_ml->ml_name); +#endif +} +static PyMethodDef __pyx_CyFunction_methods[] = { + {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0}, + {0, 0, 0, 0} +}; +#if PY_VERSION_HEX < 0x030500A0 +#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist) +#else +#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist) +#endif +static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags, PyObject* qualname, + PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { + __pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type); + if (op == NULL) + return NULL; + op->flags = flags; + __Pyx_CyFunction_weakreflist(op) = NULL; + op->func.m_ml = ml; + op->func.m_self = (PyObject *) op; + Py_XINCREF(closure); + op->func_closure = closure; + Py_XINCREF(module); + op->func.m_module = module; + op->func_dict = NULL; + op->func_name = NULL; + Py_INCREF(qualname); + op->func_qualname = qualname; + op->func_doc = NULL; + op->func_classobj = NULL; + op->func_globals = globals; + Py_INCREF(op->func_globals); + Py_XINCREF(code); + op->func_code = code; + op->defaults_pyobjects = 0; + op->defaults = NULL; + op->defaults_tuple = NULL; + op->defaults_kwdict = NULL; + op->defaults_getter = NULL; + op->func_annotations = NULL; + PyObject_GC_Track(op); + return (PyObject *) op; +} +static int +__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m) +{ + Py_CLEAR(m->func_closure); + Py_CLEAR(m->func.m_module); + Py_CLEAR(m->func_dict); + Py_CLEAR(m->func_name); + Py_CLEAR(m->func_qualname); + Py_CLEAR(m->func_doc); + Py_CLEAR(m->func_globals); + Py_CLEAR(m->func_code); + Py_CLEAR(m->func_classobj); + Py_CLEAR(m->defaults_tuple); + Py_CLEAR(m->defaults_kwdict); + Py_CLEAR(m->func_annotations); + if (m->defaults) { + PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); + int i; + for (i = 0; i < m->defaults_pyobjects; i++) + Py_XDECREF(pydefaults[i]); + PyMem_Free(m->defaults); + m->defaults = NULL; + } + return 0; +} +static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) +{ + PyObject_GC_UnTrack(m); + if (__Pyx_CyFunction_weakreflist(m) != NULL) + PyObject_ClearWeakRefs((PyObject *) m); + __Pyx_CyFunction_clear(m); + PyObject_GC_Del(m); +} +static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg) +{ + Py_VISIT(m->func_closure); + Py_VISIT(m->func.m_module); + Py_VISIT(m->func_dict); + Py_VISIT(m->func_name); + Py_VISIT(m->func_qualname); + Py_VISIT(m->func_doc); + Py_VISIT(m->func_globals); + Py_VISIT(m->func_code); + Py_VISIT(m->func_classobj); + Py_VISIT(m->defaults_tuple); + Py_VISIT(m->defaults_kwdict); + if (m->defaults) { + PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); + int i; + for (i = 0; i < m->defaults_pyobjects; i++) + Py_VISIT(pydefaults[i]); + } + return 0; +} +static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type) +{ + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) { + Py_INCREF(func); + return func; + } + if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) { + if (type == NULL) + type = (PyObject *)(Py_TYPE(obj)); + return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type))); + } + if (obj == Py_None) + obj = NULL; + return __Pyx_PyMethod_New(func, obj, type); +} +static PyObject* +__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) +{ +#if PY_MAJOR_VERSION >= 3 + return PyUnicode_FromFormat("", + op->func_qualname, (void *)op); +#else + return PyString_FromFormat("", + PyString_AsString(op->func_qualname), (void *)op); +#endif +} +#if CYTHON_COMPILING_IN_PYPY +static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { + PyCFunctionObject* f = (PyCFunctionObject*)func; + PyCFunction meth = PyCFunction_GET_FUNCTION(func); + PyObject *self = PyCFunction_GET_SELF(func); + Py_ssize_t size; + switch (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST)) { + case METH_VARARGS: + if (likely(kw == NULL) || PyDict_Size(kw) == 0) + return (*meth)(self, arg); + break; + case METH_VARARGS | METH_KEYWORDS: + return (*(PyCFunctionWithKeywords)meth)(self, arg, kw); + case METH_NOARGS: + if (likely(kw == NULL) || PyDict_Size(kw) == 0) { + size = PyTuple_GET_SIZE(arg); + if (size == 0) + return (*meth)(self, NULL); + PyErr_Format(PyExc_TypeError, + "%.200s() takes no arguments (%zd given)", + f->m_ml->ml_name, size); + return NULL; + } + break; + case METH_O: + if (likely(kw == NULL) || PyDict_Size(kw) == 0) { + size = PyTuple_GET_SIZE(arg); + if (size == 1) + return (*meth)(self, PyTuple_GET_ITEM(arg, 0)); + PyErr_Format(PyExc_TypeError, + "%.200s() takes exactly one argument (%zd given)", + f->m_ml->ml_name, size); + return NULL; + } + break; + default: + PyErr_SetString(PyExc_SystemError, "Bad call flags in " + "__Pyx_CyFunction_Call. METH_OLDARGS is no " + "longer supported!"); + return NULL; + } + PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments", + f->m_ml->ml_name); + return NULL; +} +#else +static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { + return PyCFunction_Call(func, arg, kw); +} +#endif +static PyTypeObject __pyx_CyFunctionType_type = { + PyVarObject_HEAD_INIT(0, 0) + "cython_function_or_method", + sizeof(__pyx_CyFunctionObject), + 0, + (destructor) __Pyx_CyFunction_dealloc, + 0, + 0, + 0, +#if PY_MAJOR_VERSION < 3 + 0, +#else + 0, +#endif + (reprfunc) __Pyx_CyFunction_repr, + 0, + 0, + 0, + 0, + __Pyx_CyFunction_Call, + 0, + 0, + 0, + 0, + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, + 0, + (traverseproc) __Pyx_CyFunction_traverse, + (inquiry) __Pyx_CyFunction_clear, + 0, +#if PY_VERSION_HEX < 0x030500A0 + offsetof(__pyx_CyFunctionObject, func_weakreflist), +#else + offsetof(PyCFunctionObject, m_weakreflist), +#endif + 0, + 0, + __pyx_CyFunction_methods, + __pyx_CyFunction_members, + __pyx_CyFunction_getsets, + 0, + 0, + __Pyx_CyFunction_descr_get, + 0, + offsetof(__pyx_CyFunctionObject, func_dict), + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, +#if PY_VERSION_HEX >= 0x030400a1 + 0, +#endif +}; +static int __Pyx_CyFunction_init(void) { +#if !CYTHON_COMPILING_IN_PYPY + __pyx_CyFunctionType_type.tp_call = PyCFunction_Call; +#endif + __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type); + if (__pyx_CyFunctionType == NULL) { + return -1; + } + return 0; +} +static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults = PyMem_Malloc(size); + if (!m->defaults) + return PyErr_NoMemory(); + memset(m->defaults, 0, size); + m->defaults_pyobjects = pyobjects; + return m->defaults; +} +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults_tuple = tuple; + Py_INCREF(tuple); +} +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults_kwdict = dict; + Py_INCREF(dict); +} +static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->func_annotations = dict; + Py_INCREF(dict); +} + +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + int start = 0, mid = 0, end = count - 1; + if (end >= 0 && code_line > entries[end].code_line) { + return count; + } + while (start < end) { + mid = (start + end) / 2; + if (code_line < entries[mid].code_line) { + end = mid; + } else if (code_line > entries[mid].code_line) { + start = mid + 1; + } else { + return mid; + } + } + if (code_line <= entries[mid].code_line) { + return mid; + } else { + return mid + 1; + } +} +static PyCodeObject *__pyx_find_code_object(int code_line) { + PyCodeObject* code_object; + int pos; + if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { + return NULL; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { + return NULL; + } + code_object = __pyx_code_cache.entries[pos].code_object; + Py_INCREF(code_object); + return code_object; +} +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { + int pos, i; + __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; + if (unlikely(!code_line)) { + return; + } + if (unlikely(!entries)) { + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); + if (likely(entries)) { + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = 64; + __pyx_code_cache.count = 1; + entries[0].code_line = code_line; + entries[0].code_object = code_object; + Py_INCREF(code_object); + } + return; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { + PyCodeObject* tmp = entries[pos].code_object; + entries[pos].code_object = code_object; + Py_DECREF(tmp); + return; + } + if (__pyx_code_cache.count == __pyx_code_cache.max_count) { + int new_max = __pyx_code_cache.max_count + 64; + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( + __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry)); + if (unlikely(!entries)) { + return; + } + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = new_max; + } + for (i=__pyx_code_cache.count; i>pos; i--) { + entries[i] = entries[i-1]; + } + entries[pos].code_line = code_line; + entries[pos].code_object = code_object; + __pyx_code_cache.count++; + Py_INCREF(code_object); +} + +#include "compile.h" +#include "frameobject.h" +#include "traceback.h" +static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( + const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyObject *py_srcfile = 0; + PyObject *py_funcname = 0; + #if PY_MAJOR_VERSION < 3 + py_srcfile = PyString_FromString(filename); + #else + py_srcfile = PyUnicode_FromString(filename); + #endif + if (!py_srcfile) goto bad; + if (c_line) { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + #else + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + #endif + } + else { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromString(funcname); + #else + py_funcname = PyUnicode_FromString(funcname); + #endif + } + if (!py_funcname) goto bad; + py_code = __Pyx_PyCode_New( + 0, + 0, + 0, + 0, + 0, + __pyx_empty_bytes, /*PyObject *code,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ + py_srcfile, /*PyObject *filename,*/ + py_funcname, /*PyObject *name,*/ + py_line, + __pyx_empty_bytes /*PyObject *lnotab*/ + ); + Py_DECREF(py_srcfile); + Py_DECREF(py_funcname); + return py_code; +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + return NULL; +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyFrameObject *py_frame = 0; + py_code = __pyx_find_code_object(c_line ? c_line : py_line); + if (!py_code) { + py_code = __Pyx_CreateCodeObjectForTraceback( + funcname, c_line, py_line, filename); + if (!py_code) goto bad; + __pyx_insert_code_object(c_line ? c_line : py_line, py_code); + } + py_frame = PyFrame_New( + PyThreadState_GET(), /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + __pyx_d, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + py_frame->f_lineno = py_line; + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_code); + Py_XDECREF(py_frame); +} + +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { + const int neg_one = (int) -1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(int) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(int) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); + } else if (sizeof(int) <= sizeof(unsigned long long)) { + return PyLong_FromUnsignedLongLong((unsigned long long) value); + } + } else { + if (sizeof(int) <= sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(int) <= sizeof(long long)) { + return PyLong_FromLongLong((long long) value); + } + } + { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&value; + return _PyLong_FromByteArray(bytes, sizeof(int), + little, !is_unsigned); + } +} + +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_long(unsigned long value) { + const unsigned long neg_one = (unsigned long) -1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(unsigned long) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(unsigned long) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); + } else if (sizeof(unsigned long) <= sizeof(unsigned long long)) { + return PyLong_FromUnsignedLongLong((unsigned long long) value); + } + } else { + if (sizeof(unsigned long) <= sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(unsigned long) <= sizeof(long long)) { + return PyLong_FromLongLong((long long) value); + } + } + { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&value; + return _PyLong_FromByteArray(bytes, sizeof(unsigned long), + little, !is_unsigned); + } +} + +#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value) \ + { \ + func_type value = func_value; \ + if (sizeof(target_type) < sizeof(func_type)) { \ + if (unlikely(value != (func_type) (target_type) value)) { \ + func_type zero = 0; \ + if (is_unsigned && unlikely(value < zero)) \ + goto raise_neg_overflow; \ + else \ + goto raise_overflow; \ + } \ + } \ + return (target_type) value; \ + } + +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 + #if CYTHON_USE_PYLONG_INTERNALS + #include "longintrepr.h" + #endif +#endif + +static CYTHON_INLINE unsigned long __Pyx_PyInt_As_unsigned_long(PyObject *x) { + const unsigned long neg_one = (unsigned long) -1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + if (sizeof(unsigned long) < sizeof(long)) { + __PYX_VERIFY_RETURN_INT(unsigned long, long, PyInt_AS_LONG(x)) + } else { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + goto raise_neg_overflow; + } + return (unsigned long) val; + } + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 + #if CYTHON_USE_PYLONG_INTERNALS + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: __PYX_VERIFY_RETURN_INT(unsigned long, digit, ((PyLongObject*)x)->ob_digit[0]); + } + #endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + goto raise_neg_overflow; + } + if (sizeof(unsigned long) <= sizeof(unsigned long)) { + __PYX_VERIFY_RETURN_INT(unsigned long, unsigned long, PyLong_AsUnsignedLong(x)) + } else if (sizeof(unsigned long) <= sizeof(unsigned long long)) { + __PYX_VERIFY_RETURN_INT(unsigned long, unsigned long long, PyLong_AsUnsignedLongLong(x)) + } + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 + #if CYTHON_USE_PYLONG_INTERNALS + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: __PYX_VERIFY_RETURN_INT(unsigned long, digit, +(((PyLongObject*)x)->ob_digit[0])); + case -1: __PYX_VERIFY_RETURN_INT(unsigned long, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]); + } + #endif +#endif + if (sizeof(unsigned long) <= sizeof(long)) { + __PYX_VERIFY_RETURN_INT(unsigned long, long, PyLong_AsLong(x)) + } else if (sizeof(unsigned long) <= sizeof(long long)) { + __PYX_VERIFY_RETURN_INT(unsigned long, long long, PyLong_AsLongLong(x)) + } + } + { +#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) + PyErr_SetString(PyExc_RuntimeError, + "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); +#else + unsigned long val; + PyObject *v = __Pyx_PyNumber_Int(x); + #if PY_MAJOR_VERSION < 3 + if (likely(v) && !PyLong_Check(v)) { + PyObject *tmp = v; + v = PyNumber_Long(tmp); + Py_DECREF(tmp); + } + #endif + if (likely(v)) { + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + int ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); + Py_DECREF(v); + if (likely(!ret)) + return val; + } +#endif + return (unsigned long) -1; + } + } else { + unsigned long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned long) -1; + val = __Pyx_PyInt_As_unsigned_long(tmp); + Py_DECREF(tmp); + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to unsigned long"); + return (unsigned long) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long) -1; +} + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { + PyObject *empty_list = 0; + PyObject *module = 0; + PyObject *global_dict = 0; + PyObject *empty_dict = 0; + PyObject *list; + #if PY_VERSION_HEX < 0x03030000 + PyObject *py_import; + py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); + if (!py_import) + goto bad; + #endif + if (from_list) + list = from_list; + else { + empty_list = PyList_New(0); + if (!empty_list) + goto bad; + list = empty_list; + } + global_dict = PyModule_GetDict(__pyx_m); + if (!global_dict) + goto bad; + empty_dict = PyDict_New(); + if (!empty_dict) + goto bad; + { + #if PY_MAJOR_VERSION >= 3 + if (level == -1) { + if (strchr(__Pyx_MODULE_NAME, '.')) { + #if PY_VERSION_HEX < 0x03030000 + PyObject *py_level = PyInt_FromLong(1); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + #else + module = PyImport_ImportModuleLevelObject( + name, global_dict, empty_dict, list, 1); + #endif + if (!module) { + if (!PyErr_ExceptionMatches(PyExc_ImportError)) + goto bad; + PyErr_Clear(); + } + } + level = 0; + } + #endif + if (!module) { + #if PY_VERSION_HEX < 0x03030000 + PyObject *py_level = PyInt_FromLong(level); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + #else + module = PyImport_ImportModuleLevelObject( + name, global_dict, empty_dict, list, level); + #endif + } + } +bad: + #if PY_VERSION_HEX < 0x03030000 + Py_XDECREF(py_import); + #endif + Py_XDECREF(empty_list); + Py_XDECREF(empty_dict); + return module; +} + +static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { + const int neg_one = (int) -1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + if (sizeof(int) < sizeof(long)) { + __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) + } else { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + goto raise_neg_overflow; + } + return (int) val; + } + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 + #if CYTHON_USE_PYLONG_INTERNALS + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: __PYX_VERIFY_RETURN_INT(int, digit, ((PyLongObject*)x)->ob_digit[0]); + } + #endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + goto raise_neg_overflow; + } + if (sizeof(int) <= sizeof(unsigned long)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, PyLong_AsUnsignedLong(x)) + } else if (sizeof(int) <= sizeof(unsigned long long)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long long, PyLong_AsUnsignedLongLong(x)) + } + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 + #if CYTHON_USE_PYLONG_INTERNALS + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: __PYX_VERIFY_RETURN_INT(int, digit, +(((PyLongObject*)x)->ob_digit[0])); + case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]); + } + #endif +#endif + if (sizeof(int) <= sizeof(long)) { + __PYX_VERIFY_RETURN_INT(int, long, PyLong_AsLong(x)) + } else if (sizeof(int) <= sizeof(long long)) { + __PYX_VERIFY_RETURN_INT(int, long long, PyLong_AsLongLong(x)) + } + } + { +#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) + PyErr_SetString(PyExc_RuntimeError, + "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); +#else + int val; + PyObject *v = __Pyx_PyNumber_Int(x); + #if PY_MAJOR_VERSION < 3 + if (likely(v) && !PyLong_Check(v)) { + PyObject *tmp = v; + v = PyNumber_Long(tmp); + Py_DECREF(tmp); + } + #endif + if (likely(v)) { + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + int ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); + Py_DECREF(v); + if (likely(!ret)) + return val; + } +#endif + return (int) -1; + } + } else { + int val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (int) -1; + val = __Pyx_PyInt_As_int(tmp); + Py_DECREF(tmp); + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to int"); + return (int) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to int"); + return (int) -1; +} + +static CYTHON_INLINE unsigned int __Pyx_PyInt_As_unsigned_int(PyObject *x) { + const unsigned int neg_one = (unsigned int) -1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + if (sizeof(unsigned int) < sizeof(long)) { + __PYX_VERIFY_RETURN_INT(unsigned int, long, PyInt_AS_LONG(x)) + } else { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + goto raise_neg_overflow; + } + return (unsigned int) val; + } + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 + #if CYTHON_USE_PYLONG_INTERNALS + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: __PYX_VERIFY_RETURN_INT(unsigned int, digit, ((PyLongObject*)x)->ob_digit[0]); + } + #endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + goto raise_neg_overflow; + } + if (sizeof(unsigned int) <= sizeof(unsigned long)) { + __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, PyLong_AsUnsignedLong(x)) + } else if (sizeof(unsigned int) <= sizeof(unsigned long long)) { + __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long long, PyLong_AsUnsignedLongLong(x)) + } + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 + #if CYTHON_USE_PYLONG_INTERNALS + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: __PYX_VERIFY_RETURN_INT(unsigned int, digit, +(((PyLongObject*)x)->ob_digit[0])); + case -1: __PYX_VERIFY_RETURN_INT(unsigned int, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]); + } + #endif +#endif + if (sizeof(unsigned int) <= sizeof(long)) { + __PYX_VERIFY_RETURN_INT(unsigned int, long, PyLong_AsLong(x)) + } else if (sizeof(unsigned int) <= sizeof(long long)) { + __PYX_VERIFY_RETURN_INT(unsigned int, long long, PyLong_AsLongLong(x)) + } + } + { +#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) + PyErr_SetString(PyExc_RuntimeError, + "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); +#else + unsigned int val; + PyObject *v = __Pyx_PyNumber_Int(x); + #if PY_MAJOR_VERSION < 3 + if (likely(v) && !PyLong_Check(v)) { + PyObject *tmp = v; + v = PyNumber_Long(tmp); + Py_DECREF(tmp); + } + #endif + if (likely(v)) { + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + int ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); + Py_DECREF(v); + if (likely(!ret)) + return val; + } +#endif + return (unsigned int) -1; + } + } else { + unsigned int val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned int) -1; + val = __Pyx_PyInt_As_unsigned_int(tmp); + Py_DECREF(tmp); + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to unsigned int"); + return (unsigned int) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned int"); + return (unsigned int) -1; +} + +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_int(unsigned int value) { + const unsigned int neg_one = (unsigned int) -1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(unsigned int) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(unsigned int) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); + } else if (sizeof(unsigned int) <= sizeof(unsigned long long)) { + return PyLong_FromUnsignedLongLong((unsigned long long) value); + } + } else { + if (sizeof(unsigned int) <= sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(unsigned int) <= sizeof(long long)) { + return PyLong_FromLongLong((long long) value); + } + } + { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&value; + return _PyLong_FromByteArray(bytes, sizeof(unsigned int), + little, !is_unsigned); + } +} + +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { + const long neg_one = (long) -1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(long) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(long) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); + } else if (sizeof(long) <= sizeof(unsigned long long)) { + return PyLong_FromUnsignedLongLong((unsigned long long) value); + } + } else { + if (sizeof(long) <= sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(long) <= sizeof(long long)) { + return PyLong_FromLongLong((long long) value); + } + } + { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&value; + return _PyLong_FromByteArray(bytes, sizeof(long), + little, !is_unsigned); + } +} + +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_my_ulonglong(my_ulonglong value) { + const my_ulonglong neg_one = (my_ulonglong) -1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(my_ulonglong) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(my_ulonglong) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); + } else if (sizeof(my_ulonglong) <= sizeof(unsigned long long)) { + return PyLong_FromUnsignedLongLong((unsigned long long) value); + } + } else { + if (sizeof(my_ulonglong) <= sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(my_ulonglong) <= sizeof(long long)) { + return PyLong_FromLongLong((long long) value); + } + } + { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&value; + return _PyLong_FromByteArray(bytes, sizeof(my_ulonglong), + little, !is_unsigned); + } +} + +static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { + const long neg_one = (long) -1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + if (sizeof(long) < sizeof(long)) { + __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) + } else { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + goto raise_neg_overflow; + } + return (long) val; + } + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 + #if CYTHON_USE_PYLONG_INTERNALS + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: __PYX_VERIFY_RETURN_INT(long, digit, ((PyLongObject*)x)->ob_digit[0]); + } + #endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + goto raise_neg_overflow; + } + if (sizeof(long) <= sizeof(unsigned long)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, PyLong_AsUnsignedLong(x)) + } else if (sizeof(long) <= sizeof(unsigned long long)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long long, PyLong_AsUnsignedLongLong(x)) + } + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 + #if CYTHON_USE_PYLONG_INTERNALS + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: __PYX_VERIFY_RETURN_INT(long, digit, +(((PyLongObject*)x)->ob_digit[0])); + case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]); + } + #endif +#endif + if (sizeof(long) <= sizeof(long)) { + __PYX_VERIFY_RETURN_INT(long, long, PyLong_AsLong(x)) + } else if (sizeof(long) <= sizeof(long long)) { + __PYX_VERIFY_RETURN_INT(long, long long, PyLong_AsLongLong(x)) + } + } + { +#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) + PyErr_SetString(PyExc_RuntimeError, + "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); +#else + long val; + PyObject *v = __Pyx_PyNumber_Int(x); + #if PY_MAJOR_VERSION < 3 + if (likely(v) && !PyLong_Check(v)) { + PyObject *tmp = v; + v = PyNumber_Long(tmp); + Py_DECREF(tmp); + } + #endif + if (likely(v)) { + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + int ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); + Py_DECREF(v); + if (likely(!ret)) + return val; + } +#endif + return (long) -1; + } + } else { + long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (long) -1; + val = __Pyx_PyInt_As_long(tmp); + Py_DECREF(tmp); + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to long"); + return (long) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long) -1; +} + +static int __Pyx_check_binary_version(void) { + char ctversion[4], rtversion[4]; + PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); + PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); + if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { + char message[200]; + PyOS_snprintf(message, sizeof(message), + "compiletime version %s of module '%.100s' " + "does not match runtime version %s", + ctversion, __Pyx_MODULE_NAME, rtversion); + return PyErr_WarnEx(NULL, message, 1); + } + return 0; +} + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + while (t->p) { + #if PY_MAJOR_VERSION < 3 + if (t->is_unicode) { + *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); + } else if (t->intern) { + *t->p = PyString_InternFromString(t->s); + } else { + *t->p = PyString_FromStringAndSize(t->s, t->n - 1); + } + #else + if (t->is_unicode | t->is_str) { + if (t->intern) { + *t->p = PyUnicode_InternFromString(t->s); + } else if (t->encoding) { + *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); + } else { + *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + } + } else { + *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); + } + #endif + if (!*t->p) + return -1; + ++t; + } + return 0; +} + +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) { + return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str)); +} +static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) { + Py_ssize_t ignore; + return __Pyx_PyObject_AsStringAndSize(o, &ignore); +} +static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT + if ( +#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + __Pyx_sys_getdefaultencoding_not_ascii && +#endif + PyUnicode_Check(o)) { +#if PY_VERSION_HEX < 0x03030000 + char* defenc_c; + PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); + if (!defenc) return NULL; + defenc_c = PyBytes_AS_STRING(defenc); +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + { + char* end = defenc_c + PyBytes_GET_SIZE(defenc); + char* c; + for (c = defenc_c; c < end; c++) { + if ((unsigned char) (*c) >= 128) { + PyUnicode_AsASCIIString(o); + return NULL; + } + } + } +#endif + *length = PyBytes_GET_SIZE(defenc); + return defenc_c; +#else + if (__Pyx_PyUnicode_READY(o) == -1) return NULL; +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + if (PyUnicode_IS_ASCII(o)) { + *length = PyUnicode_GET_LENGTH(o); + return PyUnicode_AsUTF8(o); + } else { + PyUnicode_AsASCIIString(o); + return NULL; + } +#else + return PyUnicode_AsUTF8AndSize(o, length); +#endif +#endif + } else +#endif +#if !CYTHON_COMPILING_IN_PYPY + if (PyByteArray_Check(o)) { + *length = PyByteArray_GET_SIZE(o); + return PyByteArray_AS_STRING(o); + } else +#endif + { + char* result; + int r = PyBytes_AsStringAndSize(o, &result, length); + if (unlikely(r < 0)) { + return NULL; + } else { + return result; + } + } +} +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + int is_true = x == Py_True; + if (is_true | (x == Py_False) | (x == Py_None)) return is_true; + else return PyObject_IsTrue(x); +} +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { + PyNumberMethods *m; + const char *name = NULL; + PyObject *res = NULL; +#if PY_MAJOR_VERSION < 3 + if (PyInt_Check(x) || PyLong_Check(x)) +#else + if (PyLong_Check(x)) +#endif + return Py_INCREF(x), x; + m = Py_TYPE(x)->tp_as_number; +#if PY_MAJOR_VERSION < 3 + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Int(x); + } + else if (m && m->nb_long) { + name = "long"; + res = PyNumber_Long(x); + } +#else + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Long(x); + } +#endif + if (res) { +#if PY_MAJOR_VERSION < 3 + if (!PyInt_Check(res) && !PyLong_Check(res)) { +#else + if (!PyLong_Check(res)) { +#endif + PyErr_Format(PyExc_TypeError, + "__%.4s__ returned non-%.4s (type %.200s)", + name, name, Py_TYPE(res)->tp_name); + Py_DECREF(res); + return NULL; + } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; +} +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject *x; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_CheckExact(b))) + return PyInt_AS_LONG(b); +#endif + if (likely(PyLong_CheckExact(b))) { + #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 + #if CYTHON_USE_PYLONG_INTERNALS + switch (Py_SIZE(b)) { + case -1: return -(sdigit)((PyLongObject*)b)->ob_digit[0]; + case 0: return 0; + case 1: return ((PyLongObject*)b)->ob_digit[0]; + } + #endif + #endif + return PyLong_AsSsize_t(b); + } + x = PyNumber_Index(b); + if (!x) return -1; + ival = PyInt_AsSsize_t(x); + Py_DECREF(x); + return ival; +} +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { + return PyInt_FromSize_t(ival); +} + + +#endif /* Py_PYTHON_H */