diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2005-12-21 02:36:54 +0000 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2005-12-21 02:36:54 +0000 |
| commit | af281888089933ab4c909862b9a41f9ada2dc1a6 (patch) | |
| tree | c93e8308d8a17091018e56b637d7c766bc60c575 /lib/sqlalchemy/sql.py | |
| parent | 3c62b09c5c795bb30f47cc6850bdfefa709d0a94 (diff) | |
| download | sqlalchemy-af281888089933ab4c909862b9a41f9ada2dc1a6.tar.gz | |
added "late WHERE" compilation to SELECT, adds where criterion based on extra bind parameters specified
at compilation/execution time
Diffstat (limited to 'lib/sqlalchemy/sql.py')
| -rw-r--r-- | lib/sqlalchemy/sql.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/sqlalchemy/sql.py b/lib/sqlalchemy/sql.py index ab762cb39..a634767ea 100644 --- a/lib/sqlalchemy/sql.py +++ b/lib/sqlalchemy/sql.py @@ -1155,6 +1155,19 @@ class UpdateBase(ClauseElement): return parameters def get_colparams(self, parameters): + """this is used by the ANSICompiler to determine the VALUES or SET clause based on the arguments + specified to the execute() or compile() method of the INSERT or UPDATE clause: + + insert(mytable).execute(col1='foo', col2='bar') + mytable.update().execute(col2='foo', col3='bar') + + in the above examples, the insert() and update() methods have no "values" sent to them + at all, so compiling them with no arguments would yield an insert for all table columns, + or an update with no SET clauses. but the parameters sent indicate a set of per-compilation + arguments that result in a differently compiled INSERT or UPDATE object compared to the + original. The "values" parameter to the insert/update is figured as well if present, + but the incoming "parameters" sent here take precedence. + """ # case one: no parameters in the statement, no parameters in the # compiled params - just return binds for all the table columns if parameters is None and self.parameters is None: |
