insert.cpp

Go to the documentation of this file.
00001 
00002 #include "clssdf.h"
00003 
00004 namespace class_def {
00005   
00006   void class_definition::print_insert( std::ostream& os ) const {
00007     std::vector<attribute*>::const_iterator ppa;
00008 
00009     os << "int " << _name << "::insert() const {" << std::endl << std::endl;
00010 
00011     os << "  init_static_attributes();" << std::endl << std::endl;
00012 
00013     os << "  EXEC SQL INSERT INTO " << _name << "(" << std::endl;
00014     for (ppa=_all_defined_attributes.begin();;) {
00015       os << "    " << (*ppa)->get_name();
00016       ppa++;
00017       if (ppa==_all_defined_attributes.end()) {
00018         os << ")" << std::endl;
00019         break;
00020       } else {
00021         os << "," << std::endl;
00022       }
00023     }
00024     os << "  VALUES(" << std::endl;
00025     for (ppa=_all_defined_attributes.begin();;) {
00026       os << "    :" << (*ppa)->get_Name();
00027       ppa++;
00028       if (ppa==_all_defined_attributes.end()) {
00029         os << ");" << std::endl << std::endl;
00030         break;
00031       } else {
00032         os << "," << std::endl;
00033       }
00034     }
00035 
00036     os << "  _sql_err();" << std::endl << std::endl;
00037 
00038     os << "  return 1;" << std::endl;
00039     os << "}" << std::endl << std::endl;
00040   }
00041 }

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