Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Problem with pro*c on winnt

Problem with pro*c on winnt

From: bipin sahani <bipinsahani_at_yahoo.co.in>
Date: Tue, 20 Feb 2001 23:07:28 -0800
Message-ID: <F001.002B9430.20010220224043@fatcity.com>


Hi All,
After getting so much info from all of you regarding pro*C on winnt.I'm still unable to get exe of code on WINT.I'm attaching .pc and .c file along with this mail.And errors I'm getting while compiling .c file
I'm using ORacle8i client and VC++ 6.0

--------------------Configuration: emp1 - Win32
Debug--------------------

Build : warning : failed to (or don't know how to) build 'C:\emp1\emp1.h'
Build : warning : failed to (or don't know how to) build 'C:\emp1\emp1_i.c'
Compiling...
emp1.cpp
c:\emp1\emp1.cpp(8) : fatal error C1083: Cannot open precompiled header file: 'Debug/emp1.pch': No such file or directory
Error executing cl.exe.

emp1.obj - 1 error(s), 2 warning(s)

Any help is greatly appreciated in this respect

Thankx and regards
Bipin



Do You Yahoo!?
Get your free @yahoo.co.in address at http://mail.yahoo.co.in

/* Result Sets Interface */

#ifndef SQL_CRSR
# define SQL_CRSR
  struct sql_cursor
  {
    unsigned int curocn;
    void *ptr1;
    void *ptr2;
    unsigned long magic;
  };
  typedef struct sql_cursor sql_cursor;
  typedef struct sql_cursor SQL_CURSOR;
#endif /* SQL_CRSR */

/* Thread Safety */

typedef void * sql_context;
typedef void * SQL_CONTEXT;

/* Object support */

struct sqltvn
{
  unsigned char *tvnvsn;
  unsigned short tvnvsnl;
  unsigned char *tvnnm;
  unsigned short tvnnml;
  unsigned char *tvnsnm;
  unsigned short tvnsnml;
};
typedef struct sqltvn sqltvn;

struct sqladts
{
  unsigned int adtvsn;
  unsigned short adtmode;
  unsigned short adtnum;
  sqltvn adttvn[1];
};
typedef struct sqladts sqladts;

static struct sqladts sqladt = {
  1,1,0,
};

/* Binding to PL/SQL Records */

struct sqltdss
{
  unsigned int tdsvsn;
  unsigned short tdsnum;
  unsigned char *tdsval[1];
};
typedef struct sqltdss sqltdss;
static struct sqltdss sqltds =
{
  1,
  0,
};

/* File name & Package Name */

struct sqlcxp
{
  unsigned short fillen;

           char filnam[16];
};
static const struct sqlcxp sqlfpn =
{

    15,
    "C:\\emp1\\emp1.pc"
};

static unsigned long sqlctx = 2244099;

static struct sqlexd {

   unsigned int sqlvsn;
   unsigned int arrsiz;
   unsigned int iters;

   unsigned int   offset;
   unsigned short selerr;
   unsigned short sqlety;
   unsigned int   occurs;
      const short *cud;
   unsigned char  *sqlest;
      const char  *stmt;

   sqladts *sqladtp;
   sqltdss *sqltdsp;
            void  **sqphsv;
   unsigned int   *sqphsl;
            int   *sqphss;
            void  **sqpind;
            int   *sqpins;
   unsigned int   *sqparm;
   unsigned int   **sqparc;

   unsigned short *sqpadto;
   unsigned short *sqptdso;

            void *sqhstv[4];
   unsigned int sqhstl[4];

            int   sqhsts[4];
            void  *sqindv[4];
            int   sqinds[4];

   unsigned int sqharm[4];
   unsigned int   *sqharc[4];
   unsigned short  sqadto[4];
   unsigned short  sqtdso[4];

} sqlstm = {10,4};

/* SQLLIB Prototypes */

extern void sqlcxt (void **, unsigned long *,

                    struct sqlexd *, const struct sqlcxp *);
extern void sqlcx2t(void **, unsigned long *,
                    struct sqlexd *, const struct sqlcxp *);
extern void sqlbuft(void **, char *);

extern void sqlgs2t(void **, char *);
extern void sqlorat(void **, unsigned long *, void *);

/* Forms Interface */

static const int IAPSUCC = 0;
static const int IAPFAIL = 1403;
static const int IAPFTL  = 535;

extern void sqliem(char *, int *);

typedef struct { unsigned short len; unsigned char arr[1]; } VARCHAR; typedef struct { unsigned short len; unsigned char arr[1]; } varchar;

/* cud (compilation unit data) array */

static const short sqlcud0[] =
{10,4130,0,0,0,
5,0,0,1,0,0,27,45,0,0,4,4,0,1,0,1,97,0,0,1,97,0,0,1,97,0,0,1,10,0,0, 36,0,0,2,77,0,4,47,0,0,3,1,0,1,0,2,9,0,0,2,3,0,0,1,3,0,0, };

#include <stdio.h>

#ifdef __cplusplus
extern "C" {

#endif
#include <stdlib.h>
#include <sqlcpr.h>
#ifdef  __cplusplus

}
#endif

/* EXEC SQL BEGIN DECLARE SECTION; */

const char* username = "scott";
const char* password = "tiger";
const char* db_alias = "Beq-Local";

/* EXEC SQL END DECLARE SECTION; */
void sqlError( void )
{

        char msg[4000];
        size_t buf_len, msg_len;

        buf_len = sizeof(msg);
        sqlglm(msg, &buf_len, &msg_len);
        printf("Error: %.*s\n\n", msg_len, msg);

        exit( 1 );

}

int main( int argc, char argv[] )
{
/* EXEC SQL BEGIN DECLARE SECTION; */
        /* VARCHAR emp_name[40]; */
struct { unsigned short len; unsigned char arr[40]; } emp_name;

        int theRaise;
        int empno = 70;

/* EXEC SQL END DECLARE SECTION; */
             /* EXEC SQL WHENEVER SQLERROR DO sqlError(); */

        /* EXEC SQL CONNECT :username IDENTIFIED BY :password USING :db_alias; */

{
 struct sqlexd sqlstm;

 sqlstm.sqlvsn = 10;
 sqlstm.arrsiz = 4;
 sqlstm.sqladtp = &sqladt;
 sqlstm.sqltdsp = &sqltds;
 sqlstm.iters = (unsigned int  )10;
 sqlstm.offset = (unsigned int  )5;
 sqlstm.cud = sqlcud0;
 sqlstm.sqlest = (unsigned char  *)&sqlca;
 sqlstm.sqlety = (unsigned short)256;
 sqlstm.occurs = (unsigned int  )0;
 sqlstm.sqhstv[0] = (         void  *)username;
 sqlstm.sqhstl[0] = (unsigned int  )0;
 sqlstm.sqhsts[0] = (         int  )0;
 sqlstm.sqindv[0] = (         void  *)0;
 sqlstm.sqinds[0] = (         int  )0;
 sqlstm.sqharm[0] = (unsigned int  )0;
 sqlstm.sqadto[0] = (unsigned short )0;
 sqlstm.sqtdso[0] = (unsigned short )0;
 sqlstm.sqhstv[1] = (         void  *)password;
 sqlstm.sqhstl[1] = (unsigned int  )0;
 sqlstm.sqhsts[1] = (         int  )0;
 sqlstm.sqindv[1] = (         void  *)0;
 sqlstm.sqinds[1] = (         int  )0;
 sqlstm.sqharm[1] = (unsigned int  )0;
 sqlstm.sqadto[1] = (unsigned short )0;
 sqlstm.sqtdso[1] = (unsigned short )0;
 sqlstm.sqhstv[2] = (         void  *)db_alias;
 sqlstm.sqhstl[2] = (unsigned int  )0;
 sqlstm.sqhsts[2] = (         int  )0;
 sqlstm.sqindv[2] = (         void  *)0;
 sqlstm.sqinds[2] = (         int  )0;
 sqlstm.sqharm[2] = (unsigned int  )0;
 sqlstm.sqadto[2] = (unsigned short )0;
 sqlstm.sqtdso[2] = (unsigned short )0;
 sqlstm.sqphsv = sqlstm.sqhstv;
 sqlstm.sqphsl = sqlstm.sqhstl;
 sqlstm.sqphss = sqlstm.sqhsts;
 sqlstm.sqpind = sqlstm.sqindv;
 sqlstm.sqpins = sqlstm.sqinds;
 sqlstm.sqparm = sqlstm.sqharm;
 sqlstm.sqparc = sqlstm.sqharc;
 sqlstm.sqpadto = sqlstm.sqadto;
 sqlstm.sqptdso = sqlstm.sqtdso;

 sqlcxt((void **)0, &sqlctx, &sqlstm, &sqlfpn);  if (sqlca.sqlcode < 0) sqlError();
}
        /* EXEC SQL SELECT e.name, e.theRaise() INTO :emp_name, :theRaise 
                FROM employees e
                WHERE e.empnum = :empno; */ 

{
 struct sqlexd sqlstm;

 sqlstm.sqlvsn = 10;
 sqlstm.arrsiz = 4;
 sqlstm.sqladtp = &sqladt;
 sqlstm.sqltdsp = &sqltds;
 sqlstm.stmt = "select e.name ,e.theRaise() into :b0,:b1  from employees e w\
here e.empnum=:b2";
 sqlstm.iters = (unsigned int  )1;
 sqlstm.offset = (unsigned int  )36;
 sqlstm.selerr = (unsigned short)1;
 sqlstm.cud = sqlcud0;
 sqlstm.sqlest = (unsigned char  *)&sqlca;
 sqlstm.sqlety = (unsigned short)256;
 sqlstm.occurs = (unsigned int  )0;
 sqlstm.sqhstv[0] = (         void  *)&emp_name;
 sqlstm.sqhstl[0] = (unsigned int  )42;
 sqlstm.sqhsts[0] = (         int  )0;
 sqlstm.sqindv[0] = (         void  *)0;
 sqlstm.sqinds[0] = (         int  )0;
 sqlstm.sqharm[0] = (unsigned int  )0;
 sqlstm.sqadto[0] = (unsigned short )0;
 sqlstm.sqtdso[0] = (unsigned short )0;
 sqlstm.sqhstv[1] = (         void  *)&theRaise;
 sqlstm.sqhstl[1] = (unsigned int  )sizeof(int);
 sqlstm.sqhsts[1] = (         int  )0;
 sqlstm.sqindv[1] = (         void  *)0;
 sqlstm.sqinds[1] = (         int  )0;
 sqlstm.sqharm[1] = (unsigned int  )0;
 sqlstm.sqadto[1] = (unsigned short )0;
 sqlstm.sqtdso[1] = (unsigned short )0;
 sqlstm.sqhstv[2] = (         void  *)&empno;
 sqlstm.sqhstl[2] = (unsigned int  )sizeof(int);
 sqlstm.sqhsts[2] = (         int  )0;
 sqlstm.sqindv[2] = (         void  *)0;
 sqlstm.sqinds[2] = (         int  )0;
 sqlstm.sqharm[2] = (unsigned int  )0;
 sqlstm.sqadto[2] = (unsigned short )0;
 sqlstm.sqtdso[2] = (unsigned short )0;
 sqlstm.sqphsv = sqlstm.sqhstv;
 sqlstm.sqphsl = sqlstm.sqhstl;
 sqlstm.sqphss = sqlstm.sqhsts;
 sqlstm.sqpind = sqlstm.sqindv;
 sqlstm.sqpins = sqlstm.sqinds;
 sqlstm.sqparm = sqlstm.sqharm;
 sqlstm.sqparc = sqlstm.sqharc;
 sqlstm.sqpadto = sqlstm.sqadto;
 sqlstm.sqptdso = sqlstm.sqtdso;

 sqlcxt((void **)0, &sqlctx, &sqlstm, &sqlfpn);  if (sqlca.sqlcode < 0) sqlError();
}

    printf("The Employee %s will get a raise of $%d\n\n", emp_name.arr, theRaise);

        return 0;
} Received on Wed Feb 21 2001 - 01:07:28 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US