Ejemplo n.º 1
0
        public string DeleteSyncMap(SyncMap sm)
        {
            string outputMsg = "implementation in progress";
            string time = "";

            try
            {
                //we need to make sure our id dictionaries are refreshed
                RefreshIds();

                using (var conn =
                    new SQLiteConnection(@"Data Source=" +
                        Configuration.GetSqliteDbPath(GetDbName())))
                {
                    conn.Open();

                    using (var cmd = new SQLiteCommand(conn))
                    {
                        using (var transaction = conn.BeginTransaction())
                        {
                            Stopwatch sw = Stopwatch.StartNew();

                            DeleteSyncMap(sm, cmd);

                            transaction.Commit();

                            sw.Stop();
                            time = sw.Elapsed.ToString("mm\\:ss\\.ff");
                        }
                    }

                    conn.Close();
                }

                outputMsg = "Delete Sync Map Finished: " + time;
            }
            catch (Exception ex)
            {
                outputMsg = "error: " + ex.Message;
            }

            return outputMsg;
        }
Ejemplo n.º 2
0
        public override void DeleteSyncMap(SyncMap sm, SQLiteCommand cmd)
        {
            Dictionary<string, int> pathIds =
                new Dictionary<string, int>();

            pathIds.Add(sm.Source, -1);
            pathIds.Add(sm.Destination, -1);
            RefreshPathIds(pathIds, cmd);

            cmd.Parameters.Clear();

            cmd.CommandText =
                "DELETE FROM " + NwdContract.TABLE_SYNC_MAP + " " +
                "WHERE " + NwdContract.COLUMN_SYNC_PROFILE_ID + " = @profileId " +
                "AND " + NwdContract.COLUMN_PATH_ID_SOURCE + " = @srcId " +
                "AND " + NwdContract.COLUMN_PATH_ID_DESTINATION + " = @destId " +
                "AND " + NwdContract.COLUMN_SYNC_DIRECTION_ID + " = @directionId";

            cmd.Parameters.AddWithValue("@profileId", GetNameId(sm.Profile.Name));
            cmd.Parameters.AddWithValue("@srcId", pathIds[sm.Source]);
            cmd.Parameters.AddWithValue("@destId", pathIds[sm.Destination]);
            cmd.Parameters.AddWithValue("@directionId", GetDirectionId(sm.SyncDirection));

            cmd.ExecuteNonQuery();
        }
Ejemplo n.º 3
0
 public abstract void DeleteSyncMap(SyncMap sm, SQLiteCommand cmd);
Ejemplo n.º 4
0
 public void DeleteSyncMap(SyncMap sm, SQLiteCommand cmd)
 {
     db.DeleteSyncMap(sm, cmd);
 }
Ejemplo n.º 5
0
 internal string DeleteSyncMap(SyncMap sm)
 {
     return db.DeleteSyncMap(sm);
 }
Ejemplo n.º 6
0
 string IDbAdapter.DeleteSyncMap(SyncMap sm)
 {
     return db.DeleteSyncMap(sm);
 }