#1 2012-03-29 13:09:50

noobies
Member
Registered: 2011-09-13
Posts: 139

duplicate column name

made changes to the structure of the database and startup error.
Project BlankPrn.exe raised exception class ESQLException with message 'duplicate column name: MKB10'.

  TSQLDataRecord = class(TSQLRecord)
  private
    fDateVid: TDateTime;
    fListNetrud,
    fBlankPrv,
    fFam, fIm, fOt: string;
    fDateBorn: TDateTime;
    fSex,
    fPMestoRab, fMestoRab: string;
    fNetrudKod, fNetrudDopKod, fNetrudKodIzm: Integer;
    fNumOrg: string;
    fDate1, fDate2: TDateTime;
    fNumPut, fOGRNSan,
    fVozrL1, fVozrM1, fRodSv1: Integer;
    fFIOChS1: string;
    fVozrL2, fVozrM2, fRodSv2: Integer;
    fFIOChS2: string;
    fBerem: string;
    fNarRej: Integer;
    fDateNarRej,
    fDateVStacS, fDateVStacPo,
    fDateNapMSE, fDateRegMSE, fDateOsvMSE: TDateTime;
    fInvalid: Integer;
    fDateOsvOtRabS1, fDateOsvOtRabPo1: TDateTime;
    fDolgnVr1, fIDVrach1: string;
    fDateOsvOtRabS2, fDateOsvOtRabPo2: TDateTime;
    fDolgnVr2, fIDVrach2: string;
    fDateOsvOtRabS3, fDateOsvOtRabPo3: TDateTime;
    fDolgnVr3, fIDVrach3: string;
    fDateWorkAt: TDateTime;
    fWorkOther: string;
    fDateWorkOtherAt: TDateTime;
    fVidanListNetr: string;
    fFIOVrachKor: string;
    fNumIstBolKor: string;
    fDateVidKor: TDateTime;
    fSS,
    fTipogNum: string;
    fDolgnVr1R, fIDVrach1R,
    fDolgnVr2R, fIDVrach2R,
    fDolgnVr3R, fIDVrach3R: string;
    fUchGosSl: string;
    fMKB10: string;
  published
    property DateVid: TDateTime read fDateVid write fDateVid;
    property ListNetrud: string read fListNetrud write fListNetrud;
    property BlankPrv: string read fBlankPrv write fBlankPrv;
    property Fam: string read fFam write fFam;
    property Im: string read fIm write fIm;
    property Ot: string read fOt write fOt;
    property DateBorn: TDateTime read fDateBorn write fDateBorn;
    property Sex: string read fSex write fSex;
    property PMestoRab: string read fPMestoRab write fPMestoRab;
    property MestoRab: string read fMestoRab write fMestoRab;
    property NetrudKod: Integer read fNetrudKod write fNetrudKod;
    property NetrudDopKod: Integer read fNetrudDopKod write fNetrudDopKod;
    property NetrudKodIzm: Integer read fNetrudKodIzm write fNetrudKodIzm;
    property NumOrg: string read fNumOrg write fNumOrg;
    property Date1: TDateTime read fDate1 write fDate1;
    property Date2: TDateTime read fDate2 write fDate2;
    property NumPut: Integer read fNumPut write fNumPut;
    property OGRNSan: Integer read fOGRNSan write fOGRNSan;
    property VozrL1: Integer read fVozrL1 write fVozrL1;
    property RodSv1: Integer read fRodSv1 write fRodSv1;
    property VozrM1: Integer read fVozrM1 write fVozrM1;
    property FIOChS1: string read fFIOChS1 write fFIOChS1;
    property VozrL2: Integer read fVozrL2 write fVozrL2;
    property RodSv2: Integer read fRodSv2 write fRodSv2;
    property VozrM2: Integer read fVozrM2 write fVozrM2;
    property FIOChS2: string read fFIOChS2 write fFIOChS2;
    property Berem: string read fBerem write fBerem;
    property NarRej: Integer read fNarRej write fNarRej;
    property DateNarRej: TDateTime read fDateNarRej write fDateNarRej;
    property DateVStacS: TDateTime read fDateVStacS write fDateVStacS;
    property DateVStacPo: TDateTime read fDateVStacPo write fDateVStacPo;
    property DateNapMSE: TDateTime read fDateNapMSE write fDateNapMSE;
    property DateRegMSE: TDateTime read fDateRegMSE write fDateRegMSE;
    property DateOsvMSE: TDateTime read fDateOsvMSE write fDateOsvMSE;
    property Invalid: Integer read fInvalid write fInvalid;
    property DateOsvOtRabS1: TDateTime read fDateOsvOtRabS1 write fDateOsvOtRabS1;
    property DateOsvOtRabPo1: TDateTime read fDateOsvOtRabPo1 write fDateOsvOtRabPo1;
    property DolgnVr1: string read fDolgnVr1 write fDolgnVr1;
    property IDVrach1: string read fIDVrach1 write fIDVrach1;
    property DateOsvOtRabS2: TDateTime read fDateOsvOtRabS2 write fDateOsvOtRabS2;
    property DateOsvOtRabPo2: TDateTime read fDateOsvOtRabPo2 write fDateOsvOtRabPo2;
    property DolgnVr2: string read fDolgnVr2 write fDolgnVr2;
    property IDVrach2: string read fIDVrach2 write fIDVrach2;
    property DateOsvOtRabS3: TDateTime read fDateOsvOtRabS3 write fDateOsvOtRabS3;
    property DateOsvOtRabPo3: TDateTime read fDateOsvOtRabPo3 write fDateOsvOtRabPo3;
    property DolgnVr3: string read fDolgnVr3 write fDolgnVr3;
    property IDVrach3: string read fIDVrach3 write fIDVrach3;
    property DateWorkAt: TDateTime read fDateWorkAt write fDateWorkAt;
    property WorkOther: string read fWorkOther write fWorkOther;
    property DateWorkOtherAt: TDateTime read fDateWorkOtherAt write fDateWorkOtherAt;
    property VidanListNetr: string read fVidanListNetr write fVidanListNetr;
    property FIOVrachKor: string read fFIOVrachKor write fFIOVrachKor;
    property NumIstBolKor: string read fNumIstBolKor write fNumIstBolKor;
    property DateVidKor: TDateTime read fDateVidKor write fDateVidKor;
    property SS: string read fSS write fSS;
    property TipogNum: string read fTipogNum write fTipogNum;
    property DolgnVr1R: string read fDolgnVr1R write fDolgnVr1R;
    property IDVrach1R: string read fIDVrach1R write fIDVrach1R;
    property DolgnVr2R: string read fDolgnVr2R write fDolgnVr2R;
    property IDVrach2R: string read fIDVrach2R write fIDVrach2R;
    property DolgnVr3R: string read fDolgnVr3R write fDolgnVr3R;
    property IDVrach3R: string read fIDVrach3R write fIDVrach3R;
    property UchGosSl: string read fUchGosSl write fUchGosSl;
    property MKB10: string read fMKB10 write fMKB10;
