informixdb-cvs Mailing List for InformixDB
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...> - 2012-06-01 03:04:01
|
Revision: 193
http://informixdb.svn.sourceforge.net/informixdb/?rev=193&view=rev
Author: chaese
Date: 2012-06-01 03:03:55 +0000 (Fri, 01 Jun 2012)
Log Message:
-----------
I've heard reports of DESCRIBE INPUT failing on static SQL with SQLCODE -1834.
I can't reproduce this on IDS 11.5, but there's no harm in silencing
SQLCODE -1834 here in case it does come up.
Modified Paths:
--------------
trunk/informixdb/ext/_informixdb.ec
Modified: trunk/informixdb/ext/_informixdb.ec
===================================================================
--- trunk/informixdb/ext/_informixdb.ec 2012-06-01 02:58:10 UTC (rev 192)
+++ trunk/informixdb/ext/_informixdb.ec 2012-06-01 03:03:55 UTC (rev 193)
@@ -1978,7 +1978,11 @@
if (self->conn->can_describe_input) {
struct sqlda *tda = NULL;
EXEC SQL DESCRIBE INPUT :queryName INTO tda;
- ret_on_dberror_cursor(self, "DESCRIBE INPUT");
+ if (SQLCODE==-1834) {
+ tda = NULL;
+ } else {
+ ret_on_dberror_cursor(self, "DESCRIBE INPUT");
+ }
if (tda) {
copyDescr(tdaIn, tda);
_da_free(tda);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ch...@us...> - 2012-06-01 02:58:16
|
Revision: 192
http://informixdb.svn.sourceforge.net/informixdb/?rev=192&view=rev
Author: chaese
Date: 2012-06-01 02:58:10 +0000 (Fri, 01 Jun 2012)
Log Message:
-----------
Convert closure arguments from void* to int more safely. The values that are
passed around are guaranteed to fit into an int, so we're not concerned about
a possible size difference between ints and pointers.
Modified Paths:
--------------
trunk/informixdb/ext/_informixdb.ec
Modified: trunk/informixdb/ext/_informixdb.ec
===================================================================
--- trunk/informixdb/ext/_informixdb.ec 2012-06-01 02:49:44 UTC (rev 191)
+++ trunk/informixdb/ext/_informixdb.ec 2012-06-01 02:58:10 UTC (rev 192)
@@ -112,11 +112,13 @@
typedef void sqlbreakcallbackfunc(mint);
/************************* Helpers *************************/
+#define INT_FROM_VOIDPTR(x) ((int)((char*)x-(char*)0))
+
static PyObject *get_bool_from_int(PyObject *self, void *closure)
{
int *p;
- p = (int*)((char*)self+(int)closure);
+ p = (int*)((char*)self+INT_FROM_VOIDPTR(closure));
if (*p) {
Py_INCREF(Py_True);
return Py_True;
@@ -130,7 +132,7 @@
static int set_bool_to_int(PyObject *self, PyObject *value, void *closure)
{
int *p;
- p = (int*)((char*)self+(int)closure);
+ p = (int*)((char*)self+INT_FROM_VOIDPTR(closure));
*p = PyObject_IsTrue(value)?1:0;
return 0;
}
@@ -4147,7 +4149,7 @@
if (!lo_spec) {
ret_on_dberror(self->conn, NULL, "ifx_lo_stat_cspec");
}
- switch ((int)closure) {
+ switch (INT_FROM_VOIDPTR(closure)) {
case SBLOB_CSPEC_ESTBYTES:
if (ifx_lo_specget_estbytes(lo_spec, &int8result)<0) {
ret_on_dberror(self->conn, NULL, "ifx_lo_specget_estbytes");
@@ -4178,7 +4180,7 @@
if (ifx_lo_stat_free(lo_stat)<0) {
ret_on_dberror(self->conn, NULL, "ifx_lo_stat_free");
}
- switch ((int)closure) {
+ switch (INT_FROM_VOIDPTR(closure)) {
case SBLOB_CSPEC_EXTSZ:
case SBLOB_CSPEC_FLAGS:
return PyInt_FromLong((long)mintresult); break;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ch...@us...> - 2012-06-01 02:49:51
|
Revision: 191
http://informixdb.svn.sourceforge.net/informixdb/?rev=191&view=rev
Author: chaese
Date: 2012-06-01 02:49:44 +0000 (Fri, 01 Jun 2012)
Log Message:
-----------
Perform DESCRIBE INPUT for EXECUTE PROCEDURE calls. This enables better type
mapping for boolean parameters (and other advanced types, too, presumably)
in procedure calls.
Modified Paths:
--------------
trunk/informixdb/ext/_informixdb.ec
Modified: trunk/informixdb/ext/_informixdb.ec
===================================================================
--- trunk/informixdb/ext/_informixdb.ec 2011-11-06 22:12:13 UTC (rev 190)
+++ trunk/informixdb/ext/_informixdb.ec 2012-06-01 02:49:44 UTC (rev 191)
@@ -1971,7 +1971,7 @@
self->has_output =
(self->stype == 0 || (self->stype == SQ_EXECPROC && tdaOut->sqld > 0) );
- if (self->has_output) {
+ if (self->has_output || self->stype == SQ_EXECPROC) {
$ifdef HAVE_DESCRIBE_INPUT;
if (self->conn->can_describe_input) {
struct sqlda *tda = NULL;
@@ -1983,6 +1983,8 @@
}
}
$endif;
+ }
+ if (self->has_output) {
bindOutput(self);
switch (self->is_hold + 2*self->is_scroll) {
case 3:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <f-a...@us...> - 2011-11-06 22:12:20
|
Revision: 190
http://informixdb.svn.sourceforge.net/informixdb/?rev=190&view=rev
Author: f-apolloner
Date: 2011-11-06 22:12:13 +0000 (Sun, 06 Nov 2011)
Log Message:
-----------
Change loc_t to ifx_loc_t to prevent clashes with system files, while also
maintainig compatibility with informix se 7. This commit also revokes my
recent ISCOLUMNNULLABLE change since it's not supported by old informixes.
Modified Paths:
--------------
trunk/informixdb/ext/_informixdb.ec
Property Changed:
----------------
trunk/informixdb/
Property changes on: trunk/informixdb
___________________________________________________________________
Modified: svn:ignore
- build
+ build
dist
InformixDB.egg-info
Modified: trunk/informixdb/ext/_informixdb.ec
===================================================================
--- trunk/informixdb/ext/_informixdb.ec 2011-11-06 20:43:45 UTC (rev 189)
+++ trunk/informixdb/ext/_informixdb.ec 2011-11-06 22:12:13 UTC (rev 190)
@@ -34,11 +34,6 @@
#include "longobject.h"
#include "cobject.h"
-#include <limits.h>
-#define loc_t temp_loc_t
-#include <ctype.h>
-#undef loc_t
-
#ifndef Py_RETURN_NONE
#define Py_RETURN_NONE return Py_INCREF(Py_None), Py_None
#endif
@@ -76,6 +71,7 @@
$else;
typedef int mint;
typedef long int4;
+typedef loc_t ifx_loc_t;
$endif;
#if HAVE_C_DATETIME == 1
@@ -106,8 +102,6 @@
#define PyDoc_STRVAR(name, str) PyDoc_VAR(name) = PyDoc_STR(str)
#endif
-EXEC SQL include sqlda.h;
-
/* This seems to be the preferred way nowadays to mark up slots which
* can't use static initializers.
*/
@@ -1325,8 +1319,8 @@
else
$endif;
{
- loc_t *loc;
- loc = (loc_t*) malloc(sizeof(loc_t));
+ ifx_loc_t *loc;
+ loc = (ifx_loc_t*) malloc(sizeof(ifx_loc_t));
loc->loc_loctype = LOCMEMORY;
loc->loc_buffer = malloc((int)n);
loc->loc_bufsize = (int)n;
@@ -1337,7 +1331,7 @@
memcpy(loc->loc_buffer, buf, (int)n);
var->sqldata = (char *) loc;
- var->sqllen = sizeof(loc_t);
+ var->sqllen = sizeof(ifx_loc_t);
var->sqltype = CLOCATORTYPE;
*var->sqlind = 0;
}
@@ -1745,7 +1739,7 @@
var->sqllen,
var->sqllen,
Py_None, Py_None,
- ISCOLUMNULLABLE(var->sqlflags));
+ !(var->sqltype & SQLNONULL));
PyTuple_SET_ITEM(cur->description, pos, new_tuple);
var->sqlind = &cur->indOut[pos];
@@ -1761,7 +1755,7 @@
switch(var->sqltype & SQLTYPE){
case SQLBYTES:
case SQLTEXT:
- var->sqllen = sizeof(loc_t);
+ var->sqllen = sizeof(ifx_loc_t);
var->sqltype = CLOCATORTYPE;
break;
case SQLSMFLOAT:
@@ -1881,7 +1875,7 @@
offset += var->sqllen;
if (var->sqltype == CLOCATORTYPE) {
- loc_t *loc = (loc_t*) var->sqldata;
+ ifx_loc_t *loc = (ifx_loc_t*) var->sqldata;
loc->loc_loctype = LOCMEMORY;
loc->loc_buffer = NULL;
loc->loc_bufsize = -1;
@@ -2456,7 +2450,7 @@
PyObject *buffer;
char *b_mem;
Py_ssize_t b_len;
- loc_t *l = (loc_t*)data;
+ ifx_loc_t *l = (ifx_loc_t*)data;
l->loc_mflags |= LOC_ALLOC;
buffer = PyBuffer_New(l->loc_size);
@@ -2617,7 +2611,7 @@
/* may not actually exist in some err cases */
if ( da->sqlvar[i].sqldata) {
if (da->sqlvar[i].sqltype == CLOCATORTYPE) {
- loc_t *loc = (loc_t*) da->sqlvar[i].sqldata;
+ ifx_loc_t *loc = (ifx_loc_t*) da->sqlvar[i].sqldata;
if (loc->loc_buffer) {
_loc_free(loc->loc_buffer);
}
@@ -2662,7 +2656,7 @@
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;
+ ifx_loc_t *loc = (ifx_loc_t*) da->sqlvar[i].sqldata;
if (loc->loc_buffer)
_loc_free(loc->loc_buffer);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <f-a...@us...> - 2011-11-06 20:43:51
|
Revision: 189
http://informixdb.svn.sourceforge.net/informixdb/?rev=189&view=rev
Author: f-apolloner
Date: 2011-11-06 20:43:45 +0000 (Sun, 06 Nov 2011)
Log Message:
-----------
update svn:ignore to ignore build folders and generated files
Property Changed:
----------------
trunk/informixdb/
trunk/informixdb/ext/
Property changes on: trunk/informixdb
___________________________________________________________________
Added: svn:ignore
+ build
Property changes on: trunk/informixdb/ext
___________________________________________________________________
Added: svn:ignore
+ esqlver.h
_informixdb.c
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <f-a...@us...> - 2011-11-06 20:36:31
|
Revision: 188
http://informixdb.svn.sourceforge.net/informixdb/?rev=188&view=rev
Author: f-apolloner
Date: 2011-11-06 20:36:25 +0000 (Sun, 06 Nov 2011)
Log Message:
-----------
Use setuptools if available to allow setup.py develop installs
Modified Paths:
--------------
trunk/informixdb/setup.py
Modified: trunk/informixdb/setup.py
===================================================================
--- trunk/informixdb/setup.py 2011-11-06 18:53:24 UTC (rev 187)
+++ trunk/informixdb/setup.py 2011-11-06 20:36:25 UTC (rev 188)
@@ -2,7 +2,6 @@
import os
import shlex
import re
-from distutils.core import setup, Extension
from distutils.spawn import find_executable
from distutils.sysconfig import get_python_inc
from distutils.util import get_platform
@@ -11,6 +10,11 @@
from distutils.dep_util import newer_group
from distutils.errors import *
+try:
+ from setuptools import setup, Extension
+except ImportError:
+ from distutils.core import setup, Extension
+
class build_ext(_build_ext):
""" build_ext which can handle ESQL/C (*.ec) files """
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <f-a...@us...> - 2011-11-06 18:53:30
|
Revision: 187
http://informixdb.svn.sourceforge.net/informixdb/?rev=187&view=rev
Author: f-apolloner
Date: 2011-11-06 18:53:24 +0000 (Sun, 06 Nov 2011)
Log Message:
-----------
change !(var->sqltype &SQLNONULL) to ISCOLUMNULLABLE(var->sqlflags).
Modified Paths:
--------------
trunk/informixdb/ext/_informixdb.ec
Modified: trunk/informixdb/ext/_informixdb.ec
===================================================================
--- trunk/informixdb/ext/_informixdb.ec 2008-09-28 02:48:41 UTC (rev 186)
+++ trunk/informixdb/ext/_informixdb.ec 2011-11-06 18:53:24 UTC (rev 187)
@@ -1745,7 +1745,7 @@
var->sqllen,
var->sqllen,
Py_None, Py_None,
- !(var->sqltype & SQLNONULL));
+ ISCOLUMNULLABLE(var->sqlflags));
PyTuple_SET_ITEM(cur->description, pos, new_tuple);
var->sqlind = &cur->indOut[pos];
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ch...@us...> - 2008-09-28 02:48:48
|
Revision: 186
http://informixdb.svn.sourceforge.net/informixdb/?rev=186&view=rev
Author: chaese
Date: 2008-09-28 02:48:41 +0000 (Sun, 28 Sep 2008)
Log Message:
-----------
Mass merge of r162 through r181 from trunk.
Modified Paths:
--------------
branches/informixdb-py3k/README
branches/informixdb-py3k/doc/manual.txt
branches/informixdb-py3k/ext/_informixdb.ec
branches/informixdb-py3k/informixdb.py
branches/informixdb-py3k/setup.py
Added Paths:
-----------
branches/informixdb-py3k/winbuild.bat
Modified: branches/informixdb-py3k/README
===================================================================
--- branches/informixdb-py3k/README 2008-09-28 02:45:11 UTC (rev 185)
+++ branches/informixdb-py3k/README 2008-09-28 02:48:41 UTC (rev 186)
@@ -1,7 +1,7 @@
INTRODUCTION
============
-This is informixdb 2.4, an Informix implementation of the Python
+This is informixdb 2.5, an Informix implementation of the Python
Database API. This release implements version 2.0 of the DB-API:
http://www.python.org/topics/database/DatabaseAPI-2.0.html
@@ -23,7 +23,12 @@
This distribution uses Python distutils to build and install the informixdb
module. It requires Python 2.2 or later.
+To compile InformixDB, you need to have Informix ESQL/C installed. ESQL/C
+is included with the Informix Client Software Development Kit (Informix CSDK),
+which is available free of charge at
+http://www.ibm.com/software/data/informix/tools/csdk/ .
+
In a hurry?
-----------
@@ -76,6 +81,13 @@
NEWS
====
+From 2.4 to 2.5:
+- Compatibility with CSDK 3.00
+- Ability to manually interrupt or automatically time out SQL execution
+- Proper binding of boolean parameters in WHERE clauses
+- Make version information about server and client available
+- Various bug fixes
+
From 2.3 to 2.4:
- Implement 'named' parameter style to optionally bind query parameters
by name
@@ -240,7 +252,9 @@
FUTURE
======
-- Nothing planned at the moment. Let me know if you think a feature is missing.
+- Some kind of Type Mapping API
+- Some kind of Unicode support
+- More unit tests to cover correct functionality in addition to API compliance
MAINTAINER
==========
@@ -279,6 +293,7 @@
2.2 2006-03-26 Carsten Haese
2.3 2006-10-01 Carsten Haese
2.4 2006-12-02 Carsten Haese
+2.5 2007-10-16 Carsten Haese
--
Carsten Haese <ch...@us...>
Modified: branches/informixdb-py3k/doc/manual.txt
===================================================================
--- branches/informixdb-py3k/doc/manual.txt 2008-09-28 02:45:11 UTC (rev 185)
+++ branches/informixdb-py3k/doc/manual.txt 2008-09-28 02:48:41 UTC (rev 186)
@@ -3,8 +3,8 @@
==========================
:Authors: Daniel Smertnig and Carsten Haese
-:Version: informixdb 2.4
-:Date: 2006-12-02
+:Version: informixdb 2.5
+:Date: 2007-10-16
:Homepage: `InformixDB on Sourceforge`_
.. contents:: InformixDB
@@ -379,6 +379,27 @@
`value` is the number of rows by which you want to scroll from the current
row.
+Interrupting Queries
+--------------------
+`(new in version 2.5)`
+
+Cursor objects provide two mechanisms for interrupting long-running queries,
+configurable with the attributes ``sqltimeout`` and ``sqlinterrupt``.
+``sqltimeout`` is an integer that specifies how many milliseconds a query is
+allowed to take. If a query takes longer than that, it is automatically
+aborted. If ``sqltimeout`` is zero, no timeout is in effect and queries are
+allowed to run indefinitely.
+
+``sqlinterrupt`` is a boolean attribute that indicates whether interrupt
+signals during query execution interrupt the query. Note that turning this
+feature on disables Python's handling of interrupt signals while queries are
+executed.
+
+Connection objects have ``sqltimeout`` and ``sqlinterrupt`` attributes that
+set the defaults for the corresponding attributes of any cursor objects
+that the connection object creates. By default, ``sqltimeout`` is zero,
+and ``sqlinterrupt`` is False.
+
Transactions
============
@@ -643,7 +664,33 @@
`Connection` object's messages attribute, and if the error is an actual
error (i.e. not of type `Warning`), an exception is raised.
+Inspecting Version Numbers
+==========================
+Occasionally it may be useful to inspect the version numbers of the database
+engine, the ESQL/C driver, or of InformixDB itself. The following version
+information is available at runtime:
+Module-level attribute:
+
+ * ``version``: The version number of InformixDB itself.
+ (`new in version 2.3`)
+
+Versions 2.0 through 2.2 didn't provide any version information. If you
+have an installation of InformixDB that doesn't have a ``version`` attribute,
+you should probably upgrade, since you're missing out on a lot of features
+and bug fixes.
+
+Connection attributes (`new in version 2.5`):
+
+ * ``dbms_name``, ``dbms_version``: The name and version number of the
+ database engine. For older engines such as Standard Engine, the name can
+ not be determined and the string "Unknown" is returned instead.
+
+ * ``driver_name``, ``driver_version``: The name and version number of the
+ ESQL/C installation with which InformixDB was compiled. The name is either
+ "INFORMIX-ESQL" or "IBM Informix-ESQL"
+
+
.. _InformixDB on Sourceforge: http://informixdb.sourceforge.net/
.. [#pep249] http://www.python.org/peps/pep-0249.html
Modified: branches/informixdb-py3k/ext/_informixdb.ec
===================================================================
--- branches/informixdb-py3k/ext/_informixdb.ec 2008-09-28 02:45:11 UTC (rev 185)
+++ branches/informixdb-py3k/ext/_informixdb.ec 2008-09-28 02:48:41 UTC (rev 186)
@@ -117,7 +117,34 @@
*/
#define DEFERRED_ADDRESS(ADDR) 0
#include <signal.h>
+#include "esqlver.h"
+typedef void sqlbreakcallbackfunc(mint);
+
+/************************* Helpers *************************/
+static PyObject *get_bool_from_int(PyObject *self, void *closure)
+{
+ int *p;
+
+ p = (int*)((char*)self+(int)closure);
+ if (*p) {
+ Py_INCREF(Py_True);
+ return Py_True;
+ }
+ else {
+ Py_INCREF(Py_False);
+ return Py_False;
+ }
+}
+
+static int set_bool_to_int(PyObject *self, PyObject *value, void *closure)
+{
+ int *p;
+ p = (int*)((char*)self+(int)closure);
+ *p = PyObject_IsTrue(value)?1:0;
+ return 0;
+}
+
/************************* Error handling *************************/
static PyObject *ExcWarning;
@@ -164,6 +191,7 @@
following attributes:\n\
\n\
- sqlcode: The Informix SQLCODE associated with the error\n\
+- sqlerrm: The SQLERRM string associated with the error\n\
- diagnostics: A list of dictionaries with keys 'sqlstate' and\n\
'message' that describe the error in detail.");
@@ -450,7 +478,7 @@
PyObject *named_params;
int have_named_params;
int sqltimeout;
- int allow_interrupt;
+ int sqlinterrupt;
} Cursor;
static int Cursor_init(Cursor *self, PyObject *args, PyObject *kwargs);
@@ -646,14 +674,15 @@
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 }
};
static PyGetSetDef Cursor_getseters[] = {
{ "sqlerrd", (getter)Cursor_getsqlerrd, NULL,
"Informix SQL error descriptor as tuple", NULL },
+ { "sqlinterrupt", (getter)get_bool_from_int, (setter)set_bool_to_int,
+ "If True, SIGINT interrupts SQL queries.",
+ (void*)offsetof(Cursor, sqlinterrupt) },
{ NULL }
};
@@ -728,6 +757,13 @@
PyObject *errorhandler;
int autocommit;
PyObject *binary_types;
+ PyObject *dbms_name;
+ PyObject *dbms_version;
+ PyObject *driver_name;
+ PyObject *driver_version;
+ int can_describe_input;
+ int sqltimeout;
+ int sqlinterrupt;
} Connection;
static int setConnection(Connection*);
@@ -876,6 +912,16 @@
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." },
+ { "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." },
+ { "sqltimeout", T_INT, offsetof(Connection, sqltimeout), 0,
+ "Default SQL query timeout in milliseconds." },
{ NULL }
};
@@ -914,6 +960,9 @@
ExcNotSupportedError_doc, DEFERRED_ADDRESS(ExcNotSupportedError) },
{ "autocommit", (getter)Connection_getautocommit,
(setter)Connection_setautocommit, Connection_autocommit_doc, NULL },
+ { "sqlinterrupt", (getter)get_bool_from_int, (setter)set_bool_to_int,
+ "Default setting for whether SIGINT interrupts SQL queries.",
+ (void*)offsetof(Connection, sqlinterrupt) },
{ NULL }
};
@@ -1404,7 +1453,7 @@
else
$endif;
{
- var->sqltype = CSTRINGTYPE;
+ var->sqltype = CVCHARTYPE;
var->sqldata = malloc(n+1);
var->sqllen = n+1;
*var->sqlind = 0;
@@ -1751,6 +1800,10 @@
case SQLINTERVAL:
var->sqltype = CINVTYPE;
break;
+ case SQLVCHAR:
+ case SQLNVCHAR:
+ var->sqltype = CVCHARTYPE;
+ break;
default: {
int known_type = 0;
$ifdef HAVE_ESQL9;
@@ -1926,6 +1979,17 @@
(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;
+ ret_on_dberror_cursor(self, "DESCRIBE INPUT");
+ if (tda) {
+ copyDescr(tdaIn, tda);
+ _da_free(tda);
+ }
+ }
+$endif;
bindOutput(self);
switch (self->is_hold + 2*self->is_scroll) {
case 3:
@@ -2025,16 +2089,16 @@
if (self->sqltimeout>0) {
sqlbreakcallback(self->sqltimeout, _sqltimeouthandler);
}
- if (self->allow_interrupt) {
+ if (self->sqlinterrupt) {
oldsighandler = signal(2, _sigint_sqlbreak);
}
EXEC SQL OPEN :cursorName USING DESCRIPTOR tdaIn;
- if (self->allow_interrupt) {
+ if (self->sqlinterrupt) {
signal(2, oldsighandler);
}
Py_END_ALLOW_THREADS;
ret_on_dberror_cursor(self, "OPEN");
- sqlbreakcallback(-1, (void*)NULL);
+ sqlbreakcallback(-1, (sqlbreakcallbackfunc*)NULL);
self->state = 3;
for (i=0; i<6; i++) self->sqlerrd[i] = sqlca.sqlerrd[i];
@@ -2046,16 +2110,16 @@
if (self->sqltimeout>0) {
sqlbreakcallback(self->sqltimeout, _sqltimeouthandler);
}
- if (self->allow_interrupt) {
+ if (self->sqlinterrupt) {
oldsighandler = signal(2, _sigint_sqlbreak);
}
EXEC SQL EXECUTE :queryName USING DESCRIPTOR tdaIn;
- if (self->allow_interrupt) {
+ if (self->sqlinterrupt) {
signal(2, oldsighandler);
}
Py_END_ALLOW_THREADS;
ret_on_dberror_cursor(self, "EXECUTE");
- sqlbreakcallback(-1, (void*)NULL);
+ sqlbreakcallback(-1, (sqlbreakcallbackfunc*)NULL);
for (i=0; i<6; i++) self->sqlerrd[i] = sqlca.sqlerrd[i];
switch (self->stype) {
@@ -2190,6 +2254,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)
{
@@ -2325,19 +2397,17 @@
}
}
case SQLCHAR:
+ case SQLNCHAR:
+ {
+ _clip_char((char*)data);
+ return Py_BuildValue("s", (char*)data);
+ }
case SQLVCHAR:
- case SQLNCHAR:
case SQLNVCHAR:
$ifdef HAVE_ESQL9;
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;
return Py_BuildValue("s", (char*)data);
- }
case SQLFLOAT:
return PyFloat_FromDouble(*(double*)data);
case SQLSMFLOAT:
@@ -2433,9 +2503,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);
}
}
@@ -2672,6 +2740,7 @@
Py_XDECREF(self->conn);
Py_XDECREF(self->messages);
Py_XDECREF(self->errorhandler);
+ Py_XDECREF(self->op);
free(self->cursorName);
}
@@ -2713,24 +2782,21 @@
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 };
+ "scroll", "hold", "use_decimal", 0 };
if (DecimalType==Py_None) { use_decimal = 0; }
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O!|siiiiii", kwdlist,
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O!|siiii", kwdlist,
&Connection_type, &conn, &name, &rowformat, &is_scroll, &is_hold,
- &use_decimal, &sqltimeout, &allow_interrupt))
+ &use_decimal))
return -1;
self->use_decimal = (use_decimal)?1:0;
- self->sqltimeout = sqltimeout;
- self->allow_interrupt = allow_interrupt;
Py_INCREF(Py_None);
self->description = Py_None;
self->conn = conn;
Py_INCREF(conn);
+ self->sqltimeout = conn->sqltimeout;
+ self->sqlinterrupt = conn->sqlinterrupt;
self->state = 0;
self->daIn.sqld = 0; self->daIn.sqlvar = 0;
self->daOut = 0;
@@ -2798,12 +2864,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);
@@ -2816,7 +2881,7 @@
if (self->sqltimeout>0) {
sqlbreakcallback(self->sqltimeout, _sqltimeouthandler);
}
- if (self->allow_interrupt) {
+ if (self->sqlinterrupt) {
oldsighandler = signal(2, _sigint_sqlbreak);
}
if (self->is_scroll) {
@@ -2841,7 +2906,7 @@
else {
EXEC SQL FETCH :cursorName USING DESCRIPTOR tdaOut;
}
- if (self->allow_interrupt) {
+ if (self->sqlinterrupt) {
signal(2, oldsighandler);
}
Py_END_ALLOW_THREADS;
@@ -2853,7 +2918,7 @@
} else if (strncmp(SQLSTATE, "00", 2)) {
ret_on_dberror_cursor(self, "FETCH");
}
- sqlbreakcallback(-1,(void*)NULL);
+ sqlbreakcallback(-1,(sqlbreakcallbackfunc*)NULL);
return processOutput(self);
}
@@ -3061,8 +3126,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 };
@@ -3106,8 +3179,11 @@
}
self->is_open = 1;
+ self->can_describe_input = 0;
self->has_commit = (sqlca.sqlwarn.sqlwarn1 == 'W');
self->autocommit = 0;
+ self->sqltimeout = 0;
+ self->sqlinterrupt = 0;
if (autocommit) self->autocommit = 1;
if (self->has_commit && !self->autocommit) {
@@ -3119,6 +3195,43 @@
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 = PyUnicode_FromString(server_type);
+ self->dbms_version = PyUnicode_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 = PyUnicode_FromString("Unknown");
+ self->dbms_version = PyUnicode_FromString(version);
+ }
+ self->driver_name = PyUnicode_FromString(DRIVER_NAME);
+ self->driver_version = PyUnicode_FromString(DRIVER_VERSION);
+
return 0;
}
@@ -3156,13 +3269,15 @@
static PyObject* DatabaseError_init(PyObject* self, PyObject* args, PyObject* kwds)
{
- static char* kwdnames[] = { "action", "sqlcode", "diagnostics", 0 };
+ static char* kwdnames[] = { "action", "sqlcode", "diagnostics", "sqlerrm",
+ 0 };
PyObject *action;
PyObject *diags;
long int sqlcode;
+ PyObject *sqlerrm;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "UlO!", kwdnames,
- &action, &sqlcode, &PyList_Type, &diags)) {
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "UlO!O", kwdnames,
+ &action, &sqlcode, &PyList_Type, &diags, &sqlerrm)) {
return NULL;
}
@@ -3178,18 +3293,23 @@
return NULL;
}
+ if (PyObject_SetAttrString(self, "sqlerrm", sqlerrm)) {
+ return NULL;
+ }
+
Py_INCREF(Py_None);
return Py_None;
}
static PyObject* DatabaseError_str(PyObject* self, PyObject* args)
{
- PyObject *str, *action, *sqlcode, *diags, *a, *f;
+ PyObject *str, *action, *sqlcode, *diags, *sqlerrm, *a, *f;
int i;
action = PyObject_GetAttrString(self, "action");
sqlcode = PyObject_GetAttrString(self, "sqlcode");
diags = PyObject_GetAttrString(self, "diagnostics");
+ sqlerrm = PyObject_GetAttrString(self, "sqlerrm");
a = Py_BuildValue("(NN)", sqlcode, action);
f = PyUnicode_FromString("SQLCODE %d in %s: \n");
@@ -3209,6 +3329,17 @@
Py_DECREF(f);
+ if (PyObject_IsTrue(sqlerrm)) {
+ PyUnicode_AppendAndDel(&str, PyUnicode_FromString("SQLERRM = "));
+ PyUnicode_Append(&str, sqlerrm);
+ PyUnicode_AppendAndDel(&str, PyUnicode_FromString("\n"));
+ }
+
+ Py_DECREF(action);
+ Py_DECREF(sqlcode);
+ Py_DECREF(diags);
+ Py_DECREF(sqlerrm);
+
return str;
}
@@ -3273,7 +3404,7 @@
Py_DECREF(msg);
}
- return Py_BuildValue("(siN)", action, SQLCODE, list);
+ return Py_BuildValue("(siNs)", action, SQLCODE, list, sqlca.sqlerrm);
}
/* determines the type of an error by looking at SQLSTATE */
@@ -4235,7 +4366,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);
Modified: branches/informixdb-py3k/informixdb.py
===================================================================
--- branches/informixdb-py3k/informixdb.py 2008-09-28 02:45:11 UTC (rev 185)
+++ branches/informixdb-py3k/informixdb.py 2008-09-28 02:48:41 UTC (rev 186)
@@ -46,7 +46,7 @@
http://www.python.org/peps/pep-0249.html
"""
-version = "2.4"
+version = "2.5"
class Row(object):
"""Helper class for cursors whose row format is ROW_AS_OBJECT."""
Modified: branches/informixdb-py3k/setup.py
===================================================================
--- branches/informixdb-py3k/setup.py 2008-09-28 02:45:11 UTC (rev 185)
+++ branches/informixdb-py3k/setup.py 2008-09-28 02:48:41 UTC (rev 186)
@@ -61,7 +61,9 @@
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
# result from os.popen is not iterable in Python 3.0a1, workaround
@@ -69,14 +71,24 @@
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")
+ if esqlversion >= 953:
+ self.esql_parts.append("-EDHAVE_DESCRIBE_INPUT")
+ 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')
@@ -91,9 +103,15 @@
esql_config.append(token)
ret = cout.close()
if ret != None and ret != 0:
- raise DistutilsSetupError(
- "\nCan't find esql. Please set INFORMIXDIR correctly.")
+ raise DistutilsSetupError("""\
+Can't run esql. Please make sure that:
+* You have the Informix CSDK installed,
+* INFORMIXDIR is set to where Informix CSDK is installed, and
+* esql is in your PATH.
+See the README for build requirements.
+""")
+
if get_platform()=="win32":
for arg in esql_config:
if arg.endswith('.lib'):
@@ -208,8 +226,8 @@
DistributionMetadata.download_url = None
setup (name = 'InformixDB',
- version = '2.4',
- description = 'InformixDB v2.4',
+ version = '2.5',
+ description = 'InformixDB v2.5',
long_description = \
"InformixDB is a DB-API 2.0 compliant interface for IBM Informix\n"
"databases.",
Copied: branches/informixdb-py3k/winbuild.bat (from rev 184, trunk/informixdb/winbuild.bat)
===================================================================
--- branches/informixdb-py3k/winbuild.bat (rev 0)
+++ branches/informixdb-py3k/winbuild.bat 2008-09-28 02:48:41 UTC (rev 186)
@@ -0,0 +1,7 @@
+set INFORMIXDIR=C:\Program Files\IBM\Informix\Client-SDK
+set OLDPATH=%PATH%
+set PATH=%INFORMIXDIR%\bin;C:\msys\1.0\mingw\bin;%PATH%
+C:\Python25\python.exe setup.py bdist_wininst build_ext -c mingw32 --esql-threadlib=winnt
+C:\Python24\python.exe setup.py bdist_wininst build_ext -c mingw32 --esql-threadlib=winnt
+C:\Python23\python.exe setup.py bdist_wininst build_ext -c mingw32 --esql-threadlib=winnt
+set PATH=%OLDPATH%
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ch...@us...> - 2008-09-28 02:45:20
|
Revision: 185
http://informixdb.svn.sourceforge.net/informixdb/?rev=185&view=rev
Author: chaese
Date: 2008-09-28 02:45:11 +0000 (Sun, 28 Sep 2008)
Log Message:
-----------
Ah, so PyString_ConcatAndDel has become PyUnicode_AppendAndDel.
Modified Paths:
--------------
branches/informixdb-py3k/ext/_informixdb.ec
Modified: branches/informixdb-py3k/ext/_informixdb.ec
===================================================================
--- branches/informixdb-py3k/ext/_informixdb.ec 2008-09-26 04:57:59 UTC (rev 184)
+++ branches/informixdb-py3k/ext/_informixdb.ec 2008-09-28 02:45:11 UTC (rev 185)
@@ -3184,7 +3184,7 @@
static PyObject* DatabaseError_str(PyObject* self, PyObject* args)
{
- PyObject *str, *action, *sqlcode, *diags, *a, *f, *str2, *str3;
+ PyObject *str, *action, *sqlcode, *diags, *a, *f;
int i;
action = PyObject_GetAttrString(self, "action");
@@ -3203,11 +3203,7 @@
PyObject* d = PyList_GetItem(diags, i);
a = Py_BuildValue("(OO)", PyDict_GetItemString(d, "sqlstate"),
PyDict_GetItemString(d, "message"));
- str2 = PyUnicode_Format(f, a);
- str3 = PyUnicode_Concat(str, str2);
- Py_DECREF(str);
- Py_DECREF(str2);
- str = str3;
+ PyUnicode_AppendAndDel(&str, PyUnicode_Format(f, a));
Py_DECREF(a);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ch...@us...> - 2008-09-26 04:58:08
|
Revision: 184
http://informixdb.svn.sourceforge.net/informixdb/?rev=184&view=rev
Author: chaese
Date: 2008-09-26 04:57:59 +0000 (Fri, 26 Sep 2008)
Log Message:
-----------
The Binary() constructor needs a byte string.
All unit tests pass now, but note that the unit tests only cover very few
features. This is still very much a work in progress.
Modified Paths:
--------------
branches/informixdb-py3k/tests/dbapi20.py
Modified: branches/informixdb-py3k/tests/dbapi20.py
===================================================================
--- branches/informixdb-py3k/tests/dbapi20.py 2008-09-26 04:50:13 UTC (rev 183)
+++ branches/informixdb-py3k/tests/dbapi20.py 2008-09-26 04:57:59 UTC (rev 184)
@@ -851,8 +851,8 @@
# self.assertEqual(str(t1),str(t2))
def test_Binary(self):
- b = self.driver.Binary('Something')
- b = self.driver.Binary('')
+ b = self.driver.Binary(b'Something')
+ b = self.driver.Binary(b'')
def test_STRING(self):
self.failUnless(hasattr(self.driver,'STRING'),
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ch...@us...> - 2008-09-26 04:50:23
|
Revision: 183
http://informixdb.svn.sourceforge.net/informixdb/?rev=183&view=rev
Author: chaese
Date: 2008-09-26 04:50:13 +0000 (Fri, 26 Sep 2008)
Log Message:
-----------
Fix how the __init__ and __str__ methods are being injected into the
Error classes. The methods are now actual methods and don't receive
"self" in the args tuple anymore.
Modified Paths:
--------------
branches/informixdb-py3k/ext/_informixdb.ec
Modified: branches/informixdb-py3k/ext/_informixdb.ec
===================================================================
--- branches/informixdb-py3k/ext/_informixdb.ec 2008-09-26 02:07:03 UTC (rev 182)
+++ branches/informixdb-py3k/ext/_informixdb.ec 2008-09-26 04:50:13 UTC (rev 183)
@@ -3156,12 +3156,12 @@
static PyObject* DatabaseError_init(PyObject* self, PyObject* args, PyObject* kwds)
{
- static char* kwdnames[] = { "self", "action", "sqlcode", "diagnostics", 0 };
+ static char* kwdnames[] = { "action", "sqlcode", "diagnostics", 0 };
PyObject *action;
PyObject *diags;
long int sqlcode;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "OSlO!", kwdnames, &self,
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "UlO!", kwdnames,
&action, &sqlcode, &PyList_Type, &diags)) {
return NULL;
}
@@ -3186,7 +3186,6 @@
{
PyObject *str, *action, *sqlcode, *diags, *a, *f, *str2, *str3;
int i;
- self = PyTuple_GetItem(args, 0);
action = PyObject_GetAttrString(self, "action");
sqlcode = PyObject_GetAttrString(self, "sqlcode");
@@ -3228,11 +3227,9 @@
PyMethodDef* meth;
for (meth = DatabaseError_methods; meth->ml_name != NULL; ++meth) {
- PyObject *func = PyCFunction_New(meth, NULL);
- PyObject *method = PyMethod_New(func, exc);
- PyObject_SetAttrString(exc, meth->ml_name, method);
+ PyObject *func = PyDescr_NewMethod((PyTypeObject*)exc, meth);
+ PyObject_SetAttrString(exc, meth->ml_name, func);
Py_DECREF(func);
- Py_DECREF(method);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ch...@us...> - 2008-09-26 02:07:07
|
Revision: 182
http://informixdb.svn.sourceforge.net/informixdb/?rev=182&view=rev
Author: chaese
Date: 2008-09-26 02:07:03 +0000 (Fri, 26 Sep 2008)
Log Message:
-----------
Incremental commit towards Python 3.0 compatibility.
WARNING: This is the bare minimum of changes to get the module to
compile against 3.0rc1. IT DOES NOT WORK! I'm only committing this to
have some sort of development base line.
Modified Paths:
--------------
branches/informixdb-py3k/ext/_informixdb.ec
Modified: branches/informixdb-py3k/ext/_informixdb.ec
===================================================================
--- branches/informixdb-py3k/ext/_informixdb.ec 2008-08-15 00:57:18 UTC (rev 181)
+++ branches/informixdb-py3k/ext/_informixdb.ec 2008-09-26 02:07:03 UTC (rev 182)
@@ -43,6 +43,10 @@
#define Py_RETURN_NONE return Py_INCREF(Py_None), Py_None
#endif
+#ifndef Py_Type
+#define Py_Type Py_TYPE
+#endif
+
/* Make sure that we can use Py_ssize_t the way Python 2.5 expects us to
while remaining compatible with older Python versions. */
#if PY_VERSION_HEX < 0x02050000
@@ -217,7 +221,7 @@
#define require_open(conn) \
if (!conn || !conn->is_open) { \
if (error_handle(conn, NULL, ExcInterfaceError, \
- PyString_FromString("Connection already closed"))) \
+ PyUnicode_FromString("Connection already closed"))) \
return NULL; \
}
@@ -227,7 +231,7 @@
if (!cursor || cursor->state == 4) { \
if (error_handle(cursor->conn, cursor, \
ExcInterfaceError, \
- PyString_FromString("Cursor already closed"))) \
+ PyUnicode_FromString("Cursor already closed"))) \
return NULL; \
}\
} while(0)
@@ -981,13 +985,13 @@
char* name;
if (!ifxdbConnKey)
- ifxdbConnKey = PyString_FromString(KEY);
+ ifxdbConnKey = PyUnicode_FromString(KEY);
dict = PyThreadState_GetDict();
conn = PyDict_GetItem(dict, ifxdbConnKey);
if (!conn) return NULL;
- name = PyString_AS_STRING(conn);
+ name = _PyUnicode_AsString(conn);
return name;
}
@@ -996,13 +1000,13 @@
PyObject *dict, *conn;
if (!ifxdbConnKey)
- ifxdbConnKey = PyString_FromString(KEY);
+ ifxdbConnKey = PyUnicode_FromString(KEY);
dict = PyThreadState_GetDict();
if (!name) {
PyDict_DelItem(dict, ifxdbConnKey);
} else {
- conn = PyString_FromString(name);
+ conn = PyUnicode_FromString(name);
PyDict_SetItem(dict, ifxdbConnKey, conn);
Py_DECREF(conn);
}
@@ -1376,7 +1380,7 @@
}
sitem = PyObject_Str(item);
if (PyErr_Occurred()) return 0;
- val = PyString_AS_STRING((PyStringObject*)sitem);
+ val = _PyUnicode_AsString(sitem);
n = strlen(val);
$ifdef HAVE_ESQL9;
if (ISUDTTYPE(sqltype) || ISCOMPLEXTYPE(sqltype)) {
@@ -1413,7 +1417,7 @@
static int ibindInterval(struct sqlvar_struct *var, PyObject *item)
{
PyObject *sitem = PyObject_Str(item);
- const char *val = PyString_AS_STRING((PyStringObject*)sitem);
+ const char *val = _PyUnicode_AsString(sitem);
intrvl_t *inv = (intrvl_t*)malloc(sizeof(intrvl_t));
int ret;
@@ -1498,7 +1502,7 @@
if (PyObject_IsInstance(item, IntervalY2MType) ||
PyObject_IsInstance(item, IntervalD2FType)) {
return ibindInterval;
- } else if (PyBuffer_Check(item)) {
+ } else if (PyObject_CheckBuffer(item)) {
return ibindBinary;
} else if (PyDateTime_Check(item)) {
return (ibindFptr)ibindDateTime;
@@ -1542,7 +1546,7 @@
the name is stored in parmName/parmLen of the parseContext.
*/
PyObject *parmname;
- parmname = PyString_FromStringAndSize(ctx.parmName,ctx.parmLen);
+ parmname = PyUnicode_FromStringAndSize(ctx.parmName,ctx.parmLen);
if (PyList_Append(cur->named_params, parmname)==-1) {
return 0;
}
@@ -1637,14 +1641,14 @@
maxp = maxp > cur->parmIdx[i] ? maxp : cur->parmIdx[i];
} else {
error_handle(cur->conn, cur, ExcInterfaceError,
- PyString_FromString("too few actual parameters"));
+ PyUnicode_FromString("too few actual parameters"));
return 0;
}
}
if (maxp+1 < n_vars) {
error_handle(cur->conn, cur, ExcInterfaceError,
- PyString_FromString("too many actual parameters"));
+ PyUnicode_FromString("too many actual parameters"));
return 0;
}
}
@@ -1656,12 +1660,12 @@
{
$ifdef HAVE_ESQL9;
if (ISCOMPLEXTYPE(var->sqltype)||ISUDTTYPE(var->sqltype)) {
- return PyString_FromFormat("%s '%s'", rtypname(var->sqltype),
+ return PyUnicode_FromFormat("%s '%s'", rtypname(var->sqltype),
var->sqltypename);
}
- else return PyString_FromString(rtypname(var->sqltype));
+ else return PyUnicode_FromString(rtypname(var->sqltype));
$else;
- return PyString_FromString(rtypname(var->sqltype));
+ return PyUnicode_FromString(rtypname(var->sqltype));
$endif;
}
@@ -1889,7 +1893,7 @@
clear_messages(self);
require_cursor_open(self);
- sql = PyString_AsString(op);
+ sql = _PyUnicode_AsString(op);
if (!sql) return NULL;
if (op == self->op) {
@@ -2368,10 +2372,10 @@
return PyFloat_FromDouble(dval);
}
case SQLSMINT:
- return PyInt_FromLong(*(short*)data);
+ return PyLong_FromLong(*(short*)data);
case SQLINT:
case SQLSERIAL:
- return PyInt_FromLong(*(long*)data);
+ return PyLong_FromLong(*(long*)data);
$ifdef HAVE_ESQL9;
case SQLINT8:
case SQLSERIAL8:
@@ -2386,14 +2390,7 @@
loc_t *l = (loc_t*)data;
l->loc_mflags |= LOC_ALLOC;
- buffer = PyBuffer_New(l->loc_size);
-
- if (PyObject_AsWriteBuffer(buffer, (void**)&b_mem, &b_len) == -1) {
- Py_DECREF(buffer);
- return NULL;
- }
-
- memcpy(b_mem, l->loc_buffer, (int)b_len);
+ buffer = PyByteArray_FromStringAndSize(l->loc_buffer, l->loc_size);
return buffer;
} /* case SQLTEXT */
} /* switch */
@@ -2422,19 +2419,11 @@
/* If the output was bound as var binary, build a buffer object. */
char *b_mem;
Py_ssize_t b_len;
- result = PyBuffer_New(len);
-
- if (PyObject_AsWriteBuffer(result, (void**)&b_mem, &b_len) == -1) {
- Py_DECREF(result);
- result = NULL;
- }
- else {
- memcpy(b_mem, lvcharbuf, (int)b_len);
- }
+ result = PyByteArray_FromStringAndSize(lvcharbuf, len);
}
else {
/* Otherwise build a string. */
- result = PyString_FromStringAndSize(lvcharbuf,len-1);
+ result = PyUnicode_FromStringAndSize(lvcharbuf,len-1);
}
ifx_var_dealloc(&data);
return result;
@@ -2524,7 +2513,7 @@
a = PyTuple_New(PyTuple_Size(args) + 2);
Py_INCREF(self);
PyTuple_SET_ITEM(a, 0, (PyObject*)self);
- PyTuple_SET_ITEM(a, 1, PyInt_FromLong(1));
+ PyTuple_SET_ITEM(a, 1, PyLong_FromLong(1));
for (i = 0; i < (int)PyTuple_Size(args); ++i) {
PyObject *o = PyTuple_GetItem(args, i);
Py_INCREF(o);
@@ -3045,7 +3034,7 @@
}
exec_args = Py_BuildValue("(N)",
- PyString_FromFormat("EXECUTE PROCEDURE %s(%s)",
+ PyUnicode_FromFormat("EXECUTE PROCEDURE %s(%s)",
func, p_str));
free(p_str);
if (params) {
@@ -3084,11 +3073,11 @@
}
if (pyDbUser && pyDbUser != Py_None) {
- dbUser = PyString_AsString(pyDbUser);
+ dbUser = _PyUnicode_AsString(pyDbUser);
if (!dbUser) return -1;
}
if (pyDbPass && pyDbPass != Py_None) {
- dbPass = PyString_AsString(pyDbPass);
+ dbPass = _PyUnicode_AsString(pyDbPass);
if (!dbPass) return -1;
}
@@ -3181,7 +3170,7 @@
return NULL;
}
- if (PyObject_SetAttrString(self, "sqlcode", PyInt_FromLong(sqlcode))) {
+ if (PyObject_SetAttrString(self, "sqlcode", PyLong_FromLong(sqlcode))) {
return NULL;
}
@@ -3195,7 +3184,7 @@
static PyObject* DatabaseError_str(PyObject* self, PyObject* args)
{
- PyObject *str, *action, *sqlcode, *diags, *a, *f;
+ PyObject *str, *action, *sqlcode, *diags, *a, *f, *str2, *str3;
int i;
self = PyTuple_GetItem(args, 0);
@@ -3204,18 +3193,22 @@
diags = PyObject_GetAttrString(self, "diagnostics");
a = Py_BuildValue("(NN)", sqlcode, action);
- f = PyString_FromString("SQLCODE %d in %s: \n");
- str = PyString_Format(f, a);
+ f = PyUnicode_FromString("SQLCODE %d in %s: \n");
+ str = PyUnicode_Format(f, a);
Py_DECREF(f);
Py_DECREF(a);
- f = PyString_FromString("%s: %s\n");
+ f = PyUnicode_FromString("%s: %s\n");
for (i = 0; i < (int)PyList_Size(diags); ++i) {
PyObject* d = PyList_GetItem(diags, i);
a = Py_BuildValue("(OO)", PyDict_GetItemString(d, "sqlstate"),
PyDict_GetItemString(d, "message"));
- PyString_ConcatAndDel(&str, PyString_Format(f, a));
+ str2 = PyUnicode_Format(f, a);
+ str3 = PyUnicode_Concat(str, str2);
+ Py_DECREF(str);
+ Py_DECREF(str2);
+ str = str3;
Py_DECREF(a);
}
@@ -3236,7 +3229,7 @@
for (meth = DatabaseError_methods; meth->ml_name != NULL; ++meth) {
PyObject *func = PyCFunction_New(meth, NULL);
- PyObject *method = PyMethod_New(func, NULL, exc);
+ PyObject *method = PyMethod_New(func, exc);
PyObject_SetAttrString(exc, meth->ml_name, method);
Py_DECREF(func);
Py_DECREF(method);
@@ -3428,9 +3421,9 @@
if (opid == Py_EQ || opid == Py_NE) {
int r = PySequence_Contains(self->values, other);
if (r == -1) /* error occured */
- return PyInt_FromLong(-1);
+ return PyLong_FromLong(-1);
- return PyInt_FromLong(opid == Py_EQ ? r == 1 : r == 0);
+ return PyLong_FromLong(opid == Py_EQ ? r == 1 : r == 0);
}
return PyObject_RichCompare(self->values, other, opid);
}
@@ -3444,9 +3437,9 @@
val = Py_Type(self->values)->tp_repr(self->values);
if (!val)
return NULL;
- str = PyString_AsString(val);
+ str = _PyUnicode_AsString(val);
- s = PyString_FromFormat("DBAPIType(%s)", str);
+ s = PyUnicode_FromFormat("DBAPIType(%s)", str);
Py_DECREF(val);
return s;
}
@@ -3519,7 +3512,7 @@
PyObject *l, *s;
l = PyList_New(0);
for (tp = types; *tp != NULL; ++tp) {
- s = PyString_FromString(*tp);
+ s = PyUnicode_FromString(*tp);
PyList_Append(l, s);
Py_DECREF(s);
}
@@ -3569,7 +3562,7 @@
return NULL;
}
- return PyBuffer_FromObject(s, 0, Py_END_OF_BUFFER);
+ return PyByteArray_FromObject(s);
}
static PyObject* db_connect(PyObject *self, PyObject *args, PyObject *kwds)
@@ -3654,7 +3647,7 @@
mint result;
sitem = PyObject_Str(in);
if (PyErr_Occurred()) return -1;
- val = PyString_AS_STRING((PyStringObject*)sitem);
+ val = _PyUnicode_AsString(sitem);
result = ifx_int8cvasc(val, strlen(val), out);
Py_DECREF(sitem);
return result;
@@ -3787,7 +3780,7 @@
if (self->lofd) {
if (error_handle(self->conn, NULL, ExcInterfaceError,
- PyString_FromString("Sblob is already open")))
+ PyUnicode_FromString("Sblob is already open")))
return NULL;
}
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|i", kwdlist, &flags))
@@ -3811,7 +3804,7 @@
mint buflen;
if (!self->lofd) {
if (error_handle(self->conn, NULL, ExcInterfaceError,
- PyString_FromString("Sblob is not open")))
+ PyUnicode_FromString("Sblob is not open")))
return NULL;
}
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i", kwdlist, &buflen))
@@ -3826,7 +3819,7 @@
PyMem_Free(buf);
ret_on_dberror(self->conn, NULL, "ifx_lo_read");
}
- py_result = PyString_FromStringAndSize(buf, result);
+ py_result = PyUnicode_FromStringAndSize(buf, result);
PyMem_Free(buf);
return py_result;
}
@@ -3839,7 +3832,7 @@
mint buflen;
if (!self->lofd) {
if (error_handle(self->conn, NULL, ExcInterfaceError,
- PyString_FromString("Sblob is not open")))
+ PyUnicode_FromString("Sblob is not open")))
return NULL;
}
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s#", kwdlist, &buf, &buflen))
@@ -3849,7 +3842,7 @@
if (result<0) {
ret_on_dberror(self->conn, NULL, "ifx_lo_write");
}
- return PyInt_FromLong((long)result);
+ return PyLong_FromLong((long)result);
}
static PyObject *Sblob_seek(Sblob *self, PyObject *args, PyObject *kwargs)
@@ -3862,7 +3855,7 @@
if (!self->lofd) {
if (error_handle(self->conn, NULL, ExcInterfaceError,
- PyString_FromString("Sblob is not open")))
+ PyUnicode_FromString("Sblob is not open")))
return NULL;
}
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|i", kwdlist,
@@ -3891,7 +3884,7 @@
if (!self->lofd) {
if (error_handle(self->conn, NULL, ExcInterfaceError,
- PyString_FromString("Sblob is not open")))
+ PyUnicode_FromString("Sblob is not open")))
return NULL;
}
if (setConnection(self->conn)) return NULL;
@@ -3925,7 +3918,7 @@
if (!self->lofd) {
if (error_handle(self->conn, NULL, ExcInterfaceError,
- PyString_FromString("Sblob is not open")))
+ PyUnicode_FromString("Sblob is not open")))
return NULL;
}
if (setConnection(self->conn)) return NULL;
@@ -3977,7 +3970,7 @@
if (!self->lofd) {
if (error_handle(self->conn, NULL, ExcInterfaceError,
- PyString_FromString("Sblob is not open")))
+ PyUnicode_FromString("Sblob is not open")))
return NULL;
}
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O", kwdlist, &py_offset))
@@ -4005,7 +3998,7 @@
if (!self->lofd) {
if (error_handle(self->conn, NULL, ExcInterfaceError,
- PyString_FromString("Sblob is not open")))
+ PyUnicode_FromString("Sblob is not open")))
return NULL;
}
if (setConnection(self->conn)) return NULL;
@@ -4050,9 +4043,9 @@
switch ((int)closure) {
case SBLOB_CSPEC_EXTSZ:
case SBLOB_CSPEC_FLAGS:
- return PyInt_FromLong((long)mintresult); break;
+ return PyLong_FromLong((long)mintresult); break;
case SBLOB_CSPEC_SBSPACE:
- return PyString_FromString(buf); break;
+ return PyUnicode_FromString(buf); break;
case SBLOB_CSPEC_ESTBYTES:
case SBLOB_CSPEC_MAXBYTES:
if (ifx_int8toasc(&int8result, buf, 29)<0) {
@@ -4074,14 +4067,14 @@
if (!self->lofd) {
if (error_handle(self->conn, NULL, ExcInterfaceError,
- PyString_FromString("Sblob is not open")))
+ PyUnicode_FromString("Sblob is not open")))
return 1;
}
if (setConnection(self->conn)) return 1;
if (ifx_lo_stat(self->lofd, &lo_stat)<0) {
if (is_dberror(self->conn, NULL, "ifx_lo_stat")) return 1;
}
- mintval = PyInt_AsLong(value);
+ mintval = PyLong_AsLong(value);
if (PyErr_Occurred()) return 1;
lo_spec = ifx_lo_stat_cspec(lo_stat);
if (!lo_spec) {
@@ -4110,7 +4103,20 @@
PyDoc_STRVAR(_informixdb_doc,
"DB-API 2.0 compliant interface for Informix databases.\n");
-void init_informixdb(void)
+static struct PyModuleDef _informixdbmodule = {
+ PyModuleDef_HEAD_INIT,
+ "_informixdb",
+ _informixdb_doc,
+ -1,
+ globalMethods,
+ NULL,
+ NULL,
+ NULL,
+ NULL
+};
+
+
+PyMODINIT_FUNC PyInit__informixdb(void)
{
int threadsafety = 0;
@@ -4123,10 +4129,15 @@
static char* dbtp_datetime[] = { "date", "datetime", NULL };
static char* dbtp_rowid[] = { "serial", "serial8", NULL };
- PyObject *m = Py_InitModule3("_informixdb", globalMethods, _informixdb_doc);
+ PyObject *m;
PyObject *module;
PyObject *mdict;
+ m = PyModule_Create(&_informixdbmodule);
+ if (!m) {
+ return NULL;
+ }
+
#define defException(name, base) \
do { \
PyObject* d = Py_BuildValue("{sssssisN}", "__doc__", Exc##name##_doc,\
@@ -4278,4 +4289,6 @@
is handled */
sqlsignal(-1, (void(*)(void))NULL, 0);
#endif
+
+ return m;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ch...@us...> - 2008-08-15 00:57:08
|
Revision: 181
http://informixdb.svn.sourceforge.net/informixdb/?rev=181&view=rev
Author: chaese
Date: 2008-08-15 00:57:18 +0000 (Fri, 15 Aug 2008)
Log Message:
-----------
Add sqlerrm attribute to DatabaseError exception instances as suggested
in feature request #2049311. Also fix refcount leaks in DatabaseError_str().
Modified Paths:
--------------
trunk/informixdb/ext/_informixdb.ec
Modified: trunk/informixdb/ext/_informixdb.ec
===================================================================
--- trunk/informixdb/ext/_informixdb.ec 2008-08-15 00:00:36 UTC (rev 180)
+++ trunk/informixdb/ext/_informixdb.ec 2008-08-15 00:57:18 UTC (rev 181)
@@ -187,6 +187,7 @@
following attributes:\n\
\n\
- sqlcode: The Informix SQLCODE associated with the error\n\
+- sqlerrm: The SQLERRM string associated with the error\n\
- diagnostics: A list of dictionaries with keys 'sqlstate' and\n\
'message' that describe the error in detail.");
@@ -3282,13 +3283,15 @@
static PyObject* DatabaseError_init(PyObject* self, PyObject* args, PyObject* kwds)
{
- static char* kwdnames[] = { "self", "action", "sqlcode", "diagnostics", 0 };
+ static char* kwdnames[] = { "self", "action", "sqlcode", "diagnostics",
+ "sqlerrm", 0 };
PyObject *action;
PyObject *diags;
long int sqlcode;
+ PyObject *sqlerrm;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "OSlO!", kwdnames, &self,
- &action, &sqlcode, &PyList_Type, &diags)) {
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "OSlO!O", kwdnames, &self,
+ &action, &sqlcode, &PyList_Type, &diags, &sqlerrm)) {
return NULL;
}
@@ -3304,19 +3307,24 @@
return NULL;
}
+ if (PyObject_SetAttrString(self, "sqlerrm", sqlerrm)) {
+ return NULL;
+ }
+
Py_INCREF(Py_None);
return Py_None;
}
static PyObject* DatabaseError_str(PyObject* self, PyObject* args)
{
- PyObject *str, *action, *sqlcode, *diags, *a, *f;
+ PyObject *str, *action, *sqlcode, *diags, *sqlerrm, *a, *f;
int i;
self = PyTuple_GetItem(args, 0);
action = PyObject_GetAttrString(self, "action");
sqlcode = PyObject_GetAttrString(self, "sqlcode");
diags = PyObject_GetAttrString(self, "diagnostics");
+ sqlerrm = PyObject_GetAttrString(self, "sqlerrm");
a = Py_BuildValue("(NN)", sqlcode, action);
f = PyString_FromString("SQLCODE %d in %s: \n");
@@ -3336,6 +3344,17 @@
Py_DECREF(f);
+ if (PyObject_IsTrue(sqlerrm)) {
+ PyString_ConcatAndDel(&str, PyString_FromString("SQLERRM = "));
+ PyString_Concat(&str, sqlerrm);
+ PyString_ConcatAndDel(&str, PyString_FromString("\n"));
+ }
+
+ Py_DECREF(action);
+ Py_DECREF(sqlcode);
+ Py_DECREF(diags);
+ Py_DECREF(sqlerrm);
+
return str;
}
@@ -3402,7 +3421,7 @@
Py_DECREF(msg);
}
- return Py_BuildValue("(siN)", action, SQLCODE, list);
+ return Py_BuildValue("(siNs)", action, SQLCODE, list, sqlca.sqlerrm);
}
/* determines the type of an error by looking at SQLSTATE */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ch...@us...> - 2008-08-15 00:00:27
|
Revision: 180
http://informixdb.svn.sourceforge.net/informixdb/?rev=180&view=rev
Author: chaese
Date: 2008-08-15 00:00:36 +0000 (Fri, 15 Aug 2008)
Log Message:
-----------
Fix bug #1998824: Refcount leak in Cursor_dealloc.
Modified Paths:
--------------
trunk/informixdb/ext/_informixdb.ec
Modified: trunk/informixdb/ext/_informixdb.ec
===================================================================
--- trunk/informixdb/ext/_informixdb.ec 2008-02-09 18:29:41 UTC (rev 179)
+++ trunk/informixdb/ext/_informixdb.ec 2008-08-15 00:00:36 UTC (rev 180)
@@ -2753,6 +2753,7 @@
Py_XDECREF(self->conn);
Py_XDECREF(self->messages);
Py_XDECREF(self->errorhandler);
+ Py_XDECREF(self->op);
free(self->cursorName);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ch...@us...> - 2008-02-09 18:29:36
|
Revision: 179
http://informixdb.svn.sourceforge.net/informixdb/?rev=179&view=rev
Author: chaese
Date: 2008-02-09 10:29:41 -0800 (Sat, 09 Feb 2008)
Log Message:
-----------
Preserve trailing spaces when writing/reading to/from varchar columns.
There might not be an actual use case for this behavior, but strictly
speaking it is the correct behavior.
Modified Paths:
--------------
trunk/informixdb/ext/_informixdb.ec
Modified: trunk/informixdb/ext/_informixdb.ec
===================================================================
--- trunk/informixdb/ext/_informixdb.ec 2007-12-21 16:22:29 UTC (rev 178)
+++ trunk/informixdb/ext/_informixdb.ec 2008-02-09 18:29:41 UTC (rev 179)
@@ -1451,7 +1451,7 @@
else
$endif;
{
- var->sqltype = CSTRINGTYPE;
+ var->sqltype = CVCHARTYPE;
var->sqldata = malloc(n+1);
var->sqllen = n+1;
*var->sqlind = 0;
@@ -1798,6 +1798,10 @@
case SQLINTERVAL:
var->sqltype = CINVTYPE;
break;
+ case SQLVCHAR:
+ case SQLNVCHAR:
+ var->sqltype = CVCHARTYPE;
+ break;
default: {
int known_type = 0;
$ifdef HAVE_ESQL9;
@@ -2391,16 +2395,17 @@
}
}
case SQLCHAR:
+ case SQLNCHAR:
+ {
+ _clip_char((char*)data);
+ return Py_BuildValue("s", (char*)data);
+ }
case SQLVCHAR:
- case SQLNCHAR:
case SQLNVCHAR:
$ifdef HAVE_ESQL9;
case SQLLVARCHAR:
$endif;
- {
- _clip_char((char*)data);
return Py_BuildValue("s", (char*)data);
- }
case SQLFLOAT:
return PyFloat_FromDouble(*(double*)data);
case SQLSMFLOAT:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ch...@us...> - 2007-12-21 16:22:24
|
Revision: 178
http://informixdb.svn.sourceforge.net/informixdb/?rev=178&view=rev
Author: chaese
Date: 2007-12-21 08:22:29 -0800 (Fri, 21 Dec 2007)
Log Message:
-----------
Add build hints
Modified Paths:
--------------
trunk/informixdb/README
trunk/informixdb/setup.py
Modified: trunk/informixdb/README
===================================================================
--- trunk/informixdb/README 2007-10-16 13:19:05 UTC (rev 177)
+++ trunk/informixdb/README 2007-12-21 16:22:29 UTC (rev 178)
@@ -23,7 +23,12 @@
This distribution uses Python distutils to build and install the informixdb
module. It requires Python 2.2 or later.
+To compile InformixDB, you need to have Informix ESQL/C installed. ESQL/C
+is included with the Informix Client Software Development Kit (Informix CSDK),
+which is available free of charge at
+http://www.ibm.com/software/data/informix/tools/csdk/ .
+
In a hurry?
-----------
Modified: trunk/informixdb/setup.py
===================================================================
--- trunk/informixdb/setup.py 2007-10-16 13:19:05 UTC (rev 177)
+++ trunk/informixdb/setup.py 2007-12-21 16:22:29 UTC (rev 178)
@@ -102,9 +102,15 @@
esql_config.append(token)
ret = cout.close()
if ret != None:
- raise DistutilsSetupError, \
- "\nCan't find esql. Please set INFORMIXDIR correctly."
+ raise DistutilsSetupError, """\
+Can't run esql. Please make sure that:
+* You have the Informix CSDK installed,
+* INFORMIXDIR is set to where Informix CSDK is installed, and
+* esql is in your PATH.
+See the README for build requirements.
+"""
+
if get_platform()=="win32":
for arg in esql_config:
if arg.endswith('.lib'):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ch...@us...> - 2007-10-16 13:19:03
|
Revision: 177
http://informixdb.svn.sourceforge.net/informixdb/?rev=177&view=rev
Author: chaese
Date: 2007-10-16 06:19:05 -0700 (Tue, 16 Oct 2007)
Log Message:
-----------
Tag release 2.5
Added Paths:
-----------
tags/rel_informixdb_2_5/
Copied: tags/rel_informixdb_2_5 (from rev 176, trunk/informixdb)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ch...@us...> - 2007-10-16 13:08:39
|
Revision: 176
http://informixdb.svn.sourceforge.net/informixdb/?rev=176&view=rev
Author: chaese
Date: 2007-10-16 06:08:43 -0700 (Tue, 16 Oct 2007)
Log Message:
-----------
initializing is probably a good idea
Modified Paths:
--------------
trunk/informixdb/ext/_informixdb.ec
Modified: trunk/informixdb/ext/_informixdb.ec
===================================================================
--- trunk/informixdb/ext/_informixdb.ec 2007-10-16 03:26:29 UTC (rev 175)
+++ trunk/informixdb/ext/_informixdb.ec 2007-10-16 13:08:43 UTC (rev 176)
@@ -3189,6 +3189,8 @@
self->can_describe_input = 0;
self->has_commit = (sqlca.sqlwarn.sqlwarn1 == 'W');
self->autocommit = 0;
+ self->sqltimeout = 0;
+ self->sqlinterrupt = 0;
if (autocommit) self->autocommit = 1;
if (self->has_commit && !self->autocommit) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ch...@us...> - 2007-10-16 03:26:27
|
Revision: 175
http://informixdb.svn.sourceforge.net/informixdb/?rev=175&view=rev
Author: chaese
Date: 2007-10-15 20:26:29 -0700 (Mon, 15 Oct 2007)
Log Message:
-----------
document new features, set release date
Modified Paths:
--------------
trunk/informixdb/README
trunk/informixdb/doc/manual.txt
Modified: trunk/informixdb/README
===================================================================
--- trunk/informixdb/README 2007-10-16 03:08:54 UTC (rev 174)
+++ trunk/informixdb/README 2007-10-16 03:26:29 UTC (rev 175)
@@ -77,8 +77,12 @@
====
From 2.4 to 2.5:
-- ...
-
+- Compatibility with CSDK 3.00
+- Ability to manually interrupt or automatically time out SQL execution
+- Proper binding of boolean parameters in WHERE clauses
+- Make version information about server and client available
+- Various bug fixes
+
From 2.3 to 2.4:
- Implement 'named' parameter style to optionally bind query parameters
by name
@@ -284,7 +288,7 @@
2.2 2006-03-26 Carsten Haese
2.3 2006-10-01 Carsten Haese
2.4 2006-12-02 Carsten Haese
-2.5 TBD Carsten Haese
+2.5 2007-10-16 Carsten Haese
--
Carsten Haese <ch...@us...>
Modified: trunk/informixdb/doc/manual.txt
===================================================================
--- trunk/informixdb/doc/manual.txt 2007-10-16 03:08:54 UTC (rev 174)
+++ trunk/informixdb/doc/manual.txt 2007-10-16 03:26:29 UTC (rev 175)
@@ -3,8 +3,8 @@
==========================
:Authors: Daniel Smertnig and Carsten Haese
-:Version: informixdb 2.4
-:Date: 2006-12-02
+:Version: informixdb 2.5
+:Date: 2007-10-16
:Homepage: `InformixDB on Sourceforge`_
.. contents:: InformixDB
@@ -379,6 +379,27 @@
`value` is the number of rows by which you want to scroll from the current
row.
+Interrupting Queries
+--------------------
+`(new in version 2.5)`
+
+Cursor objects provide two mechanisms for interrupting long-running queries,
+configurable with the attributes ``sqltimeout`` and ``sqlinterrupt``.
+``sqltimeout`` is an integer that specifies how many milliseconds a query is
+allowed to take. If a query takes longer than that, it is automatically
+aborted. If ``sqltimeout`` is zero, no timeout is in effect and queries are
+allowed to run indefinitely.
+
+``sqlinterrupt`` is a boolean attribute that indicates whether interrupt
+signals during query execution interrupt the query. Note that turning this
+feature on disables Python's handling of interrupt signals while queries are
+executed.
+
+Connection objects have ``sqltimeout`` and ``sqlinterrupt`` attributes that
+set the defaults for the corresponding attributes of any cursor objects
+that the connection object creates. By default, ``sqltimeout`` is zero,
+and ``sqlinterrupt`` is False.
+
Transactions
============
@@ -643,7 +664,33 @@
`Connection` object's messages attribute, and if the error is an actual
error (i.e. not of type `Warning`), an exception is raised.
+Inspecting Version Numbers
+==========================
+Occasionally it may be useful to inspect the version numbers of the database
+engine, the ESQL/C driver, or of InformixDB itself. The following version
+information is available at runtime:
+Module-level attribute:
+
+ * ``version``: The version number of InformixDB itself.
+ (`new in version 2.3`)
+
+Versions 2.0 through 2.2 didn't provide any version information. If you
+have an installation of InformixDB that doesn't have a ``version`` attribute,
+you should probably upgrade, since you're missing out on a lot of features
+and bug fixes.
+
+Connection attributes (`new in version 2.5`):
+
+ * ``dbms_name``, ``dbms_version``: The name and version number of the
+ database engine. For older engines such as Standard Engine, the name can
+ not be determined and the string "Unknown" is returned instead.
+
+ * ``driver_name``, ``driver_version``: The name and version number of the
+ ESQL/C installation with which InformixDB was compiled. The name is either
+ "INFORMIX-ESQL" or "IBM Informix-ESQL"
+
+
.. _InformixDB on Sourceforge: http://informixdb.sourceforge.net/
.. [#pep249] http://www.python.org/peps/pep-0249.html
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ch...@us...> - 2007-10-16 03:08:54
|
Revision: 174
http://informixdb.svn.sourceforge.net/informixdb/?rev=174&view=rev
Author: chaese
Date: 2007-10-15 20:08:54 -0700 (Mon, 15 Oct 2007)
Log Message:
-----------
Some compilers apparently warn about passing void pointers as function
pointers. This will shut them up.
Modified Paths:
--------------
trunk/informixdb/ext/_informixdb.ec
Modified: trunk/informixdb/ext/_informixdb.ec
===================================================================
--- trunk/informixdb/ext/_informixdb.ec 2007-10-16 01:17:01 UTC (rev 173)
+++ trunk/informixdb/ext/_informixdb.ec 2007-10-16 03:08:54 UTC (rev 174)
@@ -115,6 +115,8 @@
#include <signal.h>
#include "esqlver.h"
+typedef void sqlbreakcallbackfunc(mint);
+
/************************* Helpers *************************/
static PyObject *get_bool_from_int(PyObject *self, void *closure)
{
@@ -2090,7 +2092,7 @@
}
Py_END_ALLOW_THREADS;
ret_on_dberror_cursor(self, "OPEN");
- sqlbreakcallback(-1, (void*)NULL);
+ sqlbreakcallback(-1, (sqlbreakcallbackfunc*)NULL);
self->state = 3;
for (i=0; i<6; i++) self->sqlerrd[i] = sqlca.sqlerrd[i];
@@ -2111,7 +2113,7 @@
}
Py_END_ALLOW_THREADS;
ret_on_dberror_cursor(self, "EXECUTE");
- sqlbreakcallback(-1, (void*)NULL);
+ sqlbreakcallback(-1, (sqlbreakcallbackfunc*)NULL);
for (i=0; i<6; i++) self->sqlerrd[i] = sqlca.sqlerrd[i];
switch (self->stype) {
@@ -2923,7 +2925,7 @@
} else if (strncmp(SQLSTATE, "00", 2)) {
ret_on_dberror_cursor(self, "FETCH");
}
- sqlbreakcallback(-1,(void*)NULL);
+ sqlbreakcallback(-1,(sqlbreakcallbackfunc*)NULL);
return processOutput(self);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ch...@us...> - 2007-10-16 01:16:59
|
Revision: 173
http://informixdb.svn.sourceforge.net/informixdb/?rev=173&view=rev
Author: chaese
Date: 2007-10-15 18:17:01 -0700 (Mon, 15 Oct 2007)
Log Message:
-----------
Helper script for building Windows binaries. Don't expect to be able to use
this without adjusting the directory names, I'm mostly putting this here so
I don't have to reconstruct it for future releases.
Added Paths:
-----------
trunk/informixdb/winbuild.bat
Added: trunk/informixdb/winbuild.bat
===================================================================
--- trunk/informixdb/winbuild.bat (rev 0)
+++ trunk/informixdb/winbuild.bat 2007-10-16 01:17:01 UTC (rev 173)
@@ -0,0 +1,7 @@
+set INFORMIXDIR=C:\Program Files\IBM\Informix\Client-SDK
+set OLDPATH=%PATH%
+set PATH=%INFORMIXDIR%\bin;C:\msys\1.0\mingw\bin;%PATH%
+C:\Python25\python.exe setup.py bdist_wininst build_ext -c mingw32 --esql-threadlib=winnt
+C:\Python24\python.exe setup.py bdist_wininst build_ext -c mingw32 --esql-threadlib=winnt
+C:\Python23\python.exe setup.py bdist_wininst build_ext -c mingw32 --esql-threadlib=winnt
+set PATH=%OLDPATH%
Property changes on: trunk/informixdb/winbuild.bat
___________________________________________________________________
Name: svn:executable
+ *
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ch...@us...> - 2007-10-15 23:50:00
|
Revision: 172
http://informixdb.svn.sourceforge.net/informixdb/?rev=172&view=rev
Author: chaese
Date: 2007-10-15 16:50:04 -0700 (Mon, 15 Oct 2007)
Log Message:
-----------
Rename allow_interrupt to sqlinterrupt for consistency with sqltimeout.
Turn sqlinterrupt into a Boolean attribute.
Remove sqltimeout/sqlinterrupt defaults from cursor constructor and
make the defaults settable on the connection object instead, to be
consistent with how the binary_types attribute works.
Modified Paths:
--------------
trunk/informixdb/ext/_informixdb.ec
Modified: trunk/informixdb/ext/_informixdb.ec
===================================================================
--- trunk/informixdb/ext/_informixdb.ec 2007-10-15 18:06:35 UTC (rev 171)
+++ trunk/informixdb/ext/_informixdb.ec 2007-10-15 23:50:04 UTC (rev 172)
@@ -115,6 +115,30 @@
#include <signal.h>
#include "esqlver.h"
+/************************* Helpers *************************/
+static PyObject *get_bool_from_int(PyObject *self, void *closure)
+{
+ int *p;
+
+ p = (int*)((char*)self+(int)closure);
+ if (*p) {
+ Py_INCREF(Py_True);
+ return Py_True;
+ }
+ else {
+ Py_INCREF(Py_False);
+ return Py_False;
+ }
+}
+
+static int set_bool_to_int(PyObject *self, PyObject *value, void *closure)
+{
+ int *p;
+ p = (int*)((char*)self+(int)closure);
+ *p = PyObject_IsTrue(value)?1:0;
+ return 0;
+}
+
/************************* Error handling *************************/
static PyObject *ExcWarning;
@@ -448,7 +472,7 @@
PyObject *named_params;
int have_named_params;
int sqltimeout;
- int allow_interrupt;
+ int sqlinterrupt;
} Cursor;
static int Cursor_init(Cursor *self, PyObject *args, PyObject *kwargs);
@@ -644,14 +668,15 @@
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 }
};
static PyGetSetDef Cursor_getseters[] = {
{ "sqlerrd", (getter)Cursor_getsqlerrd, NULL,
"Informix SQL error descriptor as tuple", NULL },
+ { "sqlinterrupt", (getter)get_bool_from_int, (setter)set_bool_to_int,
+ "If True, SIGINT interrupts SQL queries.",
+ (void*)offsetof(Cursor, sqlinterrupt) },
{ NULL }
};
@@ -732,6 +757,8 @@
PyObject *driver_name;
PyObject *driver_version;
int can_describe_input;
+ int sqltimeout;
+ int sqlinterrupt;
} Connection;
static int setConnection(Connection*);
@@ -888,6 +915,8 @@
"Name of the client driver." },
{ "driver_version", T_OBJECT_EX, offsetof(Connection, driver_version), READONLY,
"Version of the client driver." },
+ { "sqltimeout", T_INT, offsetof(Connection, sqltimeout), 0,
+ "Default SQL query timeout in milliseconds." },
{ NULL }
};
@@ -926,6 +955,9 @@
ExcNotSupportedError_doc, DEFERRED_ADDRESS(ExcNotSupportedError) },
{ "autocommit", (getter)Connection_getautocommit,
(setter)Connection_setautocommit, Connection_autocommit_doc, NULL },
+ { "sqlinterrupt", (getter)get_bool_from_int, (setter)set_bool_to_int,
+ "Default setting for whether SIGINT interrupts SQL queries.",
+ (void*)offsetof(Connection, sqlinterrupt) },
{ NULL }
};
@@ -2049,11 +2081,11 @@
if (self->sqltimeout>0) {
sqlbreakcallback(self->sqltimeout, _sqltimeouthandler);
}
- if (self->allow_interrupt) {
+ if (self->sqlinterrupt) {
oldsighandler = signal(2, _sigint_sqlbreak);
}
EXEC SQL OPEN :cursorName USING DESCRIPTOR tdaIn;
- if (self->allow_interrupt) {
+ if (self->sqlinterrupt) {
signal(2, oldsighandler);
}
Py_END_ALLOW_THREADS;
@@ -2070,11 +2102,11 @@
if (self->sqltimeout>0) {
sqlbreakcallback(self->sqltimeout, _sqltimeouthandler);
}
- if (self->allow_interrupt) {
+ if (self->sqlinterrupt) {
oldsighandler = signal(2, _sigint_sqlbreak);
}
EXEC SQL EXECUTE :queryName USING DESCRIPTOR tdaIn;
- if (self->allow_interrupt) {
+ if (self->sqlinterrupt) {
signal(2, oldsighandler);
}
Py_END_ALLOW_THREADS;
@@ -2755,24 +2787,21 @@
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 };
+ "scroll", "hold", "use_decimal", 0 };
if (DecimalType==Py_None) { use_decimal = 0; }
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O!|siiiiii", kwdlist,
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O!|siiii", kwdlist,
&Connection_type, &conn, &name, &rowformat, &is_scroll, &is_hold,
- &use_decimal, &sqltimeout, &allow_interrupt))
+ &use_decimal))
return -1;
self->use_decimal = (use_decimal)?1:0;
- self->sqltimeout = sqltimeout;
- self->allow_interrupt = allow_interrupt;
Py_INCREF(Py_None);
self->description = Py_None;
self->conn = conn;
Py_INCREF(conn);
+ self->sqltimeout = conn->sqltimeout;
+ self->sqlinterrupt = conn->sqlinterrupt;
self->state = 0;
self->daIn.sqld = 0; self->daIn.sqlvar = 0;
self->daOut = 0;
@@ -2857,7 +2886,7 @@
if (self->sqltimeout>0) {
sqlbreakcallback(self->sqltimeout, _sqltimeouthandler);
}
- if (self->allow_interrupt) {
+ if (self->sqlinterrupt) {
oldsighandler = signal(2, _sigint_sqlbreak);
}
if (self->is_scroll) {
@@ -2882,7 +2911,7 @@
else {
EXEC SQL FETCH :cursorName USING DESCRIPTOR tdaOut;
}
- if (self->allow_interrupt) {
+ if (self->sqlinterrupt) {
signal(2, oldsighandler);
}
Py_END_ALLOW_THREADS;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ch...@us...> - 2007-10-15 18:06:30
|
Revision: 171
http://informixdb.svn.sourceforge.net/informixdb/?rev=171&view=rev
Author: chaese
Date: 2007-10-15 11:06:35 -0700 (Mon, 15 Oct 2007)
Log Message:
-----------
Document my plans beyond version 2.5
Modified Paths:
--------------
trunk/informixdb/README
Modified: trunk/informixdb/README
===================================================================
--- trunk/informixdb/README 2007-10-15 17:49:18 UTC (rev 170)
+++ trunk/informixdb/README 2007-10-15 18:06:35 UTC (rev 171)
@@ -243,7 +243,9 @@
FUTURE
======
-- Nothing planned at the moment. Let me know if you think a feature is missing.
+- Some kind of Type Mapping API
+- Some kind of Unicode support
+- More unit tests to cover correct functionality in addition to API compliance
MAINTAINER
==========
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ch...@us...> - 2007-10-15 17:49:20
|
Revision: 170
http://informixdb.svn.sourceforge.net/informixdb/?rev=170&view=rev
Author: chaese
Date: 2007-10-15 10:49:18 -0700 (Mon, 15 Oct 2007)
Log Message:
-----------
Jonathan Leffler says that DESCRIBE INPUT appeared in ESQL/C 9.53.
Modified Paths:
--------------
trunk/informixdb/setup.py
Modified: trunk/informixdb/setup.py
===================================================================
--- trunk/informixdb/setup.py 2007-10-15 01:56:03 UTC (rev 169)
+++ trunk/informixdb/setup.py 2007-10-15 17:49:18 UTC (rev 170)
@@ -80,7 +80,7 @@
esqlversion = 850
if esqlversion >= 900:
self.esql_parts.append("-EDHAVE_ESQL9")
- if esqlversion >= 940:
+ if esqlversion >= 953:
self.esql_parts.append("-EDHAVE_DESCRIBE_INPUT")
f = open(os.path.join("ext","esqlver.h"), "w")
f.write("""\
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:56:03
|
Revision: 169
http://informixdb.svn.sourceforge.net/informixdb/?rev=169&view=rev
Author: chaese
Date: 2007-10-14 18:56:03 -0700 (Sun, 14 Oct 2007)
Log Message:
-----------
Version 2.5 coming soon
Modified Paths:
--------------
trunk/informixdb/README
trunk/informixdb/informixdb.py
trunk/informixdb/setup.py
Modified: trunk/informixdb/README
===================================================================
--- trunk/informixdb/README 2007-10-15 01:51:43 UTC (rev 168)
+++ trunk/informixdb/README 2007-10-15 01:56:03 UTC (rev 169)
@@ -1,7 +1,7 @@
INTRODUCTION
============
-This is informixdb 2.4, an Informix implementation of the Python
+This is informixdb 2.5, an Informix implementation of the Python
Database API. This release implements version 2.0 of the DB-API:
http://www.python.org/topics/database/DatabaseAPI-2.0.html
@@ -76,6 +76,9 @@
NEWS
====
+From 2.4 to 2.5:
+- ...
+
From 2.3 to 2.4:
- Implement 'named' parameter style to optionally bind query parameters
by name
@@ -279,6 +282,7 @@
2.2 2006-03-26 Carsten Haese
2.3 2006-10-01 Carsten Haese
2.4 2006-12-02 Carsten Haese
+2.5 TBD Carsten Haese
--
Carsten Haese <ch...@us...>
Modified: trunk/informixdb/informixdb.py
===================================================================
--- trunk/informixdb/informixdb.py 2007-10-15 01:51:43 UTC (rev 168)
+++ trunk/informixdb/informixdb.py 2007-10-15 01:56:03 UTC (rev 169)
@@ -46,7 +46,7 @@
http://www.python.org/peps/pep-0249.html
"""
-version = "2.4"
+version = "2.5"
class Row(object):
"""Helper class for cursors whose row format is ROW_AS_OBJECT."""
Modified: trunk/informixdb/setup.py
===================================================================
--- trunk/informixdb/setup.py 2007-10-15 01:51:43 UTC (rev 168)
+++ trunk/informixdb/setup.py 2007-10-15 01:56:03 UTC (rev 169)
@@ -219,8 +219,8 @@
DistributionMetadata.download_url = None
setup (name = 'InformixDB',
- version = '2.4',
- description = 'InformixDB v2.4',
+ version = '2.5',
+ description = 'InformixDB v2.5',
long_description = \
"InformixDB is a DB-API 2.0 compliant interface for IBM Informix\n"
"databases.",
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|