Example #1
0
        public static string BuildUpdate(KeyValueListBase liste, string where)
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append("UPDATE " + liste.Table + " SET ");
            SqlBuilder.AppendKeyValuePairs(stringBuilder, liste.Pairs, ", ");
            stringBuilder.Append(" WHERE ");
            stringBuilder.Append(where);
            return(stringBuilder.ToString());
        }
Example #2
0
        public static string BuildInsert(KeyValueListBase liste)
        {
            List <KeyValuePair <string, object> > pairs = liste.Pairs;
            int           count         = pairs.Count;
            StringBuilder stringBuilder = SqlBuilder.PrepareInsertBuilder(liste);

            stringBuilder.Append("(");
            for (int i = 0; i < count; i++)
            {
                stringBuilder.Append(SqlBuilder.GetValueString(pairs[i].Value));
                if (i < count - 1)
                {
                    stringBuilder.Append(",");
                }
            }
            stringBuilder.Append(")");
            return(stringBuilder.ToString());
        }
Example #3
0
        private static StringBuilder PrepareInsertBuilder(KeyValueListBase liste)
        {
            List <KeyValuePair <string, object> > pairs = liste.Pairs;
            int           count         = pairs.Count;
            StringBuilder stringBuilder = new StringBuilder(150);

            stringBuilder.Append("INSERT INTO " + SqlBuilder.QuoteForTableName(liste.Table) + " (");
            for (int i = 0; i < count; i++)
            {
                stringBuilder.Append(SqlBuilder.QuoteForColumnName(pairs[i].Key));
                if (i < count - 1)
                {
                    stringBuilder.Append(",");
                }
            }
            stringBuilder.Append(") VALUES ");
            return(stringBuilder);
        }
Example #4
0
        private static StringBuilder PrepareInsertBuilder(KeyValueListBase liste)
        {
            var pairs = liste.Pairs;
            var count = pairs.Count;

            var sb = new StringBuilder(150);

            sb.Append("INSERT INTO " + QuoteForTableName(liste.Table) + " (");
            for (var i = 0; i < count; i++)
            {
                var pair = pairs[i];
                sb.Append(QuoteForColumnName(pair.Key));
                if (i < count - 1)
                {
                    sb.Append(",");
                }
            }
            sb.Append(") VALUES ");
            return(sb);
        }
Example #5
0
        public static string BuildInsert(KeyValueListBase liste)
        {
            var pairs = liste.Pairs;
            var count = pairs.Count;

            // create the basic statement
            var sb = PrepareInsertBuilder(liste);

            // append values
            sb.Append("(");
            for (var i = 0; i < count; i++)
            {
                var pair = pairs[i];
                sb.Append(GetValueString(pair.Value));
                if (i < count - 1)
                {
                    sb.Append(",");
                }
            }
            sb.Append(")");

            return(sb.ToString());
        }