You are not logged in Log in Join
You are here: Home » Members » brianh » SybaseDAv2_locale_patch.diff » View Document

Log in
Name

Password

 

SybaseDAv2_locale_patch.diff

* SybaseDAv2.orig/src/sy_occ.c Wed Nov 17 22:49:52 1999 --- SybaseDAv2/src/sy_occ.c Mon Feb 7 15:11:21 2000 *********** 807,812 *** --- 807,858 ---- }

static PyObject + newLocale(Context self, PyObject args) + { + Locale l; + char locale_str=""; + CS_RETCODE r; + + UNLESS (PyArg_ParseTuple(args, "s", &locale_str)) return NULL; + + UNLESS (l = PyObject_NEW(Locale, &LocaleType)) return NULL; + + l->locale = NULL; + + Py_INCREF(self); + l->context=self; + + Py_BEGIN_ALLOW_THREADS + r=cs_loc_alloc(self->context, &l->locale); + Py_END_ALLOW_THREADS + + if (r != CS_SUCCEED) { + Py_DECREF(l); + return SybaseError("Couldn't allocate a locale"); + } + + Py_BEGIN_ALLOW_THREADS + r=cs_locale(self->context, CS_SET, l->locale, CS_LC_ALL, locale_str, + CS_NULLTERM, NULL); + Py_END_ALLOW_THREADS + + if (r != CS_SUCCEED) { + Py_DECREF(l); + return SybaseError("Couldn't find the locale"); + } + + Py_BEGIN_ALLOW_THREADS + r=cs_config(self->context, CS_SET, CS_LOC_PROP, l->locale, CS_UNUSED, NULL); + Py_END_ALLOW_THREADS + + if (r != CS_SUCCEED) { + Py_DECREF(l); + return SybaseError("Couldn't set the locale"); + } + + return OBJECT(l); + } + static PyObject Context_diag(Context self, PyObject args) { int op, type=CS_UNUSED, index=CS_UNUSED; ************* 860,865 *** --- 906,913 ---- "cs_config(action,property[, value]) -- get or set a context property"}, {"ct_configContext_cs_config", (PyCFunction)Context_ct_config, METH_VARARGS, "ct_config(action,property[, value]) -- get or set a context property"}, + {"cs_loc_alloc", (PyCFunction)newLocale, METH_VARARGS, + "cs_loc_alloc(locale_string) -- set locale for the context"}, #ifdef CALLBACK_SUPPORT {"ct_callback", (PyCFunction)Context_callback, METH_VARARGS, "ct_callback(type[, function] -- Set or get a callback"},