Пример #1
0
        /// <summary>
        /// Executes a query, returning the data typed as per T.
        /// </summary>
        /// <typeparam name="T">Result type.</typeparam>
        /// <param name="cnn">Connection.</param>
        /// <param name="sql">Sql.</param>
        /// <returns>
        ///     A sequence of data of the supplied type; if a basic type (int, string, etc) is
        ///     queried then the data from the first column in assumed, otherwise an instance
        ///     is created per row, and a direct column-name===member-name mapping is assumed
        ///     (case insensitive).
        /// </returns>
        public static List <T> Query <T>(this IDisposable cnn, BuildedSql sql)
        {
            //debug.
            Debug(sql);

            try
            {
                return(SQLiteNetPclWrapper <T> .GetQuery(cnn)(cnn, sql.Text, sql.GetParamValues()));
            }
            catch (Exception e)
            {
                throw GetCoreException(e);
            }
        }
Пример #2
0
        /// <summary>
        /// Execute parameterized SQL.
        /// </summary>
        /// <param name="cnn">Connection.</param>
        /// <param name="sql">Sql.</param>
        /// <returns>Number of rows affected.</returns>
        public static int Execute(this IDisposable cnn, BuildedSql sql)
        {
            //debug.
            Debug(sql);

            try
            {
                return(SQLiteNetPclWrapper.GetExecute(cnn)(cnn, sql.Text, sql.GetParamValues()));
            }
            catch (Exception e)
            {
                throw GetCoreException(e);
            }
        }