odbc 3.0 spec mandates that sqlexecute/sqlexecdirect should return
SQL_NO_DATA(100) if no rows are affected, while pre 3.0 odbc drivers will return
SQL_SUCCESS(0).

The implies ddsql will return error for query that is actually successful.
eg. jet 4.0 odbc drver
  'delete from tdata where 1=0' ddsql ch
_1

it should return 0 or 100. Possibly fix:

-- if. sqlok sqlexecdirect sh;bs x do.
++ if. 0 <: rc=. >@{. sqlexecdirect sh;bs x do.

NB. set number of rows affected for (ddcnt)
  if. sqlok z=. sqlrowcount sh;,256 do. DDROWCNT=: fat >{:z end.

NB. if connection is not on pending transactions commit
  if. -. y e. CHTR do. SQL_COMMIT transact y end.
--  DD_OK [ freestmt sh
++  rc [ freestmt sh

However this may break codes that depend on the current (buggy) behaviour.

Also I'm not sure if the line
  if. -. y e. CHTR do. SQL_COMMIT transact y end.
is needed because it will autocommit if not within transaction.

-- 
regards,
bill
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to