CBuilder 6.0 samples

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
jjeffman
Posts: 84
Joined: Tue 09 Nov 2004 12:22
Location: Porto Alegre-Rio Grande do Sul - Brazil

CBuilder 6.0 samples

Post by jjeffman » Tue 03 May 2016 15:12

Hello.

I could not find a "C++ Builder 6.0" full demo project, so I have built a new one based on the Delphi project OdacDemo.dpr.

I wonder if I have included all the needed files in the project. I am getting an error at linking time :
[Linker Fatal Error] Fatal: Unable to open file 'MSHTML.OBJ'
Is there any way of solving this error ? I would like to have a full demo project on C++ Builder 6.0.

Thank you very much.

Best regards.

Jayme Jeffman

MaximG
Devart Team
Posts: 1822
Joined: Mon 06 Jul 2015 11:34

Re: CBuilder 6.0 samples

Post by MaximG » Thu 05 May 2016 09:45

ODAC for C ++ Builder 6 includes an example demonstrating the work with this IDE: [ODAC for CBuilder 6 install folder]\Demos\Miscellaneous\CBuilder\. When you compile this example, be sure to specify paths to the folder [ODAC for CBuilder 6 install folder]\Include and [ODAC for CBuilder 6 install folder]\Lib in the project options: menu Project\Options\, tab "Directories\Conditionals", parameters "Include Path" and "Library Path".

jjeffman
Posts: 84
Joined: Tue 09 Nov 2004 12:22
Location: Porto Alegre-Rio Grande do Sul - Brazil

Re: CBuilder 6.0 samples

Post by jjeffman » Mon 09 May 2016 18:24

Hello MaximG

Thank you for answering me.

Is the code you point me the same as the Delphi project ? It seems that the C++ Builder project do not include all tasks. I am interested on an example dealing with CLob data fields.

I am using a TOraSQL with a small unnamed procedure as follows:

Code: Select all

BEGIN
  INSERT INTO S4MED_DMED
    (MEDICAO, DATAHORA, NOMEARQ, CONTEUDO, EVENTO_ID)
  VALUES
    (:MEDICAO, TO_DATE(:DATAHORA,'YYYY-MM-DD HH24:MI:SS'), :NOMEARQ, EMPTY_CLOB(), :EVENTO_ID)
  RETURNING
    CONTEUDO
  INTO
    :CONTEUDO ;
EXCEPTION
  WHEN DUP_VAL_ON_INDEX THEN 
    BEGIN
      UPDATE S4MED_DMED
      SET
        DATAHORA = TO_DATE(:DATAHORA,'YYYY-MM-DD HH24:MI:SS'), CONTEUDO=EMPTY_CLOB(), EVENTO_ID = :EVENTO_ID
      WHERE
        MEDICAO = :MEDICAO AND NOMEARQ = :NOMEARQ
      RETURNING
        CONTEUDO
      INTO
        :CONTEUDO;

    EXCEPTION
      WHEN OTHERS THEN RAISE;
    END;
  WHEN OTHERS THEN RAISE;
END;
So I would like to pass data to the "CONTEUDO" field which is itself an Oracle CLob from a TStrings object .

I did not find any CLob reference on the C++ Builder Miscellaneous project.


Best regards.

MaximG
Devart Team
Posts: 1822
Joined: Mon 06 Jul 2015 11:34

Re: CBuilder 6.0 samples

Post by MaximG » Tue 10 May 2016 10:06

The Demo distributed with ODAC includes a Delphi sample using CLOB : [ODAC Install Folder]\Demos\ODACDemo\Clob. A C++Builder sample of filling in a table ODAC_Clob from this project will look as follows:

OraSession -> Connect();

OraQuery -> SQL -> Clear();
OraQuery -> SQL -> Add("INSERT INTO ODAC_CLOB (Code,Title,Value)");
OraQuery -> SQL -> Add(" VALUES (:Code, :Title, EMPTY_CLOB())");
OraQuery -> SQL -> Add(" RETURNING Value");
OraQuery -> SQL -> Add(" INTO :Value");

OraQuery -> ParamByName("Code") -> ParamType = ptInput;
OraQuery -> ParamByName("Code") -> DataType = ftInteger;
OraQuery -> ParamByName("Code") -> AsInteger = 100;

OraQuery -> ParamByName("Title") -> ParamType = ptInput;
OraQuery -> ParamByName("Title") -> DataType = ftString;
OraQuery -> ParamByName("Title") -> AsString = "My Title";

OraQuery -> ParamByName("Value") -> ParamType = ptInput;
OraQuery -> ParamByName("Value") -> DataType = ftOraClob;
OraQuery -> ParamByName("Value") -> AsString = "My Value" ;
OraQuery -> Execute();

jjeffman
Posts: 84
Joined: Tue 09 Nov 2004 12:22
Location: Porto Alegre-Rio Grande do Sul - Brazil

Re: CBuilder 6.0 samples

Post by jjeffman » Tue 10 May 2016 13:01

Hello MaximG,

Thank you very much for answering me.

So as the code you have posted is using the parameter "AsString" property to assing the OraClob value I think my code might be working fine and I only could not see its value in the Oracle SQLDeveloper.

Best regards.

Jayme Jeffman

MaximG
Devart Team
Posts: 1822
Joined: Mon 06 Jul 2015 11:34

Re: CBuilder 6.0 samples

Post by MaximG » Fri 13 May 2016 11:27

We have checked displaying of field values filled in by the provided code sample in Oracle SQLDeveloper - and found no issues. Please clarify whether you managed to work with CLOB fields using ODAC for C ++ Builder 6.

jjeffman
Posts: 84
Joined: Tue 09 Nov 2004 12:22
Location: Porto Alegre-Rio Grande do Sul - Brazil

Re: CBuilder 6.0 samples

Post by jjeffman » Fri 13 May 2016 12:38

Of course MaximG.

It was my fault.

The problem was that I haved set the OraClob parameter data type as ftWideString.

After I have checked your code and I realised that it should be ftOraClob.

So I have corrected the parameter data type and the application is now working fine.

Best regards.

Jayme Jeffman

MaximG
Devart Team
Posts: 1822
Joined: Mon 06 Jul 2015 11:34

Re: CBuilder 6.0 samples

Post by MaximG » Fri 13 May 2016 13:13

We are glad to see the problem resolved. Please don't hesitate to contact us with questions concerning ODAC usage.

Post Reply