def test_binary_ascii(self): """Some databases like pysqlite2 may return unicode for strings.""" self.connection.execute("INSERT INTO bin_test VALUES (10, 'Value')") result = self.connection.execute("SELECT b FROM bin_test") variable = RawStrVariable() # If the following doesn't raise a TypeError we're good. result.set_variable(variable, result.get_one()[0]) self.assertEquals(variable.get(), "Value")
def test_binary(self): """Ensure database works with high bits and embedded zeros.""" value = "\xff\x00\xff\x00" self.connection.execute("INSERT INTO bin_test (b) VALUES (?)", (value,)) result = self.connection.execute("SELECT b FROM bin_test") variable = RawStrVariable() result.set_variable(variable, result.get_one()[0]) self.assertEquals(variable.get(), value)
def test_binary(self): """Ensure database works with high bits and embedded zeros.""" value = "\xff\x00\xff\x00" self.connection.execute("INSERT INTO bin_test (b) VALUES (?)", (value, )) result = self.connection.execute("SELECT b FROM bin_test") variable = RawStrVariable() result.set_variable(variable, result.get_one()[0]) self.assertEquals(variable.get(), value)