Example #1
0
 /// <summary>
 /// Get parameters.
 /// </summary>
 /// <param name="sql">BuildedSql.</param>
 /// <returns>Parameters.</returns>
 public static Dictionary <string, DbParam> GetParams(this BuildedSql sql)
 {
     return(sql.GetParams(e =>
     {
         var dbParam = e as DbParam;
         return dbParam ?? new DbParam {
             Value = e.Value
         };
     }));
 }
        /// <summary>
        /// Get parameters.
        /// </summary>
        /// <param name="sql">BuildedSql.</param>
        /// <returns>Parameters.</returns>
        public static object[] GetParamValues(this BuildedSql sql)
        {
            var tokens = sql.Text.Split(new char[] { ' ', ',', '(', ')', '\r', '\n', '\t' }, StringSplitOptions.RemoveEmptyEntries).ToList();

            return(sql.GetParams(e => e.Value).Select(e => new { Index = tokens.IndexOfCheck(e.Key), Value = e.Value }).OrderBy(e => e.Index).Select(e => e.Value).ToArray());
        }
Example #3
0
 /// <summary>
 /// Copy constructor.
 /// </summary>
 /// <param name="src">Source.</param>
 internal BuildedSql(BuildedSql src)
 {
     Text     = src.Text;
     DbParams = src.DbParams;
 }