コード例 #1
0
        /// <summary>
        /// Stores the last executed query's result inside of the Statement, so that another data reader can be opened.
        /// </summary>
        /// <returns>true on success, false otherwise</returns>
        internal bool StoreLastExecutedQuery()
        {
            if (lastExecutedStatement != null)
            {
                var res = lastExecutedStatement.StoreQueryResult();
                if (res)
                {
                    lastExecutedStatement.CloseReader();
                }
                return(res);
            }

            return(false);
        }
コード例 #2
0
        /// <summary>
        /// Execute an SQL statement and return the number of affected rows.
        /// </summary>
        /// <param name="statement">The statement.</param>
        /// <returns></returns>
        public virtual PhpValue exec(string statement)
        {
            this.ClearError();

            lastExecutedStatement?.CloseReader();

            using (var dbCommand = this.CreateCommand(statement))
            {
                try
                {
                    return(dbCommand.ExecuteNonQuery());
                }
                catch (System.Exception ex)
                {
                    //TODO err
                    this.HandleError(ex);
                    return(PhpValue.False);
                }
            }
        }