'Establish the values and/or types of bound parameters within
this :class:`.TextClause` construct.
Given a text construct such as::
from sqlalchemy import text
stmt = text("SELECT id, name FROM user WHERE name=:name "
"AND timestamp=:timestamp")
the :meth:`.TextClause.bindparams` method can be used to establish
the initial value of ``:name`` and ``:timestamp``,
using simple keyword arguments::
stmt = stmt.bindparams(name=\'jack\',
timestamp=datetime.datetime(2012, 10, 8, 15, 12, 5))
Where above, new :class:`.BindParameter` objects
will be generated with the names ``name`` and ``timestamp``, and
values of ``jack`` and ``datetime.datetime(2012, 10, 8, 15, 12, 5)``,
respectively.  The types will be
inferred from the values given, in this case :class:`.String` and
:class:`.DateTime`.
When specific typing behavior is needed, the positional ``*binds``
argument can be used in which to specify :func:`.bindparam` constructs
directly.  These constructs must include at least the ``key`` argument,
then an optional value and type::
from sqlalchemy import bindparam
stmt = stmt.bindparams(
bindparam(\'name\', value=\'jack\', type_=String),
bindparam(\'timestamp\', type_=DateTime)
Above, we specified the type of :class:`.DateTime` for the ``timestamp``
bind, and the type of :class:`.String` for the ``name`` bind.  In
the case of ``name`` we also set the default value of ``"jack"``.
Additional bound parameters can be supplied at statement execution
time, e.g.::
result = connection.execute(stmt,
timestamp=datetime.datetime(2012, 10, 8, 15, 12, 5))
The :meth:`.TextClause.bindparams` method can be called repeatedly, where
it will re-use existing :class:`.BindParameter` objects to add new information.
For example, we can call :meth:`.TextClause.bindparams` first with
typing information, and a second time with value information, and it
will be combined::
stmt = text("SELECT id, name FROM user WHERE name=:name "
"AND timestamp=:timestamp")
stmt = stmt.bindparams(
bindparam(\'name\', type_=String),
bindparam(\'timestamp\', type_=DateTime)
stmt = stmt.bindparams(
name=\'jack\',
timestamp=datetime.datetime(2012, 10, 8, 15, 12, 5)
.. versionadded:: 0.9.0 The :meth:`.TextClause.bindparams` method supersedes
the argument ``bindparams`` passed to :func:`~.expression.text`.'

@_generative
def bindparams(self, *binds, **names_to_values):

    self._bindparams = new_params = self._bindparams.copy()
    for bind in binds:
        try:
            existing = new_params[bind.key]
        except KeyError:
            raise exc.ArgumentError((u"This    text()    construct    doesn't    define    a    bound    parameter    named    %r" % bind.key))
        else:
            new_params[existing.key] = bind
    for (key, value) in names_to_values.items():
        try:
            existing = new_params[key]
        except KeyError:
            raise exc.ArgumentError((u"This    text()    construct    doesn't    define    a    bound    parameter    named    %r" % key))
        else:
            new_params[key] = existing._with_value(value)
