Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes Issue #264 - sqlite utf-8 in db.insert function #265

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion web/db.py
Expand Up @@ -1015,7 +1015,8 @@ def __init__(self, **keywords):


if db.__name__ in ["sqlite3", "pysqlite2.dbapi2"]: if db.__name__ in ["sqlite3", "pysqlite2.dbapi2"]:
db.paramstyle = 'qmark' db.paramstyle = 'qmark'

if db.__name__ in ["sqlite3"]:
db.register_adapter( str, lambda s:s.decode( 'utf-8' ) )
# sqlite driver doesn't create datatime objects for timestamp columns unless `detect_types` option is passed. # sqlite driver doesn't create datatime objects for timestamp columns unless `detect_types` option is passed.
# It seems to be supported in sqlite3 and pysqlite2 drivers, not surte about sqlite. # It seems to be supported in sqlite3 and pysqlite2 drivers, not surte about sqlite.
keywords.setdefault('detect_types', db.PARSE_DECLTYPES) keywords.setdefault('detect_types', db.PARSE_DECLTYPES)
Expand Down