summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2007-08-02 03:13:02 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2007-08-02 03:13:02 +0000
commit14a0c29362fe7ac568b1ffde5415dcef3ac6a517 (patch)
tree7c8b7abf1cebeb2aaf40eb38bf92c54f4596a6fc /lib/sqlalchemy/sql.py
parent47eba75f35e86f865f7ebb177266fa6e525ac307 (diff)
downloadsqlalchemy-14a0c29362fe7ac568b1ffde5415dcef3ac6a517.tar.gz
added values() generative method to Insert/Update
Diffstat (limited to 'lib/sqlalchemy/sql.py')
-rw-r--r--lib/sqlalchemy/sql.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/sqlalchemy/sql.py b/lib/sqlalchemy/sql.py
index 479f13a8a..3afaef58e 100644
--- a/lib/sqlalchemy/sql.py
+++ b/lib/sqlalchemy/sql.py
@@ -3376,6 +3376,18 @@ class Insert(_UpdateBase):
else:
return ()
+ def _copy_internals(self):
+ self.parameters = self.parameters.copy()
+
+ def values(self, v):
+ u = self._clone()
+ if u.parameters is None:
+ u.parameters = u._process_colparams(v)
+ else:
+ u.parameters = self.parameters.copy()
+ u.parameters.update(u._process_colparams(v))
+ return u
+
class Update(_UpdateBase):
def __init__(self, table, whereclause, values=None):
self.table = table
@@ -3388,6 +3400,19 @@ class Update(_UpdateBase):
else:
return ()
+ def _copy_internals(self):
+ self._whereclause = self._whereclause._clone()
+ self.parameters = self.parameters.copy()
+
+ def values(self, v):
+ u = self._clone()
+ if u.parameters is None:
+ u.parameters = u._process_colparams(v)
+ else:
+ u.parameters = self.parameters.copy()
+ u.parameters.update(u._process_colparams(v))
+ return u
+
class Delete(_UpdateBase):
def __init__(self, table, whereclause):
self.table = table
@@ -3399,6 +3424,9 @@ class Delete(_UpdateBase):
else:
return ()
+ def _copy_internals(self):
+ self._whereclause = self._whereclause._clone()
+
class _IdentifiedClause(ClauseElement):
def __init__(self, ident):
self.ident = ident