sanatgersappa / odbc

Automatically exported from code.google.com/p/odbc
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Implement SQLExecDirect #6

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I see in odbcstmt.go you have a comment about using SQLExecDirect.  Now with 
the optional Queryer interface: 
http://tip.golang.org/pkg/database/sql/driver/#Queryer 
I think it would make sense to implement Queryer using SQLExecDirect.  Do you 
have any thoughts on this implementation?

Original issue reported on code.google.com by lukemaul...@gmail.com on 27 Apr 2013 at 6:41

GoogleCodeExporter commented 9 years ago
Luke,

I didn't investigate the possibility properly, but having quick look, we would 
have to implement:

func (c *Conn).Query(query string, args []driver.Value) (driver.Rows, error)

that would do what combined (*Conn).Prepare and (*Stmt).Query do, while 
replacing api.SQLPrepare and api.SQLExecute with api.SQLExecDirect.

We wouldn't be able to use ExtractParameters to discover param count and their 
types, but I do parameters blindly on unix already, so I don't think it is a 
problem.

Also, we would have to be careful about usedByStmt and usedByRows in ODBCStmt. 
These will just be in the way for this new scenario. But, perhaps we could just 
set them appropriately at the start and forget about them for now.

Alex

Original comment by alex.bra...@gmail.com on 29 Apr 2013 at 12:37