diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2007-11-01 03:58:21 +0000 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2007-11-01 03:58:21 +0000 |
commit | 66cd772094f22e78cd044c40aa3c72ced6493d2a (patch) | |
tree | 9887754057fea4d60ef5e78b0a77d90884ab22e4 /lib/sqlalchemy/sql/util.py | |
parent | ad9f8b8158ebd5509eb98c45179f1187f52c96d0 (diff) | |
download | sqlalchemy-66cd772094f22e78cd044c40aa3c72ced6493d2a.tar.gz |
- merged factor_down_bindparams branch.
- removed ClauseParameters object; compiled.params returns a regular dictionary
now, as well as result.last_inserted_params()/last_updated_params().
- various code trimming, method removals.
Diffstat (limited to 'lib/sqlalchemy/sql/util.py')
-rw-r--r-- | lib/sqlalchemy/sql/util.py | 101 |
1 files changed, 0 insertions, 101 deletions
diff --git a/lib/sqlalchemy/sql/util.py b/lib/sqlalchemy/sql/util.py index 48996fe7b..8876f42ba 100644 --- a/lib/sqlalchemy/sql/util.py +++ b/lib/sqlalchemy/sql/util.py @@ -3,107 +3,6 @@ from sqlalchemy.sql import expression, visitors """Utility functions that build upon SQL and Schema constructs.""" -class ClauseParameters(object): - """Represent a dictionary/iterator of bind parameter key names/values. - - Tracks the original [sqlalchemy.sql#_BindParamClause] objects as well as the - keys/position of each parameter, and can return parameters as a - dictionary or a list. Will process parameter values according to - the ``TypeEngine`` objects present in the ``_BindParamClause`` instances. - """ - - __slots__ = 'dialect', '_binds', 'positional' - - def __init__(self, dialect, positional=None): - self.dialect = dialect - self._binds = {} - if positional is None: - self.positional = [] - else: - self.positional = positional - - def get_parameter(self, key): - return self._binds[key] - - def set_parameter(self, bindparam, value, name): - self._binds[name] = [bindparam, name, value] - - def get_original(self, key): - return self._binds[key][2] - - def get_type(self, key): - return self._binds[key][0].type - - def get_processors(self): - """return a dictionary of bind 'processing' functions""" - return dict([ - (key, value) for key, value in - [( - key, - self._binds[key][0].bind_processor(self.dialect) - ) for key in self._binds] - if value is not None - ]) - - def get_processed(self, key, processors): - if key in processors: - return processors[key](self._binds[key][2]) - else: - return self._binds[key][2] - - def keys(self): - return self._binds.keys() - - def __iter__(self): - return iter(self.keys()) - - def __getitem__(self, key): - (bind, name, value) = self._binds[key] - processor = bind.bind_processor(self.dialect) - if processor is not None: - return processor(value) - else: - return value - - def __contains__(self, key): - return key in self._binds - - def set_value(self, key, value): - self._binds[key][2] = value - - def get_original_dict(self): - return dict([(name, value) for (b, name, value) in self._binds.values()]) - - def get_raw_list(self, processors): - binds, res = self._binds, [] - for key in self.positional: - if key in processors: - res.append(processors[key](binds[key][2])) - else: - res.append(binds[key][2]) - return res - - def get_raw_dict(self, processors, encode_keys=False): - binds, res = self._binds, {} - if encode_keys: - encoding = self.dialect.encoding - for key in self.keys(): - if key in processors: - res[key.encode(encoding)] = processors[key](binds[key][2]) - else: - res[key.encode(encoding)] = binds[key][2] - else: - for key in self.keys(): - if key in processors: - res[key] = processors[key](binds[key][2]) - else: - res[key] = binds[key][2] - return res - - def __repr__(self): - return self.__class__.__name__ + ":" + repr(self.get_original_dict()) - - class TableCollection(object): def __init__(self, tables=None): |