示例#1
0
		public static string BuildUpdate(KeyValueListBase liste, string where)
		{
			var sb = new StringBuilder();
			sb.Append("UPDATE " + liste.TableName + " SET ");
			AppendKeyValuePairs(sb, liste.Pairs, ", ");
			sb.Append(" WHERE ");
			sb.Append(where);

			return sb.ToString();
		}
示例#2
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();
		}
示例#3
0
 public void Delete(KeyValueListBase list)
 {
     ExecuteComand(SqlUtil.BuildDelete(list.TableName, SqlUtil.BuildWhere(list.Pairs)));
 }
示例#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 " + DatabaseUtil.Dialect.QuoteForTableName(liste.TableName) + " (");
			for (var i = 0; i < count; i++)
			{
				var pair = pairs[i];
				sb.Append(DatabaseUtil.Dialect.QuoteForColumnName(pair.Key));
				if (i < count - 1)
				{
					sb.Append(",");
				}
			}
			sb.Append(") VALUES ");
			return sb;
		}
示例#5
0
 public void Insert(KeyValueListBase list)
 {
     ExecuteComand(SqlUtil.BuildInsert(list));
 }