Skip to content

Commit

Permalink
Merge pull request #106 from alexcocia/master
Browse files Browse the repository at this point in the history
Propose solution for parametrized queries
  • Loading branch information
akhilravuri1 authored Mar 17, 2021
2 parents eb76470 + b4eacd8 commit 684fd6d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,12 @@ func (c *Conn) Close() error {
return releaseHandle(h)
}

//Query method executes the stament with out prepare
//Query method executes the statement with out prepare if no args provided, and a driver.ErrSkip otherwise (handled by sql.go to execute usual preparedStmt)
func (c *Conn) Query(query string, args []driver.Value) (driver.Rows, error) {
if len(args) > 0 {
// Not implemented for queries with parameters
return nil, driver.ErrSkip
}
var out api.SQLHANDLE
var os *ODBCStmt
ret := api.SQLAllocHandle(api.SQL_HANDLE_STMT, api.SQLHANDLE(c.h), &out)
Expand Down Expand Up @@ -77,4 +81,4 @@ func (c *Conn) Query(query string, args []driver.Value) (driver.Rows, error) {
return nil, err
}
return &Rows{os: os}, nil
}
}

0 comments on commit 684fd6d

Please sign in to comment.