Ejemplo n.º 1
0
 def setJDBCObject(self, stmt, index, obj, datatype=None):
     "Convert Django-models types into Java ones"
     if datatype is None:
         FilterDataHandler.setJDBCObject(self, stmt, index, obj)
         return
     if datatype == Types.TIMESTAMP and isinstance(obj, basestring):
         # Convert string into java.sql.Timestamp
         # The string is generated by Django using datetime.__str__ ,
         # so the format is year-month-day hour:minute:second.microsecond
         d, t = obj.split(' ')
         hour, minute, second, microsecond = self._hour_minute_second_micro(
             t)
         year, month, day = self._year_month_day(d)
         # FIXME: This ignores microseconds
         obj = Database.Timestamp(year, month, day, hour, minute,
                                  second)  # Database is an alias for zxJDBC
     elif datatype == Types.TIME and isinstance(obj, basestring):
         # Convert string into java.sql.Time
         hour, minute, second, microsecond = self._hour_minute_second_micro(
             obj)
         # FIXME: This ignores microseconds
         obj = Database.Time(int(hour), int(minute), int(second))
     elif datatype == Types.DATE and isinstance(obj, basestring):
         year, month, day = self._year_month_day(obj)
         obj = Database.Date(year, month, day)
     FilterDataHandler.setJDBCObject(self, stmt, index, obj, datatype)
Ejemplo n.º 2
0
 def setJDBCObject(self, statement, index, object, dbtype=None):
     if dbtype is None:
         if (isinstance(object, int_types)):
             statement.setObject(index, str(object), java_Types.BIGINT)
         elif (isinstance(object, _python_Decimal)):
             statement.setObject(index, str(object), java_Types.DECIMAL)
         else:
             statement.setObject(index, object)
     else:
         FilterDataHandler.setJDBCObject(self, statement, index, object, dbtype)
Ejemplo n.º 3
0
 def setJDBCObject(self, statement, index, object, dbtype=None):
     if type(object) is ReturningParam:
         statement.registerReturnParameter(index, object.type)
     elif dbtype is None:
         if (isinstance(object, int)):
             statement.setObject(index, str(object), java_Types.BIGINT)
         elif (isinstance(object, _python_Decimal)):
             statement.setObject(index, str(object), java_Types.DECIMAL)
         else:
             statement.setObject(index, object)
     else:
         FilterDataHandler.setJDBCObject(self, statement, index, object, dbtype)
Ejemplo n.º 4
0
 def setJDBCObject(self, statement, index, object, dbtype=None):
     if dbtype is None:
         if (isinstance(object, int)):
             statement.setObject(index, str(object), java_Types.INTEGER)
         elif (isinstance(object, long)):
             statement.setObject(index, str(object), java_Types.BIGINT)
         elif (isinstance(object, _python_Decimal)):
             statement.setObject(index, str(object), java_Types.DECIMAL)
         else:
             statement.setObject(index, object)
     else:
         FilterDataHandler.setJDBCObject(self, statement, index, object, dbtype)
Ejemplo n.º 5
0
 def setJDBCObject(self, statement, index, object, dbtype=None):
     if type(object) is ReturningParam:
         statement.registerReturnParameter(index, object.type)
     elif dbtype is None:
         if (isinstance(object, int)):
             statement.setObject(index, str(object),
                                 java_Types.BIGINT)
         elif (isinstance(object, _python_Decimal)):
             statement.setObject(index, str(object),
                                 java_Types.DECIMAL)
         else:
             statement.setObject(index, object)
     else:
         FilterDataHandler.setJDBCObject(self, statement, index,
                                         object, dbtype)
Ejemplo n.º 6
0
 def setJDBCObject(self, stmt, index, obj, datatype=None) :
     "Convert Django-models types into Java ones"
     if datatype is None:
         FilterDataHandler.setJDBCObject(self, stmt, index, obj)
         return
     if datatype == Types.TIMESTAMP and isinstance(obj, basestring):
         # Convert string into java.sql.Timestamp
         # The string is generated by Django using datetime.__str__ ,
         # so the format is year-month-day hour:minute:second.microsecond
         d, t = obj.split(' ')
         hour, minute, second, microsecond = self._hour_minute_second_micro(t)
         year, month, day = self._year_month_day(d)
         # FIXME: This ignores microseconds
         obj = Database.Timestamp(year, month, day, hour, minute, second)   # Database is an alias for zxJDBC
     elif datatype == Types.TIME and isinstance(obj, basestring):
         # Convert string into java.sql.Time
         hour, minute, second, microsecond = self._hour_minute_second_micro(obj)
         # FIXME: This ignores microseconds
         obj = Database.Time(int(hour), int(minute), int(second))
     elif datatype == Types.DATE and isinstance(obj, basestring):
         year, month, day = self._year_month_day(obj)
         obj = Database.Date(year, month, day)
     FilterDataHandler.setJDBCObject(self, stmt, index, obj, datatype)