end;
function CreateDataModel: TSQLModel;
begin
  result := TSQLModel.Create([TSQLDataRecord, TSQLOptions]);
end;

procedure InitClient();
begin
  Model := CreateDataModel;
  Database := TSQLRestClientDB.Create(Model, CreateDataModel, ChangeFileExt(paramstr(0), '.db3'), TSQLRestServerDB);
  TSQLRestClientDB(Database).Server.CreateMissingTables(0); <<<< error here
end;

deleted the database run, create a new database, but again an error message.
changed some fields in some places, the error is gone, the program starts and runs normally.

  TSQLDataRecord = class(TSQLRecord)
  private
    fTipogNum: string;
    fListNetrud,
    fBlankPrv,
    fFam, fIm, fOt: string;
    fDateBorn: TDateTime;
    fSex,
    fPMestoRab, fMestoRab: string;
    fNetrudKod, fNetrudDopKod, fNetrudKodIzm: Integer;
    fNumOrg: string;
    fDate1, fDate2: TDateTime;
    fNumPut, fOGRNSan,
    fVozrL1, fVozrM1, fRodSv1: Integer;
    fFIOChS1: string;
    fVozrL2, fVozrM2, fRodSv2: Integer;
    fFIOChS2: string;
    fBerem: string;
    fNarRej: Integer;
    fDateNarRej,
    fDateVStacS, fDateVStacPo,
    fDateNapMSE, fDateRegMSE, fDateOsvMSE: TDateTime;
    fInvalid: Integer;
    fDateOsvOtRabS1, fDateOsvOtRabPo1: TDateTime;
    fDolgnVr1, fDolgnVr1R, fIDVrach1, fIDVrach1R: string;
    fDateOsvOtRabS2, fDateOsvOtRabPo2: TDateTime;
    fDolgnVr2, fDolgnVr2R, fIDVrach2, fIDVrach2R: string;
    fDateOsvOtRabS3, fDateOsvOtRabPo3: TDateTime;
    fDolgnVr3, fDolgnVr3R, fIDVrach3, fIDVrach3R: string;
    fDateWorkAt: TDateTime;
    fWorkOther: string;
    fDateWorkOtherAt: TDateTime;
    fVidanListNetr: string;
    fFIOVrachKor: string;
    fNumIstBolKor: string;
    fDateVidKor: TDateTime;
    fSS,
    fUchGosSl: string;
    fMKB10: string;
  published
    property TipogNum: string read fTipogNum write fTipogNum;
    property ListNetrud: string read fListNetrud write fListNetrud;
    property BlankPrv: string read fBlankPrv write fBlankPrv;
    property Fam: string read fFam write fFam;
    property Im: string read fIm write fIm;
    property Ot: string read fOt write fOt;
    property DateBorn: TDateTime read fDateBorn write fDateBorn;
    property Sex: string read fSex write fSex;
    property PMestoRab: string read fPMestoRab write fPMestoRab;
    property MestoRab: string read fMestoRab write fMestoRab;
    property NetrudKod: Integer read fNetrudKod write fNetrudKod;
    property NetrudDopKod: Integer read fNetrudDopKod write fNetrudDopKod;
    property NetrudKodIzm: Integer read fNetrudKodIzm write fNetrudKodIzm;
    property NumOrg: string read fNumOrg write fNumOrg;
    property Date1: TDateTime read fDate1 write fDate1;
    property Date2: TDateTime read fDate2 write fDate2;
    property NumPut: Integer read fNumPut write fNumPut;
    property OGRNSan: Integer read fOGRNSan write fOGRNSan;
    property VozrL1: Integer read fVozrL1 write fVozrL1;
    property RodSv1: Integer read fRodSv1 write fRodSv1;
    property VozrM1: Integer read fVozrM1 write fVozrM1;
    property FIOChS1: string read fFIOChS1 write fFIOChS1;
    property VozrL2: Integer read fVozrL2 write fVozrL2;
    property RodSv2: Integer read fRodSv2 write fRodSv2;
    property VozrM2: Integer read fVozrM2 write fVozrM2;
    property FIOChS2: string read fFIOChS2 write fFIOChS2;
    property Berem: string read fBerem write fBerem;
    property NarRej: Integer read fNarRej write fNarRej;
    property DateNarRej: TDateTime read fDateNarRej write fDateNarRej;
    property DateVStacS: TDateTime read fDateVStacS write fDateVStacS;
    property DateVStacPo: TDateTime read fDateVStacPo write fDateVStacPo;
    property DateNapMSE: TDateTime read fDateNapMSE write fDateNapMSE;
    property DateRegMSE: TDateTime read fDateRegMSE write fDateRegMSE;
    property DateOsvMSE: TDateTime read fDateOsvMSE write fDateOsvMSE;
    property Invalid: Integer read fInvalid write fInvalid;
    property DateOsvOtRabS1: TDateTime read fDateOsvOtRabS1 write fDateOsvOtRabS1;
    property DateOsvOtRabPo1: TDateTime read fDateOsvOtRabPo1 write fDateOsvOtRabPo1;
    property DolgnVr1: string read fDolgnVr1 write fDolgnVr1;
    property DolgnVr1R: string read fDolgnVr1R write fDolgnVr1R;
    property IDVrach1: string read fIDVrach1 write fIDVrach1;
    property IDVrach1R: string read fIDVrach1R write fIDVrach1R;
    property DateOsvOtRabS2: TDateTime read fDateOsvOtRabS2 write fDateOsvOtRabS2;
    property DateOsvOtRabPo2: TDateTime read fDateOsvOtRabPo2 write fDateOsvOtRabPo2;
    property DolgnVr2: string read fDolgnVr2 write fDolgnVr2;
    property DolgnVr2R: string read fDolgnVr2R write fDolgnVr2R;
    property IDVrach2: string read fIDVrach2 write fIDVrach2;
    property IDVrach2R: string read fIDVrach2R write fIDVrach2R;
    property DateOsvOtRabS3: TDateTime read fDateOsvOtRabS3 write fDateOsvOtRabS3;
    property DateOsvOtRabPo3: TDateTime read fDateOsvOtRabPo3 write fDateOsvOtRabPo3;
    property DolgnVr3: string read fDolgnVr3 write fDolgnVr3;
    property DolgnVr3R: string read fDolgnVr3R write fDolgnVr3R;
    property IDVrach3: string read fIDVrach3 write fIDVrach3;
    property IDVrach3R: string read fIDVrach3R write fIDVrach3R;
    property DateWorkAt: TDateTime read fDateWorkAt write fDateWorkAt;
    property WorkOther: string read fWorkOther write fWorkOther;
    property DateWorkOtherAt: TDateTime read fDateWorkOtherAt write fDateWorkOtherAt;
    property VidanListNetr: string read fVidanListNetr write fVidanListNetr;
    property FIOVrachKor: string read fFIOVrachKor write fFIOVrachKor;
    property NumIstBolKor: string read fNumIstBolKor write fNumIstBolKor;
    property DateVidKor: TDateTime read fDateVidKor write fDateVidKor;
    property SS: string read fSS write fSS;
    property UchGosSl: string read fUchGosSl write fUchGosSl;
    property MKB10: string read fMKB10 write fMKB10;
  end;

