public override IDataReader GetDataReader(
            IGxConnectionManager connManager,
            IGxConnection con,
            GxParameterCollection parameters,
            string stmt, ushort fetchSize,
            bool forFirst, int handle,
            bool cached, SlidingTime expiration,
            bool hasNested,
            bool dynStmt)
        {
            IDataReader idatareader;

            if (NpgsqlAssembly.GetName().Version.Major == 1)
            {
                GXLogging.Debug(log, "ExecuteReader: client cursor=" + hasNested + ", handle '" + handle + "'" + ", hashcode " + this.GetHashCode());
                idatareader = new GxDataReader(connManager, this, con, parameters, stmt, fetchSize, forFirst, handle, cached, expiration, dynStmt);
            }
            else
            {
                if (!hasNested)                //Client Cursor
                {
                    GXLogging.Debug(log, "ExecuteReader: client cursor=" + hasNested + ", handle '" + handle + "'" + ", hashcode " + this.GetHashCode());
                    idatareader = new GxDataReader(connManager, this, con, parameters, stmt, fetchSize, forFirst, handle, cached, expiration, dynStmt);
                }
                else                 //Server Cursor
                {
                    GXLogging.Debug(log, "ExecuteReader: server cursor=" + hasNested + ", handle '" + handle + "'" + ", hashcode " + this.GetHashCode());
                    idatareader = new GxPostgresqlMemoryDataReader(connManager, this, con, parameters, stmt, fetchSize, forFirst, handle, cached, expiration, dynStmt);
                }
            }
            return(idatareader);
        }
示例#2
0
        public override void SetTimeout(IGxConnectionManager connManager, IGxConnection connection, int handle)
        {
            GXLogging.Debug(log, "Set Lock Timeout to " + m_lockTimeout / 1000);
            IDbCommand cmd = GetCommand(connection, SetTimeoutSentence(m_lockTimeout), new GxParameterCollection());

            cmd.ExecuteNonQuery();
        }
        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;
            }
        }
示例#4
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;
            }
        }
        public GxPostgresqlMemoryDataReader(IGxConnectionManager connManager, GxDataRecord dr, IGxConnection connection, GxParameterCollection parameters,
                                            string stmt, ushort fetchSize, bool forFirst, int handle, bool cached, SlidingTime expiration, bool dynStmt) : base(connManager, dr, connection, parameters,
                                                                                                                                                                stmt, fetchSize, forFirst, handle, cached, expiration, dynStmt)
        {
            MemoryDataReader memoryDataReader = new MemoryDataReader(reader, connection, parameters, stmt, fetchSize, forFirst, cached, expiration);

            Close();
            reader = memoryDataReader;
        }
示例#6
0
        public override IDataReader GetDataReader(
            IGxConnectionManager connManager,
            IGxConnection con,
            GxParameterCollection parameters,
            string stmt, ushort fetchSize,
            bool forFirst, int handle,
            bool cached, SlidingTime expiration,
            bool hasNested,
            bool dynStmt)
        {
            IDataReader idatareader;

            idatareader = new GxDataReader(connManager, this, con, parameters, stmt, fetchSize, forFirst, handle, cached, expiration, dynStmt);
            return(idatareader);
        }
        public override IDataReader GetDataReader(
            IGxConnectionManager connManager,
            IGxConnection con,
            GxParameterCollection parameters,
            string stmt, ushort fetchSize,
            bool forFirst, int handle,
            bool cached, SlidingTime expiration,
            bool hasNested,
            bool dynStmt)
        {
            IDataReader idatareader;

            GXLogging.Debug(log, "ExecuteReader: client cursor=", () => hasNested + ", handle '" + handle + "'" + ", hashcode " + this.GetHashCode());
            idatareader = new GxDataReader(connManager, this, con, parameters, stmt, fetchSize, forFirst, handle, cached, expiration, dynStmt);
            return(idatareader);
        }
示例#8
0
        public override IDataReader GetDataReader(
            IGxConnectionManager connManager,
            IGxConnection con,
            GxParameterCollection parameters,
            string stmt, ushort fetchSize,
            bool forFirst, int handle,
            bool cached, SlidingTime expiration,
            bool hasNested,
            bool dynStmt)
        {
            IDataReader idatareader;

#if !NETCORE
            GXLogging.Debug(log, "ExecuteReader: client cursor=" + hasNested + ", handle '" + handle + "'" + ", hashcode " + this.GetHashCode() + " PreparedStmt " + preparedStmts);
            if (preparedStmts)
            {
                idatareader = new GxMySQLCursorDataReader(connManager, this, con, parameters, stmt, fetchSize, forFirst, handle, cached, expiration, hasNested, dynStmt);
            }
            else
            {
                idatareader = new GxMySQLDataReader(connManager, this, con, parameters, stmt, fetchSize, forFirst, handle, cached, expiration, dynStmt, preparedStmts);
            }
#else
            if (!hasNested)//Client Cursor
            {
                GXLogging.Debug(log, "ExecuteReader: client cursor=" + hasNested + ", handle '" + handle + "'" + ", hashcode " + this.GetHashCode() + " PreparedStmt " + preparedStmts);
                if (preparedStmts)
                {
                    idatareader = new GxMySQLCursorDataReader(connManager, this, con, parameters, stmt, fetchSize, forFirst, handle, cached, expiration, hasNested, dynStmt);
                }
                else
                {
                    idatareader = new GxMySQLDataReader(connManager, this, con, parameters, stmt, fetchSize, forFirst, handle, cached, expiration, dynStmt, preparedStmts);
                }
            }
            else //Server Cursor
            {
                GXLogging.Debug(log, "ExecuteReader: server cursor=" + hasNested + ", handle '" + handle + "'" + ", hashcode " + this.GetHashCode());
                idatareader = new GxMySqlMemoryDataReader(connManager, this, con, parameters, stmt, fetchSize, forFirst, handle, cached, expiration, dynStmt);
            }
#endif
            return(idatareader);
        }
示例#9
0
 public GxInformixDataReader(IGxConnectionManager connManager, GxDataRecord dr, IGxConnection connection, GxParameterCollection parameters,
                             string stmt, int fetchSize, bool forFirst, int handle, bool cached, SlidingTime expiration, bool dynStmt)
     : base(connManager, dr, connection, parameters, stmt, fetchSize, forFirst, handle, cached, expiration, dynStmt)
 {
 }