- """Wrapper around sqlite3.Connection.execute."""
- return self._conn.execute(sql, inputs)
-
- def exec_on_values(self, sql: SqlText, inputs: tuple[Any, ...]
- ) -> DbCursor:
- """Wraps .exec on inputs, affixes to sql proper ' VALUES (?, …)'."""
- q_marks = '(' + ','.join(['?'] * len(inputs)) + ')'
- return self._conn.execute(f'{sql} VALUES {q_marks}', inputs)
+ """Wrapper around sqlite3.Connection.execute, building '?' if inputs"""
+ if len(inputs) > 0:
+ q_marks = ('?' if len(inputs) == 1
+ else '(' + ','.join(['?'] * len(inputs)) + ')')
+ return self._conn.execute(SqlText(f'{sql} {q_marks}'), inputs)
+ return self._conn.execute(sql)