
import re

from django.db.backends import BaseDatabaseOperations

"""
Default database operations, with unquoted names.
"""

class DatabaseOperations(BaseDatabaseOperations):
	compiler_module = "salesforce.backend.compiler"
	
	def __init__(self, connection):
		# not calling superclass constructor to maintain Django 1.3 support
		self.connection = connection
		self._cache = None
	
	def connection_init(self):
		pass
	
	def sql_flush(self, style, tables, sequences):
		return []
	
	def quote_name(self, name):
		return name
	
	def value_to_db_datetime(self, value):
		"""
		We let the JSON serializer handle dates for us.
		"""
		return value
	
	def last_insert_id(self, cursor, db_table, db_column):
		return cursor.lastrowid

import re

from django.db.backends import BaseDatabaseOperations

"""
Default database operations, with unquoted names.
"""

class DatabaseOperations(BaseDatabaseOperations):
	compiler_module = "salesforce.backend.compiler"
	
	def __init__(self, connection):
		# not calling superclass constructor to maintain Django 1.3 support
		self.connection = connection
		self._cache = None
	
	def connection_init(self):
		pass
	
	def sql_flush(self, style, tables, sequences):
		return []
	
	def quote_name(self, name):
		return name
	
	def value_to_db_datetime(self, value):
		"""
		We let the JSON serializer handle dates for us.
		"""
		return value

	def value_to_db_date(self, value):
		"""
		We let the JSON serializer handle dates for us.
		"""
		return value
	
	def last_insert_id(self, cursor, db_table, db_column):
		return cursor.lastrowid

Fix bug with Date fields and SOQL.
Fix bug with Date fields and SOQL.

Fixes https://github.com/freelancersunion/django-salesforce/issues/10
  
  import re
  
  from django.db.backends import BaseDatabaseOperations
  
  """
  Default database operations, with unquoted names.
  """
  
  class DatabaseOperations(BaseDatabaseOperations):
  	compiler_module = "salesforce.backend.compiler"
  	
  	def __init__(self, connection):
  		# not calling superclass constructor to maintain Django 1.3 support
  		self.connection = connection
  		self._cache = None
  	
  	def connection_init(self):
  		pass
  	
  	def sql_flush(self, style, tables, sequences):
  		return []
  	
  	def quote_name(self, name):
  		return name
  	
  	def value_to_db_datetime(self, value):
  		"""
  		We let the JSON serializer handle dates for us.
  		"""
  		return value
+ 
+ 	def value_to_db_date(self, value):
+ 		"""
+ 		We let the JSON serializer handle dates for us.
+ 		"""
+ 		return value
  	
  	def last_insert_id(self, cursor, db_table, db_column):
  		return cursor.lastrowid
+ 
Fix bug with Date fields and SOQL.
## Code Before:

import re

from django.db.backends import BaseDatabaseOperations

"""
Default database operations, with unquoted names.
"""

class DatabaseOperations(BaseDatabaseOperations):
	compiler_module = "salesforce.backend.compiler"
	
	def __init__(self, connection):
		# not calling superclass constructor to maintain Django 1.3 support
		self.connection = connection
		self._cache = None
	
	def connection_init(self):
		pass
	
	def sql_flush(self, style, tables, sequences):
		return []
	
	def quote_name(self, name):
		return name
	
	def value_to_db_datetime(self, value):
		"""
		We let the JSON serializer handle dates for us.
		"""
		return value
	
	def last_insert_id(self, cursor, db_table, db_column):
		return cursor.lastrowid
## Instruction:
Fix bug with Date fields and SOQL.
## Code After:

import re

from django.db.backends import BaseDatabaseOperations

"""
Default database operations, with unquoted names.
"""

class DatabaseOperations(BaseDatabaseOperations):
	compiler_module = "salesforce.backend.compiler"
	
	def __init__(self, connection):
		# not calling superclass constructor to maintain Django 1.3 support
		self.connection = connection
		self._cache = None
	
	def connection_init(self):
		pass
	
	def sql_flush(self, style, tables, sequences):
		return []
	
	def quote_name(self, name):
		return name
	
	def value_to_db_datetime(self, value):
		"""
		We let the JSON serializer handle dates for us.
		"""
		return value

	def value_to_db_date(self, value):
		"""
		We let the JSON serializer handle dates for us.
		"""
		return value
	
	def last_insert_id(self, cursor, db_table, db_column):
		return cursor.lastrowid
