예제 #1
0
        public static void UpdateNotForReplication(DbConnection sqlConnection, int[] ids, int userId)
        {
            var dbType  = DatabaseTypeHelper.ResolveDatabaseType(sqlConnection);
            var setTrue = dbType == DatabaseType.SqlServer ? "1" : "true";
            var sql     = $@"
            UPDATE CONTENT_ITEM SET NOT_FOR_REPLICATION = {setTrue}, MODIFIED = {SqlQuerySyntaxHelper.Now(dbType)}, LAST_MODIFIED_BY = @userId
            WHERE {SqlQuerySyntaxHelper.IsFalse(dbType, "NOT_FOR_REPLICATION")} AND CONTENT_ITEM_ID IN (select id from {Common.IdList(dbType, "@ids")});
            ";

            using (var cmd = DbCommandFactory.Create(sql, sqlConnection))
            {
                cmd.Parameters.Add(SqlQuerySyntaxHelper.GetIdsDatatableParam("@ids", ids, dbType));
                cmd.Parameters.AddWithValue("@userId", userId);
                cmd.ExecuteNonQuery();
            }
        }
예제 #2
0
파일: CommonMisc.cs 프로젝트: QuantumArt/QP
 internal static string IsFalse(DatabaseType databaseType, string expr) => SqlQuerySyntaxHelper.IsFalse(databaseType, expr);