Skip to content

Commit 542e593

Browse files
committed
Fixed bug that allows you to write on non-writable database.
1 parent 720da5f commit 542e593

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

readonly/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class ReadOnlyCursorWrapper(object):
5555
# Data Definition
5656
'CREATE', 'ALTER', 'RENAME', 'DROP', 'TRUNCATE',
5757
# Data Manipulation
58-
'INSERT INTO', 'UPDATE', 'REPLACE', 'DELETE FROM',
58+
'INSERT', 'UPDATE', 'REPLACE', 'DELETE',
5959
)
6060

6161
def __init__(self, cursor, db, read_only=None, readonly_dbs=None):
@@ -91,7 +91,7 @@ def __iter__(self):
9191
return iter(self.cursor)
9292

9393
def _write_sql(self, sql):
94-
return sql.startswith(self.SQL_WRITE_BLACKLIST)
94+
return any(s.strip().upper().startswith(self.SQL_WRITE_BLACKLIST) for s in sql.split(';'))
9595

9696
def _write_to_readonly_db(self):
9797
return (

0 commit comments

Comments
 (0)