示例#1
0
 public static IEnumerable <ResultSet> ExecuteQuery(this IStatement statement)
 {
     while (statement.MoveNext())
     {
         yield return(statement.Current);
     }
 }
 public static IEnumerable <IReadOnlyList <IResultSetValue> > ExecuteQuery(this IStatement statement)
 {
     while (statement.MoveNext())
     {
         yield return(statement.Current);
     }
 }
示例#3
0
 // Prevents the statement from being disposed when the enumerator is disposed
 private static IEnumerator <IReadOnlyList <IResultSetValue> > Enumerate(this IStatement This)
 {
     while (This.MoveNext())
     {
         yield return(This.Current);
     }
 }
示例#4
0
 public bool MoveNext()
 {
     if (disposed)
     {
         throw new ObjectDisposedException(this.GetType().FullName);
     }
     return(stmt.MoveNext());
 }
 public static IEnumerable <IResultSet> ExecuteQuery(
     this IStatement This)
 {
     while (This.MoveNext())
     {
         yield return(This.Current);
     }
 }
示例#6
0
        /*
         * /// <summary>
         * /// Bind the statement parameters to the key-value pairs in <paramref name="pairs"/>.
         * /// </summary>
         * /// <remarks>
         * /// Bind parameters may be <see langword="null"/>, any numeric type, or an instance of <see cref="string"/>,
         * /// byte[], or <see cref="Stream"/>.
         * /// </remarks>
         * /// <param name="This">The statement.</param>
         * /// <param name="pairs">An enumerable of keyvalue pairs keyed by bind parameter name.</param>
         * internal static void Bind(this IStatement This, IEnumerable<KeyValuePair<string,object>> pairs)
         * {
         *  Contract.Requires(This != null);
         *  Contract.Requires(pairs != null);
         *
         *  foreach (var kvp in pairs)
         *  {
         *      This.BindParameters[kvp.Key].Bind(kvp.Value);
         *  }
         * }*/

        /// <summary>
        /// Executes the <see cref="IStatement"/> with provided bind parameter values.
        /// </summary>
        /// <remarks>Note that this method resets and clears the existing bindings, before
        /// binding the new values and executing the statement.</remarks>
        /// <param name="This">The statements.</param>
        /// <param name="values">The position indexed values to bind.</param>
        public static void Execute(this IStatement This, params object[] values)
        {
            Contract.Requires(This != null);
            Contract.Requires(values != null);

            This.Reset();
            This.ClearBindings();
            This.Bind(values);
            This.MoveNext();
        }
示例#7
0
        /// <summary>
        /// Executes the <see cref="IStatement"/> with provided bind object.
        /// </summary>
        /// <remarks>Note that this method resets and clears the existing bindings, before
        /// binding the new values and executing the statement.</remarks>
        /// <param name="This">The statement.</param>
        /// <param name="obj">The object to bind.</param>
        /// <typeparam name="T">The mapped type.</typeparam>
        public static void ExecuteWithProperties <T>(this IStatement This, T obj)
        {
            Contract.Requires(This != null);
            Contract.Requires(obj != null);

            This.Reset();
            This.ClearBindings();
            This.BindProperties(obj);
            This.MoveNext();
        }