Skip to content

Releases: asifjalil/cli

Fixes issue #17

03 Jul 21:11
2598d7f
Compare
Choose a tag to compare
Fix checkptr errors

Run test using -d=checkptr and fix all the unsafe pointer conversion and
arithmatic errors. May fix issue #17.

Do not consider SQL_SUCCESS_WITH_INFO success

06 Apr 19:16
a7659c9
Compare
Choose a tag to compare

success function in error.go was considering SQL_SUCCESS_WITH_INFO return code a success. As a result, this driver wasn't retrieving warnings. Fix that by only considering SQL_SUCCESS as a success.

Fixes issue #14

02 Aug 16:47
b3a0e23
Compare
Choose a tag to compare

Fixes issue #14

Fixed issue #12

14 Jun 22:07
665fd74
Compare
Choose a tag to compare
v1.2.6

Fixed issue #12

Disable DeferredPrepare

02 May 22:30
85f2f56
Compare
Choose a tag to compare

Assuming that when an application calls tx.PrepareContext(), it wants to execute SQLPrepare right away instead of the default DB2 CLI deferred behavior.

Chomp Database Error Message

06 Mar 22:28
4f6cf3d
Compare
Choose a tag to compare

Remove trailing newline from the database error message so if the database error is wrapped in another error message, we don't introduce a new line in the middle.

Query/QueryContext can return RowsAffected

06 Mar 00:11
71c1bde
Compare
Choose a tag to compare

Before calling database/sql.Exec/ExecContext and
database/sql.Query/QueryContext, one has to know the type of the query.
That is, if it is a statement that will produce a resultset, then use
Query/QueryContext. Otherwise, use Exec/ExecContext. Sometimes, a method
like JDBC's execute can be handy: A caller can use execute for all queries and use the
true/false to decide to check for resultset or update count. Go's
database/sql package currently does not provide such function.

This driver, for both sql.Exec/ExecContext and sql.Query/QueryContext
use the SQLExecute function from DB2 CLI. It then uses DB2 CLI's
SQLRowCount for sql.Result or SQLNumResultCols for sql.Rows.

This commit adds a hack that allows callers to use sql.Query/QueryContext for all
query type. When this driver finds that a query didn't produce a
resultset but there is a update count, it returns an error that has method RowsAffected(). Callers can check for that error and then use RowsAffected to get the update count.

Allow non-select statements to use sql.Query(...)

02 Mar 00:47
2f71683
Compare
Choose a tag to compare

If non-select statements use the sql.DB.Query method, the driver throws an error that there is no resultset. Change that error to sql.ErrNoRows so an application can check and ignore it. This driver uses DB2 ODBC/CLI driver to interact with a database, and the DB2 driver handles the non-select statement fine when it is executed using the Query method.

Fixed issue #8

21 Feb 17:08
bdc3090
Compare
Choose a tag to compare
column.getData needs to set c.len to the "total" buffer size. Otherwise,
we will return truncated data.

SQLGetData sets c.len to the number of bytes that are copied
to the output buffer. That's correct if the output buffer is big enough
and the output data isn't truncated. If the data is truncated, we call
SQLGetData in a loop until we get all the data. Each call to SQLGetData
sets c.len to the number of bytes fetched. In the end, c.len is not the
total number of bytes fetched. Instead, it is the amount of bytes
fetched during the last call to SQLGetData. When we return the data to the
application, we only return up to c.len. Since c.len is not the total
size, the returned data is truncated. Fix it by setting c.len to the
total number of bytes fetched before returning from column.getData(...).

Supports sql.Out

07 Jan 21:55
Compare
Choose a tag to compare

The driver now supports sql.Out for retrieving INOUT and OUT value parameters from stored procedures.