[banshee] Check tables exist before trying to ANALYZE them
- From: Gabriel Burt <gburt src gnome org>
- To: svn-commits-list gnome org
- Subject: [banshee] Check tables exist before trying to ANALYZE them
- Date: Thu, 2 Jul 2009 22:57:30 +0000 (UTC)
commit 46881be6977dc6c951d0be7bd393bd5f306db0b7
Author: Gabriel Burt <gabriel burt gmail com>
Date: Thu Jul 2 17:55:07 2009 -0500
Check tables exist before trying to ANALYZE them
.../Banshee.Database/BansheeDbConnection.cs | 20 +++++++++++---------
1 files changed, 11 insertions(+), 9 deletions(-)
---
diff --git a/src/Core/Banshee.Services/Banshee.Database/BansheeDbConnection.cs b/src/Core/Banshee.Services/Banshee.Database/BansheeDbConnection.cs
index 0a1f82c..a51d17f 100644
--- a/src/Core/Banshee.Services/Banshee.Database/BansheeDbConnection.cs
+++ b/src/Core/Banshee.Services/Banshee.Database/BansheeDbConnection.cs
@@ -99,15 +99,17 @@ namespace Banshee.Database
if (TableExists ("sqlite_stat1")) {
foreach (string table_name in tables_with_indexes) {
- long count = Query<long> (String.Format ("SELECT COUNT(*) FROM {0}", table_name));
- string stat = Query<string> ("SELECT stat FROM sqlite_stat1 WHERE tbl = ? LIMIT 1", table_name);
- // stat contains space-separated integers,
- // the first is the number of records in the table
- long items_indexed = stat != null ? long.Parse (stat.Split (' ')[0]) : 0;
-
- if (Math.Abs (count - items_indexed) > analyze_threshold) {
- needs_analyze = true;
- break;
+ if (TableExists (table_name)) {
+ long count = Query<long> (String.Format ("SELECT COUNT(*) FROM {0}", table_name));
+ string stat = Query<string> ("SELECT stat FROM sqlite_stat1 WHERE tbl = ? LIMIT 1", table_name);
+ // stat contains space-separated integers,
+ // the first is the number of records in the table
+ long items_indexed = stat != null ? long.Parse (stat.Split (' ')[0]) : 0;
+
+ if (Math.Abs (count - items_indexed) > analyze_threshold) {
+ needs_analyze = true;
+ break;
+ }
}
}
} else {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]