def assert_is_invalid_sql(self, sql, args=None): db = self.db() cursor = db.cursor() # MySQL, PostgreSQL: ProgrammingError # sqlite: OperationalError exception_names = ('OperationalError', 'ProgrammingError') execute_sql = lambda: safe_execute(cursor, sql, args) return self.assert_raises_db_exception(exception_names, execute_sql, db)
def store_burndown_change(self, sprint_name, when, delta): sql = 'INSERT INTO agilo_burndown_data_change (burndown_type, scope, timestamp, value) values (%(burndown_type)s, %(scope)s, %(timestamp)s, %(value)s)' parameters = dict(burndown_type='remaining_time', scope=sprint_name, timestamp=to_timestamp(when), value=delta) safe_execute(self.cursor, sql, parameters)
def execute_sql(self, sql, args=None): db = self.db() cursor = db.cursor() safe_execute(cursor, sql, args) return cursor.fetchall()
def commit_sql(self, sql, args=None): db = self.db() cursor = db.cursor() safe_execute(cursor, sql, args) db.commit()