#include #include #include #include "globals.h" #include "functions.h" int db_open_oracle(char *newtoken,char *variable) { int tokentype; char token[TOKENSIZE]; int paren=0; char UID[TOKENSIZE]; char passwd[TOKENSIZE]; char database[TOKENSIZE]; char address[TOKENSIZE]; char dsn[TOKENSIZE]; char temp[LINELENGTH]; tokentype=gettoken(token); if (strcmp(token,"(")==0) { paren=1; tokentype=gettoken(token); } if (global_uid[0]==0) { getvar(UID,token,"uid"); } else { strcpy(UID,global_uid); } if (global_passwd[0]==0) { getvar(passwd,token,"pwd"); } else { strcpy(passwd,global_passwd); } if (global_dsn[0]==0) { getvar(dsn,token,"dsn"); } else { strcpy(dsn,global_dsn); } if (global_database[0]==0) { getvar(database,token,"database"); } else { strcpy(database,global_database); } if (global_address[0]==0) { strcpy(address,"localhost"); } else { strcpy(address,global_address); } if (tokentype==10 || tokentype==11) { sprintf(newtoken,"$%s_conn=OCILogon(\"%s\",\"%s\");\n", variable,UID,passwd); } else { push(token,tokentype); eval_molecule(temp); sprintf(newtoken,"$a2p_connstr=%s\n",temp); strcpy(temp,newtoken); add_indent(temp); strcat(temp,"$a2p_uid=strstr($a2p_connstr,'uid');\n"); add_indent(temp); strcat(temp,"$a2p_uid=substr($d,strpos($d,'=')+1,strpos($d,';')-strpos($d,'=')-1);\n"); add_indent(temp); strcat(temp,"$a2p_pwd=strstr($a2p_connstr,'pwd');\n"); add_indent(temp); strcat(temp,"$a2p_pwd=substr($d,strpos($d,'=')+1,strpos($d,';')-strpos($d,'=')-1);\n"); add_indent(temp); sprintf(newtoken,"%s$%s_conn=OCILogon($a2p_uid,$a2p_pwd);\n", temp,variable); } if (paren==1) { tokentype=gettoken(token); } return 0; } int db_execute_oracle(char *newtoken,char *variable) { char molecule1[LINELENGTH]; char temp[TOKENSIZE]; char spaces[100]; int r; spaces[0]=0; eval_molecule(molecule1); if (setvar==0) { sprintf(newtoken,"$%s_cursor=OCIParse($%s_conn,%s);\n",variable,variable,molecule1); for (r=0; r