Hi Elbertus,

Change the procedure ObtenerOcupaciones() in PruebaDynamic.cpc as
follows:

int ObtenerOcupaciones(void)
{
  EXEC SQL BEGIN DECLARE SECTION;

  char query[200];
  char query_out[1000];

  EXEC SQL END DECLARE SECTION;

  SQLDA *outda;

  strcpy (query,"select rpad(to_char(cod_programa),10,' ') || ");
  strcat (query,"rpad(rtrim(tabla,' '),100) || ");
  strcat (query,"rpad(to_char(orden),10,' ') ");
  strcat (query,"from guf_ocupaciones");

  printf("query (%s)\n",query);

  exec sql prepare s_cursor from :query;
  printf("perpare (%d)\n",sqlca.sqlcode);

  exec sql declare Cursor_Ocupaciones cursor for s_cursor;
  printf("declare (%d)\n",sqlca.sqlcode);

  exec sql open Cursor_Ocupaciones;  
  printf("open (%d)\n",sqlca.sqlcode);

  outda = sqlald(1, 128, 128);
  outda->V[0] = (char *) &query_out;
  outda->L[0] = sizeof(query_out);
  outda->T[0] = SQL_ORA_CHAR;

  exec sql fetch Cursor_Ocupaciones using descriptor outda;
  printf("fetch 1 (%d)\n",sqlca.sqlcode);

  if(!sqlca.sqlcode)
  {
    while(!sqlca.sqlcode)
    {
      printf("query_out: (%.*s)\n",sizeof(query_out),query_out);

      exec sql fetch Cursor_Ocupaciones using descriptor outda;
      if(sqlca.sqlcode) printf("fetch 2 (%d)\n",sqlca.sqlcode);
    }
  }

  exec sql close Cursor_Ocupaciones;  
  printf("close (%d)\n",sqlca.sqlcode);

  sqlclu(outda);
  
  return 0;
}

This should fix your core dump problem.

Regards,

Thomas Simenec
SAP Labs Berlin

-----Original Message-----
From: Elbertus Lochtenberg [mailto:[EMAIL PROTECTED] 
Sent: Donnerstag, 30. Dezember 2004 14:42
To: Simenec, Thomas
Subject: RE: MaxDB fetch into problem with concatenated data in oracle
mode with embedded SQL statment in C/C++ programs (correction)

Hi Thomas,

Sorry I have to tell you that after eliminating some obsolete code from
the sources of the test programs everything seems to work fine in the
static and dynamic version (the last and correct versions I send you in
a previous mail).

The only pending problem seems to be the last byte in the output buffer
that is initialized by ORACLE with a NULL character and with MaxDB with
a blank in where you contacted me fore.

Best regards,

Elbertus Lochtenberg

-----Mensaje original-----
De: Simenec, Thomas [mailto:[EMAIL PROTECTED] 
Enviado el: jueves, 30 de diciembre de 2004 13:52
Para: Elbertus Lochtenberg
CC: [email protected]
Asunto: RE: MaxDB fetch into problem with concatenated data in oracle
mode with embedded SQL statment in C/C++ programs (correction)

Hi,

Please send me your Precompiler program for analysis.

Regards,

Thomas Simenec
SAP Labs Berlin

-----Original Message-----
From: Elbertus Lochtenberg [mailto:[EMAIL PROTECTED] 
Sent: Donnerstag, 30. Dezember 2004 13:33
To: [email protected]
Subject: MaxDB fetch into problem with concatenated data in oracle mode
with embedded SQL statment in C/C++ programs (correction)

Dear Reader,
 
After making some tests with the same program and ORACLE, I came to the
conclusion that the concatenated output of MaxDB is similar. 
 
The difference is that in the ORACLE case the output buffer is filled up
with blanks up to the end -1. In the last byte ORACLE puts a NULL. With
MaxDB the output buffer is filled up to the end with blanks and the byte
(output buffer length+1) seems to contain the character "@" as it is the
last variable on the stack. I suppose that this character depend of what
the memory value is on this point  
 
However is seems that MaxDB is not putting the NULL value at the end of
the output buffer, the prove is that if I define another variable on the
stack, following the output buffer host variable and filled with NULLs,
this "@" character is not shown anymore in the output buffer. 
 
Any way there is something different between the output buffer update
between ORACLE and MaxDB concerning the last byte, which in the ORACLE
case is filled with a NULL character, what isn't the case working with
MaxDB in ORCALE mode.   
 
Best regards,
 
Elbertus Lochtenberg
Project Manager
Teleserver S.A.
 
   



--
MaxDB Discussion Mailing List
For list archives: http://lists.mysql.com/maxdb
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to