structure we want to save for import into an empty database

Offline

#2 2012-03-29 13:16:41

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,659
Website

Re: duplicate column name

The exception is raised with an SQL statement execution, inside the SQLite3 engine.

What is the running SQL statement at this time?

You may also perhaps try to set the MAX_SQLFIELDS constant to 128 instead of 64 in SynCommons.pas.
I guess this is the root cause of the issue.
I've commited a fix so that it will raise an explicit exception. See http://synopse.info/fossil/info/d80a9a9a46

Offline

#3 2012-03-29 13:41:01

noobies
Member
Registered: 2011-09-13
Posts: 139

Re: duplicate column name

I think understand what the problem is - 64 fields, when I reduce the number of fields up to 63 everything works fine.
Is it possible to determine the possibility of more than 63 fields?

Thank you, everything works fine!

Last edited by noobies (2012-03-29 13:45:15)

Offline

#4 2012-03-29 16:58:02

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,659
Website

Re: duplicate column name

Set the MAX_SQLFIELDS constant to 128 instead of 64 in SynCommons.pas.

Offline

#5 2012-10-25 12:29:06

noobies
Member
Registered: 2011-09-13
Posts: 139

Re: duplicate column name

Again the same problem.

Test:

1) change constant MAX_SQLFIELDS to 128

