Пример #1
0
        public GxMySQLConnectorDataReader(IGxConnectionManager connManager, GxDataRecord dr, IGxConnection connection, GxParameterCollection parameters,
                                          string stmt, int fetchSize, bool forFirst, int handle, bool cached, SlidingTime expiration, 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();
            MySQLCommand cmd = (MySQLCommand)dr.GetCommand(con, stmt, parameters);

            cmd.Prepare();
            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 override IDbCommand GetCommand(IGxConnection con, string stmt, GxParameterCollection parameters, bool isCursor, bool forFirst, bool isRpc)
        {
            if (isRpc)
            {
                stmt = convertToMySqlCall(stmt, parameters);
            }
            MySQLCommand mysqlcmd = (MySQLCommand)base.GetCommand(con, stmt, parameters.Distinct());

            if (isCursor && !isRpc)
            {
                mysqlcmd.Prepare();
            }
            return(mysqlcmd);
        }