/// <summary> /// Write the elements for this field to the XML /// </summary> /// <param name="writer"></param> internal override void WriteExtraElements(XmlHelper writer) { writer.WriteElement("FieldQuoted", FieldQuoted); writer.WriteElement("QuoteChar", QuoteChar.ToString(), "\""); writer.WriteElement("QuoteMode", QuoteMode.ToString(), "OptionalForRead"); writer.WriteElement("QuoteMultiline", QuoteMultiline.ToString(), "AllowForRead"); }
/// <summary>Indicates that the field must be read and written as a Quoted String (that can be optional).</summary> /// <param name="quoteChar">The char used to quote the string.</param> /// <param name="mode">Indicates if the handling of optionals in the quoted field.</param> /// <param name="multiline">Indicates if the field can span multiple lines.</param> public FieldQuotedAttribute(char quoteChar, QuoteMode mode, MultilineMode multiline) { if (quoteChar == '\0') throw new BadUsageException("You can't use the null char (\\0) as quoted."); QuoteChar = quoteChar; QuoteMode = mode; QuoteMultiline = multiline; }
public string GetQualifiedName(QuoteMode mode = QuoteMode.WhenNecessary) { if (this.Parent == null) { return(RedshiftUtility.GetQuotedIdentifier(this.Name, mode, false)); } else { return(this.Parent.GetQualifiedName(mode) + '.' + RedshiftUtility.GetQuotedIdentifier(this.Name, mode, true)); } }
public string GetQualifiedName(QuoteMode mode = QuoteMode.WhenNecessary) { if (this.Schema == null) { return(RedshiftUtility.GetQuotedIdentifier(this.Name, mode, false)); } else { return(RedshiftUtility.GetQualifiedName(this.Schema.Name, this.Name, mode)); } }
public static string GetQualifiedName(string parentName, string localName, QuoteMode mode = QuoteMode.WhenNecessary) { if (String.IsNullOrEmpty(parentName)) { return(GetQuotedIdentifier(localName, mode, false)); } else { return(GetQuotedIdentifier(parentName, mode, false) + '.' + GetQuotedIdentifier(localName, mode, true)); } }
/// <summary>Indicates that the field must be read and written as a Quoted String (that can be optional).</summary> /// <param name="quoteChar">The char used to quote the string.</param> /// <param name="mode">Indicates if the handling of optionals in the quoted field.</param> /// <param name="multiline">Indicates if the field can span multiple lines.</param> public FieldQuotedAttribute(char quoteChar, QuoteMode mode, MultilineMode multiline) { if (quoteChar == '\0') { throw new BadUsageException("You can't use the null char (\\0) as quoted."); } QuoteChar = quoteChar; QuoteMode = mode; QuoteMultiline = multiline; }
/// <summary> /// Serializes the specified struct to bin array /// </summary> /// <param name="xstruct"> the struct containing the data /// </param> /// <returns></returns> public static unsafe byte[] Serialize(QuoteMode xstruct) { var buffer = new byte[164]; fixed(void *d = &buffer[0]) { void *s = &xstruct; CopyMemory(d, s, buffer.Length); } return(buffer); }
public async Task <IResponse <ActionResult> > ChangeUserMode(QuoteMode mode) { var userName = this.GetUserName(); if (string.IsNullOrEmpty(userName)) { return(Invalid <ActionResult>("User is not logged in")); } await userService.ChangeUserMode(userName, mode); return(Success <ActionResult>(null)); }
/// <summary> /// change logged user mode /// </summary> /// <param name="userName"></param> /// <param name="mode"></param> /// <returns></returns> public async Task ChangeUserMode(string userName, QuoteMode mode) { try { var dbUser = await user.SingleAsync(x => x.UserName == userName && x.IsActive && !x.IsDeleted); dbUser.Mode = (byte)mode; await user.SaveChangesAsync(); } catch (InvalidOperationException iox) { throw new FqqException(FqqExceptionCode.UserNotFound, false, iox); } catch (Exception ex) { throw new FqqException(FqqExceptionCode.GeneralError, "Error when changing user mode", true, ex); } }
public static string GetQuotedIdentifier(string identifier, QuoteMode mode = QuoteMode.Always, bool qualified = false) { if (identifier == null) { throw new ArgumentNullException("identifier"); } // If the quote mode is Always or if the mode is WhenNecessary // and it is necessary to quote the identifier (because it is not safe) // then quote the identifier by surrounding with double quotes and // replacing all occurances of double quotes with a pair of double quotes. if (mode == QuoteMode.Always || (mode == QuoteMode.WhenNecessary && !IsSafeIdentifier(identifier, qualified))) { return('"' + identifier.Replace("\"", "\"\"") + '"'); } else { return(identifier); } }
/// <summary>Indicates that the field must be read and written like a Quoted String (that can be optional).</summary> /// <param name="mode">Indicates if the handling of optionals in the quoted field.</param> /// <param name="multiline">Indicates if the field can span multiple lines.</param> public FieldQuotedAttribute(QuoteMode mode, MultilineMode multiline):this('"', mode, multiline) {}
/// <summary>Indicates that the field must be read and written like a "Quoted String" (that can be optional depending of the mode).</summary> /// <param name="mode">Indicates if the handling of optionals in the quoted field.</param> public FieldQuotedAttribute(QuoteMode mode) : this('\"', mode) {}
public string GetQuotedName(QuoteMode mode = QuoteMode.WhenNecessary) { return(RedshiftUtility.GetQuotedIdentifier(this.Name, mode)); }
/// <summary>Indicates that the field must be read and written as a Quoted String (that can be optional).</summary> /// <param name="quoteChar">The char used to quote the string.</param> /// <param name="mode">Indicates if the handling of optionals in the quoted field.</param> public FieldQuotedAttribute(char quoteChar, QuoteMode mode) : this(quoteChar, mode, MultilineMode.AllowForBoth) { }
/// <summary>Indicates that the field must be read and written as a Quoted String (that can be optional).</summary> /// <param name="mode">Indicates if the handling of optionals in the quoted field.</param> /// <param name="multiline">Indicates if the field can span multiple lines.</param> public FieldQuotedAttribute(QuoteMode mode, MultilineMode multiline) : this('"', mode, multiline) { }
/// <summary>Indicates that the field must be read and written like a Quoted String (that can be optional).</summary> /// <param name="quoteChar">The char used to quote the string.</param> /// <param name="mode">Indicates if the handling of optionals in the quoted field.</param> public FieldQuotedAttribute(char quoteChar, QuoteMode mode):this(quoteChar, mode, MultilineMode.AllowForBoth) {}
/// <summary>Indicates that the field must be read and written as a Quoted String (that can be optional).</summary> /// <param name="quoteChar">The char used to quote the string.</param> /// <param name="mode">Indicates if the handling of optionals in the quoted field.</param> /// <param name="multiline">Indicates if the field can span multiple lines.</param> public FieldQuotedAttribute(char quoteChar, QuoteMode mode, MultilineMode multiline) { QuoteChar = quoteChar; QuoteMode = mode; QuoteMultiline = multiline; }
/// <summary>Indicates that the field must be read and written like a Quoted String (that can be optional).</summary> /// <param name="quoteChar">The char used to quote the string.</param> /// <param name="mode">Indicates if the handling of optionals in the quoted field.</param> /// <param name="multiline">Indicates if the field can span multiple lines.</param> public FieldQuotedAttribute(char quoteChar, QuoteMode mode, MultilineMode multiline) { QuoteChar = quoteChar; QuoteMode = mode; QuoteMultiline = multiline; }
/// <summary> /// Indicates that the field must be read and written as a "Quoted String" /// (that can be optional depending of the mode). /// </summary> /// <param name="mode">Indicates if the handling of optionals in the quoted field.</param> public FieldQuotedAttribute(QuoteMode mode) : this('\"', mode) { }