コード例 #1
0
 /// <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");
 }
コード例 #2
0
        /// <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;
        }
コード例 #3
0
 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));
     }
 }
コード例 #4
0
 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));
     }
 }
コード例 #5
0
 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));
     }
 }
コード例 #6
0
        /// <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;
        }
コード例 #7
0
        /// <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);
        }
コード例 #8
0
        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));
        }
コード例 #9
0
        /// <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);
            }
        }
コード例 #10
0
        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);
            }
        }
コード例 #11
0
		/// <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)
		{}
コード例 #12
0
		/// <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)
		{}
コード例 #13
0
 public string GetQuotedName(QuoteMode mode = QuoteMode.WhenNecessary)
 {
     return(RedshiftUtility.GetQuotedIdentifier(this.Name, mode));
 }
コード例 #14
0
 /// <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)
 {
 }
コード例 #15
0
 /// <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)
 {
 }
コード例 #16
0
		/// <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) 
		{}
コード例 #17
0
 /// <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;
 }
コード例 #18
0
		/// <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;
		}
コード例 #19
0
 /// <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)
 {
 }