2) sample project 02 - Embedded SQLite3 ORM in SampleData.pas add more fields to TSQLSampleRecord (>64) and run.

type
  /// here we declare the class containing the data
  // - it just has to inherits from TSQLRecord, and the published
  // properties will be used for the ORM (and all SQL creation)
  // - the beginning of the class name must be 'TSQL' for proper table naming
  // in client/server environnment
  TSQLSampleRecord = class(TSQLRecord)
  private
    fQuestion: RawUTF8;
    fName: RawUTF8;
    fTime: TModTime;
    fQuestion1: RawUTF8;
    fName1: RawUTF8;
    fTime1: TModTime;
    fQuestion2: RawUTF8;
    fName2: RawUTF8;
    fTime2: TModTime;
    fQuestion3: RawUTF8;
    fName3: RawUTF8;
    fTime3: TModTime;
    fQuestion4: RawUTF8;
    fName4: RawUTF8;
    fTime4: TModTime;
    fQuestion5: RawUTF8;
    fName5: RawUTF8;
    fTime5: TModTime;
    fQuestion6: RawUTF8;
    fName6: RawUTF8;
    fTime6: TModTime;
    fQuestion7: RawUTF8;
    fName7: RawUTF8;
    fTime7: TModTime;
    fQuestion8: RawUTF8;
    fName8: RawUTF8;
    fTime8: TModTime;
    fQuestion9: RawUTF8;
    fName9: RawUTF8;
    fTime9: TModTime;
    fQuestion10: RawUTF8;
    fName10: RawUTF8;
    fTime10: TModTime;
    fQuestion11: RawUTF8;
    fName11: RawUTF8;
    fTime11: TModTime;
    fQuestion12: RawUTF8;
    fName12: RawUTF8;
    fTime12: TModTime;
    fQuestion13: RawUTF8;
    fName13: RawUTF8;
    fTime13: TModTime;
    fQuestion14: RawUTF8;
    fName14: RawUTF8;
    fTime14: TModTime;
    fQuestion15: RawUTF8;
    fName15: RawUTF8;
    fTime15: TModTime;
    fQuestion16: RawUTF8;
    fName16: RawUTF8;
    fTime16: TModTime;
    fQuestion17: RawUTF8;
    fName17: RawUTF8;
    fTime17: TModTime;
    fQuestion18: RawUTF8;
    fName18: RawUTF8;
    fTime18: TModTime;
    fQuestion19: RawUTF8;
    fName19: RawUTF8;
    fTime19: TModTime;
    fQuestion20: RawUTF8;
    fName20: RawUTF8;
    fTime20: TModTime;
    fQuestion21: RawUTF8;
    fName21: RawUTF8;
    fTime21: TModTime;
    fQuestion22: RawUTF8;
    fName22: RawUTF8;
    fTime22: TModTime;

  published
    property Time: TModTime read fTime write fTime;
    property Name: RawUTF8 read fName write fName;
    property Question: RawUTF8 read fQuestion write fQuestion;
    property Time1: TModTime read fTime write fTime;
    property Name1: RawUTF8 read fName write fName;
    property Question1: RawUTF8 read fQuestion write fQuestion;
    property Time2: TModTime read fTime write fTime;
    property Name2: RawUTF8 read fName write fName;
    property Question2: RawUTF8 read fQuestion write fQuestion;
    property Time3: TModTime read fTime write fTime;
    property Name3: RawUTF8 read fName write fName;
    property Question3: RawUTF8 read fQuestion write fQuestion;
    property Time4: TModTime read fTime write fTime;
    property Name4: RawUTF8 read fName write fName;
    property Question4: RawUTF8 read fQuestion write fQuestion;
    property Time5: TModTime read fTime write fTime;
    property Name5: RawUTF8 read fName write fName;
    property Question5: RawUTF8 read fQuestion write fQuestion;
    property Time6: TModTime read fTime write fTime;
    property Name6: RawUTF8 read fName write fName;
    property Question6: RawUTF8 read fQuestion write fQuestion;
    property Time7: TModTime read fTime write fTime;
    property Name7: RawUTF8 read fName write fName;
    property Question7: RawUTF8 read fQuestion write fQuestion;
    property Time8: TModTime read fTime write fTime;
    property Name8: RawUTF8 read fName write fName;
    property Question8: RawUTF8 read fQuestion write fQuestion;
    property Time9: TModTime read fTime write fTime;
    property Name9: RawUTF8 read fName write fName;
    property Question9: RawUTF8 read fQuestion write fQuestion;
    property Time10: TModTime read fTime write fTime;
    property Name10: RawUTF8 read fName write fName;
    property Question10: RawUTF8 read fQuestion write fQuestion;
    property Time11: TModTime read fTime write fTime;
    property Name11: RawUTF8 read fName write fName;
    property Question11: RawUTF8 read fQuestion write fQuestion;
    property Time12: TModTime read fTime write fTime;
    property Name12: RawUTF8 read fName write fName;
    property Question12: RawUTF8 read fQuestion write fQuestion;
    property Time13: TModTime read fTime write fTime;
    property Name13: RawUTF8 read fName write fName;
    property Question13: RawUTF8 read fQuestion write fQuestion;
    property Time14: TModTime read fTime write fTime;
    property Name14: RawUTF8 read fName write fName;
    property Question14: RawUTF8 read fQuestion write fQuestion;
    property Time15: TModTime read fTime write fTime;
    property Name15: RawUTF8 read fName write fName;
    property Question15: RawUTF8 read fQuestion write fQuestion;
    property Time16: TModTime read fTime write fTime;
    property Name16: RawUTF8 read fName write fName;
    property Question16: RawUTF8 read fQuestion write fQuestion;
    property Time17: TModTime read fTime write fTime;
    property Name17: RawUTF8 read fName write fName;
    property Question17: RawUTF8 read fQuestion write fQuestion;
    property Time18: TModTime read fTime write fTime;
    property Name18: RawUTF8 read fName write fName;
    property Question18: RawUTF8 read fQuestion write fQuestion;
    property Time19: TModTime read fTime write fTime;
    property Name19: RawUTF8 read fName write fName;
    property Question19: RawUTF8 read fQuestion write fQuestion;
    property Time20: TModTime read fTime write fTime;
    property Name20: RawUTF8 read fName write fName;
    property Question20: RawUTF8 read fQuestion write fQuestion;
    property Time21: TModTime read fTime write fTime;
    property Name21: RawUTF8 read fName write fName;
    property Question21: RawUTF8 read fQuestion write fQuestion;
    property Time22: TModTime read fTime write fTime;
    property Name22: RawUTF8 read fName write fName;
    property Question22: RawUTF8 read fQuestion write fQuestion;
  end;

3) compiling and run fine, close program and run again and see
"Project Project02.exe raised exception class ESQLite3Exception with message 'duplicate column name: Time21'."

what i do wrong?

Offline

#6 2012-10-26 06:50:09

noobies
Member
Registered: 2011-09-13
Posts: 139

Re: duplicate column name

sorry, i download latest version, working perfect!

Offline

Board footer

Powered by FluxBB