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

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

Re: Pro*C++ HELP!

From: ORcastillo <orcastillo_at_aol.com>
Date: 21 Dec 1998 16:15:53 GMT
Message-ID: <19981221111553.00844.00001529@ng-bw1.aol.com>


> 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 .........

I hope this helps

// header file (hpp)
class OracleOperation
{

public:     
      static int LogIn(const char *username, const char *password,
                        const char *server_string = 0L);
      static int LogOut(void);
      static int ExecuteSql(char *in, int *count = 0L, int commit = 1);
      static int GetNumber(char *sqlStmt, double &number);
      static int Commit(void);
      static int Rollback(void);
      static void ErrorHandler(struct sqlca sqlca);

};
********* Source file (cpp)
int OracleOperation::LogIn(const char *u_name, const char *p_word, const char *s_string)
{

   EXEC SQL BEGIN DECLARE SECTION;

      const int UNAME_LEN = 40;
   	char username[UNAME_LEN];
      char password[UNAME_LEN];
      char dbstring[UNAME_LEN];

   EXEC SQL END DECLARE SECTION;    if (!u_name)

      return ORA_FAIL;
   strcpy(username, u_name);
   if (p_word)

      strcpy(password, p_word);
   else

      password[0] = '\0';
   if (s_string)

      strcpy(dbstring, s_string);
   else

      dbstring[0] = '\0';
   EXEC SQL WHENEVER SQLERROR GOTO log_in_error;    EXEC SQL CONNECT :username IDENTIFIED BY :password USING :dbstring;

   return ORA_SUCCESS;

   log_in_error:

      ErrorHandler(sqlca);
   	return ORA_ERROR;

} Received on Mon Dec 21 1998 - 10:15:53 CST

Original text of this message

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