1 9 package com.ziclix.python.sql.handler; 10 11 import com.ziclix.python.sql.DataHandler; 12 import com.ziclix.python.sql.FilterDataHandler; 13 import com.ziclix.python.sql.Procedure; 14 import com.ziclix.python.sql.PyCursor; 15 import com.ziclix.python.sql.procedure.SQLServerProcedure; 16 import org.python.core.Py; 17 import org.python.core.PyObject; 18 19 import java.sql.ResultSet ; 20 import java.sql.SQLException ; 21 import java.sql.Types ; 22 23 30 public class SQLServerDataHandler extends FilterDataHandler { 31 32 35 public static final int UNICODE_VARCHAR = -9; 36 37 42 public SQLServerDataHandler(DataHandler datahandler) { 43 super(datahandler); 44 } 45 46 public Procedure getProcedure(PyCursor cursor, PyObject name) throws SQLException { 47 return new SQLServerProcedure(cursor, name); 48 } 49 50 61 public PyObject getPyObject(ResultSet set, int col, int type) throws SQLException { 62 63 PyObject obj = Py.None; 64 65 switch (type) { 66 67 case UNICODE_VARCHAR: 68 obj = super.getPyObject(set, col, Types.VARCHAR); 69 break; 70 71 default : 72 obj = super.getPyObject(set, col, type); 73 } 74 75 return (set.wasNull() || (obj == null)) ? Py.None : obj; 76 } 77 } 78 | Popular Tags |