public override void WriteTo(SqlWriter writer) {
			base.WriteTo(writer);
			writer.WriteKeyword("DEFAULT ");
			writer.Write('(');
			writer.WriteScript(defaultValue, WhitespacePadding.None);
			writer.Write(')');
		}
Пример #2
0
		internal void WriteNonGlobalInternal(SqlWriter writer) {
			if (!quote) {
				writer.Write(Value);
			} else {
				base.WriteToInternal(writer, false);
			}
		}
		public override void WriteTo(SqlWriter writer) {
			WriteCommentsTo(writer);
			writer.WriteKeyword("CREATE XML SCHEMA COLLECTION ");
			writer.WriteScript(xmlSchemaCollectionName, WhitespacePadding.None);
			writer.WriteKeyword(" AS ");
			writer.WriteScript(expression, WhitespacePadding.None);
		}
Пример #4
0
 /// <summary>
 /// We delegate the writing of the fragment to the appropriate type.
 /// </summary>
 /// <param name="writer"></param>
 /// <param name="sqlGenerator"></param>
 public void WriteSql(SqlWriter writer, SqlGenerator sqlGenerator)
 {
   if (null != _sqlFragments)
   {
     foreach (object o in _sqlFragments)
     {
       string str = (o as String);
       if (null != str)
       {
         writer.Write(str);
       }
       else
       {
         ISqlFragment sqlFragment = (o as ISqlFragment);
         if (null != sqlFragment)
         {
           sqlFragment.WriteSql(writer, sqlGenerator);
         }
         else
         {
           throw new InvalidOperationException();
         }
       }
     }
   }
 }
Пример #5
0
		protected internal override void WriteToInternal(SqlWriter writer, bool isPartOfQualifiedName) {
			Debug.Assert(!isPartOfQualifiedName);
			if (global) {
				writer.WriteKeyword("GLOBAL ");
			}
			WriteNonGlobalInternal(writer);
		}
Пример #6
0
 public static Statement CreateAddColumnStatement(string tableName, Column column)
 {
     var writer = new SqlWriter();
     writer.Alter.Table.QuotedName(tableName).Add.Flush();
     WriteColumnDefinition(writer, column);
     return new Statement(writer.ToString(), Statement.StatementType.Text, Statement.ResultType.None);
 }
Пример #7
0
		public override void WriteTo(SqlWriter writer) {
			WriteCommentsTo(writer);
			writer.WriteKeyword("OPTION ");
			writer.Write('(');
			writer.WriteScriptSequence(options, WhitespacePadding.None, w => w.Write(", "));
			writer.Write(')');
		}
Пример #8
0
		protected internal override void WriteToInternal(SqlWriter writer, bool isPartOfQualifiedName) {
			if (IsWildcard) {
				writer.Write(Value);
			} else {
				base.WriteToInternal(writer, isPartOfQualifiedName);
			}
		}
		public override void WriteTo(SqlWriter writer) {
			base.WriteTo(writer);
			writer.WriteKeyword("CHECK ");
			writer.WriteScript(replication, WhitespacePadding.SpaceAfter);
			writer.WriteScript(predicate, WhitespacePadding.None);
			writer.Write(')');
		}
		public override void WriteTo(SqlWriter writer) {
			writer.WriteScript(serverName, WhitespacePadding.None, null, w => w.Write('.'));
			writer.WriteScript(databaseName, WhitespacePadding.None, null, w => w.Write('.'));
			writer.WriteScript(schemaName, WhitespacePadding.None, null, w => w.Write('.'));
			writer.WriteScript(tableName, WhitespacePadding.None);
			base.WriteTo(writer);
		}
 /// <summary>
 /// Initializes a new instance of the <see cref="ProcedureGenerator"/> class.
 /// </summary>
 /// <param name="table">The table.</param>
 public ProcedureGenerator(DatabaseTable table)
     : base(table)
 {
     SqlWriter = new SqlWriter(table, SqlType.Oracle);
     SqlWriter.InStoredProcedure = true;
     PackageName = "PACK_" + TableName;
 }
Пример #12
0
		public override void WriteTo(SqlWriter writer) {
			WriteCommentsTo(writer);
			writer.WriteFunction("UPDATE");
			writer.Write('(');
			writer.WriteScript(columnName, WhitespacePadding.None);
			writer.Write(')');
		}
Пример #13
0
		public override void WriteTo(SqlWriter writer) {
			writer.WriteFunction("COUNT");
			writer.Write('(');
			writer.WriteDuplicateRestriction(restriction, WhitespacePadding.SpaceAfter);
			writer.WriteScript(expression, WhitespacePadding.None);
			writer.Write(')');
		}
Пример #14
0
		protected internal override void WriteToInternal(SqlWriter writer, bool isPartOfQualifiedName) {
			if (isPartOfQualifiedName || (!IsBuiltinType)) {
				base.WriteToInternal(writer, isPartOfQualifiedName);
			} else {
				writer.WriteType(Value);
			}
		}
