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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Pro*C++ HELP!

Re: Pro*C++ HELP!

From: Andrew Protasov <oracle_at_protasov.kiev.ua>
Date: 1998/12/18
Message-ID: <AFKwXUsK42@protasov.kiev.ua>#1/1

Hi,

Take a look on Oracle Call Interface (OCI). It can be easiely wrapped in C++ classes. I use Direct Oracle Access (DOA) which are wrapper classes of OCI in Object Pascal (Delphi).

Andrew Protasov

> First off... TO all the idiots that "designed" Pro*C/C++...
> You're idiots.
>
> Pro*C/C++ is *easiliest* the most non standard, non portable, sloppy
> non-intuitive, non-functional "language" I have ever had the
> dissapointment to be forced to use.
>
> What the hell was wrong with simply implenting a class "SQLServer" or
> other such standard C++ constructs and then forgetting about your
> stupid Pro*C/C++ pre-pre-processor????
>
> I guess it would too easy to have users just use:
>
> #include <sqlstuff.h>
>
> and then allowing the user to use normal ANSI C++ stuff???????
> And what the HELL is with all the libraries I have to include on the
> compiling command line. (Not that I've gotten that far yet.
>
>
> Ok now. Hopefully somebody has gotten a C++ program to work using
> "Pro"*C/C++ and can help me out...
>
>
> All I want right now is to make a class wrapper so that I can easily
> use this stuff in the future.
>
> So I did this...
>
> File: oracle_wrapper.h
> -----------------------------------------------------
>
> extern unsigned char SQLerror[1024];
>
> class SqlServer
> {
> private:
> int connected;
> public:
> SqlServer(void) : connected(0) {};
> int Connect(char *username, char *password);
> int Disconnect(void);
> int Commit(void);
> int Init(void);
> int Execute(const char *sql_statement);
> int Prepare(const char *sql_statement);
> int Fields(char *buffer, int max);
> int Ignore(void);
> int Fetch(char *buffer, int max);
> int Done(void);
> int Quit(void);
> };
>
> and then I made a simple oracle_wrapper.C file to provide me with the
> methods... (Of which I will only show you the first method "Connect".
>
> File: oracle_wrapper.pc
> -----------------------------------------------------------
> unsigned char memory[MEMSIZE];
> unsigned char SQLerror[1024];
>
> EXEC ORACLE OPTION (ORACA=NO);
>
> EXEC ORACLE OPTION (RELEASE_CURSOR=YES);
>
> EXEC SQL INCLUDE sqlca;
> EXEC SQL INCLUDE sqlda;
> EXEC SQL INCLUDE oraca;
>
> extern SQLDA *sqlald();
> extern void sqlnul();
>
> SQLDA *bind_descriptor; // descriptor area for bind variables
> SQLDA *select_descriptor; // descriptor area for select list items
>
> #include "oracle_wrapper.h"
>
> /*
> establish an RDBMS connection
> */
>
> int SqlServer::Connect(char *username, char *password)
> {
> EXEC SQL CONNECT :username IDENTIFIED BY :password;
> if (sqlca.sqlcode < 0)
> return -1;
>
> return 1;
> }
>
>
> When I run "proc code=cpp oracle_wrapper.pc I get this...
>
> Pro*C/C++: Release 8.0.5.0.0 - Production on Thu Dec 17 16:50:59 1998
>
> (c) Copyright 1998 Oracle Corporation. All rights reserved.
>
> System default option values taken from:
> /usr/lib/Oracle/8.0.5/precomp/admin/pcscfg.cfg
>
> Semantic error at line 26, column 21, file oracle_wrapper.pc:
> EXEC SQL CONNECT :username IDENTIFIED BY :password;
> ....................1
> PCC-S-02322, found undefined identifier
>
> So it seems a bit like this Pro*C/C++ preprocessor doesn't really know
> C++ at all cause "username" is declared and defined on the very previous
> line as an argument to the function.
>
> If Pro*C/C++ doesn't allow argument definitions then its a pretty piss
> poor C++ "language".
>
> Sorry for the tone of this message but I've been working on this for days
> now and haven't gotten anywhere with it and the documentation is so
> cryptic as to be completely useless.
>
> Even the cppdemo included don't compile. They preprocess ok but thats
> because that only have global variables and we all know from school that
> global variables are not good.
>
> Please Help me if you can. Thanks,
>
> J E F F W I E G L E Y, Ph.D.
> Systems Analyst
> ___________________________________________________
> USWeb/CKS Corporation http://www.uswebcks.com/
> 8522 National Blvd, Suite 101
> Culver City, CA 90232
> ph 310 815 1177 x 216 fax 310 815 1133
> mailto:jeff_at_usweb.com
>
> USWeb - A Strategic Partner for the Information Age
>
>
Received on Fri Dec 18 1998 - 00:00:00 CST

Original text of this message

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