diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2005-10-22 06:12:05 +0000 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2005-10-22 06:12:05 +0000 |
commit | b8418eef7eb28adbf1eeed4b25ad6c0044ff2ec6 (patch) | |
tree | c11def95183dfcacbcc53b8b53dcd1e1d16410c5 /lib/sqlalchemy/databases/postgres.py | |
parent | 65811386b0526e1f7a775c29e97344c201845eab (diff) | |
download | sqlalchemy-b8418eef7eb28adbf1eeed4b25ad6c0044ff2ec6.tar.gz |
Diffstat (limited to 'lib/sqlalchemy/databases/postgres.py')
-rw-r--r-- | lib/sqlalchemy/databases/postgres.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/sqlalchemy/databases/postgres.py b/lib/sqlalchemy/databases/postgres.py index 4b20fd57f..6a7bf6acc 100644 --- a/lib/sqlalchemy/databases/postgres.py +++ b/lib/sqlalchemy/databases/postgres.py @@ -111,6 +111,13 @@ class PGSQLEngine(ansisql.ANSISQLEngine): last_inserted_ids.append(newid) self.context.last_inserted_ids = last_inserted_ids + def _executemany(self, c, statement, parameters): + rowcount = 0 + for param in parameters: + c.execute(statement, param) + rowcount += c.rowcount + self.context.rowcount = rowcount + def post_exec(self, connection, cursor, statement, parameters, echo = None, compiled = None, **kwargs): if compiled is None: return if getattr(compiled, "isinsert", False): @@ -118,6 +125,7 @@ class PGSQLEngine(ansisql.ANSISQLEngine): # or post-select the row, I guess not much diff. table = compiled.statement.table if len(table.primary_keys): + # TODO: cache this statement against the table to avoid multiple re-compiles row = sql.select(table.primary_keys, sql.ColumnClause("oid",table) == bindparam('oid', cursor.lastrowid) ).execute().fetchone() self.context.last_inserted_ids = [v for v in row] |