informixdb-cvs Mailing List for InformixDB (Page 4)
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: Carsten H. <ch...@us...> - 2006-09-23 15:55:45
|
Update of /cvsroot/informixdb/informixdb In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv985 Modified Files: README Log Message: Necessary changes for Python 2.5 compatibility Index: README =================================================================== RCS file: /cvsroot/informixdb/informixdb/README,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** README 13 Sep 2006 04:13:46 -0000 1.13 --- README 23 Sep 2006 15:55:43 -0000 1.14 *************** *** 80,83 **** --- 80,84 ---- - Allow parameter list for executemany() to be arbitrary iterable objects. - .prepare() method and .command attribute for explicitly prepared statements + - Python 2.5 compatibility - Bug fixes * Rare crashes caused by missing error check in DESCRIBE step. |
From: Carsten H. <ch...@us...> - 2006-09-22 00:12:16
|
Update of /cvsroot/informixdb/informixdb/ext In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv6493/ext Modified Files: _informixdb.ec Log Message: Allow connections and cursors to be used in Python2.5+ "with" blocks. Index: _informixdb.ec =================================================================== RCS file: /cvsroot/informixdb/informixdb/ext/_informixdb.ec,v retrieving revision 1.71 retrieving revision 1.72 diff -C2 -d -r1.71 -r1.72 *** _informixdb.ec 10 Sep 2006 05:14:49 -0000 1.71 --- _informixdb.ec 22 Sep 2006 00:12:09 -0000 1.72 *************** *** 452,458 **** static PyObject* Cursor_setoutputsize(Cursor *self, PyObject *args, PyObject *kwds); static PyObject* Cursor_callproc(Cursor *self, PyObject *args, PyObject *kwds); ! static PyObject* Cursor_iter(Cursor *self); static PyObject* Cursor_iternext(Cursor *self); static PyObject *Cursor_getsqlerrd(Cursor *self, void *closure); PyDoc_STRVAR(Cursor_close_doc, --- 452,459 ---- static PyObject* Cursor_setoutputsize(Cursor *self, PyObject *args, PyObject *kwds); static PyObject* Cursor_callproc(Cursor *self, PyObject *args, PyObject *kwds); ! static PyObject* Cursor_self(Cursor *self); static PyObject* Cursor_iternext(Cursor *self); static PyObject *Cursor_getsqlerrd(Cursor *self, void *closure); + static PyObject *Cursor_exit(Cursor *self, PyObject *args); PyDoc_STRVAR(Cursor_close_doc, *************** *** 563,566 **** --- 564,573 ---- procedures."); + PyDoc_STRVAR(Cursor_enter_doc, + "__enter__() -> self."); + + PyDoc_STRVAR(Cursor_exit_doc, + "__exit__(*excinfo) -> None. Closes the cursor."); + static PyMethodDef Cursor_methods[] = { { "close", (PyCFunction)Cursor_close, METH_NOARGS, *************** *** 586,589 **** --- 593,600 ---- { "callproc", (PyCFunction)Cursor_callproc, METH_VARARGS|METH_KEYWORDS, Cursor_callproc_doc }, + { "__enter__", (PyCFunction)Cursor_self, METH_NOARGS, + Cursor_enter_doc }, + { "__exit__", (PyCFunction)Cursor_exit, METH_VARARGS, + Cursor_exit_doc }, { NULL } }; *************** *** 661,665 **** 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! (getiterfunc)Cursor_iter, /* tp_iter */ (iternextfunc)Cursor_iternext, /* tp_iternext */ Cursor_methods, /* tp_methods */ --- 672,676 ---- 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! (getiterfunc)Cursor_self, /* tp_iter */ (iternextfunc)Cursor_iternext, /* tp_iternext */ Cursor_methods, /* tp_methods */ *************** *** 706,709 **** --- 717,722 ---- static PyObject *Connection_rollback(Connection *self); static PyObject *Connection_close(Connection *self); + static PyObject *Connection_self(Connection *self); + static PyObject *Connection_exit(Connection *self, PyObject *args); $ifdef HAVE_ESQL9; static PyObject *Connection_Sblob(Connection *self, PyObject *args, PyObject *kwds); *************** *** 752,755 **** --- 765,774 ---- commit any outstanding operations before closing a Connection."); + PyDoc_STRVAR(Connection_enter_doc, + "__enter__() -> self."); + + PyDoc_STRVAR(Connection_exit_doc, + "__exit__(*excinfo) -> None. Closes the connection."); + $ifdef HAVE_ESQL9; PyDoc_STRVAR(Connection_Sblob_doc, "\ *************** *** 787,790 **** --- 806,813 ---- { "close", (PyCFunction)Connection_close, METH_NOARGS, Connection_close_doc }, + { "__enter__", (PyCFunction)Connection_self, METH_NOARGS, + Connection_enter_doc }, + { "__exit__", (PyCFunction)Connection_exit, METH_VARARGS, + Connection_exit_doc }, $ifdef HAVE_ESQL9; { "Sblob", (PyCFunction)Connection_Sblob, METH_VARARGS|METH_KEYWORDS, *************** *** 1003,1006 **** --- 1026,1044 ---- } + static PyObject *Connection_self(Connection *self) + { + Py_INCREF(self); + return (PyObject*)self; + } + + static PyObject *Connection_exit(Connection *self, PyObject *args) + { + PyObject *ret = Connection_close(self); + if (!ret) + return NULL; + Py_DECREF(ret); + Py_RETURN_NONE; + } + static void Connection_dealloc(Connection *self) { *************** *** 2419,2422 **** --- 2457,2469 ---- } + static PyObject *Cursor_exit(Cursor *self, PyObject *args) + { + PyObject *ret = Cursor_close(self); + if (!ret) + return NULL; + Py_DECREF(ret); + Py_RETURN_NONE; + } + static int Cursor_init(Cursor *self, PyObject *args, PyObject *kwargs) *************** *** 2490,2494 **** } ! static PyObject* Cursor_iter(Cursor *self) { Py_INCREF(self); --- 2537,2541 ---- } ! static PyObject* Cursor_self(Cursor *self) { Py_INCREF(self); |
From: Carsten H. <ch...@us...> - 2006-09-18 18:53:43
|
Update of /cvsroot/informixdb/informixdb In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv26620 Modified Files: setup.py Log Message: Apparently, esql on Windows uses "-ED" like all the other platforms, even though the usage string said "-ed". Index: setup.py =================================================================== RCS file: /cvsroot/informixdb/informixdb/setup.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** setup.py 13 Sep 2006 04:13:46 -0000 1.13 --- setup.py 18 Sep 2006 18:53:40 -0000 1.14 *************** *** 77,84 **** esqlversion = 850 if esqlversion >= 900: ! if get_platform()=="win32": ! self.esql_parts.append("-edHAVE_ESQL9") ! else: ! self.esql_parts.append("-EDHAVE_ESQL9") # find esql libs/objects --- 77,81 ---- esqlversion = 850 if esqlversion >= 900: ! self.esql_parts.append("-EDHAVE_ESQL9") # find esql libs/objects |
From: Carsten H. <ch...@us...> - 2006-09-13 04:13:49
|
Update of /cvsroot/informixdb/informixdb In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv730 Modified Files: README informixdb.py setup.py Log Message: Preparations for new release Index: README =================================================================== RCS file: /cvsroot/informixdb/informixdb/README,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** README 26 Mar 2006 06:34:44 -0000 1.12 --- README 13 Sep 2006 04:13:46 -0000 1.13 *************** *** 2,6 **** ============ ! This is informixdb 2.2, an Informix implementation of the Python Database API. This release implements version 2.0 of the DB-API: --- 2,6 ---- ============ ! This is informixdb 2.3, an Informix implementation of the Python Database API. This release implements version 2.0 of the DB-API: *************** *** 77,80 **** --- 77,93 ---- ==== + From 2.2 to 2.3: + - Allow parameter list for executemany() to be arbitrary iterable objects. + - .prepare() method and .command attribute for explicitly prepared statements + - Bug fixes + * Rare crashes caused by missing error check in DESCRIBE step. + * Inconsistent UDT input binding caused SQLCODE -1820 in bulk insert + (executemany) if UDT contents went back and forth across 32K size + boundary or between null and non-null. + * EXECUTE PROCEDURE erroneously attempted to open a results cursor for + procedures that don't return results. + * Date columns were read incorrectly on 64 bit platforms due to mixup + of int4 versus long. + From 2.1 to 2.2: - Support for BOOLEAN columns *************** *** 259,262 **** --- 272,276 ---- 2.1 2005-11-21 Carsten Haese 2.2 2006-03-26 Carsten Haese + 2.3 TBD Carsten Haese -- Index: setup.py =================================================================== RCS file: /cvsroot/informixdb/informixdb/setup.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** setup.py 26 Mar 2006 05:44:26 -0000 1.12 --- setup.py 13 Sep 2006 04:13:46 -0000 1.13 *************** *** 220,225 **** setup (name = 'InformixDB', ! version = '2.2', ! description = 'InformixDB v2.2', long_description = \ "InformixDB is a DB-API 2.0 compliant interface for IBM Informix\n" --- 220,225 ---- setup (name = 'InformixDB', ! version = '2.3', ! description = 'InformixDB v2.3', long_description = \ "InformixDB is a DB-API 2.0 compliant interface for IBM Informix\n" Index: informixdb.py =================================================================== RCS file: /cvsroot/informixdb/informixdb/informixdb.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** informixdb.py 20 Nov 2005 05:03:35 -0000 1.15 --- informixdb.py 13 Sep 2006 04:13:46 -0000 1.16 *************** *** 47,50 **** --- 47,52 ---- """ + version = "2.3" + class Row(object): """Helper class for cursors whose row format is ROW_AS_OBJECT.""" |
From: Carsten H. <ch...@us...> - 2006-09-13 03:28:49
|
Update of /cvsroot/informixdb/informixdb/doc In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv15997 Modified Files: manual.txt Log Message: document new features Index: manual.txt =================================================================== RCS file: /cvsroot/informixdb/informixdb/doc/manual.txt,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** manual.txt 25 Mar 2006 16:02:43 -0000 1.10 --- manual.txt 13 Sep 2006 03:28:47 -0000 1.11 *************** *** 3,9 **** ========================== ! :Authors: Daniel Smertnig ! :Version: informixdb 2.2 ! :Date: 2006-03-26 :Homepage: `InformixDB on Sourceforge`_ --- 3,9 ---- ========================== ! :Authors: Daniel Smertnig and Carsten Haese ! :Version: informixdb 2.3 ! :Date: TBD :Homepage: `InformixDB on Sourceforge`_ *************** *** 195,202 **** ---------------------------------- When `execute` is called multiple times with the same SQL statement object on the same Cursor object but different arguments the statement is prepared ! only once. `executemany` can be used to execute the same statement with different parameters multiple times. It takes a sequence of parameter-sequences as --- 195,225 ---- ---------------------------------- + Statement caching + ,,,,,,,,,,,,,,,,, When `execute` is called multiple times with the same SQL statement object on the same Cursor object but different arguments the statement is prepared ! only once. This mechanism is called statement caching. Each Cursor object ! only caches its most recent query. If you need to execute different queries ! multiple times while still making use of statement caching, you will need to ! create one cursor for each query. ! ! Note: Statement caching operates based on the identity of the statement ! string, not on the contents, because an identity check is much faster ! than an equality check. In practice this means that:: ! ! >>> cursor.execute("UPDATE names SET age = :2 WHERE last = :1", params1) ! >>> cursor.execute("UPDATE names SET age = :2 WHERE last = :1", params2) ! ! will not make use of statement caching, since each command will instantiate ! its own copy of the query string, which will result in two query strings that ! are equal to each other but not identical. To gurantee that statement caching ! is used, you need to do the following:: ! ! >>> query_string = "UPDATE names SET age = :2 WHERE last = :1" ! >>> cursor.execute(query_string, params1) ! >>> cursor.execute(query_string, params2) + executemany() + ,,,,,,,,,,,,, `executemany` can be used to execute the same statement with different parameters multiple times. It takes a sequence of parameter-sequences as *************** *** 209,212 **** --- 232,261 ---- ... ) + `(New in version 2.3)`: In earlier versions, the parameter list for + `executemany` had to be a true sequence (i.e. list or tuple) of sequences. + Beginning with version 2.3, it is allowed to be any iterable object that + yields sequences. + + Explicitly prepared statements + ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, + `(new in version 2.3)` + + The method `Cursor.prepare` explicitly prepares a query for subsequent + execution by the same cursor, and the attribute `command` contains the query + string that the cursor has most recently prepared or executed. Note that + `prepare` simply caches the statement like `execute` does, except + that the query is not immediately executed. Consequently, to prepare more than + one statement, you'll need to create more than one cursor. + + Since `prepare` is just statement caching in disguise, it does not offer + any additional performance benefits, but it makes your code more readable. + The following code snippet is equivalent to the above example of guaranteed + statement caching, but it conveys in a clearer fashion that a statement is + prepared once and executed twice:: + + >>> cursor.prepare("UPDATE names SET age = :2 WHERE first = :1") + >>> cursor.execute(cursor.command, params1) + >>> cursor.execute(cursor.command, params2) + Using named cursors ------------------- |
From: Carsten H. <ch...@us...> - 2006-09-10 05:14:53
|
Update of /cvsroot/informixdb/informixdb/ext In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv9429/ext Modified Files: _informixdb.ec Log Message: Play nice with 64 bit architectures. Index: _informixdb.ec =================================================================== RCS file: /cvsroot/informixdb/informixdb/ext/_informixdb.ec,v retrieving revision 1.70 retrieving revision 1.71 diff -C2 -d -r1.70 -r1.71 *** _informixdb.ec 10 Sep 2006 04:55:37 -0000 1.70 --- _informixdb.ec 10 Sep 2006 05:14:49 -0000 1.71 *************** *** 1208,1212 **** short mdy_date[3]; int ret; ! long *d= (long*)malloc(sizeof(long)); mdy_date[2] = PyDateTime_GET_YEAR(date); mdy_date[1] = PyDateTime_GET_DAY(date); --- 1208,1212 ---- short mdy_date[3]; int ret; ! int4 *d= (int4*)malloc(sizeof(int4)); mdy_date[2] = PyDateTime_GET_YEAR(date); mdy_date[1] = PyDateTime_GET_DAY(date); *************** *** 1221,1225 **** var->sqldata = (char*)d; ! var->sqllen = sizeof(long); var->sqltype = CDATETYPE; *var->sqlind = 0; --- 1221,1225 ---- var->sqldata = (char*)d; ! var->sqllen = sizeof(int4); var->sqltype = CDATETYPE; *var->sqlind = 0; *************** *** 1952,1956 **** { short mdy_date[3]; ! rjulmdy(*(long*)data, mdy_date); return PyDate_FromDate(mdy_date[2], mdy_date[0], mdy_date[1]); } --- 1952,1956 ---- { short mdy_date[3]; ! rjulmdy(*(int4*)data, mdy_date); return PyDate_FromDate(mdy_date[2], mdy_date[0], mdy_date[1]); } |
From: Carsten H. <ch...@us...> - 2006-09-10 04:55:40
|
Update of /cvsroot/informixdb/informixdb/ext In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv2693/ext Modified Files: _informixdb.ec Log Message: Fix minor compiler warnings. Force correct diagnostic message when rollback is attempted on an unlogged database. Index: _informixdb.ec =================================================================== RCS file: /cvsroot/informixdb/informixdb/ext/_informixdb.ec,v retrieving revision 1.69 retrieving revision 1.70 diff -C2 -d -r1.69 -r1.70 *** _informixdb.ec 9 Sep 2006 01:48:42 -0000 1.69 --- _informixdb.ec 10 Sep 2006 04:55:37 -0000 1.70 *************** *** 1058,1061 **** --- 1058,1063 ---- } } else { + /* force error -256, Transaction not available. */ + EXEC SQL ROLLBACK WORK; error_handle(self, NULL, ExcNotSupportedError, dberror_value("ROLLBACK")); *************** *** 1750,1754 **** PyObject *op; const char *sql; - int i; static char* kwdlist[] = { "operation", 0 }; --- 1752,1755 ---- *************** *** 1772,1776 **** { struct sqlda *tdaIn = &self->daIn; - struct sqlda *tdaOut = self->daOut; PyObject *op, *inputvars=NULL; const char *sql; --- 1773,1776 ---- *************** *** 1840,1844 **** { struct sqlda *tdaIn = &self->daIn; - struct sqlda *tdaOut = self->daOut; PyObject *op, *params, *paramiter, *inputvars = 0; const char *sql; --- 1840,1843 ---- *************** *** 1887,1891 **** } ! while (inputvars = PyIter_Next(paramiter)) { if (inputDirty) { cleanInputBinding(self); --- 1886,1890 ---- } ! while ((inputvars = PyIter_Next(paramiter))) { if (inputDirty) { cleanInputBinding(self); |
From: Carsten H. <ch...@us...> - 2006-09-09 01:48:45
|
Update of /cvsroot/informixdb/informixdb/ext In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv1637/ext Modified Files: _informixdb.ec Log Message: Only declare a cursor for EXECUTE PROCEDURE if the procedure produces output. Index: _informixdb.ec =================================================================== RCS file: /cvsroot/informixdb/informixdb/ext/_informixdb.ec,v retrieving revision 1.68 retrieving revision 1.69 diff -C2 -d -r1.68 -r1.69 *** _informixdb.ec 9 Sep 2006 00:55:03 -0000 1.68 --- _informixdb.ec 9 Sep 2006 01:48:42 -0000 1.69 *************** *** 422,425 **** --- 422,426 ---- int *parmIdx; int stype; /* statement type */ + int has_output; PyObject *op; /* last executed operation */ long sqlerrd[6]; *************** *** 1707,1712 **** self->daOut = tdaOut; self->stype = SQLCODE; ! if (self->stype == 0 || self->stype == SQ_EXECPROC) { bindOutput(self); switch (self->is_hold + 2*self->is_scroll) { --- 1708,1715 ---- self->daOut = tdaOut; self->stype = SQLCODE; + self->has_output = + (self->stype == 0 || (self->stype == SQ_EXECPROC && tdaOut->sqld > 0) ); ! if (self->has_output) { bindOutput(self); switch (self->is_hold + 2*self->is_scroll) { *************** *** 1797,1801 **** return 0; ! if (self->stype == 0 || self->stype == SQ_EXECPROC) { EXEC SQL OPEN :cursorName USING DESCRIPTOR tdaIn; ret_on_dberror_cursor(self, "OPEN"); --- 1800,1804 ---- return 0; ! if (self->has_output) { EXEC SQL OPEN :cursorName USING DESCRIPTOR tdaIn; ret_on_dberror_cursor(self, "OPEN"); *************** *** 1895,1899 **** inputDirty = 1; ! if (self->stype == 0) { EXEC SQL OPEN :cursorName USING DESCRIPTOR tdaIn; ret_on_dberror_cursor(self, "OPEN"); --- 1898,1902 ---- inputDirty = 1; ! if (self->has_output) { EXEC SQL OPEN :cursorName USING DESCRIPTOR tdaIn; ret_on_dberror_cursor(self, "OPEN"); *************** *** 2353,2357 **** EXEC SQL END DECLARE SECTION; ! if (cur->stype == 0) { /* if cursor is opened, close it */ if (cur->state == 3) { --- 2356,2360 ---- EXEC SQL END DECLARE SECTION; ! if (cur->has_output) { /* if cursor is opened, close it */ if (cur->state == 3) { |
From: Carsten H. <ch...@us...> - 2006-09-09 00:55:06
|
Update of /cvsroot/informixdb/informixdb/ext In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv13515/ext Modified Files: _informixdb.ec Log Message: Fix carelessly committed doc-string change, restore input-binding cleanup that got lost in the prepare refactorization, and tighten insert cursor logic. Index: _informixdb.ec =================================================================== RCS file: /cvsroot/informixdb/informixdb/ext/_informixdb.ec,v retrieving revision 1.67 retrieving revision 1.68 diff -C2 -d -r1.67 -r1.68 *** _informixdb.ec 7 Sep 2006 02:05:58 -0000 1.67 --- _informixdb.ec 9 Sep 2006 00:55:03 -0000 1.68 *************** *** 474,480 **** (SELECT * FROM names WHERE name = :1) may be used.\n\ \n\ ! To execute a previously prepared statement or to re-execute ! a previously executed statement, pass the cursor's 'command' ! attribute as the operation. \n\ 'parameters' is a sequence of values to be bound to the\n\ --- 474,480 ---- (SELECT * FROM names WHERE name = :1) may be used.\n\ \n\ ! To execute a previously prepared statement or to re-execute\n\ ! a previously executed statement, pass the cursor's 'command'\n\ ! attribute as the operation.\n\ \n\ 'parameters' is a sequence of values to be bound to the\n\ *************** *** 1681,1684 **** --- 1681,1690 ---- require_cursor_open(self); + if (op == self->op) { + doCloseCursor(self, 0); + cleanInputBinding(self); + return Py_None; + } + doCloseCursor(self, 1); deleteInputBinding(self); *************** *** 1784,1791 **** if (setConnection(self->conn)) return NULL; ! if (self->op != op) { ! if (!do_prepare(self, op, sql)) { ! return NULL; ! } } --- 1790,1795 ---- if (setConnection(self->conn)) return NULL; ! if (!do_prepare(self, op, sql)) { ! return NULL; } *************** *** 1858,1869 **** if (setConnection(self->conn)) return NULL; ! if (self->op != op) { ! if (!do_prepare(self, op, sql)) { ! return NULL; ! } ! useInsertCursor = ! (self->conn->has_commit&&!self->conn->autocommit&&self->stype==SQ_INSERT); ! if (useInsertCursor) { EXEC SQL DECLARE :cursorName CURSOR FOR :queryName; ret_on_dberror_cursor(self, "DECLARE"); --- 1862,1875 ---- if (setConnection(self->conn)) return NULL; ! if (!do_prepare(self, op, sql)) { ! return NULL; ! } ! useInsertCursor = ! (self->conn->has_commit&&!self->conn->autocommit&&self->stype==SQ_INSERT); ! if (useInsertCursor) { ! /* If do_prepare closed and reprepared the query, redeclare the ! insert cursor */ ! if (self->state==1) { EXEC SQL DECLARE :cursorName CURSOR FOR :queryName; ret_on_dberror_cursor(self, "DECLARE"); *************** *** 1872,1882 **** self->state = 2; } - } - else { - useInsertCursor = - (self->conn->has_commit&&!self->conn->autocommit&&self->stype==SQ_INSERT); - } - if (useInsertCursor) { EXEC SQL OPEN :cursorName; ret_on_dberror_cursor(self, "OPEN"); --- 1878,1882 ---- *************** *** 1932,1937 **** Py_BEGIN_ALLOW_THREADS; EXEC SQL FLUSH :cursorName; - Py_END_ALLOW_THREADS; rowcount += sqlca.sqlerrd[2]; } --- 1932,1938 ---- Py_BEGIN_ALLOW_THREADS; EXEC SQL FLUSH :cursorName; rowcount += sqlca.sqlerrd[2]; + EXEC SQL CLOSE :cursorName; + Py_END_ALLOW_THREADS; } |
From: Carsten H. <ch...@us...> - 2006-09-07 02:06:04
|
Update of /cvsroot/informixdb/informixdb/ext In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv21266/ext Modified Files: _informixdb.ec Log Message: factor out the PREPARE step from execute/executemany and implement cursor.prepare() Index: _informixdb.ec =================================================================== RCS file: /cvsroot/informixdb/informixdb/ext/_informixdb.ec,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -d -r1.66 -r1.67 *** _informixdb.ec 5 Sep 2006 16:38:26 -0000 1.66 --- _informixdb.ec 7 Sep 2006 02:05:58 -0000 1.67 *************** *** 441,444 **** --- 441,445 ---- static void Cursor_dealloc(Cursor *self); static PyObject* Cursor_close(Cursor *self); + static PyObject* Cursor_prepare(Cursor *self, PyObject *args, PyObject *kwds); static PyObject* Cursor_execute(Cursor *self, PyObject *args, PyObject *kwds); static PyObject* Cursor_executemany(Cursor *self, PyObject *args, PyObject *kwds); *************** *** 460,463 **** --- 461,469 ---- operations on it will raise an InterfaceError."); + PyDoc_STRVAR(Cursor_prepare_doc, + "prepare(operation)\n\n\ + Prepare an arbitrary SQL statement for later execution.\n\n\ + See cursor.execute for more information."); + PyDoc_STRVAR(Cursor_execute_doc, "execute(operation [,parameters])\n\n\ *************** *** 468,471 **** --- 474,481 ---- (SELECT * FROM names WHERE name = :1) may be used.\n\ \n\ + To execute a previously prepared statement or to re-execute + a previously executed statement, pass the cursor's 'command' + attribute as the operation. + \n\ 'parameters' is a sequence of values to be bound to the\n\ placeholders in the SQL statement. The number of values in the\n\ *************** *** 555,558 **** --- 565,570 ---- { "close", (PyCFunction)Cursor_close, METH_NOARGS, Cursor_close_doc }, + { "prepare", (PyCFunction)Cursor_prepare, METH_VARARGS|METH_KEYWORDS, + Cursor_prepare_doc }, { "execute", (PyCFunction)Cursor_execute, METH_VARARGS|METH_KEYWORDS, Cursor_execute_doc }, *************** *** 598,601 **** --- 610,615 ---- { "connection", T_OBJECT_EX, offsetof(Cursor, conn), 0, "Database connection associated with this cursor." }, + { "command", T_OBJECT_EX, offsetof(Cursor, op), READONLY, + "Last prepared or executed command." }, { NULL } }; *************** *** 1653,1656 **** --- 1667,1763 ---- } + static PyObject *do_prepare(Cursor *self, PyObject *op, const char *sql) + { + struct sqlda *tdaIn = &self->daIn; + struct sqlda *tdaOut = self->daOut; + int i; + EXEC SQL BEGIN DECLARE SECTION; + char *queryName = self->queryName; + char *cursorName = self->cursorName; + char *newSql; + EXEC SQL END DECLARE SECTION; + + clear_messages(self); + require_cursor_open(self); + + doCloseCursor(self, 1); + deleteInputBinding(self); + deleteOutputBinding(self); + + /* `newSql' may be shorter than but will never exceed length of `sql' */ + newSql = malloc(strlen(sql) + 1); + if (!parseSql(self, newSql, sql)) { + free(newSql); + return 0; + } + EXEC SQL PREPARE :queryName FROM :newSql; + for (i=0; i<6; i++) self->sqlerrd[i] = sqlca.sqlerrd[i]; + free(newSql); + ret_on_dberror_cursor(self, "PREPARE"); + self->state = 1; + + EXEC SQL DESCRIBE :queryName INTO tdaOut; + ret_on_dberror_cursor(self, "DESCRIBE"); + self->daOut = tdaOut; + self->stype = SQLCODE; + + if (self->stype == 0 || self->stype == SQ_EXECPROC) { + bindOutput(self); + switch (self->is_hold + 2*self->is_scroll) { + case 3: + EXEC SQL DECLARE :cursorName SCROLL CURSOR WITH HOLD FOR :queryName; + break; + case 2: + EXEC SQL DECLARE :cursorName SCROLL CURSOR FOR :queryName; break; + case 1: + EXEC SQL DECLARE :cursorName CURSOR WITH HOLD FOR :queryName; break; + case 0: + EXEC SQL DECLARE :cursorName CURSOR FOR :queryName; break; + } + ret_on_dberror_cursor(self, "DECLARE"); + EXEC SQL FREE :queryName; + ret_on_dberror_cursor(self, "FREE"); + self->state = 2; + self->pending_scroll = 0; + self->scroll_value = 0; + } else { + /* If available, copy information about input parameters into daIn */ + copyDescr(tdaIn, tdaOut); + _da_free(self->daOut); + self->daOut = NULL; + } + + /* cache operation reference */ + Py_DECREF(self->op); + self->op = op; + Py_INCREF(op); + + // No INCREF because the callers don't DECREF. + return Py_None; + } + + static PyObject *Cursor_prepare(Cursor *self, PyObject *args, PyObject *kwds) + { + PyObject *op; + const char *sql; + int i; + static char* kwdlist[] = { "operation", 0 }; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", kwdlist, &sql)) + return NULL; + op = PyTuple_GET_ITEM(args, 0); + + /* Make sure we talk to the right database. */ + if (setConnection(self->conn)) return NULL; + + if (do_prepare(self, op, sql)) { + Py_INCREF(Py_None); + return Py_None; + } + else { + return NULL; + } + } + static PyObject *Cursor_execute(Cursor *self, PyObject *args, PyObject *kwds) { *************** *** 1664,1668 **** char *queryName = self->queryName; char *cursorName = self->cursorName; - char *newSql; EXEC SQL END DECLARE SECTION; --- 1771,1774 ---- *************** *** 1678,1735 **** if (setConnection(self->conn)) return NULL; ! if (op == self->op) { ! doCloseCursor(self, 0); ! cleanInputBinding(self); ! } else { ! doCloseCursor(self, 1); ! deleteInputBinding(self); ! deleteOutputBinding(self); ! ! /* `newSql' may be shorter than but will never exceed length of `sql' */ ! newSql = malloc(strlen(sql) + 1); ! if (!parseSql(self, newSql, sql)) { ! free(newSql); ! return 0; ! } ! EXEC SQL PREPARE :queryName FROM :newSql; ! for (i=0; i<6; i++) self->sqlerrd[i] = sqlca.sqlerrd[i]; ! free(newSql); ! ret_on_dberror_cursor(self, "PREPARE"); ! self->state = 1; ! ! EXEC SQL DESCRIBE :queryName INTO tdaOut; ! ret_on_dberror_cursor(self, "DESCRIBE"); ! self->daOut = tdaOut; ! self->stype = SQLCODE; ! ! if (self->stype == 0 || self->stype == SQ_EXECPROC) { ! bindOutput(self); ! switch (self->is_hold + 2*self->is_scroll) { ! case 3: ! EXEC SQL DECLARE :cursorName SCROLL CURSOR WITH HOLD FOR :queryName; ! break; ! case 2: ! EXEC SQL DECLARE :cursorName SCROLL CURSOR FOR :queryName; break; ! case 1: ! EXEC SQL DECLARE :cursorName CURSOR WITH HOLD FOR :queryName; break; ! case 0: ! EXEC SQL DECLARE :cursorName CURSOR FOR :queryName; break; ! } ! ret_on_dberror_cursor(self, "DECLARE"); ! EXEC SQL FREE :queryName; ! ret_on_dberror_cursor(self, "FREE"); ! self->state = 2; ! self->pending_scroll = 0; ! self->scroll_value = 0; ! } else { ! /* If available, copy information about input parameters into daIn */ ! copyDescr(tdaIn, tdaOut); ! _da_free(self->daOut); ! self->daOut = NULL; } - - /* cache operation reference */ - self->op = op; - Py_INCREF(op); } --- 1784,1791 ---- if (setConnection(self->conn)) return NULL; ! if (self->op != op) { ! if (!do_prepare(self, op, sql)) { ! return NULL; } } *************** *** 1786,1790 **** char *queryName = self->queryName; char *cursorName = self->cursorName; - char *newSql; EXEC SQL END DECLARE SECTION; --- 1842,1845 ---- *************** *** 1803,1848 **** if (setConnection(self->conn)) return NULL; ! if (op == self->op) { ! doCloseCursor(self, 0); ! cleanInputBinding(self); ! useInsertCursor = ! (self->conn->has_commit&&!self->conn->autocommit&&self->stype==SQ_INSERT); ! } else { ! doCloseCursor(self, 1); ! deleteInputBinding(self); ! deleteOutputBinding(self); ! ! /* `newSql' may be shorter than but will never exceed length of `sql' */ ! newSql = malloc(strlen(sql) + 1); ! if (!parseSql(self, newSql, sql)) { ! free(newSql); ! return 0; ! } ! EXEC SQL PREPARE :queryName FROM :newSql; ! for (i=0; i<6; i++) self->sqlerrd[i] = sqlca.sqlerrd[i]; ! free(newSql); ! ret_on_dberror_cursor(self, "PREPARE"); ! self->state = 1; ! ! EXEC SQL DESCRIBE :queryName INTO tdaOut; ! ret_on_dberror_cursor(self, "DESCRIBE"); ! self->daOut = tdaOut; ! self->stype = SQLCODE; ! ! if (self->stype == 0) { ! bindOutput(self); ! ! EXEC SQL DECLARE :cursorName CURSOR FOR :queryName; ! ret_on_dberror_cursor(self, "DECLARE"); ! EXEC SQL FREE :queryName; ! ret_on_dberror_cursor(self, "FREE"); ! self->state = 2; ! } else { ! /* If available, copy information about input parameters into daIn */ ! copyDescr(tdaIn, tdaOut); ! _da_free(self->daOut); ! self->daOut = NULL; } - useInsertCursor = (self->conn->has_commit&&!self->conn->autocommit&&self->stype==SQ_INSERT); --- 1858,1865 ---- if (setConnection(self->conn)) return NULL; ! if (self->op != op) { ! if (!do_prepare(self, op, sql)) { ! return NULL; } useInsertCursor = (self->conn->has_commit&&!self->conn->autocommit&&self->stype==SQ_INSERT); *************** *** 1855,1862 **** self->state = 2; } ! ! /* cache operation reference */ ! self->op = op; ! Py_INCREF(op); } --- 1872,1879 ---- self->state = 2; } ! } ! else { ! useInsertCursor = ! (self->conn->has_commit&&!self->conn->autocommit&&self->stype==SQ_INSERT); } *************** *** 2439,2443 **** self->parmIdx = 0; self->stype = -1; ! self->op = 0; self->is_hold = 0; self->is_scroll = 0; --- 2456,2461 ---- self->parmIdx = 0; self->stype = -1; ! Py_INCREF(Py_None); ! self->op = Py_None; self->is_hold = 0; self->is_scroll = 0; |
From: Carsten H. <ch...@us...> - 2006-09-05 16:38:40
|
Update of /cvsroot/informixdb/informixdb/ext In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv311/ext Modified Files: _informixdb.ec Log Message: Make cursor.executemany more useful by allowing arbitrary iterables for the parameters. Index: _informixdb.ec =================================================================== RCS file: /cvsroot/informixdb/informixdb/ext/_informixdb.ec,v retrieving revision 1.65 retrieving revision 1.66 diff -C2 -d -r1.65 -r1.66 *** _informixdb.ec 29 Apr 2006 02:52:15 -0000 1.65 --- _informixdb.ec 5 Sep 2006 16:38:26 -0000 1.66 *************** *** 1778,1784 **** struct sqlda *tdaIn = &self->daIn; struct sqlda *tdaOut = self->daOut; ! PyObject *op, *params, *inputvars = 0; const char *sql; ! int i, len; int rowcount = 0, inputDirty = 0, useInsertCursor; static char* kwdlist[] = { "operation", "seq_of_parameters", 0 }; --- 1778,1784 ---- struct sqlda *tdaIn = &self->daIn; struct sqlda *tdaOut = self->daOut; ! PyObject *op, *params, *paramiter, *inputvars = 0; const char *sql; ! int i; int rowcount = 0, inputDirty = 0, useInsertCursor; static char* kwdlist[] = { "operation", "seq_of_parameters", 0 }; *************** *** 1795,1801 **** return NULL; op = PyTuple_GET_ITEM(args, 0); ! len = PySequence_Size(params); ! if (len == -1) { ! PyErr_SetString(PyExc_TypeError, "Parameter must be a sequence"); return NULL; } --- 1795,1800 ---- return NULL; op = PyTuple_GET_ITEM(args, 0); ! paramiter = PyObject_GetIter(params); ! if (paramiter == NULL) { return NULL; } *************** *** 1868,1878 **** } ! for (i=0; i<len; i++) { ! inputvars = PySequence_GetItem(params, i); if (inputDirty) { cleanInputBinding(self); } ! if (!bindInput(self, inputvars)) return 0; inputDirty = 1; --- 1867,1879 ---- } ! while (inputvars = PyIter_Next(paramiter)) { if (inputDirty) { cleanInputBinding(self); } ! if (!bindInput(self, inputvars)) { ! Py_DECREF(inputvars); ! Py_DECREF(paramiter); return 0; + } inputDirty = 1; *************** *** 1910,1913 **** --- 1911,1915 ---- Py_DECREF(inputvars); } + Py_DECREF(paramiter); if (useInsertCursor) { Py_BEGIN_ALLOW_THREADS; |
From: Carsten H. <ch...@us...> - 2006-04-29 02:52:17
|
Update of /cvsroot/informixdb/informixdb/ext In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8777/ext Modified Files: _informixdb.ec Log Message: Apparently we have to call SqlFreeMem() when freeing descriptors and locator buffers in multithreaded Windows ESQL/C applications. Index: _informixdb.ec =================================================================== RCS file: /cvsroot/informixdb/informixdb/ext/_informixdb.ec,v retrieving revision 1.64 retrieving revision 1.65 diff -C2 -d -r1.64 -r1.65 *** _informixdb.ec 29 Apr 2006 02:34:55 -0000 1.64 --- _informixdb.ec 29 Apr 2006 02:52:15 -0000 1.65 *************** *** 40,46 **** --- 40,55 ---- #undef loc_t + #define _da_free(x) free(x) + #define _loc_free(x) free(x) + #ifdef _WIN32 #include <value.h> #include <sqlproto.h> + #ifdef IFX_THREAD + #undef _da_free + #undef _loc_free + #define _da_free(x) SqlFreeMem(x, SQLDA_FREE) + #define _loc_free(x) SqlFreeMem(x, LOC_BUFFER_FREE) + #endif #else #include <values.h> *************** *** 1716,1720 **** /* If available, copy information about input parameters into daIn */ copyDescr(tdaIn, tdaOut); ! free(self->daOut); self->daOut = NULL; } --- 1725,1729 ---- /* If available, copy information about input parameters into daIn */ copyDescr(tdaIn, tdaOut); ! _da_free(self->daOut); self->daOut = NULL; } *************** *** 1833,1837 **** /* If available, copy information about input parameters into daIn */ copyDescr(tdaIn, tdaOut); ! free(self->daOut); self->daOut = NULL; } --- 1842,1846 ---- /* If available, copy information about input parameters into daIn */ copyDescr(tdaIn, tdaOut); ! _da_free(self->daOut); self->daOut = NULL; } *************** *** 2238,2242 **** loc_t *loc = (loc_t*) da->sqlvar[i].sqldata; if (loc->loc_buffer) { ! free(loc->loc_buffer); } } --- 2247,2251 ---- loc_t *loc = (loc_t*) da->sqlvar[i].sqldata; if (loc->loc_buffer) { ! _loc_free(loc->loc_buffer); } } *************** *** 2280,2284 **** loc_t *loc = (loc_t*) da->sqlvar[i].sqldata; if (loc->loc_buffer) ! free(loc->loc_buffer); } $ifdef HAVE_ESQL9; --- 2289,2293 ---- loc_t *loc = (loc_t*) da->sqlvar[i].sqldata; if (loc->loc_buffer) ! _loc_free(loc->loc_buffer); } $ifdef HAVE_ESQL9; *************** *** 2287,2291 **** } $endif; ! free(cur->daOut); cur->daOut = 0; } --- 2296,2300 ---- } $endif; ! _da_free(cur->daOut); cur->daOut = 0; } |
From: Carsten H. <ch...@us...> - 2006-04-29 02:34:59
|
Update of /cvsroot/informixdb/informixdb/ext In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25493 Modified Files: _informixdb.ec Log Message: UDT input binding logic was not consistent, leading to problems in executemany when values changed across 32K size boundary or between null and non-null, due to changing host variable type. Fixed. Index: _informixdb.ec =================================================================== RCS file: /cvsroot/informixdb/informixdb/ext/_informixdb.ec,v retrieving revision 1.63 retrieving revision 1.64 diff -C2 -d -r1.63 -r1.64 *** _informixdb.ec 25 Apr 2006 23:35:14 -0000 1.63 --- _informixdb.ec 29 Apr 2006 02:34:55 -0000 1.64 *************** *** 1233,1237 **** n = strlen(val); $ifdef HAVE_ESQL9; ! if (n >= 32768) { /* use lvarchar* instead */ EXEC SQL BEGIN DECLARE SECTION; --- 1233,1237 ---- n = strlen(val); $ifdef HAVE_ESQL9; ! if (ISUDTTYPE(sqltype) || ISCOMPLEXTYPE(sqltype)) { /* use lvarchar* instead */ EXEC SQL BEGIN DECLARE SECTION; *************** *** 1310,1317 **** static int ibindNone(struct sqlvar_struct *var, PyObject *item) { ! var->sqltype = CSTRINGTYPE; ! var->sqldata = NULL; ! var->sqllen = 0; ! *var->sqlind = -1; return 1; } --- 1310,1340 ---- static int ibindNone(struct sqlvar_struct *var, PyObject *item) { ! int sqltype = var->sqltype & SQLTYPE; ! $ifdef HAVE_ESQL9; ! if (ISUDTTYPE(sqltype) || ISCOMPLEXTYPE(sqltype)) { ! /* use lvarchar* instead */ ! EXEC SQL BEGIN DECLARE SECTION; ! lvarchar **data; ! EXEC SQL END DECLARE SECTION; ! data = malloc(sizeof(void*)); ! *data = 0; ! ifx_var_flag(data, 0); ! ifx_var_alloc(data, 1); ! ifx_var_setlen(data, 0); ! var->sqltype = SQLUDTVAR; ! var->sqlxid = XID_LVARCHAR; ! var->sqldata = *data; ! var->sqllen = sizeof(void*); ! *var->sqlind = -1; ! free( data ); ! } ! else ! $endif; ! { ! var->sqltype = CSTRINGTYPE; ! var->sqldata = NULL; ! var->sqllen = 0; ! *var->sqlind = -1; ! } return 1; } |
From: Carsten H. <ch...@us...> - 2006-04-25 23:35:18
|
Update of /cvsroot/informixdb/informixdb/ext In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24386/ext Modified Files: _informixdb.ec Log Message: Certain errors don't set SQLCODE in PREPARE but instead fail with SQLCODE -410 later, which wasn't checked, leading to a crash. Fixed. Index: _informixdb.ec =================================================================== RCS file: /cvsroot/informixdb/informixdb/ext/_informixdb.ec,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -d -r1.62 -r1.63 *** _informixdb.ec 26 Mar 2006 06:08:49 -0000 1.62 --- _informixdb.ec 25 Apr 2006 23:35:14 -0000 1.63 *************** *** 1667,1670 **** --- 1667,1671 ---- EXEC SQL DESCRIBE :queryName INTO tdaOut; + ret_on_dberror_cursor(self, "DESCRIBE"); self->daOut = tdaOut; self->stype = SQLCODE; *************** *** 1794,1797 **** --- 1795,1799 ---- EXEC SQL DESCRIBE :queryName INTO tdaOut; + ret_on_dberror_cursor(self, "DESCRIBE"); self->daOut = tdaOut; self->stype = SQLCODE; |
From: Carsten H. <ch...@us...> - 2006-03-26 06:34:50
|
Update of /cvsroot/informixdb/informixdb In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7305 Modified Files: README Log Message: Missed a version number update Index: README =================================================================== RCS file: /cvsroot/informixdb/informixdb/README,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** README 25 Mar 2006 16:02:43 -0000 1.11 --- README 26 Mar 2006 06:34:44 -0000 1.12 *************** *** 2,6 **** ============ ! This is informixdb 2.1, an Informix implementation of the Python Database API. This release implements version 2.0 of the DB-API: --- 2,6 ---- ============ ! This is informixdb 2.2, an Informix implementation of the Python Database API. This release implements version 2.0 of the DB-API: |
From: Carsten H. <ch...@us...> - 2006-03-26 06:08:53
|
Update of /cvsroot/informixdb/informixdb/ext In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25275/ext Modified Files: _informixdb.ec Log Message: apparently there are compilers that don't know what to do with inline, and it's not critical that this function be inlined. Index: _informixdb.ec =================================================================== RCS file: /cvsroot/informixdb/informixdb/ext/_informixdb.ec,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** _informixdb.ec 17 Mar 2006 02:24:20 -0000 1.61 --- _informixdb.ec 26 Mar 2006 06:08:49 -0000 1.62 *************** *** 1423,1427 **** } ! static inline PyObject* gettypename(struct sqlvar_struct *var) { $ifdef HAVE_ESQL9; --- 1423,1427 ---- } ! static PyObject* gettypename(struct sqlvar_struct *var) { $ifdef HAVE_ESQL9; |
From: Carsten H. <ch...@us...> - 2006-03-26 05:44:29
|
Update of /cvsroot/informixdb/informixdb In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12539 Modified Files: setup.py Log Message: bump version number Index: setup.py =================================================================== RCS file: /cvsroot/informixdb/informixdb/setup.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** setup.py 1 Dec 2005 11:50:51 -0000 1.11 --- setup.py 26 Mar 2006 05:44:26 -0000 1.12 *************** *** 220,225 **** setup (name = 'InformixDB', ! version = '2.1', ! description = 'InformixDB v2.1', long_description = \ "InformixDB is a DB-API 2.0 compliant interface for IBM Informix\n" --- 220,225 ---- setup (name = 'InformixDB', ! version = '2.2', ! description = 'InformixDB v2.2', long_description = \ "InformixDB is a DB-API 2.0 compliant interface for IBM Informix\n" |
From: Carsten H. <ch...@us...> - 2006-03-25 16:02:57
|
Update of /cvsroot/informixdb/informixdb/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3191/doc Modified Files: manual.txt Log Message: prepare for release of version 2.2 Index: manual.txt =================================================================== RCS file: /cvsroot/informixdb/informixdb/doc/manual.txt,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** manual.txt 26 Nov 2005 00:51:34 -0000 1.9 --- manual.txt 25 Mar 2006 16:02:43 -0000 1.10 *************** *** 4,9 **** :Authors: Daniel Smertnig ! :Version: informixdb 2.1 ! :Date: 2005-11-20 :Homepage: `InformixDB on Sourceforge`_ --- 4,9 ---- :Authors: Daniel Smertnig ! :Version: informixdb 2.2 ! :Date: 2006-03-26 :Homepage: `InformixDB on Sourceforge`_ *************** *** 50,53 **** --- 50,58 ---- setting up a new database from within InformixDB. + `New in version 2.2`: An optional `autocommit` parameter may be passed to + turn on autocommit mode. In autocommit mode, the connection operates without + transaction control and any changes are committed automatically. By default, + autocommit is off. + A `Connection` can be closed by calling its `close` method. From that point forward all operations on the `Connection` object or any of its associated *************** *** 301,304 **** --- 306,313 ---- `rollback` raises a `NotSupportedError` when called. + `New in version 2.2`: A `Connection` object has an `autocommit` attribute + that can be used to turn automatic commits on or off. + + Database values =============== *************** *** 310,316 **** `string` ! ``FLOAT``, ``SMALLFLOAT``, ``DECIMAL``, ``MONEY`` `float` ``SMALLINT``, ``INT``, ``SERIAL`` `int` --- 319,331 ---- `string` ! ``FLOAT``, ``SMALLFLOAT`` `float` + ``DECIMAL``, ``MONEY`` + `float` or `decimal.Decimal`; + In InformixDB-2.2 and Python 2.4, ``DECIMAL`` and ``MONEY`` values + will be returned as `decimal.Decimal` instances unless the cursor was + created with the ``use_decimal`` flag set to False. + ``SMALLINT``, ``INT``, ``SERIAL`` `int` *************** *** 350,353 **** --- 365,371 ---- file-like interface for reading and writing its data. + ``BOOLEAN`` (IDS) (`new in version 2.2`) + `bool` + extended types, user-defined types (IDS) (`new in version 2.1`) Complex and opaque types are mapped to their string representation. |
From: Carsten H. <ch...@us...> - 2006-03-25 16:02:51
|
Update of /cvsroot/informixdb/informixdb In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3191 Modified Files: README Log Message: prepare for release of version 2.2 Index: README =================================================================== RCS file: /cvsroot/informixdb/informixdb/README,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** README 21 Nov 2005 04:25:56 -0000 1.10 --- README 25 Mar 2006 16:02:43 -0000 1.11 *************** *** 77,80 **** --- 77,92 ---- ==== + From 2.1 to 2.2: + - Support for BOOLEAN columns + - DECIMAL and MONEY columns can be fetched as decimal.Decimal instances + if the decimal module is available + - autocommit mode for connections + - Bug fixes: + * Output buffer allocation used pointer/int casts that don't work on + most 64 bit platforms. + * Selecting TEXT/BYTE column from an empty set of rows caused segmentation + fault under certain circumstances. + * datetime values with trailing double-zeroes were fetched incorrectly. + From 2.0 to 2.1: - INTERVAL support *************** *** 246,249 **** --- 258,262 ---- 2.0 2005-10-22 Carsten Haese 2.1 2005-11-21 Carsten Haese + 2.2 2006-03-26 Carsten Haese -- |
From: Carsten H. <ch...@us...> - 2006-03-17 02:24:23
|
Update of /cvsroot/informixdb/informixdb/ext In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19426/ext Modified Files: _informixdb.ec Log Message: Fix bug #1447106: Trailing zeroes in a datetime's stored precision are read out with bogus digits instead of zeroes. Index: _informixdb.ec =================================================================== RCS file: /cvsroot/informixdb/informixdb/ext/_informixdb.ec,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** _informixdb.ec 12 Jan 2006 16:51:44 -0000 1.60 --- _informixdb.ec 17 Mar 2006 02:24:20 -0000 1.61 *************** *** 1904,1908 **** int year=1,month=1,day=1,hour=0,minute=0,second=0,usec=0; dtime_t* dt = (dtime_t*)data; ! for (pos = 0, i = TU_START(dt->dt_qual); i <= TU_END(dt->dt_qual); ++i) { switch (i) { case TU_YEAR: --- 1904,1910 ---- int year=1,month=1,day=1,hour=0,minute=0,second=0,usec=0; dtime_t* dt = (dtime_t*)data; ! 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: |
From: Carsten H. <ch...@us...> - 2006-01-12 16:51:57
|
Update of /cvsroot/informixdb/informixdb/ext In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20707/ext Modified Files: _informixdb.ec Log Message: bindOutput didn't initialize loc->loc_buffer, which under certain circumstances leads to a segfault in deleteOutputBinding due to a bogus free() after performing a TEXT/BYTE select that doesn't return any rows. Fixed. Index: _informixdb.ec =================================================================== RCS file: /cvsroot/informixdb/informixdb/ext/_informixdb.ec,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** _informixdb.ec 29 Dec 2005 02:52:20 -0000 1.59 --- _informixdb.ec 12 Jan 2006 16:51:44 -0000 1.60 *************** *** 1584,1587 **** --- 1584,1588 ---- loc_t *loc = (loc_t*) var->sqldata; loc->loc_loctype = LOCMEMORY; + loc->loc_buffer = NULL; loc->loc_bufsize = -1; loc->loc_oflags = 0; |
From: Carsten H. <ch...@us...> - 2005-12-29 02:52:30
|
Update of /cvsroot/informixdb/informixdb/ext In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2580/ext Modified Files: _informixdb.ec Log Message: fix some compiler warnings Index: _informixdb.ec =================================================================== RCS file: /cvsroot/informixdb/informixdb/ext/_informixdb.ec,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** _informixdb.ec 23 Dec 2005 19:22:36 -0000 1.58 --- _informixdb.ec 29 Dec 2005 02:52:20 -0000 1.59 *************** *** 1736,1741 **** return Py_BuildValue("i", self->rowcount); /* number of row */ } - /* error return */ - return NULL; } --- 1736,1739 ---- *************** *** 3880,3884 **** child processes might stay around as <defunct> unless SIGCHLD is handled */ ! sqlsignal(-1, (void*)NULL, 0); #endif } --- 3878,3882 ---- child processes might stay around as <defunct> unless SIGCHLD is handled */ ! sqlsignal(-1, (void(*)(void))NULL, 0); #endif } |
From: Carsten H. <ch...@us...> - 2005-12-23 19:22:45
|
Update of /cvsroot/informixdb/informixdb/ext In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24879 Modified Files: _informixdb.ec Log Message: Fix output binding for platforms where pointers don't have the same size as int, such as Tru64. Fixed. Index: _informixdb.ec =================================================================== RCS file: /cvsroot/informixdb/informixdb/ext/_informixdb.ec,v retrieving revision 1.57 retrieving revision 1.58 diff -C2 -d -r1.57 -r1.58 *** _informixdb.ec 15 Dec 2005 18:10:32 -0000 1.57 --- _informixdb.ec 23 Dec 2005 19:22:36 -0000 1.58 *************** *** 1442,1445 **** --- 1442,1446 ---- int count = 0; struct sqlvar_struct *var; + int offset = 0; cur->indOut = calloc(cur->daOut->sqld, sizeof(short)); *************** *** 1576,1583 **** if (var->sqldata) continue; ! bufp = (char *) rtypalign( (int) bufp, var->sqltype); if (var->sqltype == CLOCATORTYPE) { ! loc_t *loc = (loc_t*) bufp; loc->loc_loctype = LOCMEMORY; loc->loc_bufsize = -1; --- 1577,1586 ---- if (var->sqldata) continue; ! offset = rtypalign(offset, var->sqltype); ! var->sqldata = bufp+offset; ! offset += var->sqllen; if (var->sqltype == CLOCATORTYPE) { ! loc_t *loc = (loc_t*) var->sqldata; loc->loc_loctype = LOCMEMORY; loc->loc_bufsize = -1; *************** *** 1585,1590 **** loc->loc_mflags = 0; } - var->sqldata = bufp; - bufp += var->sqllen; if (var->sqltype == CDTIMETYPE || var->sqltype == CINVTYPE) { --- 1588,1591 ---- |
From: Carsten H. <ch...@us...> - 2005-12-15 18:10:40
|
Update of /cvsroot/informixdb/informixdb/ext In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9451/ext Modified Files: _informixdb.ec Log Message: allow immediate binding of strings for insert/update into BYTE/TEXT columns without having to make a Binary() object. Index: _informixdb.ec =================================================================== RCS file: /cvsroot/informixdb/informixdb/ext/_informixdb.ec,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** _informixdb.ec 13 Dec 2005 02:29:32 -0000 1.56 --- _informixdb.ec 15 Dec 2005 18:10:32 -0000 1.57 *************** *** 1207,1210 **** --- 1207,1211 ---- const char *val; int n; + int sqltype = var->sqltype & SQLTYPE; #if HAVE_PY_BOOL == 1 if (PyBool_Check(item)) { *************** *** 1213,1217 **** #endif $ifdef HAVE_ESQL9; ! if ((var->sqltype&SQLTYPE)==SQLBOOL || LIKEBOOLEANXTYPE(var->sqltype, var->sqlxid) ) { var->sqltype = CBOOLTYPE; --- 1214,1218 ---- #endif $ifdef HAVE_ESQL9; ! if (sqltype==SQLBOOL || LIKEBOOLEANXTYPE(var->sqltype, var->sqlxid) ) { var->sqltype = CBOOLTYPE; *************** *** 1224,1227 **** --- 1225,1231 ---- } $endif; + if (sqltype==SQLTEXT||sqltype==SQLBYTES) { + return ibindBinary(var, item); + } sitem = PyObject_Str(item); if (PyErr_Occurred()) return 0; *************** *** 2708,2711 **** --- 2712,2719 ---- Py_INCREF(self->errorhandler); + /* this causes 'DESCRIBE' to describe inputs for update statements in + addition to insert statements. */ + putenv("IFX_UPDDESC=1"); + Py_BEGIN_ALLOW_THREADS; if (dbUser && dbPass) { |
From: Carsten H. <ch...@us...> - 2005-12-13 02:29:40
|
Update of /cvsroot/informixdb/informixdb/ext In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3300/ext Modified Files: _informixdb.ec Log Message: str() can actually fail (e.g. when passing in unicode objects that contain characters that the default encoding can't handle), so we should handle errors correctly. Index: _informixdb.ec =================================================================== RCS file: /cvsroot/informixdb/informixdb/ext/_informixdb.ec,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** _informixdb.ec 1 Dec 2005 11:50:52 -0000 1.55 --- _informixdb.ec 13 Dec 2005 02:29:32 -0000 1.56 *************** *** 1225,1228 **** --- 1225,1229 ---- $endif; sitem = PyObject_Str(item); + if (PyErr_Occurred()) return 0; val = PyString_AS_STRING((PyStringObject*)sitem); n = strlen(val); *************** *** 1266,1269 **** --- 1267,1271 ---- int ret; + if (PyErr_Occurred()) return 1; if (PyObject_IsInstance(item, IntervalY2MType)) inv->in_qual = TU_IENCODE(9,TU_YEAR,TU_MONTH); *************** *** 3256,3259 **** --- 3258,3262 ---- mint result; sitem = PyObject_Str(in); + if (PyErr_Occurred()) return -1; val = PyString_AS_STRING((PyStringObject*)sitem); result = ifx_int8cvasc(val, strlen(val), out); |