exists.cpp

Go to the documentation of this file.
00001 
00002 
00003 #include "clssdf.h"
00004 
00005 namespace class_def {
00006 
00007   void class_definition::print_exists( std::ostream& os) const {
00008     std::vector<key_attribute>::const_iterator pa = _key_attributes.begin();
00009 
00010     os << "int " << _name << "::exists() const {" << std::endl;
00011     os << "  init_static_attributes();" << std::endl << std::endl;
00012 
00013     os << "  EXEC SQL SELECT COUNT(*) " << std::endl;
00014     os << "  INTO :Num" << std::endl;
00015     os << "  FROM " << _name << std::endl;
00016     os << "  WHERE" << std::endl;
00017 
00018     for (pa=_key_attributes.begin();;) {
00019       os << "    " << pa->get_name() << "=:" << pa->get_Name();
00020       pa++;
00021       if (pa==_key_attributes.end()) {
00022         os << ";" << std::endl;
00023         break;
00024       }
00025       os << " AND" << std::endl;
00026     }
00027     os << std::endl;
00028     os << "  _sql_err();" << std::endl << std::endl;
00029 
00030     os << "  return (int)Num;" << std::endl;
00031     os << "}" << std::endl << std::endl;
00032   }
00033 }

Generated on Tue Jul 14 12:22:31 2009 for cstpp by  doxygen 1.5.1