diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2008-11-04 17:28:26 +0000 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2008-11-04 17:28:26 +0000 |
commit | c38e5d043f3d340f8e3cb3c82d2013739f35fc78 (patch) | |
tree | 9b63eb16b82b53392cbb0fd322836be57022695a /lib/sqlalchemy/databases/firebird.py | |
parent | 3f1e5e213d65375e89a23ecb4d50566c1f34b7b0 (diff) | |
download | sqlalchemy-c38e5d043f3d340f8e3cb3c82d2013739f35fc78.tar.gz |
- Simplified the check for ResultProxy "autoclose without results"
to be based solely on presence of cursor.description.
All the regexp-based guessing about statements returning rows
has been removed [ticket:1212].
Diffstat (limited to 'lib/sqlalchemy/databases/firebird.py')
-rw-r--r-- | lib/sqlalchemy/databases/firebird.py | 37 |
1 files changed, 1 insertions, 36 deletions
diff --git a/lib/sqlalchemy/databases/firebird.py b/lib/sqlalchemy/databases/firebird.py index ccd4db3c7..7c7d4793b 100644 --- a/lib/sqlalchemy/databases/firebird.py +++ b/lib/sqlalchemy/databases/firebird.py @@ -261,45 +261,10 @@ ischema_names = { 'BLOB': lambda r: r['stype']==1 and FBText() or FBBinary() } - -SELECT_RE = re.compile( - r'\s*(?:SELECT|(UPDATE|INSERT|DELETE))', - re.I | re.UNICODE) - -RETURNING_RE = re.compile( - 'RETURNING', - re.I | re.UNICODE) - -# This finds if the RETURNING is not inside a quoted/commented values. Handles string literals, -# quoted identifiers, dollar quotes, SQL comments and C style multiline comments. This does not -# handle correctly nested C style quotes, lets hope no one does the following: -# UPDATE tbl SET x=y /* foo /* bar */ RETURNING */ -RETURNING_QUOTED_RE = re.compile( - """\s*(?:UPDATE|INSERT|DELETE)\s - (?: # handle quoted and commented tokens separately - [^'"$/-] # non quote/comment character - | -(?!-) # a dash that does not begin a comment - | /(?!\*) # a slash that does not begin a comment - | "(?:[^"]|"")*" # quoted literal - | '(?:[^']|'')*' # quoted string - | --[^\\n]*(?=\\n) # SQL comment, leave out line ending as that counts as whitespace - # for the returning token - | /\*([^*]|\*(?!/))*\*/ # C style comment, doesn't handle nesting - )* - \sRETURNING\s""", re.I | re.UNICODE | re.VERBOSE) - RETURNING_KW_NAME = 'firebird_returning' class FBExecutionContext(default.DefaultExecutionContext): - def returns_rows_text(self, statement): - m = SELECT_RE.match(statement) - return m and (not m.group(1) or (RETURNING_RE.search(statement) - and RETURNING_QUOTED_RE.match(statement))) - - def returns_rows_compiled(self, compiled): - return (isinstance(compiled.statement, sql.expression.Selectable) or - ((compiled.isupdate or compiled.isinsert or compiled.isdelete) and - RETURNING_KW_NAME in compiled.statement.kwargs)) + pass class FBDialect(default.DefaultDialect): |