Version 6: Question about SQLType value.

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
gregoryliss
Posts: 13
Joined: Mon 19 Dec 2005 16:31

Example....

Post by gregoryliss » Tue 07 Jul 2009 14:02

Code: Select all

create or replace procedure foo
begin
  null;
end;

var
  Qry: TOraSQL;
begin
  ...
  Qry.Execute;
  // at this point, Qry.SQLType should be 24 but returns 0

in the previous version, function GetSQLType returned FSQLType. Now it returns FLastSQLType. It's in the TOCICommand.InternalExecute method where FSQLType gets set properly

Code: Select all

        
if FSQLType = SQL_UNKNOWN then begin
          Check(OCIAttrGet2(OCIStmt, OCI_HTYPE_STMT, ValuePtr, nil, OCI_ATTR_SQLFNCODE, hOCIError));
          FSQLType := Word(ValuePtr);
end;
Since GetSQLType is now returning FLastSQLType and that only gets set in the TOCICommand.InternalPrepare method and only to the few items listed below:

Code: Select all

    case StmtType of
      OCI_STMT_SELECT:
        FSQLType := SQL_SELECT;
      OCI_STMT_UPDATE:
        FSQLType := SQL_UPDATE;
      OCI_STMT_DELETE:
        FSQLType := SQL_DELETE;
      OCI_STMT_INSERT:
        FSQLType := SQL_INSERT;
      OCI_STMT_BEGIN, OCI_STMT_DECLARE:
        FSQLType := SQL_PLSQL;
      14,15: // explain 805 - 14, 816 - 15
        FSQLType:= SQL_EXPLAIN;
    else
      FSQLType := SQL_UNKNOWN;
    end;
the result will be SQL_UNKNOWN for anything but the items defined above.

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Wed 08 Jul 2009 07:00

We have fixed this problem. The fix will be included in the next build of ODAC.

Post Reply