Beispiel #1
0
        public ProcedureCacheEntry GetProcedure(MySqlConnection conn, string spName, string cacheKey)
        {
            ProcedureCacheEntry procedureCacheEntry = null;

            if (cacheKey != null)
            {
                int hashCode = cacheKey.GetHashCode();
                lock (this.procHash)
                {
                    this.procHash.TryGetValue(hashCode, out procedureCacheEntry);
                }
            }
            if (procedureCacheEntry == null)
            {
                procedureCacheEntry = this.AddNew(conn, spName);
                conn.PerfMonitor.AddHardProcedureQuery();
                if (conn.Settings.Logging)
                {
                    MySqlTrace.LogInformation(conn.ServerThread, string.Format(Resources.HardProcQuery, spName));
                }
            }
            else
            {
                conn.PerfMonitor.AddSoftProcedureQuery();
                if (conn.Settings.Logging)
                {
                    MySqlTrace.LogInformation(conn.ServerThread, string.Format(Resources.SoftProcQuery, spName));
                }
            }
            return(procedureCacheEntry);
        }
Beispiel #2
0
        public DataSet GetProcedure(MySqlConnection conn, string spName, string cacheKey)
        {
            DataSet ds = null;

            if (cacheKey != null)
            {
                int hash = cacheKey.GetHashCode();

                lock (procHash.SyncRoot)
                {
                    ds = (DataSet)procHash[hash];
                }
            }
            if (ds == null)
            {
                ds = AddNew(conn, spName);
#if !CF
                conn.PerfMonitor.AddHardProcedureQuery();
#endif
                if (conn.Settings.Logging)
                {
                    MySqlTrace.LogInformation(conn.ServerThread,
                                              String.Format(Resources.HardProcQuery, spName));
                }
            }
            else
            {
#if !CF
                conn.PerfMonitor.AddSoftProcedureQuery();
#endif
                if (conn.Settings.Logging)
                {
                    MySqlTrace.LogInformation(conn.ServerThread,
                                              String.Format(Resources.SoftProcQuery, spName));
                }
            }
            return(ds);
        }