Проектирование схемы БД в среде ERwin. Проблема избыточности данных. Проблема обновления данных. Проблема удаления данных., страница 25

fgets(Ass1.uploadN,UploadN_pos+1,cdr_file);   fgets(Ass1.fd,fd_pos+1,cdr_file);      fgets(Ass1.Direct,Direct_pos+1,cdr_file);  fgets(Ass1.dur,dur_pos+1,cdr_file);  fgets(Ass1.Anum,Anum_pos+1,cdr_file);  fgets(Ass1.Bnum,Bnum_pos+1,cdr_file);  fgets(Ass1.servicekey,servicekey_pos+1,cdr_file);  fgets(qqq,2,cdr_file);  uploadn = Ass1.uploadN;       fd = Ass1.fd;  direct = Ass1.Direct;  duration = Ass1.dur;         anum = Ass1.Anum;  bnum = Ass1.Bnum;  sk = Ass1.servicekey;

//  Bind the placeholders in the INSERT statement.      if (

obndrv(&cda1, (text *) ":uploadn", -1, (ub1 *) uploadn,       uploadnlen+1,

STRING_TYPE, -1, (sb2 *) 0, (text *) 0, -1, -1) ||

obndrv(&cda1, (text *) ":fd",             -1, (ub1 *) fd,               

STRING_TYPE, -1, (sb2 *) 0, (text *) 0, -1, -1) ||

fdlen+1,

obndrv(&cda1, (text *) ":direct",       -1, (ub1 *)       direct, 

STRING_TYPE, -1, (sb2 *) 0, (text *) 0, -1, -1) ||

directlen+1,

obndrv(&cda1, (text *) ":duration", -1, (ub1 *)         duration,

durationlen+1,

STRING_TYPE, -1, (sb2 *) 0, (text *) 0, -1, -1) ||

obndrv(&cda1, (text *) ":anum",                    -1, (ub1 *)       anum,              numlen+1,

STRING_TYPE, -1, (sb2 *) 0, (text *) 0, -1, -1) ||         

obndrv(&cda1, (text *) ":bnum",                    -1, (ub1 *)       bnum,              numlen+1,

STRING_TYPE, -1, (sb2 *) 0, (text *) 0, -1, -1) ||

obndrv(&cda1, (text *) ":sk",             -1, (ub1 *)       sk,                               sklen+1,

STRING_TYPE, -1, (sb2 *) 0, (text *) 0, -1, -1)

)

{

printf("Binding ERROR\n");

}

//execute the INSERT statement if(oexec(&cda1))

{

printf("Insert Executing ERROR\n");

} //commit; if(ocom(&lda))

{

printf("Commiting ERROR\n");

}

}

_strtime(tmpbuf);     printf("%s ", tmpbuf);     _strdate(tmpbuf);     printf("%s   ", tmpbuf); printf("Get load CDR %s, ", CDRname); printf("read %d rows.\n", count); fclose(cdr_file);

}

}

//----------------- конец чтения сидиара ------------------------------- printf("Press any key to exit!!!!!\n"); getch();   return 0;

}

Листинг файла CDEMO6.H

/*

* $Header: cdemo6.h,v 1.2 1995/04/25 15:19:29 slari Exp $ 

*/

/* Copyright (c) 1995 by Oracle Corporation */

/*

NAME

cdemo6.h - header file for C++ Demo Program

MODIFIED   (MM/DD/YY)

slari      04/25/95 -  merge changes from branch 1.1.720.1     slari      04/24/95 -  Branch_for_patch     slari      04/21/95 -  Creation

*/ extern "C"

{

#include <string.h>

#include "oratypes.h"

#include "ocidfn.h"

#include "ocidem.h"

}

/* oparse flags */

#define  DEFER_PARSE        1

#define  NATIVE             1

#define  VERSION_7          2 /* Class forward declarations */ class connection; class cursor;

/*

*  This class represents a connection to ORACLE database.

*

*  NOTE: This connection class is just given as an example and all possible  *       operations on a connection have not been defined.

*/ class connection

{

friend class cursor;   public:

connection() 

{ state = not_connected; memset(hda,'\0', HDA_SIZE); }

~connection();

sword connect(const text *username, const text *password);     sword disconnect();     void display_error(FILE* file) const;   private:     Lda_Def lda;     ub1 hda[HDA_SIZE];     enum conn_state

{

not_connected,       connected

};     conn_state state;

};

/*

*  This class represents an ORACLE cursor.

*

*  NOTE: This cursor class is just given as an example and all possible  *       operations on a cursor have not been defined.

*/ class cursor {   public:     cursor() 

{state = not_opened; conn = (connection *)0; }

~cursor();