From: brian z. <bz...@us...> - 2003-04-11 19:03:54
|
Update of /cvsroot/jython/jython/com/ziclix/python/sql In directory sc8-pr-cvs1:/tmp/cvs-serv4151/com/ziclix/python/sql Modified Files: PyConnection.java PyCursor.java Log Message: fixed function call min/max arguments Index: PyConnection.java =================================================================== RCS file: /cvsroot/jython/jython/com/ziclix/python/sql/PyConnection.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** PyConnection.java 9 Apr 2003 13:49:13 -0000 1.12 --- PyConnection.java 11 Apr 2003 19:03:48 -0000 1.13 *************** *** 248,252 **** if (closed) { ! return; } --- 248,252 ---- if (closed) { ! throw zxJDBC.makeException(zxJDBC.ProgrammingError, "connection is closed"); } *************** *** 461,520 **** } - /** - * Class ConnectionFunc - * - * @date $today.date$ - * @author last modified by $Author$ - * @date last modified on $Date$ - * @version $Revision$ - * @copyright 2001 brian zimmer - */ class ConnectionFunc extends PyBuiltinFunctionSet { - - /** - * Constructor ConnectionFunc - * - * - * @param name - * @param index - * @param minargs - * @param maxargs - * @param doc - * - */ ConnectionFunc(String name, int index, int minargs, int maxargs, String doc) { super(name, index, minargs, maxargs, true, doc); } - /** - * Method __call__ - * - * @return PyObject - * - */ public PyObject __call__() { - PyConnection c = (PyConnection)__self__; - switch (index) { - case 0 : c.close(); - return Py.None; - case 1 : c.commit(); - return Py.None; - case 2 : return c.cursor(); - case 3 : c.rollback(); - return Py.None; - default : throw argCountError(0); --- 461,483 ---- *************** *** 522,546 **** } - /** - * Method __call__ - * - * - * @param arg - * - * @return PyObject - * - */ public PyObject __call__(PyObject arg) { - PyConnection c = (PyConnection)__self__; - switch (index) { - case 2 : return c.cursor(arg.__nonzero__()); - case 4 : return c.nativesql(arg); - default : throw argCountError(1); --- 485,495 ---- *************** *** 548,594 **** } - /** - * Method __call__ - * - * - * @param arg1 - * @param arg2 - * - * @return PyObject - * - */ - public PyObject __call__(PyObject arg1, PyObject arg2) { - - PyConnection c = (PyConnection)__self__; - - switch (index) { - - case 2 : - throw Py.TypeError(name + "() takes exactly 0, 1 or 3 arguments (2 given)"); - default : - throw argCountError(2); - } - } - - /** - * Method __call__ - * - * - * @param arg1 - * @param arg2 - * @param arg3 - * - * @return PyObject - * - */ public PyObject __call__(PyObject arg1, PyObject arg2, PyObject arg3) { - PyConnection c = (PyConnection)__self__; - switch (index) { - case 2 : return c.cursor(arg1.__nonzero__(), arg2, arg3); - default : throw argCountError(3); --- 497,505 ---- *************** *** 596,616 **** } - /** - * Method __call__ - * - * - * @param args - * @param keywords - * - * @return PyObject - * - */ public PyObject __call__(PyObject[] args, String[] keywords) { - PyConnection c = (PyConnection)__self__; PyArgParser parser = new PyArgParser(args, keywords); - switch (index) { - case 2 : PyObject dynamic = parser.kw("dynamic", Py.None); --- 507,514 ---- Index: PyCursor.java =================================================================== RCS file: /cvsroot/jython/jython/com/ziclix/python/sql/PyCursor.java,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** PyCursor.java 10 Apr 2003 20:17:43 -0000 1.32 --- PyCursor.java 11 Apr 2003 19:03:49 -0000 1.33 *************** *** 262,269 **** dict.__setitem__("__version__", Py.newString("$Revision$").__getslice__(Py.newInteger(11), Py.newInteger(-2), null)); dict.__setitem__("fetchmany", new CursorFunc("fetchmany", 0, 1, 2, "fetch specified number of rows")); ! dict.__setitem__("close", new CursorFunc("close", 1, 1, "close the cursor")); ! dict.__setitem__("fetchall", new CursorFunc("fetchall", 2, 1, "fetch all results")); ! dict.__setitem__("fetchone", new CursorFunc("fetchone", 3, 1, "fetch the next result")); ! dict.__setitem__("nextset", new CursorFunc("nextset", 4, 1, "return next set or None")); dict.__setitem__("execute", new CursorFunc("execute", 5, 1, 4, "execute the sql expression")); dict.__setitem__("setinputsizes", new CursorFunc("setinputsizes", 6, 1, "not implemented")); --- 262,269 ---- dict.__setitem__("__version__", Py.newString("$Revision$").__getslice__(Py.newInteger(11), Py.newInteger(-2), null)); dict.__setitem__("fetchmany", new CursorFunc("fetchmany", 0, 1, 2, "fetch specified number of rows")); ! dict.__setitem__("close", new CursorFunc("close", 1, 0, "close the cursor")); ! dict.__setitem__("fetchall", new CursorFunc("fetchall", 2, 0, "fetch all results")); ! dict.__setitem__("fetchone", new CursorFunc("fetchone", 3, 0, "fetch the next result")); ! dict.__setitem__("nextset", new CursorFunc("nextset", 4, 0, "return next set or None")); dict.__setitem__("execute", new CursorFunc("execute", 5, 1, 4, "execute the sql expression")); dict.__setitem__("setinputsizes", new CursorFunc("setinputsizes", 6, 1, "not implemented")); *************** *** 884,956 **** } - /** - * Class CursorFunc - * - * @date $today.date$ - * @author last modified by $Author$ - * @date last modified on $Date$ - * @version $Revision$ - * @copyright 2001 brian zimmer - */ class CursorFunc extends PyBuiltinFunctionSet { - - /** - * Constructor CursorFunc - * - * - * @param name - * @param index - * @param argcount - * @param doc - * - */ CursorFunc(String name, int index, int argcount, String doc) { super(name, index, argcount, argcount, true, doc); } - - /** - * Constructor CursorFunc - * - * - * @param name - * @param index - * @param minargs - * @param maxargs - * @param doc - * - */ CursorFunc(String name, int index, int minargs, int maxargs, String doc) { super(name, index, minargs, maxargs, true, doc); } - /** - * Method __call__ - * - * @return PyObject - * - */ public PyObject __call__() { - PyCursor cursor = (PyCursor)__self__; - switch (index) { - case 0 : return cursor.fetchmany(cursor.arraysize); - case 1 : cursor.close(); - return Py.None; - case 2 : return cursor.fetchall(); - case 3 : return cursor.fetchone(); - case 4 : return cursor.nextset(); - default : throw argCountError(0); --- 884,909 ---- *************** *** 958,1011 **** } - /** - * Method __call__ - * - * - * @param arg - * - * @return PyObject - * - */ public PyObject __call__(PyObject arg) { - PyCursor cursor = (PyCursor)__self__; - switch (index) { - case 0 : return cursor.fetchmany(arg.__int__().getValue()); - case 5 : cursor.execute(arg, Py.None, Py.None, Py.None); - return Py.None; - case 6 : case 7 : return Py.None; - case 8 : cursor.callproc(arg, Py.None, Py.None, Py.None); - return Py.None; - case 9 : cursor.executemany(arg, Py.None, Py.None, Py.None); - return Py.None; - case 10 : cursor.scroll(arg.__int__().getValue(), "relative"); - return Py.None; - case 11 : cursor.execute(arg, Py.None, Py.None, Py.None); - return Py.None; - case 12 : return cursor.prepare(arg); - default : throw argCountError(1); --- 911,939 ---- *************** *** 1013,1055 **** } - /** - * Method __call__ - * - * - * @param arga - * @param argb - * - * @return PyObject - * - */ public PyObject __call__(PyObject arga, PyObject argb) { - PyCursor cursor = (PyCursor)__self__; - switch (index) { - case 5 : cursor.execute(arga, argb, Py.None, Py.None); - return Py.None; - case 7 : return Py.None; - case 8 : cursor.callproc(arga, argb, Py.None, Py.None); - return Py.None; - case 9 : cursor.executemany(arga, argb, Py.None, Py.None); - return Py.None; - case 10 : cursor.scroll(arga.__int__().getValue(), argb.toString()); - return Py.None; - default : throw argCountError(2); --- 941,961 ---- *************** *** 1057,1092 **** } - /** - * Method __call__ - * - * - * @param arga - * @param argb - * @param argc - * - * @return PyObject - * - */ public PyObject __call__(PyObject arga, PyObject argb, PyObject argc) { - PyCursor cursor = (PyCursor)__self__; - switch (index) { - case 5 : cursor.execute(arga, argb, argc, Py.None); - return Py.None; - case 8 : cursor.callproc(arga, argb, argc, Py.None); - return Py.None; - case 9 : cursor.executemany(arga, argb, argc, Py.None); - return Py.None; - default : throw argCountError(3); --- 963,978 ---- *************** *** 1094,1107 **** } - /** - * Method __call__ - * - * - * @param args - * @param keywords - * - * @return PyObject - * - */ public PyObject __call__(PyObject[] args, String[] keywords) { --- 980,983 ---- *************** *** 1118,1137 **** switch (index) { - case 5 : cursor.execute(sql, params, bindings, maxrows); - return Py.None; - case 8 : cursor.callproc(sql, params, bindings, maxrows); - return Py.None; - case 9 : cursor.executemany(sql, params, bindings, maxrows); - return Py.None; - default : throw argCountError(args.length); --- 994,1006 ---- |