Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members

msd_chem.cc

00001 //--------------------------------
00002 // msd_chem.cc
00003 //
00004 // Project: PDBe API Framework, EBI 
00005 // Module: Scientific Layer Classes for PDBe API Framework 
00006 //
00007 // Chemistry Layer
00008 // Last updated: 25 February 2004 10:17
00009 // (C) Siamak Sobhany
00010 //--------------------------------
00011 
00012 #ifndef __MSD_CHEM_H__
00013 #include "msd_chem.h"
00014 #endif
00015 
00016 #ifdef __WITH_XMMDB__
00017 
00018 //Add method calls to the XMMDB library here
00019 
00020 #endif
00021 
00022 int getMSDEntryID(msdbConnect& db, char* acc_code) {
00023  int ne_ID;
00024  char select_stm[512];
00025  sprintf (select_stm, "select /*+ INDEX(ENTRY)*/ ENTRY_ID "  
00026   "from ENTRY where ACCESSION_CODE = '%s' and :ni<int> = 1", acc_code);
00027   try{
00028   msdbStream imsd (50, select_stm, db);
00029   imsd << 1;
00030   while (!imsd.eof()){
00031           imsd >> ne_ID;
00032   }
00033  } catch(msdbException& p){ // intercept OTL exceptions
00034   cerr<<p.msg<<endl; // print out error message
00035   cerr<<p.stm_text<<endl; // print out SQL that caused the error
00036   cerr<<p.var_info<<endl; // print out the variable that caused the error
00037  }
00038 return ne_ID;
00039 }
00040 
00041 int getMSDAccessionCode(msdbConnect& db, int e_ID, char* acc_code) {
00042 char buf[16];
00043  const char* select_stm= "select /*+ INDEX(ENTRY)*/ ACCESSION_CODE  "  
00044   "from ENTRY where ENTRY_ID = :neID <int>";
00045   try{
00046   msdbStream imsd (50, select_stm, db);
00047   imsd << e_ID;
00048   
00049   while (!imsd.eof()){
00050           imsd >> buf;
00051   }
00052  } catch(msdbException& p){ // intercept OTL exceptions
00053   cerr<<p.msg<<endl; // print out error message
00054   cerr<<p.stm_text<<endl; // print out SQL that caused the error
00055   cerr<<p.var_info<<endl; // print out the variable that caused the error
00056  }
00057 
00058  int index = 0;
00059  int len = strlen(buf);
00060         for(int i = 0; i < len; i++)
00061         {
00062                 acc_code[index] = buf[i];
00063                 index++;
00064         }
00065  acc_code[index] = '\0';
00066  
00067 return 0;
00068 }
00069   
00070   
00071   

Generated on Fri Apr 16 13:47:40 2004 for MSDAPI by doxygen 1.3.4-20031005