-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optimize executescript() to use batching
Refs #70
- Loading branch information
Showing
2 changed files
with
26 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -88,6 +88,19 @@ def test_cursor_executemany(provider): | |
res = cur.execute("SELECT * FROM users") | ||
assert [(1, '[email protected]'), (2, '[email protected]')] == res.fetchall() | ||
|
||
@pytest.mark.parametrize("provider", ["libsql", "sqlite"]) | ||
def test_cursor_executescript(provider): | ||
conn = connect(provider, ":memory:") | ||
cur = conn.cursor() | ||
cur.executescript(""" | ||
CREATE TABLE users (id INTEGER, email TEXT); | ||
INSERT INTO users VALUES (1, '[email protected]'); | ||
INSERT INTO users VALUES (2, '[email protected]'); | ||
""") | ||
res = cur.execute("SELECT * FROM users") | ||
assert (1, '[email protected]') == res.fetchone() | ||
assert (2, '[email protected]') == res.fetchone() | ||
|
||
@pytest.mark.parametrize("provider", ["libsql", "sqlite"]) | ||
def test_lastrowid(provider): | ||
conn = connect(provider, ":memory:") | ||
|