User:Shobikarur/sandbox

using namespace std; EXEC SQL BEGIN DECLARE SECTION; int cid; char cname[30]; char con[30]="c0218@oracle"; char pwd[30]; int ccount; sql_cursor course_record; EXEC SQL END DECLARE SECTION; EXEC SQL INCLUDE SQLCA; class Course {       int courseid; char * coursename; public: Course; Course(int,char[]); ~Course; Course(const Course &); int getId; char * getName; void setId(int); void setName(char []); }; Course::Course {       courseid=0; coursename=new char[1]; coursename="\0"; } Course::Course(int courseid,char coursename[]) {       this->courseid=courseid; this->coursename=new char[strlen(coursename)+1]; strcpy(this->coursename,coursename); } Course::~Course {       delete[] coursename; } Course::Course(const Course &ref) {       this->courseid=ref.courseid; this->coursename=new char[strlen(ref.coursename)+1]; strcpy(this->coursename,ref.coursename); } int Course::getId {       return courseid; } char * Course::getName {        return coursename; } void Course::setId(int courseid) {       this->courseid=courseid; } void Course::setName(char coursename[]) {       this->coursename=new char[strlen(coursename)+1]; strcpy(this->coursename,coursename); } void connectToDB {       strcpy(pwd,"tcs"); EXEC SQL CONNECT :con IDENTIFIED BY :pwd; if(sqlca.sqlcode==0) {           cout<<"Connection successful\n"; }       if(sqlca.sqlcode<0) {           cout<<"Error in connection\n"; } } void insertToDB(Course cobj) {       cid=cobj.getId; strcpy(cname,cobj.getName); EXEC SQL INSERT into COURSE1 VALUES(:cid,:cname); EXEC SQL COMMIT; if(sqlca.sqlcode==0) {            cout<<"Insertion successful\n"; }       if(sqlca.sqlcode<0) {            cout<<"Error in insertion\n"; } } void updateToDB {       EXEC SQL UPDATE COURSE1 SET COURSENAME='J2EE' WHERE COURSEID=1002; EXEC SQL COMMIT; if(sqlca.sqlcode==0) {             cout<<"Update successful\n"; }       if(sqlca.sqlcode<0) {             cout<<"Error in updation\n"; } } vector selectall {       vector courses; EXEC SQL SELECT count(*) into ccount from course1; cout<<"\nTotal number of Courses: "<<ccount; EXEC SQL ALLOCATE:course_record; EXEC ORACLE OPTION(select_error=no); EXEC SQL SELECT CURSOR(SELECT * FROM COURSE1)INTO :course_record from DUAL; EXEC ORACLE OPTION(select_error=yes); for(int i=0;i vlist=selectall; vector::iterator itr; cout<<"The details are:\n"; for(itr=vlist.begin;itr!=vlist.end;itr++) {          cout<<"\n"<<(*itr).getId<<"\n"; cout<<"\n"<<(*itr).getName<<"\n"; } } void deleteInDB {   EXEC SQL DELETE FROM COURSE1 WHERE COURSEID=1002; EXEC SQL COMMIT; if(sqlca.sqlcode==0) {       cout<<"Deletion successful\n"; }   if(sqlca.sqlcode<0) {       cout<<"Error while deleting\n"; } } int main {   int id,op; char name[30]; connectToDB; Course c;   cout<<"\nEnter your option\n1.Add Course\n2.View Course\n3.Update Course\n4.Delete Course\n5.Exit\n"; cin>>op; while(1) {        switch(op) {            case 1: cout<<"\nEnter the id: "; cin>>id; cout<<"\nEnter the name: "; cin>>name; c.setId(id); c.setName(name); insertToDB(c); break; case 2: display; break; case 3: updateToDB; break; case 4: deleteInDB; break; case 5: exit(0);break; default: cout<<"Invalid option";break; }         cout<<"\nEnter your option\n1.Add Course\n2.View Course\n3.Update Course\n4.Delete Course\n5.Exit\n"; cin>>op; }  EXEC SQL COMMIT WORK RELEASE; } n technical session we did regression testing. In growth,customer centricity and experience certainty session I learnt about the various domains and the interconnection between growth,customer centricity and experience certainty. In bizskill,team dynamics activity we had puzzle game and conflict management activity. 2)What can I do with the learning? I learned many economic related words from the growth session and the behaviour of experience certainty. I understand how to make the team success and how to handle the conflicts.
 * 1) include
 * 2) include
 * 3) include