/** * Constructor Procedure * * @param cursor cursor an open cursor * @param name name a string or tuple representing the name * @throws SQLException */ public Procedure(PyCursor cursor, PyObject name) throws SQLException { this.cursor = cursor; this.inputSet = new BitSet(); if (name instanceof PyString) { this.procedureCatalog = getDefault(); this.procedureSchema = getDefault(); this.procedureName = name; } else if (PyCursor.isSeq(name)) { if (name.__len__() == 3) { this.procedureCatalog = name.__getitem__(0); this.procedureSchema = name.__getitem__(1); this.procedureName = name.__getitem__(2); } else { // throw an exception } } else { // throw an exception } fetchColumns(); }
void pack(ByteStream buf, PyObject value) { if (!(value instanceof PyString) || value.__len__() != 1) throw StructError("char format require string of length 1"); buf.writeByte(value.toString().charAt(0)); }