func (m *qlbStmt) Query(args []driver.Value) (driver.Rows, error) {
	var err error
	if len(args) > 0 {
		m.query, err = queryArgsConvert(m.query, args)
		if err != nil {
			return nil, err
		}
	}
	u.Debugf("query: %v", m.query)

	// Create a Job, which is Dag of Tasks that Run()
	ctx := plan.NewContext(m.query)
	ctx.Schema = m.conn.schema
	job, err := BuildSqlJob(ctx)
	if err != nil {
		u.Warnf("return error? %v", err)
		return nil, err
	}
	m.job = job

	// The only type of stmt that makes sense for Query is SELECT
	//  and we need list of columns that requires casing
	sqlSelect, ok := job.Ctx.Stmt.(*rel.SqlSelect)
	if !ok {
		u.Warnf("ctx? %v", job.Ctx)
		return nil, fmt.Errorf("We could not recognize that as a select query: %T", job.Ctx.Stmt)
	}

	// Prepare a result writer, we manually append this task to end
	// of job?
	resultWriter := NewResultRows(ctx, sqlSelect.Columns.AliasedFieldNames())

	job.RootTask.Add(resultWriter)

	job.Setup()

	// TODO:   this can't run in parallel-buffered mode?
	// how to open in go-routine and still be able to send error to rows?
	go func() {
		//u.Debugf("Start Job.Run")
		err = job.Run()
		//u.Debugf("After job.Run()")
		if err != nil {
			u.Errorf("error on Query.Run(): %v", err)
			//resultWriter.ErrChan() <- err
			//job.Close()
		}
		job.Close()
		//u.Debugf("exiting Background Query")
	}()

	return resultWriter, nil
}
// Query executes a query that may return rows, such as a SELECT
Query executes a query that may return rows, such as a SELECT
// Query executes a query that may return rows such as a SELECT
func (m *qlbStmt) Query(args []driver.Value) (driver.Rows, error) {
	var err error
	if len(args) > 0 {
		m.query, err = queryArgsConvert(m.query, args)
		if err != nil {
			return nil, err
		}
	}
	u.Debugf("query: %v", m.query)
	ctx := plan.NewContext(m.query)
	ctx.Schema = m.conn.schema
	job, err := BuildSqlJob(ctx)
	if err != nil {
		u.Warnf("return error? %v", err)
		return nil, err
	}
	m.job = job
	sqlSelect, ok := job.Ctx.Stmt.(*rel.SqlSelect)
	if !ok {
		u.Warnf("ctx? %v", job.Ctx)
		return nil, fmt.Errorf("We could not recognize that as a select query: %T", job.Ctx.Stmt)
	}
	resultWriter := NewResultRows(ctx, sqlSelect.Columns.AliasedFieldNames())
	job.RootTask.Add(resultWriter)
	job.Setup()
	go func() {
		err = job.Run()
		if err != nil {
			u.Errorf("error on Query.Run(): %v", err)
		}
		job.Close()
	}()
	return resultWriter, nil
}
func ( m * qlbStmt ) Query ( args [ ] driver . Value ) ( driver . Rows , error ) { var err error if len ( args ) > 0 { m . query , err = queryArgsConvert ( m . query , args ) if err != nil { return nil , err } } u . Debugf ( " " , m . query ) ctx := plan . NewContext ( m . query ) ctx . Schema = m . conn . schema job , err := BuildSqlJob ( ctx ) if err != nil { u . Warnf ( " " , err ) return nil , err } m . job = job sqlSelect , ok := job . Ctx . Stmt . ( * rel . SqlSelect ) if ! ok { u . Warnf ( " " , job . Ctx ) return nil , fmt . Errorf ( " " , job . Ctx . Stmt ) } resultWriter := NewResultRows ( ctx , sqlSelect . Columns . AliasedFieldNames ( ) ) job . RootTask . Add ( resultWriter ) job . Setup ( ) go func ( ) { err = job . Run ( ) if err != nil { u . Errorf ( " " , err ) } job . Close ( ) } ( ) return resultWriter , nil }
Query executes a query that may return rows, such as a SELECT
Query executes a query that may return rows such as a SELECT
// Create a Job, which is Dag of Tasks that Run() // The only type of stmt that makes sense for Query is SELECT //  and we need list of columns that requires casing // Prepare a result writer, we manually append this task to end // of job? // TODO:   this can't run in parallel-buffered mode? // how to open in go-routine and still be able to send error to rows? //u.Debugf("Start Job.Run") //u.Debugf("After job.Run()") //resultWriter.ErrChan() <- err //job.Close() //u.Debugf("exiting Background Query")