Exemple #1
0
        public void SyncToDatabase(DsnConnection dsn)
        {
            if (dsn != null)
            {
                switch (dsn.DbMode)
                {
                case DsnConnection.ConnectionMode.Odbc:
                case DsnConnection.ConnectionMode.MySqlNative:
                    // cannot truncate foreign keyed tables.
                    //dsn.ExecuteNonQuery( "truncate " + Prefix + XTableName );
                    dsn.ExecuteNonQuery("delete from " + Prefix + XTableName);
                    // want to reset the keys though... so can truncate after it's empty?
                    dsn.ExecuteNonQuery("ALTER TABLE " + Prefix + XTableName + " AUTO_INCREMENT = 1");
                    break;

                case DsnConnection.ConnectionMode.Sqlite:
                    dsn.ExecuteNonQuery("delete from " + Prefix + XTableName);
                    dsn.KindExecuteNonQuery("update sqlite_sequence set seq = 1 where name='" + Prefix + XTableName + "'");
                    break;

                default:
                    dsn.ExecuteNonQuery("delete from " + Prefix + XTableName);
                    break;
                }
                DsnSQLUtil.InsertAllRows(dsn, this);
            }
            filling = false;
        }
Exemple #2
0
 public static bool KindExecuteNonQuery(string s)
 {
     return(_dsn.KindExecuteNonQuery(s));
 }