Fixes to make mysql db work

This commit is contained in:
Tomas Groth 2015-02-11 20:56:13 +00:00
parent 88cb02bb3d
commit 8c8fbe45b2
9 changed files with 26 additions and 5 deletions

View File

@ -81,9 +81,6 @@ def init_url(plugin_name, db_file_name=None):
urlquote(settings.value('db password')), urlquote(settings.value('db password')),
urlquote(settings.value('db hostname')), urlquote(settings.value('db hostname')),
urlquote(settings.value('db database'))) urlquote(settings.value('db database')))
if db_type == 'mysql':
db_encoding = settings.value('db encoding')
db_url += '?charset=%s' % urlquote(db_encoding)
settings.endGroup() settings.endGroup()
return db_url return db_url

View File

@ -112,6 +112,10 @@ __default_settings__ = {
'alerts/font face': QtGui.QFont().family(), 'alerts/font face': QtGui.QFont().family(),
'alerts/font size': 40, 'alerts/font size': 40,
'alerts/db type': 'sqlite', 'alerts/db type': 'sqlite',
'alerts/db username': '',
'alerts/db password': '',
'alerts/db hostname': '',
'alerts/db database': '',
'alerts/location': AlertLocation.Bottom, 'alerts/location': AlertLocation.Bottom,
'alerts/background color': '#660000', 'alerts/background color': '#660000',
'alerts/font color': '#ffffff', 'alerts/font color': '#ffffff',

View File

@ -37,6 +37,10 @@ log = logging.getLogger(__name__)
__default_settings__ = { __default_settings__ = {
'bibles/db type': 'sqlite', 'bibles/db type': 'sqlite',
'bibles/db username': '',
'bibles/db password': '',
'bibles/db hostname': '',
'bibles/db database': '',
'bibles/last search type': BibleSearch.Reference, 'bibles/last search type': BibleSearch.Reference,
'bibles/verse layout style': LayoutStyle.VersePerSlide, 'bibles/verse layout style': LayoutStyle.VersePerSlide,
'bibles/book name language': LanguageSelection.Bible, 'bibles/book name language': LanguageSelection.Bible,

View File

@ -36,6 +36,10 @@ log = logging.getLogger(__name__)
__default_settings__ = { __default_settings__ = {
'custom/db type': 'sqlite', 'custom/db type': 'sqlite',
'custom/db username': '',
'custom/db password': '',
'custom/db hostname': '',
'custom/db database': '',
'custom/last search type': CustomSearch.Titles, 'custom/last search type': CustomSearch.Titles,
'custom/display footer': True, 'custom/display footer': True,
'custom/add custom from service': True 'custom/add custom from service': True

View File

@ -35,6 +35,10 @@ log = logging.getLogger(__name__)
__default_settings__ = { __default_settings__ = {
'images/db type': 'sqlite', 'images/db type': 'sqlite',
'imaegs/db username': '',
'images/db password': '',
'images/db hostname': '',
'images/db database': '',
'images/background color': '#000000', 'images/background color': '#000000',
} }

View File

@ -312,7 +312,7 @@ def init_schema(url):
'authors_songs', metadata, 'authors_songs', metadata,
Column('author_id', types.Integer(), ForeignKey('authors.id'), primary_key=True), Column('author_id', types.Integer(), ForeignKey('authors.id'), primary_key=True),
Column('song_id', types.Integer(), ForeignKey('songs.id'), primary_key=True), Column('song_id', types.Integer(), ForeignKey('songs.id'), primary_key=True),
Column('author_type', types.String(), primary_key=True, nullable=False, server_default=text('""')) Column('author_type', types.Unicode(255), primary_key=True, nullable=False, server_default=text('""'))
) )
# Definition of the "songs_topics" table # Definition of the "songs_topics" table

View File

@ -109,7 +109,7 @@ def upgrade_4(session, metadata):
op.create_table('authors_songs_tmp', op.create_table('authors_songs_tmp',
Column('author_id', types.Integer(), ForeignKey('authors.id'), primary_key=True), Column('author_id', types.Integer(), ForeignKey('authors.id'), primary_key=True),
Column('song_id', types.Integer(), ForeignKey('songs.id'), primary_key=True), Column('song_id', types.Integer(), ForeignKey('songs.id'), primary_key=True),
Column('author_type', types.String(), primary_key=True, Column('author_type', types.Unicode(255), primary_key=True,
nullable=False, server_default=text('""'))) nullable=False, server_default=text('""')))
op.execute('INSERT INTO authors_songs_tmp SELECT author_id, song_id, "" FROM authors_songs') op.execute('INSERT INTO authors_songs_tmp SELECT author_id, song_id, "" FROM authors_songs')
op.drop_table('authors_songs') op.drop_table('authors_songs')

View File

@ -50,6 +50,10 @@ from openlp.plugins.songs.lib.songstab import SongsTab
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
__default_settings__ = { __default_settings__ = {
'songs/db type': 'sqlite', 'songs/db type': 'sqlite',
'songs/db username': '',
'songs/db password': '',
'songs/db hostname': '',
'songs/db database': '',
'songs/last search type': SongSearch.Entire, 'songs/last search type': SongSearch.Entire,
'songs/last import type': SongFormat.OpenLyrics, 'songs/last import type': SongFormat.OpenLyrics,
'songs/update service on edit': False, 'songs/update service on edit': False,

View File

@ -43,6 +43,10 @@ if QtCore.QDate().currentDate().month() < 9:
__default_settings__ = { __default_settings__ = {
'songusage/db type': 'sqlite', 'songusage/db type': 'sqlite',
'songusage/db username': '',
'songuasge/db password': '',
'songuasge/db hostname': '',
'songuasge/db database': '',
'songusage/active': False, 'songusage/active': False,
'songusage/to date': QtCore.QDate(YEAR, 8, 31), 'songusage/to date': QtCore.QDate(YEAR, 8, 31),
'songusage/from date': QtCore.QDate(YEAR - 1, 9, 1), 'songusage/from date': QtCore.QDate(YEAR - 1, 9, 1),