Exemplo 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);
            }
        }
Exemplo 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;
 }
Exemplo 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));
         }
     }
 }
Exemplo 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);
        }
Exemplo 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);
        }
Exemplo n.º 6
0
 public TableSynchronization(HubbleConnection conn, string tableName, int step,
                             OptimizeOption option, bool fastestMode)
     : this(conn, tableName, step, option, fastestMode, null)
 {
 }
Exemplo 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)
 {
 }
Exemplo n.º 8
0
 public HubbleCommand(string sql, HubbleConnection sqlConn, params object[] parameters)
 {
     _Sql           = sql;
     _SqlConnection = sqlConn;
     _ObjParameters = parameters;
 }
Exemplo n.º 9
0
 public HubbleCommand(string sql, HubbleConnection sqlConn)
 {
     _Sql           = sql;
     _SqlConnection = sqlConn;
     _ObjParameters = null;
 }
Exemplo n.º 10
0
 public HubbleCommand(HubbleConnection sqlConn)
     : this("", sqlConn)
 {
 }