MCPcopy Index your code
hub / github.com/clips/pattern / execute

Method execute

pattern/db/__init__.py:531–545  ·  view source on GitHub ↗

Executes the given SQL query and return a list of rows. With commit=True, automatically commits insert/update/delete changes.

(self, SQL, commit=False)

Source from the content-addressed store, hash-verified

529 return self._query
530
531 def execute(self, SQL, commit=False):
532 """ Executes the given SQL query and return a list of rows.
533 With commit=True, automatically commits insert/update/delete changes.
534 """
535 self._query = SQL
536 if not SQL:
537 return # MySQL doesn't like empty queries.
538 #print SQL
539 cursor = self._connection.cursor()
540 cursor.execute(SQL)
541 rows = list(cursor.fetchall())
542 cursor.close()
543 if commit is not False:
544 self._connection.commit()
545 return rows
546
547 def commit(self):
548 """ Commit all pending insert/update/delete changes.

Callers 4

__init__Method · 0.95
createMethod · 0.95
dropMethod · 0.95
_deleteMethod · 0.95

Calls 3

commitMethod · 0.80
executeMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected