From e240446aa4d81949934afeefc4c3ea6a32522b51 Mon Sep 17 00:00:00 2001 From: Dmitry Blokhin Date: Tue, 21 Jan 2014 00:44:17 +0200 Subject: [mysql] don't recreate views on copy() - they'll be dropped and recreated in the update routines --- xbmc/dbwrappers/mysqldataset.cpp | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/xbmc/dbwrappers/mysqldataset.cpp b/xbmc/dbwrappers/mysqldataset.cpp index a39554cfad..c186fdf20b 100644 --- a/xbmc/dbwrappers/mysqldataset.cpp +++ b/xbmc/dbwrappers/mysqldataset.cpp @@ -284,30 +284,8 @@ int MysqlDatabase::copy(const char *backup_name) { } mysql_free_result(res); - // after table are recreated and repopulated we can recreate views - // grab a list of views and their definitions - sprintf(sql, "SELECT TABLE_NAME, VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_SCHEMA = '%s'", db.c_str()); - if ( (ret=query_with_reconnect(sql)) != MYSQL_OK ) - throw DbErrors("Can't determine views to recreate."); - - // get list of all views from old DB - MYSQL_RES* resViews = mysql_store_result(conn); - - if (resViews) - { - while ( (row=mysql_fetch_row(resViews)) != NULL ) - { - sprintf(sql, "CREATE VIEW %s.%s AS %s", - backup_name, row[0], row[1]); - - if ( (ret=query_with_reconnect(sql)) != MYSQL_OK ) - { - mysql_free_result(resViews); - throw DbErrors("Can't create view '%s'\nError: %d", row[0], ret); - } - } - mysql_free_result(resViews); - } + // we don't recreate views, indicies, or triggers on copy + // as we'll be dropping and recreating them anyway } return 1; -- cgit v1.2.3