/// <summary> /// Get number of sync sources in intermediate storage /// Maximum numbers of sync sources can be added is 2 /// </summary> /// <returns></returns> public override int GetSyncSourceCount() { try { SQLiteAccess db = new SQLiteAccess(Path.Combine(this.StoragePath, Configuration.DATABASE_NAME), false); using (SqliteConnection con = db.NewSQLiteConnection()) { if (con == null) { throw new DatabaseException(String.Format(m_ResourceManager.GetString("err_somethingNotFound"), Path.Combine(this.StoragePath, Configuration.DATABASE_NAME))); } string cmdText = "SELECT COUNT (DISTINCT " + Configuration.COL_SOURCE_ID + ") AS num" + " FROM " + Configuration.TBL_DATASOURCE_INFO; return(Convert.ToInt32(db.ExecuteScalar(cmdText, null))); } } catch (Exception) { // Possible exception during first-run when DataSourceInfo Table not created yet. // Log error? return(-1); } }
/// <summary> /// Get number of sync sources in intermediate storage /// Maximum numbers of sync sources can be added is 2 /// </summary> /// <returns></returns> public override int GetSyncSourceCount() { try { SQLiteAccess db = new SQLiteAccess(Path.Combine(this.StoragePath, Configuration.DATABASE_NAME),false); using (SqliteConnection con = db.NewSQLiteConnection ()) { if (con == null) throw new DatabaseException(String.Format(m_ResourceManager.GetString("err_somethingNotFound"), Path.Combine(this.StoragePath, Configuration.DATABASE_NAME))); string cmdText = "SELECT COUNT (DISTINCT " + Configuration.COL_SOURCE_ID + ") AS num" + " FROM " + Configuration.TBL_DATASOURCE_INFO; return Convert.ToInt32(db.ExecuteScalar(cmdText, null)); } } catch (Exception) { // Possible exception during first-run when DataSourceInfo Table not created yet. // Log error? return -1; } }