Пример #15
0
		public override void WriteTo(SqlWriter writer) {
			WriteCommentsTo(writer);
			writer.WriteScript(valueExpression, WhitespacePadding.None);
			base.WriteTo(writer);
			writer.WriteKeyword(" IN ");
			writer.WriteScript(tuple, WhitespacePadding.None);
		}
		public override void WriteTo(SqlWriter writer) {
			writer.WriteKeyword("FOR UPDATE");
			if (columns.Count > 0) {
				writer.WriteKeyword(" OF ");
				writer.WriteScriptSequence(columns, WhitespacePadding.None, w => w.Write(", "));
			}
		}
		protected virtual void WriteToInternal(SqlWriter writer) {
			writer.WriteScript(function, WhitespacePadding.None);
			if (functions.Count > 0) {
				writer.Write('.');
				writer.WriteScriptSequence(functions, WhitespacePadding.None, w => w.Write('.'));
			}
		}
		public override void WriteTo(SqlWriter writer) {
			writer.WriteScript(tableNameQualified, WhitespacePadding.None);
			writer.Write('.');
			writer.WriteScript(columnName, WhitespacePadding.None);
			writer.Write('.');
			base.WriteTo(writer);
		}
		protected override void WriteArguments(SqlWriter writer) {
			if (isMax) {
				writer.WriteKeyword("MAX");
			} else {
				writer.WriteScript(extension, WhitespacePadding.None);
			}
		}
		public override void WriteTo(SqlWriter writer) {
			base.WriteTo(writer);
			writer.WriteKeyword("REFERENCES ");
			writer.WriteScript(tableName, WhitespacePadding.None);
			writer.WriteScript(refColumnName, WhitespacePadding.SpaceBefore);
			writer.WriteScriptSequence(keyActions, WhitespacePadding.SpaceBefore, null);
		}
		public override void WriteTo(SqlWriter writer) {
			// we ignore the fill factor when computing a hash, so that differences due to fill factor only are ignored
			if (writer.Mode != SqlWriterMode.ForHashing) {
				writer.WriteKeyword("WITH FILLFACTOR");
				writer.Write('=');
				writer.WriteScript(fillfactor, WhitespacePadding.None);
			}
		}
Пример #22
0
		public override void WriteTo(SqlWriter writer) {
			writer.WriteFunction("CAST");
			writer.Write('(');
			writer.WriteScript(expression, WhitespacePadding.None);
			writer.WriteKeyword(" AS ");
			writer.WriteScript(typeName, WhitespacePadding.None);
			writer.Write(')');
		}
Пример #23
0
        public void WriteStartUpdate_WhenDisposed_ThrowsObjectDisposed()
        {
            StringBuilder builder = new StringBuilder();
            SqlWriter writer = new SqlWriter(builder);
            writer.Dispose();

            AssertEx.Throws<ObjectDisposedException>(() => writer.WriteStartUpdate());
        }
Пример #24
0
		public override void WriteTo(SqlWriter writer) {
			WriteCommentsTo(writer);
			writer.Write('(');
			using (writer.Indent()) {
				writer.WriteScript(expression, WhitespacePadding.None);
			}
			writer.Write(')');
		}
Пример #25
0
		public AnyStatement(Identifier identifier, Sequence<Expression> expressions) {
			using (StringWriter stringWriter = new StringWriter()) {
				SqlWriter statementWriter = new SqlWriter(stringWriter, DatabaseEngine.Unknown);
				statementWriter.WriteIdentifier(identifier.Value);
				statementWriter.WriteScriptSequence(expressions, WhitespacePadding.SpaceBefore, null);
				statementText = stringWriter.ToString();
			}
		}
		public override void WriteTo(SqlWriter writer) {
			WriteCommentsTo(writer);
			writer.WriteScript(functionCall, WhitespacePadding.None);
			writer.WriteKeyword(" OVER ");
			writer.Write('(');
			writer.WriteScript(rankingArguments, WhitespacePadding.None);
			writer.Write(')');
		}
Пример #27
0
		public override void WriteTo(SqlWriter writer) {
			writer.WriteKeyword("IDENTITY");
			writer.Write('(');
			writer.WriteScript(typeName, WhitespacePadding.None);
			writer.WriteScript(seed, WhitespacePadding.None, w => w.Write(", "), null);
			writer.WriteScript(increment, WhitespacePadding.None, w => w.Write(", "), null);
			writer.Write(')');
		}
Пример #28
0
		/// <summary>
		/// Write out the SKIP part of sql select statement 
		/// It basically writes SKIP (X).
		/// </summary>
		/// <param name="writer"></param>
		/// <param name="sqlGenerator"></param>
		public void WriteSql(SqlWriter writer, SqlGenerator sqlGenerator)
		{
			writer.Write("SKIP (");
			this.SkipCount.WriteSql(writer, sqlGenerator);
			writer.Write(")");

			writer.Write(" ");
		}
Пример #29
0
		public override sealed void WriteTo(SqlWriter writer) {
			writer.WriteScript(parameterName, WhitespacePadding.SpaceAfter);
			writer.WriteScript(parameterTypeName, WhitespacePadding.None);
			WriteParameterQualifiers(writer);
			if (readOnly) {
				writer.WriteKeyword(" READONLY");
			}
		}
Пример #30
0
 public ProcedureGenerator(DatabaseTable table)
     : base(table)
 {
     SqlWriter = new SqlWriter(table, SqlType.Db2);
     SqlWriter.InStoredProcedure = true;
     SqlWriter.FormatParameter = x => { return "p_" + x; };
     FormatParameter = SqlWriter.FormatParameter;
 }