xstrm.c
/*---------------------------------------------------------------------
 * connect_db - Connect to the database and set the env to the given
 * char and nchar character set ids.
 *---------------------------------------------------------------------*/
Connect to the database and set the env to the given
char and nchar character set ids.
Connect to the database and set the env to the given char and nchar character set ids .
static void connect_db(conn_info_t *params_p, oci_t **ociptr, ub2 char_csid,
                ub2 nchar_csid)
{
  oci_t        *ocip;
  printf ("Connect to Oracle as %.*s@%.*s ",
          params_p->userlen, params_p->user,
          params_p->dbnamelen, params_p->dbname);
  if (char_csid && nchar_csid)
    printf ("using char csid=%d and nchar csid=%d", char_csid, nchar_csid);
  printf("\n");
  ocip = (oci_t *)malloc(sizeof(oci_t));
  if (OCIEnvNlsCreate(&ocip->envp, OCI_OBJECT, (dvoid *)0,
                     (dvoid * (*)(dvoid *, size_t)) 0,
                     (dvoid * (*)(dvoid *, dvoid *, size_t))0,
                     (void (*)(dvoid *, dvoid *)) 0,
                     (size_t) 0, (dvoid **) 0, char_csid, nchar_csid))
  {
    ocierror(ocip, (char *)"OCIEnvCreate() failed");
  }
  if (OCIHandleAlloc((dvoid *) ocip->envp, (dvoid **) &ocip->errp,
                     (ub4) OCI_HTYPE_ERROR, (size_t) 0, (dvoid **) 0))
  {
    ocierror(ocip, (char *)"OCIHandleAlloc(OCI_HTYPE_ERROR) failed");
  }
  OCICALL(ocip,
          OCILogon(ocip->envp, ocip->errp, &ocip->svcp,
                   params_p->user, params_p->userlen,
                   params_p->passw, params_p->passwlen,
                   params_p->dbname, params_p->dbnamelen));
  OCICALL(ocip,
          OCIHandleAlloc((dvoid *) ocip->envp, (dvoid **) &ocip->srvp,
                         OCI_HTYPE_SERVER, (size_t) 0, (dvoid **) 0));
  OCICALL(ocip,
          OCIHandleAlloc((dvoid *) ocip->envp, (dvoid **) &ocip->stmtp,
                     (ub4) OCI_HTYPE_STMT, (size_t) 0, (dvoid **) 0));
  if (*ociptr == (oci_t *)NULL)
  {
    *ociptr = ocip;
  }
}
static void connect_db ( conn_info_t * params_p , oci_t * * ociptr , ub2 char_csid , ub2 nchar_csid ) { oci_t * ocip ; printf ( " " , params_p -> userlen , params_p -> user , params_p -> dbnamelen , params_p -> dbname ) ; if ( char_csid && nchar_csid ) printf ( " " , char_csid , nchar_csid ) ; printf ( " \n " ) ; ocip = ( oci_t * ) malloc ( sizeof ( oci_t ) ) ; if ( OCIEnvNlsCreate ( & ocip -> envp , OCI_OBJECT , ( dvoid * ) 0 , ( dvoid * ( * ) ( dvoid * , size_t ) ) 0 , ( dvoid * ( * ) ( dvoid * , dvoid * , size_t ) ) 0 , ( void ( * ) ( dvoid * , dvoid * ) ) 0 , ( size_t ) 0 , ( dvoid * * ) 0 , char_csid , nchar_csid ) ) { ocierror ( ocip , ( char * ) " " ) ; } if ( OCIHandleAlloc ( ( dvoid * ) ocip -> envp , ( dvoid * * ) & ocip -> errp , ( ub4 ) OCI_HTYPE_ERROR , ( size_t ) 0 , ( dvoid * * ) 0 ) ) { ocierror ( ocip , ( char * ) " " ) ; } OCICALL ( ocip , OCILogon ( ocip -> envp , ocip -> errp , & ocip -> svcp , params_p -> user , params_p -> userlen , params_p -> passw , params_p -> passwlen , params_p -> dbname , params_p -> dbnamelen ) ) ; OCICALL ( ocip , OCIHandleAlloc ( ( dvoid * ) ocip -> envp , ( dvoid * * ) & ocip -> srvp , OCI_HTYPE_SERVER , ( size_t ) 0 , ( dvoid * * ) 0 ) ) ; OCICALL ( ocip , OCIHandleAlloc ( ( dvoid * ) ocip -> envp , ( dvoid * * ) & ocip -> stmtp , ( ub4 ) OCI_HTYPE_STMT , ( size_t ) 0 , ( dvoid * * ) 0 ) ) ; if ( * ociptr == ( oci_t * ) NULL ) { * ociptr = ocip ; } }
connect_db - Connect to the database and set the env to the given
 char and nchar character set ids.
connect_db - Connect to the database and set the env to the given char and nchar character set ids .
/* Logon to database */ /* allocate the server handle */