Re: Any Pro*C/C++ users out there?
From: Maxim Demenko <mdemenko_at_gmail.com>
Date: Mon, 07 Sep 2009 16:57:56 +0200
Message-ID: <4AA51F74.90103_at_gmail.com>
Ramon F Herrera wrote:
> I have a new question. I took a C program that precompiled, compiled,
> linked and executed perfectly.
>
> Now I am trying to convert it into a C++ program.
>
> My current problem is that the following four variables are not
> recognized by the C++ precompiler:
>
> varchar username[UNAME_LEN];
> varchar password[PWD_LEN];
>
> EXEC SQL CONNECT :username IDENTIFIED BY :password;
>
> int howMany;
> varchar table_name[SOME_SIZE];
>
> EXEC SQL SELECT COUNT(1) INTO :howMany FROM user_tables WHERE
> table_name = :table_name;
>
>
> It seems like the variables embedded into the EXEC SQL statements need
> a different syntax?
>
> TIA,
>
> -Ramon
>
I'm not a c/c++ developer by any means,so forgive me if i ask too obvious question, but did you included your variable definition into declare section ( as in cppdemo1.pc ) ?
If i understood it properly,
EXEC SQL BEGIN DECLARE SECTION;
int howMany;
varchar table_name[SOME_SIZE];
EXEC SQL END DECLARE SECTION; is required for c++ mode.
Date: Mon, 07 Sep 2009 16:57:56 +0200
Message-ID: <4AA51F74.90103_at_gmail.com>
Ramon F Herrera wrote:
> I have a new question. I took a C program that precompiled, compiled,
> linked and executed perfectly.
>
> Now I am trying to convert it into a C++ program.
>
> My current problem is that the following four variables are not
> recognized by the C++ precompiler:
>
> varchar username[UNAME_LEN];
> varchar password[PWD_LEN];
>
> EXEC SQL CONNECT :username IDENTIFIED BY :password;
>
> int howMany;
> varchar table_name[SOME_SIZE];
>
> EXEC SQL SELECT COUNT(1) INTO :howMany FROM user_tables WHERE
> table_name = :table_name;
>
>
> It seems like the variables embedded into the EXEC SQL statements need
> a different syntax?
>
> TIA,
>
> -Ramon
>
I'm not a c/c++ developer by any means,so forgive me if i ask too obvious question, but did you included your variable definition into declare section ( as in cppdemo1.pc ) ?
If i understood it properly,
EXEC SQL BEGIN DECLARE SECTION;
varchar username[UNAME_LEN]; varchar password[PWD_LEN];
int howMany;
varchar table_name[SOME_SIZE];
EXEC SQL END DECLARE SECTION; is required for c++ mode.
Best regards
Maxim Received on Mon Sep 07 2009 - 09:57:56 CDT