Backup/DbUtility/MySqlHelper.cs

(开头部分) 45KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

/*******************************************************************************
             数据库基类 (MySql)                                    
             本类主要实现对数据库操作的各种方法              
             本类由Aosy.net代码生成器自动生成  
             2013/4/14                 
 * *****************************************************************************/

using System;
using System.Collections;
using System.Data;
using MySql.Data.MySqlClient;

namespace PR.DbUtility
{
	/// <summary>
	/// Helper class that makes it easier to work with the provider.
	/// </summary>
	public sealed class MySqlHelper
	{
        private static Hashtable parmCache = Hashtable.Synchronized( new Hashtable() );
		// this class provides only static methods
		private MySqlHelper(){}        

        #region private utility methods & constructors     
       

        /// <summary>
        /// This method is used to attach array of SqlParameters to a SqlCommand.
        /// 
        /// This method will assign a value of DbNull to any parameter with a direction of
        /// InputOutput and a value of null.  
        /// 
        /// This behavior will prevent default values from being used, but
        /// this will be the less common case than an intended pure output parameter (derived as InputOutput)
        /// where the user provided no input value.
        /// </summary>
        /// <param name="command">The command to which the parameters will be added</param>
        /// <param name="commandParameters">An array of SqlParameters to be added to command</param>
        private static void AttachParameters( MySqlCommand command, MySqlParameter[] commandParameters )
        {
            if( command == null ) throw new ArgumentNullException( "command" );
            if( commandParameters != null )
            {
                foreach ( MySqlParameter p in commandParameters )
                {
                    if( p != null )
                    {
                        // Check for derived output value with no value assigned
                        if ( ( p.Direction == ParameterDirection.InputOutput || 
                            p.Direction == ParameterDirection.Input ) && 
                            (p.Value == null))
                        {
                            p.Value = DBNull.Value;
                        }
                        command.Parameters.Add(p);
                    }
                }
            }
        }

后面还有 944 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。