예제 #1
0
        /// <summary>
        /// The get db string.
        /// </summary>
        /// <param name="str">
        /// The string.
        /// </param>
        /// <param name="StringFormat">
        /// The string format.
        /// </param>
        /// <returns>
        /// The <see cref="string"/>.
        /// </returns>
        public static string GetDbString(string str, TDbProviders StringFormat)
        {
            if (str == null)
            {
                return("NULL");
            }

            str = str.Replace("'", "''");
            if (StringFormat == TDbProviders.MSSQL)
            {
                return("N'" + str + "'");
            }

            return("'" + str + "'");
        }
예제 #2
0
        /// <summary>
        /// The get db param text for sql condition.
        /// </summary>
        /// <param name="DbParamValue">
        /// The db param value.
        /// </param>
        /// <param name="StringFormat">
        /// The string format.
        /// </param>
        /// <returns>
        /// The <see cref="string"/>.
        /// </returns>
        public static string GetDbParamTextForSqlCondition(object DbParamValue, TDbProviders StringFormat)
        {
            if (DbParamValue == null)
            {
                return("IS NULL");
            }

            var dbString = DbParamValue.ToString();

            if (DbParamValue is string)
            {
                dbString = GetDbString(dbString, StringFormat);
            }

            return("=" + dbString);
        }
예제 #3
0
        /// <summary>
        /// The get db param text for sql assignment.
        /// </summary>
        /// <param name="DbParamValue">
        /// The db param value.
        /// </param>
        /// <param name="StringFormat">
        /// The string format.
        /// </param>
        /// <returns>
        /// The <see cref="string"/>.
        /// </returns>
        public static string GetDbParamTextForSqlAssignment(object DbParamValue, TDbProviders StringFormat)
        {
            string dbString;

            if (DbParamValue == null)
            {
                dbString = "NULL";
            }
            else
            {
                dbString = DbParamValue.ToString();
                if (DbParamValue is string)
                {
                    dbString = GetDbString(dbString, StringFormat);
                }
            }

            return("=" + dbString);
        }