pro-C host variable VARCHAR sizes
Date: 1996/01/05
Message-ID: <4ck370$5qi_at_ixnews5.ix.netcom.com>#1/1
I have a problem when declaring the host variables from within the
'DECLARE SECTION' of embeded SQL. I have not yet been able to find a
way to use a defined variable length when defining a VARCHAR or CHAR
within this section. The only way that I have been able to get the
declaration to work is to put hard-coded numbers within the statement.
For example, I would like to use something like:
#define VAR_LENGTH 10
I believe that it is not working because proc does not have a
pre-processor to convert the #defines.
I have also tried to use:
unsigned int VAR_LENGTH = 10;
The only thing that I have found that will work is exactally what I do
not want to use -- hard-coded numbers:
EXEC SQL BEGIN DECLARE SECTION;
#define VAR2_LENGTH 20
...
EXEC SQL BEGIN DECLARE SECTION;
VARCHAR hostVariableName[VAR_LENGTH];
CHAR hostVaribleName2[VAR2_LENGTH];
EXEC SQL END DECLARE SECTION;
unsigned int VAR2_LENGTH = 20;
...
EXEC SQL BEGIN DECLARE SECTION;
VARCHAR hostVariableName[VAR_LENGTH];
CHAR hostVaribleName2[VAR2_LENGTH];
EXEC SQL END DECLARE SECTION;
VARCHAR hostVariableName[10]; CHAR hostVaribleName2[20]; EXEC SQL END DECLARE SECTION;
We have even tried to use 'const' in the C++ compiler and the same situation occurs.
Does anyone know a way that either #defines or variables can be used for the array size versus using hard-coded numbers? Received on Fri Jan 05 1996 - 00:00:00 CET