Ticket #11487: 11487_fix.diff

File 11487_fix.diff, 2.3 KB (added by jbronn, 15 years ago)

Cleaned up base_with_tests patch.

  • django/db/backends/oracle/base.py

     
    345345    """
    346346    Wrapper object for formatting parameters for Oracle. If the string
    347347    representation of the value is large enough (greater than 4000 characters)
    348     the input size needs to be set as NCLOB. Alternatively, if the parameter
     348    the input size needs to be set as CLOB. Alternatively, if the parameter
    349349    has an `input_size` attribute, then the value of the `input_size` attribute
    350350    will be used instead. Otherwise, no input size will be set for the
    351351    parameter when executing the query.
     
    360360            # If parameter has `input_size` attribute, use that.
    361361            self.input_size = param.input_size
    362362        elif isinstance(param, basestring) and len(param) > 4000:
    363             # Mark any string param greater than 4000 characters as an NCLOB.
    364             self.input_size = Database.NCLOB
     363            # Mark any string param greater than 4000 characters as a CLOB.
     364            self.input_size = Database.CLOB
    365365        else:
    366366            self.input_size = None
    367367
  • tests/regressiontests/backends/tests.py

     
    1717            return True
    1818        else:
    1919            return True
     20           
     21class LongString(unittest.TestCase):
    2022
     23    def test_long_string(self):
     24        # If the backend is Oracle, test that we can save a text longer
     25        # than 4000 chars and read it properly
     26        if settings.DATABASE_ENGINE == 'oracle':
     27            c = connection.cursor()
     28            c.execute('CREATE TABLE ltext ("TEXT" NCLOB)')
     29            long_str = ''.join([unicode(x) for x in xrange(4000)])
     30            c.execute('INSERT INTO ltext VALUES (%s)',[long_str])
     31            c.execute('SELECT text FROM ltext')
     32            row = c.fetchone()
     33            c.execute('DROP TABLE ltext')
     34            self.assertEquals(long_str, row[0].read())
     35
    2136def connection_created_test(sender, **kwargs):
    2237    print 'connection_created signal'
    2338
Back to Top