コード例 #1
0
        public GxMySQLDriverCSCursorDataReader(IGxConnectionManager connManager, GxDataRecord dr, IGxConnection connection, GxParameterCollection parameters,
                                               string stmt, int fetchSize, bool forFirst, int handle, bool cached, SlidingTime expiration, bool hasNested, bool dynStmt)
        {
            this.parameters = parameters;
            this.stmt       = stmt;
            this.fetchSize  = fetchSize;
            this.cache      = connection.ConnectionCache;
            this.cached     = cached;
            this.handle     = handle;
            this.isForFirst = forFirst;
            _connManager    = connManager;
            this.m_dr       = dr;
            this.readBytes  = 0;
            this.dynStmt    = dynStmt;
            con             = _connManager.IncOpenHandles(handle, m_dr.DataSource);
            con.CurrentStmt = stmt;
            con.MonitorEnter();
            GXLogging.Debug(log, "Open GxMySQLCursorDataReader handle:'" + handle);
            MySQLCommand cmd = (MySQLCommand)dr.GetCommand(con, stmt, parameters);

            cmd.ServerCursor = hasNested;
            cmd.FetchSize    = (uint)fetchSize;
            reader           = cmd.ExecuteReader();
            cache.SetAvailableCommand(stmt, false, dynStmt);
            open  = true;
            block = new GxArrayList(fetchSize);
            pos   = -1;
            if (cached)
            {
                key             = SqlUtil.GetKeyStmtValues(parameters, stmt, isForFirst);
                this.expiration = expiration;
            }
        }
コード例 #2
0
 public CacheItem(GxArrayList data, bool hasnext, int blockSize, long sizeInBytes)
 {
     Data        = data;
     HasNext     = hasnext;
     BlockSize   = blockSize;
     SizeInBytes = sizeInBytes;
 }
コード例 #3
0
        public GxMySQLDataReader(IGxConnectionManager connManager, GxDataRecord dr, IGxConnection connection, GxParameterCollection parameters,
                                 string stmt, int fetchSize, bool forFirst, int handle, bool cached, SlidingTime expiration, bool dynStmt, bool preparedStmts)
        {
            this.parameters = parameters;
            this.stmt       = stmt;
            this.fetchSize  = fetchSize;
            this.cache      = connection.ConnectionCache;
            this.cached     = cached;
            this.handle     = handle;
            this.isForFirst = forFirst;
            _connManager    = connManager;
            this.m_dr       = dr;
            this.readBytes  = 0;
            this.dynStmt    = dynStmt;
            con             = _connManager.IncOpenHandles(handle, m_dr.DataSource);
            con.CurrentStmt = stmt;
            con.MonitorEnter();
            MySQLCommand cmd = (MySQLCommand)dr.GetCommand(con, stmt, parameters);

#if !NETCORE
            cmd.UsePreparedStatement = preparedStmts;
#endif
            reader = cmd.ExecuteReader();
            cache.SetAvailableCommand(stmt, false, dynStmt);
            open  = true;
            block = new GxArrayList(fetchSize);
            pos   = -1;
            if (cached)
            {
                key             = SqlUtil.GetKeyStmtValues(parameters, stmt, isForFirst);
                this.expiration = expiration;
            }
        }
コード例 #4
0
        public MemoryDataReader(IDataReader reader, IGxConnection connection, GxParameterCollection parameters,
                                string stmt, ushort fetchSize, bool isForFirst, bool withCached, SlidingTime expiration)
            : this()
        {
            if (reader == null)
            {
                throw new ArgumentNullException(nameof(reader));
            }
            if (reader.IsClosed)
            {
                throw new ArgumentException("Reader is closed");
            }

            DataTable schemaTab = reader.GetSchemaTable();

            if (schemaTab != null)
            {
                this._schemaDataTable = schemaTab.Clone();
            }


            string[] colnames = null;

            while (reader.Read())
            {
                if (colnames == null)
                {
                    colnames = new string[reader.FieldCount];
                    for (int fi = 0; fi < colnames.Length; fi++)
                    {
                        colnames[fi] = reader.GetName(fi);
                    }
                }

                this.AddRecord(reader, colnames);
            }
            this.cached = withCached;
            this.con    = connection;
            block       = new GxArrayList(fetchSize);
            if (cached)
            {
                this.key        = SqlUtil.GetKeyStmtValues(parameters, stmt, isForFirst);
                this.expiration = expiration;
            }
        }