Ejemplo n.º 1
0
        static internal QueryResult Get(HubbleConnection conn, string sql,
                                        out DateTime expireTime, out int hitCount, out string tableTicks)
        {
            DataCache dataCache;

            tableTicks = "";

            lock (_LockObj)
            {
                string key = conn.DataSource.ToLower().Trim() + ":" + conn.TcpPort.ToString() + "\\" + conn.Database.ToLower().Trim();
                if (!_DataCacheDict.TryGetValue(key, out dataCache))
                {
                    expireTime = default(DateTime);
                    hitCount   = 0;

                    return(null);
                }
            }

            QueryResult result;

            object tag;

            if (dataCache.TryGetValue(sql.Trim(), out result, out expireTime, out hitCount, out tag))
            {
                tableTicks = (string)tag;
                return(result);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 2
0
 public TableSynchronization(HubbleConnection conn, string tableName, int step,
                             OptimizeOption option, bool fastestMode, string flags)
 {
     _Conn        = conn;
     _TableName   = tableName;
     _Step        = step;
     _Option      = option;
     _FastestMode = fastestMode;
     _Flags       = flags;
 }
Ejemplo n.º 3
0
 static internal void OnConnect(HubbleConnection conn)
 {
     lock (_LockObj)
     {
         string key = conn.DataSource.ToLower().Trim() + ":" + conn.TcpPort.ToString() + "\\" + conn.Database.ToLower().Trim();
         if (!_DataCacheDict.ContainsKey(key))
         {
             _DataCacheDict.Add(key, new DataCache(_Mgr));
         }
     }
 }
Ejemplo n.º 4
0
        static internal void Insert(HubbleConnection conn,
                                    string sql, QueryResult qResult, DateTime expireTime, string tableTick)
        {
            DataCache dataCache;

            lock (_LockObj)
            {
                string key = conn.DataSource.ToLower().Trim() + ":" + conn.TcpPort.ToString() + "\\" + conn.Database.ToLower().Trim();
                if (!_DataCacheDict.TryGetValue(key, out dataCache))
                {
                    return;
                }
            }

            dataCache.Insert(sql.Trim(), qResult, expireTime, tableTick);
        }
Ejemplo n.º 5
0
        static internal void ChangeExpireTime(HubbleConnection conn,
                                              string sql, DateTime expireTime)
        {
            DataCache dataCache;

            lock (_LockObj)
            {
                string key = conn.DataSource.ToLower().Trim() + ":" + conn.TcpPort.ToString() + "\\" + conn.Database.ToLower().Trim();
                if (!_DataCacheDict.TryGetValue(key, out dataCache))
                {
                    return;
                }
            }

            dataCache.ChangeExpireTime(sql.ToLower().Trim(), expireTime);
        }
Ejemplo n.º 6
0
 public TableSynchronization(HubbleConnection conn, string tableName, int step,
                             OptimizeOption option, bool fastestMode)
     : this(conn, tableName, step, option, fastestMode, null)
 {
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Constractor
 /// </summary>
 /// <param name="conn">hubble connection</param>
 /// <param name="tableName">table name</param>
 /// <param name="step">number of record synchronized every time</param>
 /// <param name="option">optimize option</param>
 public TableSynchronization(HubbleConnection conn, string tableName, int step,
                             OptimizeOption option)
     : this(conn, tableName, step, option, false)
 {
 }
Ejemplo n.º 8
0
 public HubbleCommand(string sql, HubbleConnection sqlConn, params object[] parameters)
 {
     _Sql           = sql;
     _SqlConnection = sqlConn;
     _ObjParameters = parameters;
 }
Ejemplo n.º 9
0
 public HubbleCommand(string sql, HubbleConnection sqlConn)
 {
     _Sql           = sql;
     _SqlConnection = sqlConn;
     _ObjParameters = null;
 }
Ejemplo n.º 10
0
 public HubbleCommand(HubbleConnection sqlConn)
     : this("", sqlConn)
 {
 }