informixdb-cvs Mailing List for InformixDB (Page 2)
Brought to you by:
chaese,
f-apolloner
You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(36) |
Nov
(40) |
Dec
(6) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(1) |
Feb
|
Mar
(6) |
Apr
(3) |
May
|
Jun
|
Jul
|
Aug
|
Sep
(13) |
Oct
(12) |
Nov
(10) |
Dec
(8) |
2007 |
Jan
|
Feb
(1) |
Mar
(1) |
Apr
|
May
|
Jun
(5) |
Jul
|
Aug
(1) |
Sep
(4) |
Oct
(15) |
Nov
|
Dec
(1) |
2008 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(2) |
Sep
(5) |
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(4) |
Dec
|
2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(3) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <ch...@us...> - 2007-10-15 01:51:39
|
Revision: 168 http://informixdb.svn.sourceforge.net/informixdb/?rev=168&view=rev Author: chaese Date: 2007-10-14 18:51:43 -0700 (Sun, 14 Oct 2007) Log Message: ----------- Don't mix declarations and assignments, some compilers don't like that. Modified Paths: -------------- trunk/informixdb/ext/_informixdb.ec Modified: trunk/informixdb/ext/_informixdb.ec =================================================================== --- trunk/informixdb/ext/_informixdb.ec 2007-10-15 01:49:21 UTC (rev 167) +++ trunk/informixdb/ext/_informixdb.ec 2007-10-15 01:51:43 UTC (rev 168) @@ -2840,12 +2840,11 @@ struct sqlda *tdaOut = self->daOut; int i; void (*oldsighandler)(int); - oldsighandler = NULL; - EXEC SQL BEGIN DECLARE SECTION; char *cursorName; EXEC SQL END DECLARE SECTION; + oldsighandler = NULL; cursorName = self->cursorName; require_cursor_open(self); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ch...@us...> - 2007-10-15 01:49:19
|
Revision: 167 http://informixdb.svn.sourceforge.net/informixdb/?rev=167&view=rev Author: chaese Date: 2007-10-14 18:49:21 -0700 (Sun, 14 Oct 2007) Log Message: ----------- some ESQL/C 9.x versions don't define LO_ATTR_TEMP Modified Paths: -------------- trunk/informixdb/ext/_informixdb.ec Modified: trunk/informixdb/ext/_informixdb.ec =================================================================== --- trunk/informixdb/ext/_informixdb.ec 2007-10-15 01:47:21 UTC (rev 166) +++ trunk/informixdb/ext/_informixdb.ec 2007-10-15 01:49:21 UTC (rev 167) @@ -4309,7 +4309,9 @@ ExposeIntConstant(LO_ATTR_NOKEEP_LASTACCESS_TIME); ExposeIntConstant(LO_ATTR_HIGH_INTEG); ExposeIntConstant(LO_ATTR_MODERATE_INTEG); +#ifdef LO_ATTR_TEMP ExposeIntConstant(LO_ATTR_TEMP); +#endif ExposeIntConstant(LO_SEEK_SET); ExposeIntConstant(LO_SEEK_CUR); ExposeIntConstant(LO_SEEK_END); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ch...@us...> - 2007-10-15 01:47:17
|
Revision: 166 http://informixdb.svn.sourceforge.net/informixdb/?rev=166&view=rev Author: chaese Date: 2007-10-14 18:47:21 -0700 (Sun, 14 Oct 2007) Log Message: ----------- Let's assume for now that ESQL/C understands DESCRIBE INPUT iff it's version 9.40 or better. Modified Paths: -------------- trunk/informixdb/ext/_informixdb.ec trunk/informixdb/setup.py Modified: trunk/informixdb/ext/_informixdb.ec =================================================================== --- trunk/informixdb/ext/_informixdb.ec 2007-10-14 17:40:37 UTC (rev 165) +++ trunk/informixdb/ext/_informixdb.ec 2007-10-15 01:47:21 UTC (rev 166) @@ -1939,6 +1939,7 @@ (self->stype == 0 || (self->stype == SQ_EXECPROC && tdaOut->sqld > 0) ); if (self->has_output) { +$ifdef HAVE_DESCRIBE_INPUT; if (self->conn->can_describe_input) { struct sqlda *tda = NULL; EXEC SQL DESCRIBE INPUT :queryName INTO tda; @@ -1948,6 +1949,7 @@ _da_free(tda); } } +$endif; bindOutput(self); switch (self->is_hold + 2*self->is_scroll) { case 3: Modified: trunk/informixdb/setup.py =================================================================== --- trunk/informixdb/setup.py 2007-10-14 17:40:37 UTC (rev 165) +++ trunk/informixdb/setup.py 2007-10-15 01:47:21 UTC (rev 166) @@ -80,6 +80,8 @@ esqlversion = 850 if esqlversion >= 900: self.esql_parts.append("-EDHAVE_ESQL9") + if esqlversion >= 940: + self.esql_parts.append("-EDHAVE_DESCRIBE_INPUT") f = open(os.path.join("ext","esqlver.h"), "w") f.write("""\ #define DRIVER_NAME "%(driver_name)s" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ch...@us...> - 2007-10-14 17:40:35
|
Revision: 165 http://informixdb.svn.sourceforge.net/informixdb/?rev=165&view=rev Author: chaese Date: 2007-10-14 10:40:37 -0700 (Sun, 14 Oct 2007) Log Message: ----------- Since we publish server version information, it might be useful to publish version information about the client too, i.e. the ESQL version, for symmetry. Modified Paths: -------------- trunk/informixdb/ext/_informixdb.ec trunk/informixdb/setup.py Modified: trunk/informixdb/ext/_informixdb.ec =================================================================== --- trunk/informixdb/ext/_informixdb.ec 2007-10-13 22:07:31 UTC (rev 164) +++ trunk/informixdb/ext/_informixdb.ec 2007-10-14 17:40:37 UTC (rev 165) @@ -113,6 +113,7 @@ */ #define DEFERRED_ADDRESS(ADDR) 0 #include <signal.h> +#include "esqlver.h" /************************* Error handling *************************/ @@ -728,6 +729,8 @@ PyObject *binary_types; PyObject *dbms_name; PyObject *dbms_version; + PyObject *driver_name; + PyObject *driver_version; int can_describe_input; } Connection; @@ -881,6 +884,10 @@ "Name of the database engine." }, { "dbms_version", T_OBJECT_EX, offsetof(Connection, dbms_version), READONLY, "Version of the database engine." }, + { "driver_name", T_OBJECT_EX, offsetof(Connection, driver_name), READONLY, + "Name of the client driver." }, + { "driver_version", T_OBJECT_EX, offsetof(Connection, driver_version), READONLY, + "Version of the client driver." }, { NULL } }; @@ -3195,6 +3202,8 @@ self->dbms_name = PyString_FromString("Unknown"); self->dbms_version = PyString_FromString(version); } + self->driver_name = PyString_FromString(DRIVER_NAME); + self->driver_version = PyString_FromString(DRIVER_VERSION); return 0; } Modified: trunk/informixdb/setup.py =================================================================== --- trunk/informixdb/setup.py 2007-10-13 22:07:31 UTC (rev 164) +++ trunk/informixdb/setup.py 2007-10-14 17:40:37 UTC (rev 165) @@ -61,21 +61,31 @@ self.esql_parts.append('-static') # determine esql version - esqlver = re.compile(r"(IBM)?.*ESQL Version (\d+)\.(\d+)") + driver_name = "INFORMIX-ESQL" + driver_version = "Unknown" + esqlver = re.compile(r"(IBM)?.*ESQL Version ((\d+)\.(\d+)[^ ]*)") cout = os.popen(' '.join(self.esql_parts[0:1] + [ '-V' ]),'r') esqlversion = None for line in cout: matchobj = esqlver.match(line) if matchobj: matchgroups = matchobj.groups() - esqlversion = int(matchgroups[1] + matchgroups[2]) + driver_version = matchgroups[1].strip() + esqlversion = int(matchgroups[2] + matchgroups[3]) if matchgroups[0]=="IBM": # Assume ESQL 9.xx for any IBM branded CSDK. + driver_name = "IBM Informix-ESQL" esqlversion = 960 if esqlversion==None: esqlversion = 850 if esqlversion >= 900: self.esql_parts.append("-EDHAVE_ESQL9") + f = open(os.path.join("ext","esqlver.h"), "w") + f.write("""\ +#define DRIVER_NAME "%(driver_name)s" +#define DRIVER_VERSION "%(driver_version)s" +""" % locals()) + f.close() # find esql libs/objects cout = os.popen(' '.join(self.esql_parts + [ '-libs' ]),'r') This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ch...@us...> - 2007-10-13 22:07:30
|
Revision: 164 http://informixdb.svn.sourceforge.net/informixdb/?rev=164&view=rev Author: chaese Date: 2007-10-13 15:07:31 -0700 (Sat, 13 Oct 2007) Log Message: ----------- DESCRIBE INPUT doesn't touch the DA pointer if there are no inputs, so we have to initialize the pointer to NULL. Modified Paths: -------------- trunk/informixdb/ext/_informixdb.ec Modified: trunk/informixdb/ext/_informixdb.ec =================================================================== --- trunk/informixdb/ext/_informixdb.ec 2007-10-13 21:48:18 UTC (rev 163) +++ trunk/informixdb/ext/_informixdb.ec 2007-10-13 22:07:31 UTC (rev 164) @@ -1933,7 +1933,7 @@ if (self->has_output) { if (self->conn->can_describe_input) { - struct sqlda *tda; + struct sqlda *tda = NULL; EXEC SQL DESCRIBE INPUT :queryName INTO tda; ret_on_dberror_cursor(self, "DESCRIBE INPUT"); if (tda) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ch...@us...> - 2007-10-13 21:48:17
|
Revision: 163 http://informixdb.svn.sourceforge.net/informixdb/?rev=163&view=rev Author: chaese Date: 2007-10-13 14:48:18 -0700 (Sat, 13 Oct 2007) Log Message: ----------- * obtain and expose server version * If possible, use DESCRIBE INPUT so that booleans and UDTs can be bound correctly in WHERE clauses. Modified Paths: -------------- trunk/informixdb/ext/_informixdb.ec Modified: trunk/informixdb/ext/_informixdb.ec =================================================================== --- trunk/informixdb/ext/_informixdb.ec 2007-09-12 14:22:46 UTC (rev 162) +++ trunk/informixdb/ext/_informixdb.ec 2007-10-13 21:48:18 UTC (rev 163) @@ -726,6 +726,9 @@ PyObject *errorhandler; int autocommit; PyObject *binary_types; + PyObject *dbms_name; + PyObject *dbms_version; + int can_describe_input; } Connection; static int setConnection(Connection*); @@ -874,6 +877,10 @@ Connection_errorhandler_doc }, { "binary_types", T_OBJECT_EX, offsetof(Connection, binary_types), READONLY, Connection_binary_types_doc }, + { "dbms_name", T_OBJECT_EX, offsetof(Connection, dbms_name), READONLY, + "Name of the database engine." }, + { "dbms_version", T_OBJECT_EX, offsetof(Connection, dbms_version), READONLY, + "Version of the database engine." }, { NULL } }; @@ -1925,6 +1932,15 @@ (self->stype == 0 || (self->stype == SQ_EXECPROC && tdaOut->sqld > 0) ); if (self->has_output) { + if (self->conn->can_describe_input) { + struct sqlda *tda; + EXEC SQL DESCRIBE INPUT :queryName INTO tda; + ret_on_dberror_cursor(self, "DESCRIBE INPUT"); + if (tda) { + copyDescr(tdaIn, tda); + _da_free(tda); + } + } bindOutput(self); switch (self->is_hold + 2*self->is_scroll) { case 3: @@ -2189,6 +2205,14 @@ return Py_None; } +static void _clip_char(char *s) +{ + /* clip trailing spaces */ + register size_t len = strlen(s); + register size_t clipped_len = byleng(s, len); + s[clipped_len] = 0; +} + static PyObject *doCopy(struct sqlvar_struct *var, int type, int4 xid, int4 sqllen, struct Cursor_t *cur) { @@ -2331,10 +2355,7 @@ case SQLLVARCHAR: $endif; { - /* clip trailing spaces */ - register size_t len = strlen((char*)data); - register size_t clipped_len = byleng(data, len); - ((char*)data)[clipped_len] = 0; + _clip_char((char*)data); return Py_BuildValue("s", (char*)data); } case SQLFLOAT: @@ -2447,9 +2468,7 @@ /* Unknown type. bindOutput falls back to binding to a character string. If Informix actually managed to read this unknown type into that string, we might as well return it instead of returning None. */ - register size_t len = strlen((char*)data); - register size_t clipped_len = byleng(data, len); - ((char*)data)[clipped_len] = 0; + _clip_char((char*)data); return Py_BuildValue("s", (char*)data); } } @@ -3075,8 +3094,16 @@ char *connectionString = NULL; char *dbUser = NULL; char *dbPass = NULL; + char server_type[128]; + char ver_major[16]; + char ver_minor[16]; + char ver_os[16]; + char ver_level[16]; + char version[256]; EXEC SQL END DECLARE SECTION; int autocommit = 0; + int iVerMajor = 0; + int iVerMinor = 0; PyObject *pyDbUser = NULL, *pyDbPass = NULL; static char* kwd_list[] = { "dsn", "user", "password", "autocommit", 0 }; @@ -3120,6 +3147,7 @@ } self->is_open = 1; + self->can_describe_input = 0; self->has_commit = (sqlca.sqlwarn.sqlwarn1 == 'W'); self->autocommit = 0; if (autocommit) self->autocommit = 1; @@ -3133,6 +3161,41 @@ setConnectionName(self->name); + EXEC SQL + SELECT dbinfo("version","server-type"), + dbinfo("version","major"), + dbinfo("version","minor"), + dbinfo("version","os"), + dbinfo("version","level") + INTO :server_type, :ver_major, :ver_minor, :ver_os, :ver_level + FROM systables where tabid=1 ; + + if (SQLCODE==0) { + _clip_char(server_type); + _clip_char(ver_major); + _clip_char(ver_minor); + _clip_char(ver_os); + _clip_char(ver_level); + sprintf(version, "%s.%s%s%s", ver_major, ver_minor, ver_os, ver_level); + self->dbms_name = PyString_FromString(server_type); + self->dbms_version = PyString_FromString(version); + + iVerMajor = atoi(ver_major); + iVerMinor = atoi(ver_minor); + if (iVerMajor*100+iVerMinor >= 940) { + self->can_describe_input = 1; + } + } + else { + EXEC SQL + SELECT owner + INTO :version + FROM systables where tabname = " VERSION"; + _clip_char(version); + self->dbms_name = PyString_FromString("Unknown"); + self->dbms_version = PyString_FromString(version); + } + return 0; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ch...@us...> - 2007-09-12 14:22:42
|
Revision: 162 http://informixdb.svn.sourceforge.net/informixdb/?rev=162&view=rev Author: chaese Date: 2007-09-12 07:22:46 -0700 (Wed, 12 Sep 2007) Log Message: ----------- merge r161 from trunk Modified Paths: -------------- branches/informixdb-py3k/ext/_informixdb.ec Modified: branches/informixdb-py3k/ext/_informixdb.ec =================================================================== --- branches/informixdb-py3k/ext/_informixdb.ec 2007-09-12 14:19:33 UTC (rev 161) +++ branches/informixdb-py3k/ext/_informixdb.ec 2007-09-12 14:22:46 UTC (rev 162) @@ -2588,7 +2588,7 @@ struct sqlda *da = cur->daOut; if (da && da->sqlvar) { int i; - for (i=0; i<da->sqld; i++) + for (i=0; i<da->sqld; i++) { if (da->sqlvar[i].sqldata && (da->sqlvar[i].sqltype == CLOCATORTYPE)) { loc_t *loc = (loc_t*) da->sqlvar[i].sqldata; @@ -2600,6 +2600,7 @@ free(da->sqlvar[i].sqldata); } $endif; + } _da_free(cur->daOut); cur->daOut = 0; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ch...@us...> - 2007-09-12 14:19:29
|
Revision: 161 http://informixdb.svn.sourceforge.net/informixdb/?rev=161&view=rev Author: chaese Date: 2007-09-12 07:19:33 -0700 (Wed, 12 Sep 2007) Log Message: ----------- Fix bug reported by Kristof Beyls: the smartblob check/free code really needs to happen inside the for-i loop. Modified Paths: -------------- trunk/informixdb/ext/_informixdb.ec Modified: trunk/informixdb/ext/_informixdb.ec =================================================================== --- trunk/informixdb/ext/_informixdb.ec 2007-09-02 22:06:12 UTC (rev 160) +++ trunk/informixdb/ext/_informixdb.ec 2007-09-12 14:19:33 UTC (rev 161) @@ -2591,7 +2591,7 @@ struct sqlda *da = cur->daOut; if (da && da->sqlvar) { int i; - for (i=0; i<da->sqld; i++) + for (i=0; i<da->sqld; i++) { if (da->sqlvar[i].sqldata && (da->sqlvar[i].sqltype == CLOCATORTYPE)) { loc_t *loc = (loc_t*) da->sqlvar[i].sqldata; @@ -2603,6 +2603,7 @@ free(da->sqlvar[i].sqldata); } $endif; + } _da_free(cur->daOut); cur->daOut = 0; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ch...@us...> - 2007-09-02 22:51:58
|
Revision: 159 http://informixdb.svn.sourceforge.net/informixdb/?rev=159&view=rev Author: chaese Date: 2007-09-02 14:58:25 -0700 (Sun, 02 Sep 2007) Log Message: ----------- Make branch for Python 3.0 version Added Paths: ----------- branches/informixdb-py3k/ Copied: branches/informixdb-py3k (from rev 158, trunk/informixdb) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ch...@us...> - 2007-09-02 22:06:14
|
Revision: 160 http://informixdb.svn.sourceforge.net/informixdb/?rev=160&view=rev Author: chaese Date: 2007-09-02 15:06:12 -0700 (Sun, 02 Sep 2007) Log Message: ----------- Some necessary changes for Python 3.0 and some workarounds to quirks/bugs in Python 3.0 alpha 1. Modified Paths: -------------- branches/informixdb-py3k/ext/_informixdb.ec branches/informixdb-py3k/informixdb.py branches/informixdb-py3k/setup.py branches/informixdb-py3k/tests/dbapi20.py branches/informixdb-py3k/tests/testdbapi.py Modified: branches/informixdb-py3k/ext/_informixdb.ec =================================================================== --- branches/informixdb-py3k/ext/_informixdb.ec 2007-09-02 21:58:25 UTC (rev 159) +++ branches/informixdb-py3k/ext/_informixdb.ec 2007-09-02 22:06:12 UTC (rev 160) @@ -361,8 +361,7 @@ }; static PyTypeObject Sblob_type = { - PyObject_HEAD_INIT(DEFERRED_ADDRESS(&PyType_Type)) - 0, /* ob_size*/ + PyVarObject_HEAD_INIT(DEFERRED_ADDRESS(&PyType_Type),0) "_informixdb.Sblob", /* tp_name */ sizeof(Sblob), /* tp_basicsize */ 0, /* tp_itemsize */ @@ -400,7 +399,7 @@ (initproc)Sblob_init, /* tp_init */ DEFERRED_ADDRESS(PyType_GenericAlloc), /* tp_alloc */ DEFERRED_ADDRESS(PyType_GenericNew), /* tp_new */ - DEFERRED_ADDRESS(_PyObject_Del) /* tp_free */ + DEFERRED_ADDRESS(PyObject_Del) /* tp_free */ }; $endif; @@ -667,8 +666,7 @@ fetchmany(), fetchall(), or by iterating over the Cursor object."); static PyTypeObject Cursor_type = { - PyObject_HEAD_INIT(DEFERRED_ADDRESS(&PyType_Type)) - 0, /* ob_size*/ + PyVarObject_HEAD_INIT(DEFERRED_ADDRESS(&PyType_Type),0) "_informixdb.Cursor", /* tp_name */ sizeof(Cursor), /* tp_basicsize */ 0, /* tp_itemsize */ @@ -706,7 +704,7 @@ (initproc)Cursor_init, /* tp_init */ DEFERRED_ADDRESS(PyType_GenericAlloc), /* tp_alloc */ DEFERRED_ADDRESS(PyType_GenericNew), /* tp_new */ - DEFERRED_ADDRESS(_PyObject_Del) /* tp_free */ + DEFERRED_ADDRESS(PyObject_Del) /* tp_free */ }; static void doCloseCursor(Cursor *cur, int doFree); @@ -927,8 +925,7 @@ informixdb.connect() method instead."); static PyTypeObject Connection_type = { - PyObject_HEAD_INIT(DEFERRED_ADDRESS(&PyType_Type)) - 0, /* ob_size*/ + PyVarObject_HEAD_INIT(DEFERRED_ADDRESS(&PyType_Type),0) "_informixdb.Connection", /* tp_name */ sizeof(Connection), /* tp_basicsize */ 0, /* tp_itemsize */ @@ -966,7 +963,7 @@ (initproc)Connection_init, /* tp_init */ DEFERRED_ADDRESS(PyType_GenericAlloc), /* tp_alloc */ DEFERRED_ADDRESS(PyType_GenericNew), /* tp_new */ - DEFERRED_ADDRESS(_PyObject_Del) /* tp_free */ + DEFERRED_ADDRESS(PyObject_Del) /* tp_free */ }; static PyObject *dberror_type(PyObject *override); @@ -1092,7 +1089,7 @@ Py_XDECREF(self->messages); Py_XDECREF(self->errorhandler); - self->ob_type->tp_free((PyObject*)self); + Py_Type(self)->tp_free((PyObject*)self); } /* If this connection has transactions, commit and @@ -2689,7 +2686,7 @@ free(self->cursorName); } - self->ob_type->tp_free((PyObject*)self); + Py_Type(self)->tp_free((PyObject*)self); } static PyObject *Cursor_close(Cursor *self) @@ -3443,7 +3440,7 @@ PyObject *s,*val; char *str; - val = self->values->ob_type->tp_repr(self->values); + val = Py_Type(self->values)->tp_repr(self->values); if (!val) return NULL; str = PyString_AsString(val); @@ -3456,7 +3453,7 @@ PyObject* DBAPIType_str(DBAPIType* self) { - return self->values->ob_type->tp_repr(self->values); + return Py_Type(self->values)->tp_repr(self->values); } PyDoc_STRVAR(DBAPIType_doc, @@ -3474,8 +3471,7 @@ 1"); static PyTypeObject DBAPIType_type = { - PyObject_HEAD_INIT(DEFERRED_ADDRESS(&PyType_Type)) - 0, /* ob_size*/ + PyVarObject_HEAD_INIT(DEFERRED_ADDRESS(&PyType_Type),0) "_informixdb.DBAPIType", /* tp_name */ sizeof(DBAPIType), /* tp_basicsize */ 0, /* tp_itemsize */ @@ -3513,7 +3509,7 @@ (initproc)DBAPIType_init, /* tp_init */ DEFERRED_ADDRESS(PyType_GenericAlloc), /* tp_alloc */ DEFERRED_ADDRESS(PyType_GenericNew), /* tp_new */ - DEFERRED_ADDRESS(_PyObject_Del) /* tp_free */ + DEFERRED_ADDRESS(PyObject_Del) /* tp_free */ }; static PyObject* dbtp_create(char* types[]) @@ -3769,7 +3765,7 @@ self->lo_spec = NULL; } Py_XDECREF(self->conn); - self->ob_type->tp_free((PyObject*)self); + Py_Type(self)->tp_free((PyObject*)self); } static PyObject *Sblob_close(Sblob *self) { @@ -4139,9 +4135,9 @@ Py_DECREF(d); \ PyModule_AddObject(m, #name, Exc##name); \ } while(0); - defException(Warning, PyExc_StandardError); + defException(Warning, PyExc_Exception); setupdb_error(ExcWarning); - defException(Error, PyExc_StandardError); + defException(Error, PyExc_Exception); defException(InterfaceError, ExcError); defException(DatabaseError, ExcError); setupdb_error(ExcDatabaseError); @@ -4153,18 +4149,18 @@ defException(NotSupportedError, ExcDatabaseError); #undef defException - Cursor_type.ob_type = &PyType_Type; + Py_Type(&Cursor_type) = &PyType_Type; Cursor_type.tp_alloc = PyType_GenericAlloc; Cursor_type.tp_new = PyType_GenericNew; - Cursor_type.tp_free = _PyObject_Del; - Connection_type.ob_type = &PyType_Type; + Cursor_type.tp_free = PyObject_Del; + Py_Type(&Connection_type) = &PyType_Type; Connection_type.tp_alloc = PyType_GenericAlloc; Connection_type.tp_new = PyType_GenericNew; - Connection_type.tp_free = _PyObject_Del; - DBAPIType_type.ob_type = &PyType_Type; + Connection_type.tp_free = PyObject_Del; + Py_Type(&DBAPIType_type) = &PyType_Type; DBAPIType_type.tp_alloc = PyType_GenericAlloc; DBAPIType_type.tp_new = PyType_GenericNew; - DBAPIType_type.tp_free = _PyObject_Del; + DBAPIType_type.tp_free = PyObject_Del; Connection_getseters[0].closure = ExcWarning; Connection_getseters[1].closure = ExcError; @@ -4182,10 +4178,10 @@ PyType_Ready(&DBAPIType_type); $ifdef HAVE_ESQL9; - Sblob_type.ob_type = &PyType_Type; + Py_Type(&Sblob_type) = &PyType_Type; Sblob_type.tp_alloc = PyType_GenericAlloc; Sblob_type.tp_new = PyType_GenericNew; - Sblob_type.tp_free = _PyObject_Del; + Sblob_type.tp_free = PyObject_Del; PyType_Ready(&Sblob_type); Py_INCREF(&Sblob_type); $endif; Modified: branches/informixdb-py3k/informixdb.py =================================================================== --- branches/informixdb-py3k/informixdb.py 2007-09-02 21:58:25 UTC (rev 159) +++ branches/informixdb-py3k/informixdb.py 2007-09-02 22:06:12 UTC (rev 160) @@ -88,7 +88,7 @@ try: date2 = datetime.date(y+y2,m2+1,d) except ValueError: - raise ValueError, "month arithmetic yielded an invalid date." + raise ValueError("month arithmetic yielded an invalid date.") # apply the resulting timedelta to the operand return other + (date2 - otherdate) else: return NotImplemented @@ -153,12 +153,12 @@ class Cursor(_Cursor): __doc__ = _Cursor.__doc__ def __new__(self, *args, **kwargs): - raise InterfaceError, "Use Connection.cursor() to instantiate a cursor." + raise InterfaceError("Use Connection.cursor() to instantiate a cursor.") del _Cursor class Connection(_Connection): __doc__ = _Connection.__doc__ def __new__(self, *args, **kwargs): - raise InterfaceError, "Use connect() to instantiate a connection." + raise InterfaceError("Use connect() to instantiate a connection.") del _Connection try: # Same for Sblobs if we have support for them in _informixdb @@ -166,6 +166,6 @@ class Sblob(_Sblob): __doc__ = _Sblob.__doc__ def __new__(self, *args, **kwargs): - raise InterfaceError, "Use Connection.Sblob() to instantiate an Sblob." + raise InterfaceError("Use Connection.Sblob() to instantiate an Sblob.") del _Sblob except: pass Modified: branches/informixdb-py3k/setup.py =================================================================== --- branches/informixdb-py3k/setup.py 2007-09-02 21:58:25 UTC (rev 159) +++ branches/informixdb-py3k/setup.py 2007-09-02 22:06:12 UTC (rev 160) @@ -64,7 +64,8 @@ esqlver = re.compile(r"(IBM)?.*ESQL Version (\d+)\.(\d+)") cout = os.popen(' '.join(self.esql_parts[0:1] + [ '-V' ]),'r') esqlversion = None - for line in cout: + # result from os.popen is not iterable in Python 3.0a1, workaround + for line in cout.read().split("\n"): matchobj = esqlver.match(line) if matchobj: matchgroups = matchobj.groups() @@ -89,9 +90,9 @@ token = token[1:-1] esql_config.append(token) ret = cout.close() - if ret != None: - raise DistutilsSetupError, \ - "\nCan't find esql. Please set INFORMIXDIR correctly." + if ret != None and ret != 0: + raise DistutilsSetupError( + "\nCan't find esql. Please set INFORMIXDIR correctly.") if get_platform()=="win32": for arg in esql_config: @@ -135,7 +136,7 @@ dir = os.path.dirname(file) f = os.path.basename(file) cmd = ' '.join(self.esql_parts + [ '-e', f ]) - print cmd + print (cmd) curdir = os.getcwd() os.chdir(dir) Modified: branches/informixdb-py3k/tests/dbapi20.py =================================================================== --- branches/informixdb-py3k/tests/dbapi20.py 2007-09-02 21:58:25 UTC (rev 159) +++ branches/informixdb-py3k/tests/dbapi20.py 2007-09-02 22:06:12 UTC (rev 160) @@ -205,8 +205,8 @@ def test_Exceptions(self): # Make sure required exceptions exist, and are in the # defined heirarchy. - self.failUnless(issubclass(self.driver.Warning,StandardError)) - self.failUnless(issubclass(self.driver.Error,StandardError)) + self.failUnless(issubclass(self.driver.Warning,Exception)) + self.failUnless(issubclass(self.driver.Error,Exception)) self.failUnless( issubclass(self.driver.InterfaceError,self.driver.Error) ) @@ -734,7 +734,7 @@ that returns two result sets, first the number of rows in booze then "name from booze" ''' - raise NotImplementedError,'Helper not implemented' + raise NotImplementedError('Helper not implemented') #sql=""" # create procedure deleteme as # begin @@ -746,7 +746,7 @@ def help_nextset_tearDown(self,cur): 'If cleaning up is needed after nextSetTest' - raise NotImplementedError,'Helper not implemented' + raise NotImplementedError('Helper not implemented') #cur.execute("drop procedure deleteme") def test_nextset(self): @@ -779,7 +779,7 @@ con.close() def test_nextset(self): - raise NotImplementedError,'Drivers need to override this test' + raise NotImplementedError('Drivers need to override this test') def test_arraysize(self): # Not much here - rest of the tests for this are in test_fetchmany @@ -814,7 +814,7 @@ def test_setoutputsize(self): # Real test for setoutputsize is driver dependant - raise NotImplementedError,'Driver need to override this test' + raise NotImplementedError('Driver need to override this test') def test_None(self): con = self._connect() Modified: branches/informixdb-py3k/tests/testdbapi.py =================================================================== --- branches/informixdb-py3k/tests/testdbapi.py 2007-09-02 21:58:25 UTC (rev 159) +++ branches/informixdb-py3k/tests/testdbapi.py 2007-09-02 22:06:12 UTC (rev 160) @@ -2,7 +2,7 @@ import dbapi20 import unittest import informixdb -import popen2 +#import popen2 class TestDBAPI(dbapi20.DatabaseAPI20Test): driver = informixdb @@ -39,11 +39,13 @@ con = self._connect() con.close() except: - cmd = "dbaccess" - cout,cin = popen2.popen2(cmd) - cin.write('create database ifxtest') - cin.close() - cout.read() + pass + # popen2 doesn't exist (yet?) in Python 3.0a1 + #cmd = "dbaccess" + #cout,cin = popen2.popen2(cmd) + #cin.write('create database ifxtest') + #cin.close() + #cout.read() con = self._connect() try: @@ -63,7 +65,7 @@ try: c = con.cursor() c.execute("SELECT * MORF SYNTAXERROR"); - except self.driver.DatabaseError, e: + except self.driver.DatabaseError as e: # this are not really whitebox tests anymore, but handy # anyway self.assertEqual(e.sqlcode, -201, @@ -85,32 +87,32 @@ it = iter(cur) - # it.next() should raise an Error if called before + # it.__next__() should raise an Error if called before # executing a select-type query - self.assertRaises(self.driver.Error, it.next) + self.assertRaises(self.driver.Error, it.__next__) # it.fetchone should raise an Error if called after # executing a query that cannnot return rows self.executeDDL1(cur) - self.assertRaises(self.driver.Error, it.next) + self.assertRaises(self.driver.Error, it.__next__) # it.fetchone should raise an Error if called after # executing a query that cannnot return rows cur.execute("insert into %sbooze values ('Victoria Bitter')" % ( self.table_prefix )) - self.assertRaises(self.driver.Error,it.next) + self.assertRaises(self.driver.Error,it.__next__) cur.execute('select name from %sbooze' % self.table_prefix) count = 0 for r in cur: count += 1 self.assertEqual(r[0],'Victoria Bitter', - 'iter(cursor).next retrieved incorrect data' + 'iter(cursor).__next__ retrieved incorrect data' ) self.assertEqual(count, 1, - 'iter(cursor).next should have retrieved a single row' + 'iter(cursor).__next__ should have retrieved a single row' ) finally: con.close() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <da...@us...> - 2007-08-13 07:26:42
|
Revision: 158 http://informixdb.svn.sourceforge.net/informixdb/?rev=158&view=rev Author: dansme Date: 2007-08-13 00:26:41 -0700 (Mon, 13 Aug 2007) Log Message: ----------- Change comment to old-style to make old ESQL versions (7.24.UC8) happy Modified Paths: -------------- trunk/informixdb/ext/_informixdb.ec Modified: trunk/informixdb/ext/_informixdb.ec =================================================================== --- trunk/informixdb/ext/_informixdb.ec 2007-06-17 13:59:35 UTC (rev 157) +++ trunk/informixdb/ext/_informixdb.ec 2007-08-13 07:26:41 UTC (rev 158) @@ -1955,7 +1955,7 @@ self->op = op; Py_INCREF(op); - // No INCREF because the callers don't DECREF. + /* No INCREF because the callers don't DECREF. */ return Py_None; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ch...@us...> - 2007-06-17 13:59:33
|
Revision: 157 http://informixdb.svn.sourceforge.net/informixdb/?rev=157&view=rev Author: chaese Date: 2007-06-17 06:59:35 -0700 (Sun, 17 Jun 2007) Log Message: ----------- test subversion: update year in copyright notice Modified Paths: -------------- trunk/informixdb/COPYRIGHT Modified: trunk/informixdb/COPYRIGHT =================================================================== --- trunk/informixdb/COPYRIGHT 2007-06-17 03:06:18 UTC (rev 156) +++ trunk/informixdb/COPYRIGHT 2007-06-17 13:59:35 UTC (rev 157) @@ -1,6 +1,6 @@ Copyright (c) 1997 by IV DocEye AB Copyright (c) 1999 by Stephen J. Turner - Copyright (c) 2005 by Carsten Haese + Copyright (c) 2007 by Carsten Haese By obtaining, using, and/or copying this software and/or its associated documentation, you agree that you have read, understood, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: Carsten H. <ch...@us...> - 2007-06-17 03:06:21
|
Update of /cvsroot/informixdb/informixdb/ext In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv9732/ext Modified Files: _informixdb.ec Log Message: correct input binding of timestamps with nonzero usec part less than .1 Index: _informixdb.ec =================================================================== RCS file: /cvsroot/informixdb/informixdb/ext/_informixdb.ec,v retrieving revision 1.91 retrieving revision 1.92 diff -C2 -d -r1.91 -r1.92 *** _informixdb.ec 17 Jun 2007 02:57:12 -0000 1.91 --- _informixdb.ec 17 Jun 2007 03:06:18 -0000 1.92 *************** *** 1312,1316 **** dt = (dtime_t*)malloc(sizeof(dtime_t)); dt->dt_qual = TU_DTENCODE(TU_YEAR, TU_F5); ! snprintf(buf, sizeof(buf), "%d-%d-%d %d:%d:%d.%d", year, month, day, hour, minute, second, usec/10); if ((ret = dtcvasc(buf, dt)) != 0) { --- 1312,1316 ---- dt = (dtime_t*)malloc(sizeof(dtime_t)); dt->dt_qual = TU_DTENCODE(TU_YEAR, TU_F5); ! snprintf(buf, sizeof(buf), "%d-%d-%d %d:%d:%d.%05d", year, month, day, hour, minute, second, usec/10); if ((ret = dtcvasc(buf, dt)) != 0) { |
From: Carsten H. <ch...@us...> - 2007-06-17 02:59:21
|
Update of /cvsroot/informixdb/informixdb/ext In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv5442/ext Modified Files: _informixdb.ec Log Message: Correct unit test failure in roundtrip of Time-only datetime value: Only read the datetime parts that are part of the value. Index: _informixdb.ec =================================================================== RCS file: /cvsroot/informixdb/informixdb/ext/_informixdb.ec,v retrieving revision 1.90 retrieving revision 1.91 diff -C2 -d -r1.90 -r1.91 *** _informixdb.ec 11 Jun 2007 00:44:36 -0000 1.90 --- _informixdb.ec 17 Jun 2007 02:57:12 -0000 1.91 *************** *** 2205,2218 **** int i, pos; int year=1,month=1,day=1,hour=0,minute=0,second=0,usec=0; ! dtime_t* dt = (dtime_t*)data; exec sql begin declare section; datetime year to fraction(5) dt_extended; exec sql end declare section; dtextend(dt, &dt_extended); dt = &dt_extended; for (pos = 0, i = TU_START(dt->dt_qual); i <= TU_END(dt->dt_qual) && pos < dt->dt_dec.dec_ndgts; ++i) { switch (i) { case TU_YEAR: --- 2205,2229 ---- int i, pos; int year=1,month=1,day=1,hour=0,minute=0,second=0,usec=0; ! dtime_t* dt = (dtime_t*)data, *origdt; exec sql begin declare section; datetime year to fraction(5) dt_extended; exec sql end declare section; + origdt = dt; dtextend(dt, &dt_extended); dt = &dt_extended; + for (pos = 0, i = TU_START(dt->dt_qual); i <= TU_END(dt->dt_qual) && pos < dt->dt_dec.dec_ndgts; ++i) { + if (i<TU_START(origdt->dt_qual)||i>TU_END(origdt->dt_qual)) { + switch (i) { + case TU_YEAR: pos++; + case TU_MONTH: case TU_DAY: case TU_HOUR: + case TU_MINUTE: case TU_SECOND: case TU_F1: case TU_F3: + case TU_F5: pos++; + } + continue; + } switch (i) { case TU_YEAR: |
From: Carsten H. <ch...@us...> - 2007-06-11 00:44:40
|
Update of /cvsroot/informixdb/informixdb/ext In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv28857 Modified Files: _informixdb.ec Log Message: reprepare insert statement when switching from insert cursor to single execution Index: _informixdb.ec =================================================================== RCS file: /cvsroot/informixdb/informixdb/ext/_informixdb.ec,v retrieving revision 1.89 retrieving revision 1.90 diff -C2 -d -r1.89 -r1.90 *** _informixdb.ec 2 Jun 2007 14:50:39 -0000 1.89 --- _informixdb.ec 11 Jun 2007 00:44:36 -0000 1.90 *************** *** 2005,2008 **** --- 2005,2016 ---- if (setConnection(self->conn)) return NULL; + /* If an insert statement was used by an insert cursor, it must be + reprepared for single execution */ + if (self->op==op && self->stype==SQ_INSERT && self->state > 1) { + Py_DECREF(self->op); + self->op = Py_None; + Py_INCREF(Py_None); + } + if (!do_prepare(self, op)) { return NULL; |
From: Carsten H. <ch...@us...> - 2007-06-02 14:50:49
|
Update of /cvsroot/informixdb/informixdb/ext In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv10819 Modified Files: _informixdb.ec Log Message: Skip comments in scan for parameter markers Index: _informixdb.ec =================================================================== RCS file: /cvsroot/informixdb/informixdb/ext/_informixdb.ec,v retrieving revision 1.88 retrieving revision 1.89 diff -C2 -d -r1.88 -r1.89 *** _informixdb.ec 22 Mar 2007 21:06:54 -0000 1.88 --- _informixdb.ec 2 Jun 2007 14:50:39 -0000 1.89 *************** *** 1190,1193 **** --- 1190,1197 ---- if ((ch == '\'') || (ch == '"')) { ct->state = ch; + } else if (ch == '-' && ct->prev=='-') { + ct->state = '\n'; + } else if (ch == '{') { + ct->state = '}'; } else if (ch == '?') { ct->parmIdx = ct->parmCount; |
From: Carsten H. <ch...@us...> - 2007-03-22 21:07:19
|
Update of /cvsroot/informixdb/informixdb/ext In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv17281 Modified Files: _informixdb.ec Log Message: Fix bogus results from reading DATETIME HOUR TO SECOND columns with leading double-zeroes. Thanks to rad...@us... for reporting this issue. Index: _informixdb.ec =================================================================== RCS file: /cvsroot/informixdb/informixdb/ext/_informixdb.ec,v retrieving revision 1.87 retrieving revision 1.88 diff -C2 -d -r1.87 -r1.88 *** _informixdb.ec 29 Dec 2006 03:43:36 -0000 1.87 --- _informixdb.ec 22 Mar 2007 21:06:54 -0000 1.88 *************** *** 2194,2197 **** --- 2194,2203 ---- int year=1,month=1,day=1,hour=0,minute=0,second=0,usec=0; dtime_t* dt = (dtime_t*)data; + exec sql begin declare section; + datetime year to fraction(5) dt_extended; + exec sql end declare section; + + dtextend(dt, &dt_extended); + dt = &dt_extended; for (pos = 0, i = TU_START(dt->dt_qual); i <= TU_END(dt->dt_qual) && pos < dt->dt_dec.dec_ndgts; |
From: Carsten H. <ch...@us...> - 2007-02-16 03:45:20
|
Update of /cvsroot/informixdb/informixdb In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv30769 Modified Files: setup.py Log Message: make esql version check compatible with IBM Informix CSDK 3.00 Index: setup.py =================================================================== RCS file: /cvsroot/informixdb/informixdb/setup.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** setup.py 23 Dec 2006 05:34:48 -0000 1.16 --- setup.py 16 Feb 2007 03:45:18 -0000 1.17 *************** *** 71,77 **** esqlversion = int(matchgroups[1] + matchgroups[2]) if matchgroups[0]=="IBM": ! # IBM Informix CSDK 2.90 reports the ESQL version as 2.90 ! # even though it's ESQL 9.xx ! if esqlversion == 290: esqlversion = 960 if esqlversion==None: esqlversion = 850 --- 71,76 ---- esqlversion = int(matchgroups[1] + matchgroups[2]) if matchgroups[0]=="IBM": ! # Assume ESQL 9.xx for any IBM branded CSDK. ! esqlversion = 960 if esqlversion==None: esqlversion = 850 |
From: Carsten H. <ch...@us...> - 2006-12-29 03:43:45
|
Update of /cvsroot/informixdb/informixdb/ext In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv29363/ext Modified Files: _informixdb.ec Log Message: Fix a rare "bogus free()" bug that was uncovered by a fuzz test from http://seclists.org/fulldisclosure/2006/Dec/0190.html Index: _informixdb.ec =================================================================== RCS file: /cvsroot/informixdb/informixdb/ext/_informixdb.ec,v retrieving revision 1.86 retrieving revision 1.87 diff -C2 -d -r1.86 -r1.87 *** _informixdb.ec 23 Dec 2006 05:40:14 -0000 1.86 --- _informixdb.ec 29 Dec 2006 03:43:36 -0000 1.87 *************** *** 2571,2575 **** } $ifdef HAVE_ESQL9; ! if (ISSMARTBLOB(da->sqlvar[i].sqltype,da->sqlvar[i].sqlxid)) { free(da->sqlvar[i].sqldata); } --- 2571,2575 ---- } $ifdef HAVE_ESQL9; ! if (ISSMARTBLOB(cur->originalType[i],cur->originalXid[i])) { free(da->sqlvar[i].sqldata); } |
From: Carsten H. <ch...@us...> - 2006-12-23 05:40:17
|
Update of /cvsroot/informixdb/informixdb/ext In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv14305/ext Modified Files: _informixdb.ec Log Message: - experimental support for SQL query interrupt and timeout - check existence of decimal module at run time - make executemany and fetchmany/fetchall interruptible - fetchall "only" fetched the next MAXINT rows. Probably didn't affect anybody, but it's not hard to really fetch all rows. Index: _informixdb.ec =================================================================== RCS file: /cvsroot/informixdb/informixdb/ext/_informixdb.ec,v retrieving revision 1.85 retrieving revision 1.86 diff -C2 -d -r1.85 -r1.86 *** _informixdb.ec 2 Dec 2006 03:22:22 -0000 1.85 --- _informixdb.ec 23 Dec 2006 05:40:14 -0000 1.86 *************** *** 113,116 **** --- 113,117 ---- */ #define DEFERRED_ADDRESS(ADDR) 0 + #include <signal.h> /************************* Error handling *************************/ *************** *** 130,136 **** static PyObject *IntervalD2FType; static PyObject *DataRowType; - #if HAVE_DECIMAL == 1 static PyObject *DecimalType; - #endif PyDoc_STRVAR(ExcWarning_doc, --- 131,135 ---- *************** *** 442,448 **** int pending_scroll; int scroll_value; - #if HAVE_DECIMAL == 1 int use_decimal; - #endif PyObject *messages; PyObject *errorhandler; --- 441,445 ---- *************** *** 450,453 **** --- 447,452 ---- PyObject *named_params; int have_named_params; + int sqltimeout; + int allow_interrupt; } Cursor; *************** *** 643,646 **** --- 642,649 ---- { "binary_types", T_OBJECT_EX, offsetof(Cursor, binary_types), READONLY, Cursor_binary_types_doc }, + { "sqltimeout", T_INT, offsetof(Cursor, sqltimeout), 0, + "SQL query timeout in milliseconds." }, + { "allow_interrupt", T_INT, offsetof(Cursor, allow_interrupt), 0, + "Indicates if SIGINT interrupts SQL queries." }, { NULL } }; *************** *** 1861,1864 **** --- 1864,1877 ---- } + static void _sqltimeouthandler(mint status) + { + if (status==2) { sqlbreak(); } + } + + static void _sigint_sqlbreak(int sig) + { + sqlbreak(); + } + static PyObject *do_prepare(Cursor *self, PyObject *op) { *************** *** 1973,1977 **** char *cursorName = self->cursorName; EXEC SQL END DECLARE SECTION; ! clear_messages(self); require_cursor_open(self); --- 1986,1992 ---- char *cursorName = self->cursorName; EXEC SQL END DECLARE SECTION; ! void (*oldsighandler)(int); ! ! oldsighandler = NULL; clear_messages(self); require_cursor_open(self); *************** *** 1994,1999 **** --- 2009,2026 ---- if (self->has_output) { + Py_BEGIN_ALLOW_THREADS; + if (self->sqltimeout>0) { + sqlbreakcallback(self->sqltimeout, _sqltimeouthandler); + } + if (self->allow_interrupt) { + oldsighandler = signal(2, _sigint_sqlbreak); + } EXEC SQL OPEN :cursorName USING DESCRIPTOR tdaIn; + if (self->allow_interrupt) { + signal(2, oldsighandler); + } + Py_END_ALLOW_THREADS; ret_on_dberror_cursor(self, "OPEN"); + sqlbreakcallback(-1, (void*)NULL); self->state = 3; *************** *** 2004,2010 **** --- 2031,2047 ---- } else { Py_BEGIN_ALLOW_THREADS; + if (self->sqltimeout>0) { + sqlbreakcallback(self->sqltimeout, _sqltimeouthandler); + } + if (self->allow_interrupt) { + oldsighandler = signal(2, _sigint_sqlbreak); + } EXEC SQL EXECUTE :queryName USING DESCRIPTOR tdaIn; + if (self->allow_interrupt) { + signal(2, oldsighandler); + } Py_END_ALLOW_THREADS; ret_on_dberror_cursor(self, "EXECUTE"); + sqlbreakcallback(-1, (void*)NULL); for (i=0; i<6; i++) self->sqlerrd[i] = sqlca.sqlerrd[i]; *************** *** 2122,2125 **** --- 2159,2165 ---- } Py_DECREF(inputvars); + if (PyErr_CheckSignals()) { + return NULL; + } } Py_DECREF(paramiter); *************** *** 2275,2279 **** case SQLDECIMAL: case SQLMONEY: - #if HAVE_DECIMAL == 1 if (cur->use_decimal) { char dbuf[35]; --- 2315,2318 ---- *************** *** 2281,2284 **** --- 2320,2327 ---- mint right; PyObject *retval = NULL; + if (DecimalType==Py_None) { + PyErr_SetString(PyExc_ImportError, "can't find decimal.Decimal"); + return NULL; + } right = PRECDEC(sqllen); if (right==255) right = -1; *************** *** 2293,2299 **** } return retval; ! } else ! #endif ! { double dval; dectodbl((dec_t*)data, &dval); --- 2336,2341 ---- } return retval; ! } ! else { double dval; dectodbl((dec_t*)data, &dval); *************** *** 2655,2674 **** int is_scroll = 0; int is_hold = 0; - #if HAVE_DECIMAL == 1 int use_decimal = 1; static char* kwdlist[] = { "connection", "name", "rowformat", ! "scroll", "hold", "use_decimal", 0 }; ! if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O!|siiii", kwdlist, &Connection_type, &conn, &name, &rowformat, &is_scroll, &is_hold, ! &use_decimal)) return -1; self->use_decimal = (use_decimal)?1:0; ! #else ! static char* kwdlist[] = { "connection", "name", "rowformat", ! "scroll", "hold", 0 }; ! if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O!|siii", kwdlist, ! &Connection_type, &conn, &name, &rowformat, &is_scroll, &is_hold)) ! return -1; ! #endif Py_INCREF(Py_None); --- 2697,2714 ---- int is_scroll = 0; int is_hold = 0; int use_decimal = 1; + int sqltimeout = 0; + int allow_interrupt = 0; static char* kwdlist[] = { "connection", "name", "rowformat", ! "scroll", "hold", "use_decimal", ! "sqltimeout", "allow_interrupt", 0 }; ! if (DecimalType==Py_None) { use_decimal = 0; } ! if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O!|siiiiii", kwdlist, &Connection_type, &conn, &name, &rowformat, &is_scroll, &is_hold, ! &use_decimal, &sqltimeout, &allow_interrupt)) return -1; self->use_decimal = (use_decimal)?1:0; ! self->sqltimeout = sqltimeout; ! self->allow_interrupt = allow_interrupt; Py_INCREF(Py_None); *************** *** 2742,2745 **** --- 2782,2787 ---- struct sqlda *tdaOut = self->daOut; int i; + void (*oldsighandler)(int); + oldsighandler = NULL; EXEC SQL BEGIN DECLARE SECTION; *************** *** 2756,2759 **** --- 2798,2807 ---- Py_BEGIN_ALLOW_THREADS; + if (self->sqltimeout>0) { + sqlbreakcallback(self->sqltimeout, _sqltimeouthandler); + } + if (self->allow_interrupt) { + oldsighandler = signal(2, _sigint_sqlbreak); + } if (self->is_scroll) { exec sql begin declare section; *************** *** 2778,2781 **** --- 2826,2832 ---- EXEC SQL FETCH :cursorName USING DESCRIPTOR tdaOut; } + if (self->allow_interrupt) { + signal(2, oldsighandler); + } Py_END_ALLOW_THREADS; for (i=0; i<6; i++) *************** *** 2787,2790 **** --- 2838,2842 ---- ret_on_dberror_cursor(self, "FETCH"); } + sqlbreakcallback(-1,(void*)NULL); return processOutput(self); } *************** *** 2796,2800 **** require_cursor_open(self); ! while ( count-- > 0 ) { PyObject *entry = Cursor_fetchone(self); --- 2848,2852 ---- require_cursor_open(self); ! while ( count==-1 || count-- > 0 ) { PyObject *entry = Cursor_fetchone(self); *************** *** 2819,2822 **** --- 2871,2878 ---- Py_DECREF(entry); + + if (PyErr_CheckSignals()) { + return NULL; + } } *************** *** 2833,2842 **** return NULL; ! return fetchCounted(self, n_rows); } static PyObject *Cursor_fetchall(Cursor *self) { ! return fetchCounted(self, INT_MAX); } --- 2889,2903 ---- return NULL; ! if (n_rows<1) { ! return PyList_New(0); ! } ! else { ! return fetchCounted(self, n_rows); ! } } static PyObject *Cursor_fetchall(Cursor *self) { ! return fetchCounted(self, -1); } *************** *** 4172,4176 **** PyDateTime_IMPORT; - #if HAVE_DECIMAL DecimalType = NULL; module = PyImport_ImportModule("decimal"); --- 4233,4236 ---- *************** *** 4183,4190 **** if (!DecimalType) { DecimalType = Py_None; ! PyErr_SetString(PyExc_ImportError, "can't find decimal.Decimal"); } Py_INCREF(DecimalType); - #endif #ifndef _WIN32 --- 4243,4249 ---- if (!DecimalType) { DecimalType = Py_None; ! PyErr_Clear(); } Py_INCREF(DecimalType); #ifndef _WIN32 |
From: Carsten H. <ch...@us...> - 2006-12-23 05:34:49
|
Update of /cvsroot/informixdb/informixdb In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv14288 Modified Files: setup.py Log Message: don't test for decimal module at compile time anymore Index: setup.py =================================================================== RCS file: /cvsroot/informixdb/informixdb/setup.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** setup.py 11 Nov 2006 22:36:39 -0000 1.15 --- setup.py 23 Dec 2006 05:34:48 -0000 1.16 *************** *** 176,190 **** return 0 - def have_decimal(): - try: - import decimal - return 1 - except: - return 0 - extra_macros = [('PYTHON_INCLUDE', get_python_inc(plat_specific=1)), ('HAVE_C_DATETIME', have_c_datetime()), ! ('HAVE_PY_BOOL', have_py_bool()), ! ('HAVE_DECIMAL', have_decimal()) ] modules = [ 'informixdb' ] --- 176,182 ---- return 0 extra_macros = [('PYTHON_INCLUDE', get_python_inc(plat_specific=1)), ('HAVE_C_DATETIME', have_c_datetime()), ! ('HAVE_PY_BOOL', have_py_bool()) ] modules = [ 'informixdb' ] |
From: Carsten H. <ch...@us...> - 2006-12-02 03:22:25
|
Update of /cvsroot/informixdb/informixdb/ext In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv4797/ext Modified Files: _informixdb.ec Log Message: Guard against not passing a parameter mapping for queries with named parameters. Index: _informixdb.ec =================================================================== RCS file: /cvsroot/informixdb/informixdb/ext/_informixdb.ec,v retrieving revision 1.84 retrieving revision 1.85 diff -C2 -d -r1.84 -r1.85 *** _informixdb.ec 2 Dec 2006 02:40:19 -0000 1.84 --- _informixdb.ec 2 Dec 2006 03:22:22 -0000 1.85 *************** *** 1588,1592 **** as the parameter mapping. */ ! if (vars && !PyMapping_Check(vars)) { PyErr_SetString(PyExc_TypeError, "SQL parameters are not a mapping"); return 0; --- 1588,1596 ---- as the parameter mapping. */ ! if (!vars) { ! PyErr_SetString(PyExc_TypeError, "SQL parameters must be supplied"); ! return 0; ! } ! if (!PyMapping_Check(vars)) { PyErr_SetString(PyExc_TypeError, "SQL parameters are not a mapping"); return 0; |
From: Carsten H. <ch...@us...> - 2006-12-02 02:40:22
|
Update of /cvsroot/informixdb/informixdb/ext In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv20636/ext Modified Files: _informixdb.ec Log Message: cheap performance enhancement Index: _informixdb.ec =================================================================== RCS file: /cvsroot/informixdb/informixdb/ext/_informixdb.ec,v retrieving revision 1.83 retrieving revision 1.84 diff -C2 -d -r1.83 -r1.84 *** _informixdb.ec 2 Dec 2006 02:30:46 -0000 1.83 --- _informixdb.ec 2 Dec 2006 02:40:19 -0000 1.84 *************** *** 449,452 **** --- 449,453 ---- PyObject *binary_types; PyObject *named_params; + int have_named_params; } Cursor; *************** *** 1558,1561 **** --- 1559,1563 ---- return 0; } + cur->have_named_params = have_named; if (ctx.parmCount == 0) { *************** *** 1579,1589 **** int i; ! if (PyList_Size(cur->named_params)) { ! /* If cur->named_params is not empty, the statement is using named ! parameters, so the vars must be supplied in a mapping. ! Note that we allow the vars mapping to contain more keys ! than the statement needs. This is analogous to string%dict ! interpolation, and it allows passing locals() as the parameter ! mapping. */ if (vars && !PyMapping_Check(vars)) { --- 1581,1590 ---- int i; ! if (cur->have_named_params) { ! /* If the statement is using named parameters, the vars must be ! supplied in a mapping. Note that we allow the vars mapping to ! contain more keys than the statement needs. This is analogous ! to string%dict interpolation, and it allows passing locals() ! as the parameter mapping. */ if (vars && !PyMapping_Check(vars)) { *************** *** 2701,2704 **** --- 2702,2706 ---- self->binary_types = PyDict_Copy(conn->binary_types); self->named_params = PyList_New(0); + self->have_named_params = 0; self->errorhandler = conn->errorhandler; Py_INCREF(self->errorhandler); |
From: Carsten H. <ch...@us...> - 2006-12-02 02:30:48
|
Update of /cvsroot/informixdb/informixdb/ext In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv14758/ext Modified Files: _informixdb.ec Log Message: - Fix segfault caused by improper connect() arguments - Allow providing None for username and password as an alternative to not providing them at all. Index: _informixdb.ec =================================================================== RCS file: /cvsroot/informixdb/informixdb/ext/_informixdb.ec,v retrieving revision 1.82 retrieving revision 1.83 diff -C2 -d -r1.82 -r1.83 *** _informixdb.ec 13 Nov 2006 15:45:59 -0000 1.82 --- _informixdb.ec 2 Dec 2006 02:30:46 -0000 1.83 *************** *** 1082,1086 **** setConnectionName(NULL); ! PyDict_Clear(self->binary_types); Py_XDECREF(self->binary_types); Py_XDECREF(self->messages); --- 1082,1088 ---- setConnectionName(NULL); ! if (self->binary_types) { ! PyDict_Clear(self->binary_types); ! } Py_XDECREF(self->binary_types); Py_XDECREF(self->messages); *************** *** 2979,2990 **** EXEC SQL END DECLARE SECTION; int autocommit = 0; static char* kwd_list[] = { "dsn", "user", "password", "autocommit", 0 }; ! if (!PyArg_ParseTupleAndKeywords(args, kwds, "s|ssi", kwd_list, ! &connectionString, &dbUser, &dbPass, &autocommit)) { return -1; } sprintf(self->name, "CONN%p", self); connectionName = self->name; --- 2981,3002 ---- EXEC SQL END DECLARE SECTION; int autocommit = 0; + PyObject *pyDbUser = NULL, *pyDbPass = NULL; static char* kwd_list[] = { "dsn", "user", "password", "autocommit", 0 }; ! if (!PyArg_ParseTupleAndKeywords(args, kwds, "s|OOi", kwd_list, ! &connectionString, &pyDbUser, &pyDbPass, &autocommit)) { return -1; } + if (pyDbUser && pyDbUser != Py_None) { + dbUser = PyString_AsString(pyDbUser); + if (!dbUser) return -1; + } + if (pyDbPass && pyDbPass != Py_None) { + dbPass = PyString_AsString(pyDbPass); + if (!dbPass) return -1; + } + sprintf(self->name, "CONN%p", self); connectionName = self->name; |
From: Carsten H. <ch...@us...> - 2006-12-02 02:21:48
|
Update of /cvsroot/informixdb/informixdb In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv13470 Modified Files: README Log Message: set release date Index: README =================================================================== RCS file: /cvsroot/informixdb/informixdb/README,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** README 11 Nov 2006 22:36:39 -0000 1.16 --- README 2 Dec 2006 02:21:46 -0000 1.17 *************** *** 279,283 **** 2.2 2006-03-26 Carsten Haese 2.3 2006-10-01 Carsten Haese ! 2.4 TBD Carsten Haese -- --- 279,283 ---- 2.2 2006-03-26 Carsten Haese 2.3 2006-10-01 Carsten Haese ! 2.4 2006-12-02 Carsten Haese -- |