MCPcopy Index your code
hub / github.com/RustPython/RustPython / execute

Function execute

Lib/sqlite3/__main__.py:15–34  ·  view source on GitHub ↗

Helper that wraps execution of SQL code. This is used both by the REPL and by direct execution from the CLI. 'c' may be a cursor or a connection. 'sql' is the SQL string to execute.

(c, sql, suppress_errors=True)

Source from the content-addressed store, hash-verified

13
14
15def execute(c, sql, suppress_errors=True):
16 """Helper that wraps execution of SQL code.
17
18 This is used both by the REPL and by direct execution from the CLI.
19
20 'c' may be a cursor or a connection.
21 'sql' is the SQL string to execute.
22 """
23
24 try:
25 for row in c.execute(sql):
26 print(row)
27 except sqlite3.Error as e:
28 tp = type(e).__name__
29 try:
30 print(f"{tp} ({e.sqlite_errorname}): {e}", file=sys.stderr)
31 except AttributeError:
32 print(f"{tp}: {e}", file=sys.stderr)
33 if not suppress_errors:
34 sys.exit(1)
35
36
37class SqliteInteractiveConsole(InteractiveConsole):

Calls 3

printFunction · 0.50
executeMethod · 0.45
exitMethod · 0.45