object dmData: TdmData
  OnCreate = DataModuleCreate
  OnDestroy = DataModuleDestroy
  OldCreateOrder = False
  Height = 606
  HorizontalOffset = 381
  VerticalOffset = 87
  Width = 822
  PPI = 96
  object dsrMain: TDataSource
    DataSet = qCQRLOG
    left = 304
    top = 24
  end
  object dsrQSOBefore: TDataSource
    DataSet = qQSOBefore
    left = 304
    top = 360
  end
  object dsrImport: TDataSource
    left = 728
    top = 528
  end
  object dsrBands: TDataSource
    DataSet = qBands
    left = 88
    top = 360
  end
  object dsrWorkedContests: TDataSource
    DataSet = qWorkedContests
    left = 416
    top = 424
  end
  object dsrProfiles: TDataSource
    DataSet = qProfiles
    left = 88
    top = 24
  end
  object dsrDXCluster: TDataSource
    DataSet = qDXClusters
    left = 224
    top = 24
  end
  object dsrQSLMgr: TDataSource
    AutoEdit = False
    DataSet = qQSLMgr
    left = 152
    top = 360
  end
  object mQ: TSQLQuery
    FieldDefs = <>
    BeforeOpen = mQBeforeOpen
    Transaction = trmQ
    Params = <>
    ParseSQL = False
    left = 632
    top = 80
  end
  object trmQ: TSQLTransaction
    Active = False
    Action = caNone
    left = 632
    top = 144
  end
  object scCommon: TSQLScript
    Transaction = trmQ
    UseDollarString = False
    Directives.Strings = (
      'SET TERM'
      'COMMIT'
      '#IFDEF'
      '#IFNDEF'
      '#ELSE'
      '#ENDIF'
      '#DEFINE'
      '#UNDEF'
      '#UNDEFINE'
    )
    Script.Strings = (
      'CREATE DATABASE cqrlog_common DEFAULT CHARACTER SET = utf8  DEFAULT COLLATE = utf8_bin;'
      ''
      'USE cqrlog_common;'
      ''
      'CREATE TABLE bands ('
      '       id_bands INT AUTO_INCREMENT PRIMARY KEY,'
      '       band VARCHAR(10) DEFAULT '''','
      '       b_begin NUMERIC(10,4),'
      '       b_end NUMERIC(10,4),'
      '       cw NUMERIC(10,4),'
      '       rtty NUMERIC(10,4),'
      '       ssb NUMERIC(10,4),'
      '       rx_offset numeric(10,4) default 0,'
      '       tx_offset numeric(10,4) default 0'
      ');'
      'CREATE INDEX band ON bands(band);'
      ''
      'CREATE TABLE dxclusters ('
      '      id_dxclusters INT AUTO_INCREMENT PRIMARY KEY,'
      '      description VARCHAR(100) DEFAULT '''','
      '      address VARCHAR(100) DEFAULT '''','
      '      port VARCHAR(10) DEFAULT '''','
      '      dxcuser VARCHAR(12) DEFAULT '''','
      '      dxcpass VARCHAR(20) DEFAULT '''''
      ');'
      'CREATE INDEX description ON dxclusters(description);'
      ''
      'CREATE TABLE iota_list ('
      '      id_iota_list INT AUTO_INCREMENT PRIMARY KEY,'
      '      iota_nr VARCHAR(6) DEFAULT '''','
      '      island_name VARCHAR(250) DEFAULT '''','
      '      dxcc_ref VARCHAR(15) DEFAULT '''','
      '      pref VARCHAR(15) DEFAULT '''''
      ');'
      'CREATE INDEX iota_nr ON iota_list(iota_nr);'
      'CREATE INDEX pref ON iota_list(pref);'
      ''
      ''
      'CREATE TABLE dxcc_ref ('
      '            id_dxcc_ref INT AUTO_INCREMENT PRIMARY KEY,'
      '            pref VARCHAR(20) NOT NULL,'
      '            name VARCHAR(100) NOT NULL,'
      '            cont VARCHAR(6) NOT NULL,'
      '            utc VARCHAR(12)NOT NULL,'
      '            lat VARCHAR(10) NOT NULL,'
      '            longit VARCHAR(10) NOT NULL,'
      '            itu VARCHAR(20) NOT NULL,'
      '            waz VARCHAR(20) NOT NULL,'
      '            adif SMALLINT NOT NULL DEFAULT 0,'
      '            deleted SMALLINT NOT NULL DEFAULT 0'
      ');'
      'CREATE INDEX pref ON dxcc_ref(pref);'
      'CREATE INDEX adif ON dxcc_ref(adif);'
      ''
      'CREATE TABLE qslmgr ('
      '            id_qslmgr INT AUTO_INCREMENT PRIMARY KEY,'
      '            callsign VARCHAR(20),'
      '            qsl_via VARCHAR(20),'
      '            fromdate DATE'
      ');'
      'CREATE INDEX callsign ON qslmgr(callsign);'
      'CREATE INDEX fromdate ON qslmgr(fromdate);'
      ''
      'CREATE TABLE log_list ('
      '            id_log_list INT AUTO_INCREMENT PRIMARY KEY,'
      '            log_nr SMALLINT NOT NULL,'
      '            log_name VARCHAR(50) DEFAULT '''','
      '            auto_open SMALLINT NOT NULL DEFAULT 0'
      ');'
      'CREATE INDEX log_nr ON log_list(log_nr);'
      ''
      'CREATE TABLE db_version'
      '('
      '  nr SMALLINT NOT NULL'
      ');'
    )
    Terminator = ';'
    CommentsinSQL = True
    UseSetTerm = True
    UseCommit = True
    UseDefines = True
    left = 304
    top = 472
  end
  object scLog: TSQLScript
    Transaction = trmQ
    UseDollarString = False
    Directives.Strings = (
      'SET TERM'
      'COMMIT'
      '#IFDEF'
      '#IFNDEF'
      '#ELSE'
      '#ENDIF'
      '#DEFINE'
      '#UNDEF'
      '#UNDEFINE'
    )
    Script.Strings = (
      'CREATE TABLE cqrlog_main ('
      '            id_cqrlog_main INT AUTO_INCREMENT PRIMARY KEY,'
      '            qsodate DATE NOT NULL,'
      '            time_on VARCHAR(5) NOT NULL,'
      '            time_off VARCHAR(5) DEFAULT '''','
      '            callsign VARCHAR(20) NOT NULL,'
      '            freq NUMERIC(10,4) NOT NULL,'
      '            mode VARCHAR(12) NOT NULL,'
      '            rst_s VARCHAR(20) DEFAULT '''','
      '            rst_r VARCHAR(20) DEFAULT '''','
      '            name VARCHAR(40) DEFAULT '''','
      '            qth VARCHAR(60) DEFAULT '''','
      '            qsl_s VARCHAR(4) DEFAULT '''','
      '            qsl_r VARCHAR(3) DEFAULT '''','
      '            qsl_via VARCHAR(30) DEFAULT '''','
      '            iota VARCHAR(6) DEFAULT '''','
      '            pwr VARCHAR(10) DEFAULT '''','
      '            itu INT DEFAULT 0,'
      '            waz INT DEFAULT 0,'
      '            loc VARCHAR(10) DEFAULT '''','
      '            my_loc VARCHAR(10) DEFAULT '''','
      '            county VARCHAR(30) DEFAULT '''','
      '            award VARCHAR(50) DEFAULT '''','
      '            remarks VARCHAR(200) DEFAULT '''','
      '            adif INTEGER DEFAULT 0,'
      '            /*dxcc_ref VARCHAR(20) DEFAULT '''',*/'
      '            band VARCHAR(6) DEFAULT '''','
      '            qso_dxcc INT DEFAULT 0,'
      '            profile INT DEFAULT 0,'
      '            idcall VARCHAR(20) DEFAULT '''','
      '            state VARCHAR(4) DEFAULT '''','
      '            lotw_qslsdate DATE,'
      '            lotw_qslrdate DATE,'
      '            lotw_qsls VARCHAR(3) DEFAULT '''' not null,'
      '            lotw_qslr VARCHAR(3) DEFAULT '''' not null,'
      '            cont VARCHAR(3) DEFAULT '''','
      '            qsls_date VARCHAR(10),'
      '            qslr_date VARCHAR(10),'
      '            club_nr1 VARCHAR(100) DEFAULT '''','
      '            club_nr2 VARCHAR(100) DEFAULT '''','
      '            club_nr3 VARCHAR(100) DEFAULT '''','
      '            club_nr4 VARCHAR(100) DEFAULT '''','
      '            club_nr5 VARCHAR(100) DEFAULT '''','
      '            eqsl_qsl_sent varchar(1) default '''' not null,'
      '            eqsl_qslsdate date default null,'
      '            eqsl_qsl_rcvd varchar(1) default '''' not null,'
      '            eqsl_qslrdate date default null,'
      '            rxfreq NUMERIC(10,4) NULL,'
      '            satellite VARCHAR(30) DEFAULT '''','
      '            prop_mode VARCHAR(30) DEFAULT '''','
      '            contestname VARCHAR(40) NULL,'
      '            stx VARCHAR(6) NULL,'
      '            srx VARCHAR(6) NULL,'
      '            stx_string VARCHAR(50) NULL,'
      '            srx_string VARCHAR(50) NULL,'
      '            dok VARCHAR(12) NULL,'
      '            operator varchar(20) null'
      ');'
      'CREATE INDEX main_index ON cqrlog_main(qsodate DESC,time_on DESC);'
      'CREATE INDEX callsign ON cqrlog_main(callsign);'
      'CREATE INDEX name ON cqrlog_main(name);'
      'CREATE INDEX qth ON cqrlog_main(QTH);'
      'CREATE INDEX adif ON cqrlog_main(adif);'
      'CREATE INDEX idcall ON cqrlog_main(idcall);'
      'CREATE INDEX band ON cqrlog_main(band);'
      'CREATE INDEX club_nr1 ON cqrlog_main(club_nr1);'
      'CREATE INDEX club_nr2 ON cqrlog_main(club_nr2);'
      'CREATE INDEX club_nr3 ON cqrlog_main(club_nr3);'
      'CREATE INDEX club_nr4 ON cqrlog_main(club_nr4);'
      'CREATE INDEX club_nr5 ON cqrlog_main(club_nr5);'
      ''
      ''
      'CREATE TABLE notes('
      '            id_notes INT AUTO_INCREMENT PRIMARY KEY,'
      '            callsign VARCHAR(20) DEFAULT '''','
      '            longremarks VARCHAR(256) DEFAULT '''''
      ');'
      'CREATE INDEX callsign ON notes(callsign);'
      ''
      'CREATE TABLE profiles ('
      '            id_profiles INT AUTO_INCREMENT PRIMARY KEY,'
      '            nr INT NOT NULL,'
      '            locator VARCHAR(6) DEFAULT '''','
      '            qth VARCHAR(250) DEFAULT '''','
      '            rig VARCHAR(250) DEFAULT '''','
      '            remarks VARCHAR(250) DEFAULT '''','
      '            visible INT DEFAULT 1'
      ');'
      'CREATE INDEX nr ON profiles(nr);'
      ''
      'CREATE TABLE long_note ('
      '            id_long_note INT AUTO_INCREMENT PRIMARY KEY,'
      '            note LONGTEXT'
      ');'
      ''
      'CREATE TABLE version ('
      '            major INTEGER DEFAULT 0,'
      '            minor INTEGER DEFAULT 9,'
      '            releas INTEGER DEFAULT 4'
      ');'
      ''
      'CREATE TABLE club1 ('
      '   id_club1 INT AUTO_INCREMENT PRIMARY KEY,'
      '   club_nr VARCHAR(100) DEFAULT '''','
      '   clubcall VARCHAR(100) DEFAULT '''','
      '   fromdate DATE,'
      '   todate DATE'
      ');'
      'CREATE INDEX club_nr ON club1(club_nr);'
      'CREATE INDEX fromdate ON club1(fromdate);'
      'CREATE INDEX todate ON club1(todate);'
      'CREATE INDEX clubcall ON club1(clubcall);'
      ''
      'CREATE TABLE club2 ('
      '   id_club2 INT AUTO_INCREMENT PRIMARY KEY,'
      '   club_nr VARCHAR(100) DEFAULT '''','
      '   clubcall VARCHAR(100) DEFAULT '''','
      '   fromdate DATE,'
      '   todate DATE'
      ');'
      'CREATE INDEX club_nr ON club2(club_nr);'
      'CREATE INDEX fromdate ON club2(fromdate);'
      'CREATE INDEX todate ON club2(todate);'
      'CREATE INDEX clubcall ON club2(clubcall);'
      ''
      'CREATE TABLE club3 ('
      '   id_club3 INT AUTO_INCREMENT PRIMARY KEY,'
      '   club_nr VARCHAR(100) DEFAULT '''','
      '   clubcall VARCHAR(100) DEFAULT '''','
      '   fromdate DATE,'
      '   todate DATE'
      ');'
      'CREATE INDEX club_nr ON club3(club_nr);'
      'CREATE INDEX fromdate ON club3(fromdate);'
      'CREATE INDEX todate ON club3(todate);'
      'CREATE INDEX clubcall ON club3(clubcall);'
      ''
      'CREATE TABLE club4 ('
      '   id_club4 INT AUTO_INCREMENT PRIMARY KEY,'
      '   club_nr VARCHAR(100) DEFAULT '''','
      '   clubcall VARCHAR(100) DEFAULT '''','
      '   fromdate DATE,'
      '   todate DATE'
      ');'
      'CREATE INDEX club_nr ON club4(club_nr);'
      'CREATE INDEX fromdate ON club4(fromdate);'
      'CREATE INDEX todate ON club4(todate);'
      'CREATE INDEX clubcall ON club4(clubcall);'
      ''
      'CREATE TABLE club5 ('
      '   id_club5 INT AUTO_INCREMENT PRIMARY KEY,'
      '   club_nr VARCHAR(100) DEFAULT '''','
      '   clubcall VARCHAR(100) DEFAULT '''','
      '   fromdate DATE,'
      '   todate DATE'
      ');'
      'CREATE INDEX club_nr ON club5(club_nr);'
      'CREATE INDEX fromdate ON club5(fromdate);'
      'CREATE INDEX todate ON club5(todate);'
      'CREATE INDEX clubcall ON club5(clubcall);'
      ''
      ''
      'CREATE TABLE zipcode1 ('
      '   id_zipcode1 INT AUTO_INCREMENT PRIMARY KEY,'
      '   zip VARCHAR(20) DEFAULT '''','
      '   county VARCHAR(100) DEFAULT '''''
      ');'
      'CREATE INDEX zip ON zipcode1(zip);'
      ''
      'CREATE TABLE zipcode2 ('
      '   id_zipcode2 INT AUTO_INCREMENT PRIMARY KEY,'
      '   zip VARCHAR(20) DEFAULT '''','
      '   county VARCHAR(100) DEFAULT '''''
      ');'
      'CREATE INDEX zip ON zipcode2(zip);'
      ''
      'CREATE TABLE zipcode3 ('
      '   id_zipcode3 INT AUTO_INCREMENT PRIMARY KEY,'
      '   zip VARCHAR(20) DEFAULT '''','
      '   county VARCHAR(100) DEFAULT '''''
      ');'
      'CREATE INDEX zip ON zipcode3(zip);'
      ''
      'CREATE TABLE cqrlog_config ('
      '  id_cqrlog__config INT AUTO_INCREMENT PRIMARY KEY,'
      '  config_file LONGTEXT'
      ');'
      'INSERT INTO cqrlog_config (config_file) VALUES ('''');'
      ''
      'CREATE TABLE dxcc_id'
      '('
      '  id_dxcc INT AUTO_INCREMENT PRIMARY KEY,'
      '  adif INT DEFAULT 0,'
      '  dxcc_ref VARCHAR(16) NOT NULL,'
      '  country VARCHAR(100) NOT NULL'
      ');'
      'CREATE INDEX adif ON dxcc_id(adif);'
      ''
      'CREATE TABLE db_version'
      '('
      '  nr SMALLINT NOT NULL'
      ');'
      ''
      'CREATE TABLE log_changes ('
      '  id int NOT NULL AUTO_INCREMENT PRIMARY KEY,'
      '  id_cqrlog_main int(11) NULL,'
      '  cmd varchar(20) NOT NULL,'
      '  qsodate date NULL,'
      '  time_on varchar(5) NULL,'
      '  callsign varchar(20) NULL,'
      '  mode varchar(12) NULL,'
      '  band varchar(6) NULL,'
      '  freq numeric(10,4) NULL,'
      '  old_qsodate date NULL,'
      '  old_time_on varchar(5) NULL,'
      '  old_callsign varchar(20) NULL,'
      '  old_mode varchar(12) NULL,'
      '  old_band varchar(6) NULL,'
      '  old_freq numeric(10,4) NULL,'
      '  upddeleted int(1) default 1'
      ') COLLATE ''utf8_bin'';'
      ''
      'ALTER TABLE log_changes'
      'ADD INDEX id_cqrlog_main (id_cqrlog_main);'
      ''
      'ALTER TABLE log_changes'
      'ADD FOREIGN KEY (id_cqrlog_main) REFERENCES cqrlog_main (id_cqrlog_main) ON DELETE SET NULL ON UPDATE CASCADE;'
      ''
      'CREATE TABLE upload_status ('
      '  id int NOT NULL AUTO_INCREMENT PRIMARY KEY,'
      '  logname varchar(30) NOT NULL,'
      '  id_log_changes int(11) NULL,'
      '  FOREIGN KEY (id_log_changes) REFERENCES log_changes (id) ON DELETE SET NULL'
      ') COLLATE ''utf8_bin'';'
      ''
      'CREATE TABLE call_alert ('
      '  id int NOT NULL AUTO_INCREMENT PRIMARY KEY,'
      '  callsign varchar(20) NOT NULL,'
      '  band varchar(6) NULL,'
      '  mode varchar(12) NULL'
      ') COLLATE ''utf8_bin'';'
      ''
      'ALTER TABLE call_alert ADD INDEX (id);'
      'ALTER TABLE call_alert ADD INDEX (callsign);'
      ''
      'CREATE TABLE freqmem ('
      '       id int NOT NULL AUTO_INCREMENT PRIMARY KEY,'
      '       freq numeric(10,4) NOT NULL,'
      '       mode varchar(12) NOT NULL,'
      '       bandwidth int NOT NULL,'
      '       info varchar(25) NULL'
      ') COLLATE ''utf8_bin'';'
      ''
    )
    Terminator = ';'
    CommentsinSQL = True
    UseSetTerm = False
    UseCommit = False
    UseDefines = False
    OnException = scLogException
    left = 152
    top = 472
  end
  object dsrmQ: TDataSource
    DataSet = mQ
    left = 632
    top = 24
  end
  object qLogList: TSQLQuery
    FieldDefs = <>
    BeforeOpen = qLogListBeforeOpen
    Transaction = trLogList
    Params = <>
    ParseSQL = False
    left = 528
    top = 216
  end
  object trLogList: TSQLTransaction
    Active = False
    Action = caNone
    left = 528
    top = 288
  end
  object dsrLogList: TDataSource
    DataSet = qLogList
    left = 528
    top = 360
  end
  object qSQLConsole: TSQLQuery
    PacketRecords = 100
    FieldDefs = <>
    Transaction = trmQ
    Params = <>
    ParseSQL = False
    left = 632
    top = 216
  end
  object trSQLConsole: TSQLTransaction
    Active = False
    Action = caNone
    left = 632
    top = 288
  end
  object dsrSQLConsole: TDataSource
    DataSet = qSQLConsole
    left = 632
    top = 360
  end
  object qQSLMgr: TSQLQuery
    FieldDefs = <>
    Transaction = trQSLMgr
    Params = <>
    ParseSQL = False
    left = 152
    top = 216
  end
  object trQSLMgr: TSQLTransaction
    Active = False
    Action = caNone
    left = 152
    top = 288
  end
  object qCallBook: TSQLQuery
    FieldDefs = <>
    Transaction = trCallBook
    Params = <>
    left = 24
    top = 80
  end
  object trCallBook: TSQLTransaction
    Active = False
    Action = caNone
    left = 24
    top = 144
  end
  object trLongNote: TSQLTransaction
    Active = False
    Action = caNone
    left = 728
    top = 144
  end
  object qLongNote: TSQLQuery
    FieldDefs = <>
    BeforeOpen = qLongNoteBeforeOpen
    Transaction = trLongNote
    Params = <>
    left = 728
    top = 80
  end
  object qProfiles: TSQLQuery
    FieldDefs = <>
    Transaction = trProfiles
    Params = <>
    ParseSQL = False
    left = 88
    top = 80
  end
  object trProfiles: TSQLTransaction
    Active = False
    Action = caNone
    left = 88
    top = 144
  end
  object qIOTAList: TSQLQuery
    FieldDefs = <>
    Transaction = trIOTAList
    Params = <>
    ParseSQL = False
    left = 24
    top = 216
  end
  object trIOTAList: TSQLTransaction
    Active = False
    Action = caNone
    left = 24
    top = 288
  end
  object trBands: TSQLTransaction
    Active = False
    Action = caNone
    left = 88
    top = 288
  end
  object trWorkedContests: TSQLTransaction
    Active = False
    Action = caNone
    left = 416
    top = 360
  end
  object qBands: TSQLQuery
    FieldDefs = <>
    BeforeOpen = qBandsBeforeOpen
    Transaction = trBands
    Params = <>
    ParseSQL = False
    left = 88
    top = 216
  end
  object qWorkedContests: TSQLQuery
    FieldDefs = <>
    Transaction = trWorkedContests
    Params = <>
    ParseSQL = False
    left = 122
    top = 216
  end
  object trDXClusters: TSQLTransaction
    Active = False
    Action = caNone
    left = 224
    top = 144
  end
  object qDXClusters: TSQLQuery
    FieldDefs = <>
    Transaction = trDXClusters
    Params = <>
    ParseSQL = False
    left = 224
    top = 80
  end
  object trComment: TSQLTransaction
    Active = False
    Action = caNone
    left = 224
    top = 288
  end
  object qComment: TSQLQuery
    FieldDefs = <>
    Transaction = trComment
    Params = <>
    ParseSQL = False
    left = 224
    top = 216
  end
  object trException: TSQLTransaction
    Active = False
    Action = caNone
    left = 472
    top = 288
  end
  object qException: TSQLQuery
    FieldDefs = <>
    Transaction = trException
    Params = <>
    ParseSQL = False
    left = 472
    top = 216
  end
  object trQSOBefore: TSQLTransaction
    Active = False
    Action = caNone
    left = 304
    top = 288
  end
  object qQSOBefore: TSQLQuery
    FieldDefs = <>
    Transaction = trQSOBefore
    Params = <>
    ParseSQL = False
    left = 299
    top = 216
  end
  object trQ1: TSQLTransaction
    Active = False
    Action = caNone
    left = 528
    top = 144
  end
  object Q1: TSQLQuery
    FieldDefs = <>
    BeforeOpen = Q1BeforeOpen
    Transaction = trQ1
    Params = <>
    ParseSQL = False
    left = 528
    top = 80
  end
  object trQ: TSQLTransaction
    Active = False
    Action = caNone
    left = 472
    top = 144
  end
  object Q: TSQLQuery
    FieldDefs = <>
    BeforeOpen = QBeforeOpen
    Transaction = trQ
    Params = <>
    ParseSQL = False
    left = 472
    top = 80
  end
  object trCQRLOG: TSQLTransaction
    Active = False
    Action = caNone
    left = 304
    top = 144
  end
  object qCQRLOG: TSQLQuery
    PacketRecords = 100
    FieldDefs = <>
    BeforeOpen = qCQRLOGBeforeOpen
    Transaction = trCQRLOG
    Params = <>
    ParseSQL = False
    left = 304
    top = 80
  end
  object scViews: TSQLScript
    Transaction = trmQ
    UseDollarString = False
    Directives.Strings = (
      'SET TERM'
      'COMMIT'
      '#IFDEF'
      '#IFNDEF'
      '#ELSE'
      '#ENDIF'
      '#DEFINE'
      '#UNDEF'
      '#UNDEFINE'
    )
    Script.Strings = (
      'CREATE VIEW view_cqrlog_main_by_qsodate AS SELECT id_cqrlog_main,qsodate,time_on,time_off,callsign, freq,mode,rst_s,rst_r,name,qth,qsl_s,qsl_r,qsl_via,iota,pwr,itu,waz,loc,my_loc,county,'
      'award,remarks, band, dxcc_id.dxcc_ref AS dxcc_ref ,qso_dxcc, profile,idcall, state, lotw_qslsdate, lotw_qslrdate,lotw_qsls, lotw_qslr, cont, qsls_date,qslr_date,club_nr1,club_nr2,club_nr3,'
      'club_nr4, club_nr5, eqsl_qsl_sent, eqsl_qslsdate, eqsl_qsl_rcvd,eqsl_qslrdate,concat(qsl_r,lotw_qslr,eqsl_qsl_rcvd) as qslr,dxcc_id.country, rxfreq, satellite, prop_mode, srx, stx, srx_string, stx_string, contestname, dok, operator FROM cqrlog_main JOIN dxcc_id ON dxcc_id.adif = cqrlog_main.adif order by qsodate DESC, time_on DESC;'
      'CREATE VIEW view_cqrlog_main_by_qsodate_asc AS SELECT id_cqrlog_main,qsodate,time_on,time_off,callsign, freq,mode,rst_s,rst_r,name,qth,qsl_s,qsl_r,qsl_via,iota,pwr,itu,waz,loc,my_loc,county,'
      'award,remarks, band, dxcc_id.dxcc_ref AS dxcc_ref ,qso_dxcc, profile,idcall, state, lotw_qslsdate, lotw_qslrdate,lotw_qsls, lotw_qslr, cont, qsls_date,qslr_date,club_nr1,club_nr2,club_nr3,'
      'club_nr4,club_nr5,eqsl_qsl_sent,eqsl_qslsdate,eqsl_qsl_rcvd,eqsl_qslrdate,concat(qsl_r,lotw_qslr,eqsl_qsl_rcvd) as qslr,dxcc_id.country, rxfreq, satellite, prop_mode, srx, stx, srx_string, stx_string, contestname, dok, operator FROM cqrlog_main JOIN dxcc_id ON dxcc_id.adif = cqrlog_main.adif order by qsodate ASC, time_on ASC;'
      'CREATE VIEW view_cqrlog_main_by_callsign AS SELECT id_cqrlog_main,qsodate,time_on,time_off,callsign, freq,mode,rst_s,rst_r,name,qth,qsl_s,qsl_r,qsl_via,iota,pwr,itu,waz,loc,my_loc,county,'
      'award,remarks, band, dxcc_id.dxcc_ref AS dxcc_ref ,qso_dxcc, profile,idcall, state, lotw_qslsdate, lotw_qslrdate,lotw_qsls, lotw_qslr, cont, qsls_date,qslr_date,club_nr1,club_nr2,club_nr3,'
      'club_nr4,club_nr5,eqsl_qsl_sent,eqsl_qslsdate,eqsl_qsl_rcvd,eqsl_qslrdate,concat(qsl_r,lotw_qslr,eqsl_qsl_rcvd) as qslr,dxcc_id.country, rxfreq, satellite, prop_mode, srx, stx, srx_string, stx_string, contestname, dok, operator FROM cqrlog_main JOIN dxcc_id ON dxcc_id.adif = cqrlog_main.adif order by callsign;'
    )
    Terminator = ';'
    CommentsinSQL = True
    UseSetTerm = True
    UseCommit = True
    UseDefines = True
    OnException = scViewsException
    left = 224
    top = 472
  end
  object tmrDBPing: TTimer
    Enabled = False
    OnTimer = tmrDBPingTimer
    left = 16
    top = 24
  end
  object scQSLExport: TSQLScript
    UseDollarString = False
    Directives.Strings = (
      'SET TERM'
      'COMMIT'
      '#IFDEF'
      '#IFNDEF'
      '#ELSE'
      '#ENDIF'
      '#DEFINE'
      '#UNDEF'
      '#UNDEFINE'
    )
    Script.Strings = (
      'CREATE TEMPORARY TABLE IF NOT EXISTS  qslexport ('
      '            id_qslexport INT AUTO_INCREMENT PRIMARY KEY,'
      '            idcall VARCHAR(20) DEFAULT '''','
      '            id_cqrlog_main INT NOT NULL,'
      '            dxcc   VARCHAR(20) DEFAULT '''','
      '            qsodate DATE NOT NULL,'
      '            time_on VARCHAR(5) NOT NULL,'
      '            time_off VARCHAR(5) DEFAULT '''','
      '            callsign VARCHAR(20) NOT NULL,'
      '            freq NUMERIC(10,4) NOT NULL,'
      '            mode VARCHAR(12) NOT NULL,'
      '            rst_s VARCHAR(20) DEFAULT '''','
      '            rst_r VARCHAR(20) DEFAULT '''','
      '            name VARCHAR(40) DEFAULT '''','
      '            qth VARCHAR(60) DEFAULT '''','
      '            qsl_s VARCHAR(3) DEFAULT '''','
      '            qsl_r VARCHAR(3) DEFAULT '''','
      '            qsl_via VARCHAR(30) DEFAULT '''','
      '            iota VARCHAR(6) DEFAULT '''','
      '            pwr VARCHAR(10) DEFAULT '''','
      '            loc VARCHAR(6) DEFAULT '''','
      '            my_loc VARCHAR(6) DEFAULT '''','
      '            award VARCHAR(50) DEFAULT '''','
      '            remarks VARCHAR(200) DEFAULT '''','
      '            band VARCHAR(6) DEFAULT '''','
      '            qslmsg VARCHAR(20) DEFAULT '''','
      '            prop_mode VARCHAR(30) DEFAULT '''','
      '            satellite VARCHAR(30) DEFAULT '''','
      '            contestname VARCHAR(40) DEFAULT '''','
      '            stx VARCHAR(6) DEFAULT '''','
      '            stx_string VARCHAR(50) DEFAULT '''','
      '            srx VARCHAR(6) DEFAULT '''','
      '            srx_string VARCHAR(50) DEFAULT '''''
      ');'
      'CREATE INDEX idcall ON qslexport(idcall);'
      'CREATE INDEX dxcc ON qslexport(dxcc);'
      ''
    )
    Terminator = ';'
    CommentsinSQL = True
    UseSetTerm = True
    UseCommit = True
    UseDefines = True
    left = 528
    top = 472
  end
  object scOnlineLogTriggers: TSQLScript
    Transaction = trmQ
    UseDollarString = False
    Directives.Strings = (
      'SET TERM'
      'COMMIT'
      '#IFDEF'
      '#IFNDEF'
      '#ELSE'
      '#ENDIF'
      '#DEFINE'
      '#UNDEF'
      '#UNDEFINE'
    )
    Script.Strings = (
      'CREATE TRIGGER `cqrlog_main_ai` AFTER INSERT ON `cqrlog_main` FOR EACH ROW'
      'insert into log_changes(id_cqrlog_main,cmd,qsodate,time_on,callsign,mode,freq,band) values'
      '  (NEW.id_cqrlog_main,''INSERT'',NEW.qsodate,NEW.time_on,NEW.callsign,NEW.mode,NEW.freq,NEW.band);'
      ''
      'CREATE TRIGGER `cqrlog_main_bd` BEFORE DELETE ON `cqrlog_main` FOR EACH ROW'
      'insert into log_changes(id_cqrlog_main,cmd,old_qsodate, old_time_on, old_callsign, old_mode, old_band,old_freq)'
      'values (OLD.id_cqrlog_main,''DELETE'',OLD.qsodate, OLD.time_on, OLD.callsign, OLD.mode, OLD.band, OLD.freq);'
      ''
      'CREATE TRIGGER `cqrlog_main_bu` BEFORE UPDATE ON `cqrlog_main` FOR EACH ROW'
      'insert into log_changes(id_cqrlog_main,cmd,old_qsodate, old_time_on, old_callsign, old_mode, old_band,old_freq,'
      'qsodate, time_on, callsign, mode, band,freq)'
      'values (OLD.id_cqrlog_main,''UPDATE'',OLD.qsodate, OLD.time_on, OLD.callsign, OLD.mode, OLD.band,OLD.freq,'
      'NEW.qsodate, NEW.time_on, NEW.callsign, NEW.mode, NEW.band, NEW.freq);'
    )
    Terminator = ';'
    CommentsinSQL = True
    UseSetTerm = True
    UseCommit = True
    UseDefines = True
    left = 416
    top = 472
  end
  object scMySQLConfig: TSQLScript
    UseDollarString = False
    Directives.Strings = (
      'SET TERM'
      'COMMIT'
      '#IFDEF'
      '#IFNDEF'
      '#ELSE'
      '#ENDIF'
      '#DEFINE'
      '#UNDEF'
      '#UNDEFINE'
    )
    Script.Strings = (
      '[mysqld]'
      ''
      '# Use UTF-8 encoding for tables'
      'character_set_server=utf8'
      'collation_server=utf8_bin'
      ''
      '# use InnoDB for transactions and better crash recovery'
      'default_storage_engine=innodb'
      ''
      '# memory pool InnoDB uses to store data dictionary information and other internal data structures (default:1M)'
      '# Deprecated in MySQL >= 5.6.3'
      '#innodb_additional_mem_pool_size=1M'
      ''
      '# memory buffer InnoDB uses to cache data and indexes of its tables (default:128M)'
      '# Larger values means less I/O'
      'innodb_buffer_pool_size=80M'
      ''
      '# Create a .ibd file for each table (default:0)'
      'innodb_file_per_table=1'
      ''
      '# Write out the log buffer to the log file at each commit (default:1)'
      'innodb_flush_log_at_trx_commit=2'
      ''
      '# Buffer size used to write to the log files on disk (default:1M for builtin, 8M for plugin)'
      '# larger values means less I/O'
      'innodb_log_buffer_size=1M'
      ''
      '# error log file name, relative to datadir (default:hostname.err)'
      'log_error=mysql.err'
      ''
      '# print warnings and connection errors (default:1)'
      'log_warnings=2'
      ''
      '# Convert table named to lowercase'
      'lower_case_table_names=1'
      ''
      '# Maximum size of one packet or any generated/intermediate string. (default:1M)'
      'max_allowed_packet=32M'
      ''
      '# Maximum simultaneous connections allowed (default:100)'
      'max_connections=256'
      ''
      '# The two options below make no sense with prepared statements and/or transactions'
      '# (make sense when having the same query multiple times)'
      ''
      '# Memory allocated for caching query results (default:0 (disabled))'
      'query_cache_size=0'
      ''
      '# Do not cache results (default:1)'
      'query_cache_type=0'
      ''
      '# Do not use the privileges mechanisms'
      'skip_grant_tables'
      ''
      '# The number of open tables for all threads. (default:64)'
      'table_open_cache=200'
      ''
      '# How many threads the server should cache for reuse (default:0)'
      'thread_cache_size=3'
      ''
      '# wait 365d before dropping the DB connection (default:8h)'
      'wait_timeout=31536000'
      ''
      '[client]'
      'default-character-set=utf8'
      ''
    )
    Terminator = ';'
    CommentsinSQL = True
    UseSetTerm = True
    UseCommit = True
    UseDefines = True
    left = 40
    top = 472
  end
  object qBandMapFil: TSQLQuery
    FieldDefs = <>
    Params = <>
    left = 728
    top = 216
  end
  object trBandMapFil: TSQLTransaction
    Active = False
    left = 728
    top = 288
  end
  object qRbnMon: TSQLQuery
    FieldDefs = <>
    Params = <>
    left = 152
    top = 80
  end
  object trRbnMon: TSQLTransaction
    Active = False
    left = 152
    top = 144
  end
  object qFreqMem: TSQLQuery
    FieldDefs = <>
    Transaction = trFreqMem
    Params = <>
    left = 368
    top = 216
  end
  object trFreqMem: TSQLTransaction
    Active = False
    left = 368
    top = 288
  end
  object W: TSQLQuery
    FieldDefs = <>
    BeforeOpen = WBeforeOpen
    Transaction = trW
    Params = <>
    left = 368
    top = 80
  end
  object trW: TSQLTransaction
    Active = False
    Action = caNone
    left = 368
    top = 144
  end
  object W1: TSQLQuery
    FieldDefs = <>
    BeforeOpen = W1BeforeOpen
    Transaction = trW1
    Params = <>
    left = 416
    top = 80
  end
  object trW1: TSQLTransaction
    Active = False
    Action = caNone
    left = 416
    top = 144
  end
  object Q2: TSQLQuery
    FieldDefs = <>
    BeforeOpen = Q2BeforeOpen
    Transaction = trQ2
    Params = <>
    ParseSQL = False
    left = 576
    top = 80
  end
  object trQ2: TSQLTransaction
    Active = False
    Action = caNone
    left = 576
    top = 144
  end
end
