/// <summary> /// Setup this workload manager for the specified spider. /// </summary> /// <param name="spider">The spider using this workload manager.</param> public virtual void Init(Spider spider) { this.spider = spider; this.addLock = new Semaphore(1, 1); this.workLatch = new AutoResetEvent(false); this.connectionString = spider.Options.DbConnectionString; this.statements.Add(this.stmtClear = new RepeatableStatement(this.holder.getSQLClear())); this.statements.Add(this.stmtClear2 = new RepeatableStatement(this.holder.getSQLClear2())); this.statements.Add(this.stmtAdd = new RepeatableStatement(this.holder.getSQLAdd())); this.statements.Add(this.stmtAdd2 = new RepeatableStatement(this.holder.getSQLAdd2())); this.statements.Add(this.stmtGetWork = new RepeatableStatement(this.holder.getSQLGetWork())); this.statements.Add(this.stmtGetWork2 = new RepeatableStatement(this.holder.getSQLGetWork2())); this.statements .Add(this.stmtWorkloadEmpty = new RepeatableStatement(this.holder.getSQLWorkloadEmpty())); this.statements.Add(this.stmtSetWorkloadStatus = new RepeatableStatement( this.holder.getSQLSetWorkloadStatus())); this.statements.Add(this.stmtSetWorkloadStatus2 = new RepeatableStatement( this.holder.getSQLSetWorkloadStatus2())); this.statements.Add(this.stmtGetDepth = new RepeatableStatement(this.holder.getSQLGetDepth())); this.statements.Add(this.stmtGetSource = new RepeatableStatement(this.holder.getSQLGetSource())); this.statements.Add(this.stmtResume = new RepeatableStatement(this.holder.getSQLResume())); this.statements.Add(this.stmtResume2 = new RepeatableStatement(this.holder.getSQLResume2())); this.statements .Add(this.stmtGetWorkloadID = new RepeatableStatement(this.holder.getSQLGetWorkloadID())); this.statements.Add(this.stmtGetHostID = new RepeatableStatement(this.holder.getSQLGetHostID())); this.statements.Add(this.stmtGetNextHost = new RepeatableStatement(this.holder.getSQLGetNextHost())); this.statements .Add(this.stmtSetHostStatus = new RepeatableStatement(this.holder.getSQLSetHostStatus())); this.statements.Add(this.stmtGetHost = new RepeatableStatement(this.holder.getSQLGetHost())); try { Open(); this.maxURLSize = GetColumnSize("spider_workload", "url"); this.maxHostSize = GetColumnSize("spider_host", "host"); } catch (Exception e) { throw (new WorkloadException(e)); } }
/// <summary> /// Construct a Results object. /// </summary> /// <param name="parent">The parent object, the RepeatableStatement.</param> /// <param name="statement">The PreparedStatement for these results.</param> /// <param name="resultSet">The ResultSet.</param> public Results(RepeatableStatement parent, DbCommand statement, DbDataReader resultSet) { this.statement = statement; this.resultSet = resultSet; this.parent = parent; }