unit i_SYSPABCP;

interface

uses
   DB, DBTables, Sysutils, { Variants, } i_ebss;

type
   _SYSPABCP = class(_ebss)
   public
      function getAllRows(tmpSessionName, tmpDatabaseName: String):TQuery;overload;
      function getAllRows(tmpSessionName, tmpDatabaseName, Cond:String):TQuery;overload;

      function getSomeColumns(tmpSessionName, tmpDatabaseName, ColumnNames:String):TQuery;overload;
      function getSomeColumns(tmpSessionName, tmpDatabaseName, ColumnNames, Cond:String):TQuery;overload;
      function setSomeColumns(tmpSessionName, tmpDatabaseName: String;FieldNames, Values: Variant) :Boolean;

      function Insert(tmpSessionName, tmpDatabaseName:String;Values: Variant):Boolean;
      function Delete(tmpSessionName, tmpDatabaseName, Cond:String):Boolean;
      function Empty(tmpSessionName, tmpDatabaseName: String):Boolean;

      function getZONENOs(tmpSessionName, tmpDatabaseName: String):TQuery;overload;
      function getZONENOs(tmpSessionName, tmpDatabaseName, Cond:String):TQuery;overload;
      function getZONENO(tmpSessionName, tmpDatabaseName, Cond:String):TField;overload;
      function getZONENOvalue(tmpSessionName, tmpDatabaseName, Cond:String):Real;overload;
      function setZONENOvalue(tmpSessionName, tmpDatabaseName:String; Value:String; Cond:String):Boolean;

      function getBRCHNOs(tmpSessionName, tmpDatabaseName: String):TQuery;overload;
      function getBRCHNOs(tmpSessionName, tmpDatabaseName, Cond:String):TQuery;overload;
      function getBRCHNO(tmpSessionName, tmpDatabaseName, Cond:String):TField;overload;
      function getBRCHNOvalue(tmpSessionName, tmpDatabaseName, Cond:String):Real;overload;
      function setBRCHNOvalue(tmpSessionName, tmpDatabaseName:String; Value:String; Cond:String):Boolean;

      function getBNAMEs(tmpSessionName, tmpDatabaseName: String):TQuery;overload;
      function getBNAMEs(tmpSessionName, tmpDatabaseName, Cond:String):TQuery;overload;
      function getBNAME(tmpSessionName, tmpDatabaseName, Cond:String):TField;overload;
      function getBNAMEvalue(tmpSessionName, tmpDatabaseName, Cond:String):String;overload;
      function setBNAMEvalue(tmpSessionName, tmpDatabaseName:String; Value:String; Cond:String):Boolean;

      function getSNAMEs(tmpSessionName, tmpDatabaseName: String):TQuery;overload;
      function getSNAMEs(tmpSessionName, tmpDatabaseName, Cond:String):TQuery;overload;
      function getSNAME(tmpSessionName, tmpDatabaseName, Cond:String):TField;overload;
      function getSNAMEvalue(tmpSessionName, tmpDatabaseName, Cond:String):String;overload;
      function setSNAMEvalue(tmpSessionName, tmpDatabaseName:String; Value:String; Cond:String):Boolean;

      function getKINKs(tmpSessionName, tmpDatabaseName: String):TQuery;overload;
      function getKINKs(tmpSessionName, tmpDatabaseName, Cond:String):TQuery;overload;
      function getKINK(tmpSessionName, tmpDatabaseName, Cond:String):TField;overload;
      function getKINKvalue(tmpSessionName, tmpDatabaseName, Cond:String):Real;overload;
      function setKINKvalue(tmpSessionName, tmpDatabaseName:String; Value:String; Cond:String):Boolean;

      function getSTATUSs(tmpSessionName, tmpDatabaseName: String):TQuery;overload;
      function getSTATUSs(tmpSessionName, tmpDatabaseName, Cond:String):TQuery;overload;
      function getSTATUS(tmpSessionName, tmpDatabaseName, Cond:String):TField;overload;
      function getSTATUSvalue(tmpSessionName, tmpDatabaseName, Cond:String):Real;overload;
      function setSTATUSvalue(tmpSessionName, tmpDatabaseName:String; Value:String; Cond:String):Boolean;

      function getADDRs(tmpSessionName, tmpDatabaseName: String):TQuery;overload;
      function getADDRs(tmpSessionName, tmpDatabaseName, Cond:String):TQuery;overload;
      function getADDR(tmpSessionName, tmpDatabaseName, Cond:String):TField;overload;
      function getADDRvalue(tmpSessionName, tmpDatabaseName, Cond:String):String;overload;
      function setADDRvalue(tmpSessionName, tmpDatabaseName:String; Value:String; Cond:String):Boolean;

      function getTELEs(tmpSessionName, tmpDatabaseName: String):TQuery;overload;
      function getTELEs(tmpSessionName, tmpDatabaseName, Cond:String):TQuery;overload;
      function getTELE(tmpSessionName, tmpDatabaseName, Cond:String):TField;overload;
      function getTELEvalue(tmpSessionName, tmpDatabaseName, Cond:String):String;overload;
      function setTELEvalue(tmpSessionName, tmpDatabaseName:String; Value:String; Cond:String):Boolean;

      function getFAXs(tmpSessionName, tmpDatabaseName: String):TQuery;overload;
      function getFAXs(tmpSessionName, tmpDatabaseName, Cond:String):TQuery;overload;
      function getFAX(tmpSessionName, tmpDatabaseName, Cond:String):TField;overload;
      function getFAXvalue(tmpSessionName, tmpDatabaseName, Cond:String):String;overload;
      function setFAXvalue(tmpSessionName, tmpDatabaseName:String; Value:String; Cond:String):Boolean;

      function getCEOs(tmpSessionName, tmpDatabaseName: String):TQuery;overload;
      function getCEOs(tmpSessionName, tmpDatabaseName, Cond:String):TQuery;overload;
      function getCEO(tmpSessionName, tmpDatabaseName, Cond:String):TField;overload;
      function getCEOvalue(tmpSessionName, tmpDatabaseName, Cond:String):String;overload;
      function setCEOvalue(tmpSessionName, tmpDatabaseName:String; Value:String; Cond:String):Boolean;

      function getIDCODEs(tmpSessionName, tmpDatabaseName: String):TQuery;overload;
      function getIDCODEs(tmpSessionName, tmpDatabaseName, Cond:String):TQuery;overload;
      function getIDCODE(tmpSessionName, tmpDatabaseName, Cond:String):TField;overload;
      function getIDCODEvalue(tmpSessionName, tmpDatabaseName, Cond:String):String;overload;
      function setIDCODEvalue(tmpSessionName, tmpDatabaseName:String; Value:String; Cond:String):Boolean;

      function getMTELEs(tmpSessionName, tmpDatabaseName: String):TQuery;overload;
      function getMTELEs(tmpSessionName, tmpDatabaseName, Cond:String):TQuery;overload;
      function getMTELE(tmpSessionName, tmpDatabaseName, Cond:String):TField;overload;
      function getMTELEvalue(tmpSessionName, tmpDatabaseName, Cond:String):String;overload;
      function setMTELEvalue(tmpSessionName, tmpDatabaseName:String; Value:String; Cond:String):Boolean;

      function getNOTEs(tmpSessionName, tmpDatabaseName: String):TQuery;overload;
      function getNOTEs(tmpSessionName, tmpDatabaseName, Cond:String):TQuery;overload;
      function getNOTE(tmpSessionName, tmpDatabaseName, Cond:String):TField;overload;
      function getNOTEvalue(tmpSessionName, tmpDatabaseName, Cond:String):String;overload;
      function setNOTEvalue(tmpSessionName, tmpDatabaseName:String; Value:String; Cond:String):Boolean;
   end;

var
   admin_SYSPABCP: _SYSPABCP;

implementation

function _SYSPABCP.getAllRows(tmpSessionName, tmpDatabaseName: String):TQuery;
begin
   Result := openSQL(tmpSessionName, tmpDatabaseName, Format('Select * from %s', ['SYSPABCP']));
end;

function _SYSPABCP.getAllRows(tmpSessionName, tmpDatabaseName, Cond:String):TQuery;
begin
   Result := openSQL(tmpSessionName, tmpDatabaseName, Format('Select * from %s where %s',['SYSPABCP', Cond]));
end;

function _SYSPABCP.getSomeColumns(tmpSessionName, tmpDatabaseName, ColumnNames:String):TQuery;
begin
   Result := openSQL(tmpSessionName, tmpDatabaseName, Format('Select %s from %s',[ColumnNames, 'SYSPABCP']));
end;

function _SYSPABCP.getSomeColumns(tmpSessionName, tmpDatabaseName, ColumnNames, Cond:String):TQuery;
begin
   Result := openSQL(tmpSessionName, tmpDatabaseName, Format('Select %s from %s where %s',[ColumnNames, 'SYSPABCP', Cond]));
end;

function _SYSPABCP.setSomeColumns(tmpSessionName, tmpDatabaseName: String;FieldNames, Values: Variant) :Boolean;
var
   i,n: Integer;
   NamesCount, ValuesCount:Integer;
   tmpSQL: String;
begin
   Result := False;

   NamesCount := VarArrayHighBound(FieldNames, 1);
   ValuesCount := VarArrayHighBound(Values, 1);

   If NamesCount = ValuesCount then
   begin
      n := NamesCount;

      tmpSQL := Format('Update %s set ',['SYSPABCP']);

      For i:= 0 to n do
      begin
         tmpSQL := tmpSQL + Format('%s = %s',[FieldNames[i], Values[i]]);
         If i < n then
         begin
            tmpSQL := tmpSQL +', ';
         end;
      end;
      Result := execSQL(tmpSessionName, tmpDatabaseName, tmpSQL);
   end;
end;

function _SYSPABCP.Insert(tmpSessionName, tmpDatabaseName: String;Values: Variant):Boolean;
var
   i,n: Integer;
   ValueCount: Integer;
   tmpSQL: String;
begin
   Result := False;

   ValueCount := VarArrayHighBound(Values, 1);

   If ValueCount > 0 then
   begin
      n := ValueCount;

      tmpSQL := Format('Insert into %s values(',['SYSPABCP']);

      For i:= 0 to n do
      begin
         tmpSQL := tmpSQL + Format('%s',[Values[i]]);
         If i < n then
         begin
            tmpSQL := tmpSQL +', ';
         end;
      end;
      tmpSQL := tmpSQL + ')';

      Result := execSQL(tmpSessionName, tmpDatabaseName, tmpSQL);
   end;
end;

function _SYSPABCP.Delete(tmpSessionName, tmpDatabaseName, Cond:String):Boolean;
begin
   Result := execSQL(tmpSessionName, tmpDatabaseName, Format('Delete from %s where %s',['SYSPABCP', Cond]));
end;

function _SYSPABCP.Empty(tmpSessionName, tmpDatabaseName: String):Boolean;
begin
   Result := execSQL(tmpSessionName, tmpDatabaseName, Format('Delete from %s',['SYSPABCP']));
end;


function _SYSPABCP.getZONENOs(tmpSessionName, tmpDatabaseName: String):TQuery;
begin
  Result := openSQL(tmpSessionName, tmpDatabaseName, Format('Select ZONENO from %s',['SYSPABCP']));
end;

function _SYSPABCP.getZONENOs(tmpSessionName, tmpDatabaseName, Cond:String):TQuery;
begin
  Result := openSQL(tmpSessionName, tmpDatabaseName, Format('Select ZONENO from %s where %s',['SYSPABCP', Cond]));
end;

function _SYSPABCP.getZONENO(tmpSessionName, tmpDatabaseName, Cond:String):TField;
var
  Query: TQuery;
begin
  Result := nil;

  Query := getZONENOs(tmpSessionName, tmpDatabaseName, Cond);
  If Not Query.IsEmpty then
  begin
    Result := Query.FieldByName('ZONENO');
  end;
  Query.Free;
end;

function _SYSPABCP.getZONENOvalue(tmpSessionName, tmpDatabaseName, Cond:String):Real;
var
  Query: TQuery;
begin
  Result := -1;

  Query := getZONENOs(tmpSessionName, tmpDatabaseName, Cond);
  If Not Query.IsEmpty then
  begin
    Result := Query.FieldByName('ZONENO').AsVariant;
  end;
  Query.Free;
end;

function _SYSPABCP.setZONENOvalue(tmpSessionName, tmpDatabaseName: String; Value:String; Cond:String):Boolean;
begin
  Result := execSQL(tmpSessionName, tmpDatabaseName, Format('Update %s set ZONENO = %s where %s',
                           ['SYSPABCP', Value, Cond])
                   );
end;

function _SYSPABCP.getBRCHNOs(tmpSessionName, tmpDatabaseName: String):TQuery;
begin
  Result := openSQL(tmpSessionName, tmpDatabaseName, Format('Select BRCHNO from %s',['SYSPABCP']));
end;

function _SYSPABCP.getBRCHNOs(tmpSessionName, tmpDatabaseName, Cond:String):TQuery;
begin
  Result := openSQL(tmpSessionName, tmpDatabaseName, Format('Select BRCHNO from %s where %s',['SYSPABCP', Cond]));
end;

function _SYSPABCP.getBRCHNO(tmpSessionName, tmpDatabaseName, Cond:String):TField;
var
  Query: TQuery;
begin
  Result := nil;

  Query := getBRCHNOs(tmpSessionName, tmpDatabaseName, Cond);
  If Not Query.IsEmpty then
  begin
    Result := Query.FieldByName('BRCHNO');
  end;
  Query.Free;
end;

function _SYSPABCP.getBRCHNOvalue(tmpSessionName, tmpDatabaseName, Cond:String):Real;
var
  Query: TQuery;
begin
  Result := -1;

  Query := getBRCHNOs(tmpSessionName, tmpDatabaseName, Cond);
  If Not Query.IsEmpty then
  begin
    Result := Query.FieldByName('BRCHNO').AsVariant;
  end;
  Query.Free;
end;

function _SYSPABCP.setBRCHNOvalue(tmpSessionName, tmpDatabaseName: String; Value:String; Cond:String):Boolean;
begin
  Result := execSQL(tmpSessionName, tmpDatabaseName, Format('Update %s set BRCHNO = %s where %s',
                           ['SYSPABCP', Value, Cond])
                   );
end;

function _SYSPABCP.getBNAMEs(tmpSessionName, tmpDatabaseName: String):TQuery;
begin
  Result := openSQL(tmpSessionName, tmpDatabaseName, Format('Select BNAME from %s',['SYSPABCP']));
end;

function _SYSPABCP.getBNAMEs(tmpSessionName, tmpDatabaseName, Cond:String):TQuery;
begin
  Result := openSQL(tmpSessionName, tmpDatabaseName, Format('Select BNAME from %s where %s',['SYSPABCP', Cond]));
end;

function _SYSPABCP.getBNAME(tmpSessionName, tmpDatabaseName, Cond:String):TField;
var
  Query: TQuery;
begin
  Result := nil;

  Query := getBNAMEs(tmpSessionName, tmpDatabaseName, Cond);
  If Not Query.IsEmpty then
  begin
    Result := Query.FieldByName('BNAME');
  end;
  Query.Free;
end;

function _SYSPABCP.getBNAMEvalue(tmpSessionName, tmpDatabaseName, Cond:String):String;
var
  Query: TQuery;
begin
  Result := 'null';

  Query := getBNAMEs(tmpSessionName, tmpDatabaseName, Cond);
  If Not Query.IsEmpty then
  begin
    Result := Query.FieldByName('BNAME').AsString;
  end;
  Query.Free;
end;

function _SYSPABCP.setBNAMEvalue(tmpSessionName, tmpDatabaseName: String; Value:String; Cond:String):Boolean;
begin
  Result := execSQL(tmpSessionName, tmpDatabaseName, Format('Update %s set BNAME = %s where %s',
                           ['SYSPABCP', Value, Cond])
                   );
end;

function _SYSPABCP.getSNAMEs(tmpSessionName, tmpDatabaseName: String):TQuery;
begin
  Result := openSQL(tmpSessionName, tmpDatabaseName, Format('Select SNAME from %s',['SYSPABCP']));
end;

function _SYSPABCP.getSNAMEs(tmpSessionName, tmpDatabaseName, Cond:String):TQuery;
begin
  Result := openSQL(tmpSessionName, tmpDatabaseName, Format('Select SNAME from %s where %s',['SYSPABCP', Cond]));
end;

function _SYSPABCP.getSNAME(tmpSessionName, tmpDatabaseName, Cond:String):TField;
var
  Query: TQuery;
begin
  Result := nil;

  Query := getSNAMEs(tmpSessionName, tmpDatabaseName, Cond);
  If Not Query.IsEmpty then
  begin
    Result := Query.FieldByName('SNAME');
  end;
  Query.Free;
end;

function _SYSPABCP.getSNAMEvalue(tmpSessionName, tmpDatabaseName, Cond:String):String;
var
  Query: TQuery;
begin
  Result := 'null';

  Query := getSNAMEs(tmpSessionName, tmpDatabaseName, Cond);
  If Not Query.IsEmpty then
  begin
    Result := Query.FieldByName('SNAME').AsString;
  end;
  Query.Free;
end;

function _SYSPABCP.setSNAMEvalue(tmpSessionName, tmpDatabaseName: String; Value:String; Cond:String):Boolean;
begin
  Result := execSQL(tmpSessionName, tmpDatabaseName, Format('Update %s set SNAME = %s where %s',
                           ['SYSPABCP', Value, Cond])
                   );
end;

function _SYSPABCP.getKINKs(tmpSessionName, tmpDatabaseName: String):TQuery;
begin
  Result := openSQL(tmpSessionName, tmpDatabaseName, Format('Select KINK from %s',['SYSPABCP']));
end;

function _SYSPABCP.getKINKs(tmpSessionName, tmpDatabaseName, Cond:String):TQuery;
begin
  Result := openSQL(tmpSessionName, tmpDatabaseName, Format('Select KINK from %s where %s',['SYSPABCP', Cond]));
end;

function _SYSPABCP.getKINK(tmpSessionName, tmpDatabaseName, Cond:String):TField;
var
  Query: TQuery;
begin
  Result := nil;

  Query := getKINKs(tmpSessionName, tmpDatabaseName, Cond);
  If Not Query.IsEmpty then
  begin
    Result := Query.FieldByName('KINK');
  end;
  Query.Free;
end;

function _SYSPABCP.getKINKvalue(tmpSessionName, tmpDatabaseName, Cond:String):Real;
var
  Query: TQuery;
begin
  Result := -1;

  Query := getKINKs(tmpSessionName, tmpDatabaseName, Cond);
  If Not Query.IsEmpty then
  begin
    Result := Query.FieldByName('KINK').AsVariant;
  end;
  Query.Free;
end;

function _SYSPABCP.setKINKvalue(tmpSessionName, tmpDatabaseName: String; Value:String; Cond:String):Boolean;
begin
  Result := execSQL(tmpSessionName, tmpDatabaseName, Format('Update %s set KINK = %s where %s',
                           ['SYSPABCP', Value, Cond])
                   );
end;

function _SYSPABCP.getSTATUSs(tmpSessionName, tmpDatabaseName: String):TQuery;
begin
  Result := openSQL(tmpSessionName, tmpDatabaseName, Format('Select STATUS from %s',['SYSPABCP']));
end;

function _SYSPABCP.getSTATUSs(tmpSessionName, tmpDatabaseName, Cond:String):TQuery;
begin
  Result := openSQL(tmpSessionName, tmpDatabaseName, Format('Select STATUS from %s where %s',['SYSPABCP', Cond]));
end;

function _SYSPABCP.getSTATUS(tmpSessionName, tmpDatabaseName, Cond:String):TField;
var
  Query: TQuery;
begin
  Result := nil;

  Query := getSTATUSs(tmpSessionName, tmpDatabaseName, Cond);
  If Not Query.IsEmpty then
  begin
    Result := Query.FieldByName('STATUS');
  end;
  Query.Free;
end;

function _SYSPABCP.getSTATUSvalue(tmpSessionName, tmpDatabaseName, Cond:String):Real;
var
  Query: TQuery;
begin
  Result := -1;

  Query := getSTATUSs(tmpSessionName, tmpDatabaseName, Cond);
  If Not Query.IsEmpty then
  begin
    Result := Query.FieldByName('STATUS').AsVariant;
  end;
  Query.Free;
end;

function _SYSPABCP.setSTATUSvalue(tmpSessionName, tmpDatabaseName: String; Value:String; Cond:String):Boolean;
begin
  Result := execSQL(tmpSessionName, tmpDatabaseName, Format('Update %s set STATUS = %s where %s',
                           ['SYSPABCP', Value, Cond])
                   );
end;

function _SYSPABCP.getADDRs(tmpSessionName, tmpDatabaseName: String):TQuery;
begin
  Result := openSQL(tmpSessionName, tmpDatabaseName, Format('Select ADDR from %s',['SYSPABCP']));
end;

function _SYSPABCP.getADDRs(tmpSessionName, tmpDatabaseName, Cond:String):TQuery;
begin
  Result := openSQL(tmpSessionName, tmpDatabaseName, Format('Select ADDR from %s where %s',['SYSPABCP', Cond]));
end;

function _SYSPABCP.getADDR(tmpSessionName, tmpDatabaseName, Cond:String):TField;
var
  Query: TQuery;
begin
  Result := nil;

  Query := getADDRs(tmpSessionName, tmpDatabaseName, Cond);
  If Not Query.IsEmpty then
  begin
    Result := Query.FieldByName('ADDR');
  end;
  Query.Free;
end;

function _SYSPABCP.getADDRvalue(tmpSessionName, tmpDatabaseName, Cond:String):String;
var
  Query: TQuery;
begin
  Result := 'null';

  Query := getADDRs(tmpSessionName, tmpDatabaseName, Cond);
  If Not Query.IsEmpty then
  begin
    Result := Query.FieldByName('ADDR').AsString;
  end;
  Query.Free;
end;

function _SYSPABCP.setADDRvalue(tmpSessionName, tmpDatabaseName: String; Value:String; Cond:String):Boolean;
begin
  Result := execSQL(tmpSessionName, tmpDatabaseName, Format('Update %s set ADDR = %s where %s',
                           ['SYSPABCP', Value, Cond])
                   );
end;

function _SYSPABCP.getTELEs(tmpSessionName, tmpDatabaseName: String):TQuery;
begin
  Result := openSQL(tmpSessionName, tmpDatabaseName, Format('Select TELE from %s',['SYSPABCP']));
end;

function _SYSPABCP.getTELEs(tmpSessionName, tmpDatabaseName, Cond:String):TQuery;
begin
  Result := openSQL(tmpSessionName, tmpDatabaseName, Format('Select TELE from %s where %s',['SYSPABCP', Cond]));
end;

function _SYSPABCP.getTELE(tmpSessionName, tmpDatabaseName, Cond:String):TField;
var
  Query: TQuery;
begin
  Result := nil;

  Query := getTELEs(tmpSessionName, tmpDatabaseName, Cond);
  If Not Query.IsEmpty then
  begin
    Result := Query.FieldByName('TELE');
  end;
  Query.Free;
end;

function _SYSPABCP.getTELEvalue(tmpSessionName, tmpDatabaseName, Cond:String):String;
var
  Query: TQuery;
begin
  Result := 'null';

  Query := getTELEs(tmpSessionName, tmpDatabaseName, Cond);
  If Not Query.IsEmpty then
  begin
    Result := Query.FieldByName('TELE').AsString;
  end;
  Query.Free;
end;

function _SYSPABCP.setTELEvalue(tmpSessionName, tmpDatabaseName: String; Value:String; Cond:String):Boolean;
begin
  Result := execSQL(tmpSessionName, tmpDatabaseName, Format('Update %s set TELE = %s where %s',
                           ['SYSPABCP', Value, Cond])
                   );
end;

function _SYSPABCP.getFAXs(tmpSessionName, tmpDatabaseName: String):TQuery;
begin
  Result := openSQL(tmpSessionName, tmpDatabaseName, Format('Select FAX from %s',['SYSPABCP']));
end;

function _SYSPABCP.getFAXs(tmpSessionName, tmpDatabaseName, Cond:String):TQuery;
begin
  Result := openSQL(tmpSessionName, tmpDatabaseName, Format('Select FAX from %s where %s',['SYSPABCP', Cond]));
end;

function _SYSPABCP.getFAX(tmpSessionName, tmpDatabaseName, Cond:String):TField;
var
  Query: TQuery;
begin
  Result := nil;

  Query := getFAXs(tmpSessionName, tmpDatabaseName, Cond);
  If Not Query.IsEmpty then
  begin
    Result := Query.FieldByName('FAX');
  end;
  Query.Free;
end;

function _SYSPABCP.getFAXvalue(tmpSessionName, tmpDatabaseName, Cond:String):String;
var
  Query: TQuery;
begin
  Result := 'null';

  Query := getFAXs(tmpSessionName, tmpDatabaseName, Cond);
  If Not Query.IsEmpty then
  begin
    Result := Query.FieldByName('FAX').AsString;
  end;
  Query.Free;
end;

function _SYSPABCP.setFAXvalue(tmpSessionName, tmpDatabaseName: String; Value:String; Cond:String):Boolean;
begin
  Result := execSQL(tmpSessionName, tmpDatabaseName, Format('Update %s set FAX = %s where %s',
                           ['SYSPABCP', Value, Cond])
                   );
end;

function _SYSPABCP.getCEOs(tmpSessionName, tmpDatabaseName: String):TQuery;
begin
  Result := openSQL(tmpSessionName, tmpDatabaseName, Format('Select CEO from %s',['SYSPABCP']));
end;

function _SYSPABCP.getCEOs(tmpSessionName, tmpDatabaseName, Cond:String):TQuery;
begin
  Result := openSQL(tmpSessionName, tmpDatabaseName, Format('Select CEO from %s where %s',['SYSPABCP', Cond]));
end;

function _SYSPABCP.getCEO(tmpSessionName, tmpDatabaseName, Cond:String):TField;
var
  Query: TQuery;
begin
  Result := nil;

  Query := getCEOs(tmpSessionName, tmpDatabaseName, Cond);
  If Not Query.IsEmpty then
  begin
    Result := Query.FieldByName('CEO');
  end;
  Query.Free;
end;

function _SYSPABCP.getCEOvalue(tmpSessionName, tmpDatabaseName, Cond:String):String;
var
  Query: TQuery;
begin
  Result := 'null';

  Query := getCEOs(tmpSessionName, tmpDatabaseName, Cond);
  If Not Query.IsEmpty then
  begin
    Result := Query.FieldByName('CEO').AsString;
  end;
  Query.Free;
end;

function _SYSPABCP.setCEOvalue(tmpSessionName, tmpDatabaseName: String; Value:String; Cond:String):Boolean;
begin
  Result := execSQL(tmpSessionName, tmpDatabaseName, Format('Update %s set CEO = %s where %s',
                           ['SYSPABCP', Value, Cond])
                   );
end;

function _SYSPABCP.getIDCODEs(tmpSessionName, tmpDatabaseName: String):TQuery;
begin
  Result := openSQL(tmpSessionName, tmpDatabaseName, Format('Select IDCODE from %s',['SYSPABCP']));
end;

function _SYSPABCP.getIDCODEs(tmpSessionName, tmpDatabaseName, Cond:String):TQuery;
begin
  Result := openSQL(tmpSessionName, tmpDatabaseName, Format('Select IDCODE from %s where %s',['SYSPABCP', Cond]));
end;

function _SYSPABCP.getIDCODE(tmpSessionName, tmpDatabaseName, Cond:String):TField;
var
  Query: TQuery;
begin
  Result := nil;

  Query := getIDCODEs(tmpSessionName, tmpDatabaseName, Cond);
  If Not Query.IsEmpty then
  begin
    Result := Query.FieldByName('IDCODE');
  end;
  Query.Free;
end;

function _SYSPABCP.getIDCODEvalue(tmpSessionName, tmpDatabaseName, Cond:String):String;
var
  Query: TQuery;
begin
  Result := 'null';

  Query := getIDCODEs(tmpSessionName, tmpDatabaseName, Cond);
  If Not Query.IsEmpty then
  begin
    Result := Query.FieldByName('IDCODE').AsString;
  end;
  Query.Free;
end;

function _SYSPABCP.setIDCODEvalue(tmpSessionName, tmpDatabaseName: String; Value:String; Cond:String):Boolean;
begin
  Result := execSQL(tmpSessionName, tmpDatabaseName, Format('Update %s set IDCODE = %s where %s',
                           ['SYSPABCP', Value, Cond])
                   );
end;

function _SYSPABCP.getMTELEs(tmpSessionName, tmpDatabaseName: String):TQuery;
begin
  Result := openSQL(tmpSessionName, tmpDatabaseName, Format('Select MTELE from %s',['SYSPABCP']));
end;

function _SYSPABCP.getMTELEs(tmpSessionName, tmpDatabaseName, Cond:String):TQuery;
begin
  Result := openSQL(tmpSessionName, tmpDatabaseName, Format('Select MTELE from %s where %s',['SYSPABCP', Cond]));
end;

function _SYSPABCP.getMTELE(tmpSessionName, tmpDatabaseName, Cond:String):TField;
var
  Query: TQuery;
begin
  Result := nil;

  Query := getMTELEs(tmpSessionName, tmpDatabaseName, Cond);
  If Not Query.IsEmpty then
  begin
    Result := Query.FieldByName('MTELE');
  end;
  Query.Free;
end;

function _SYSPABCP.getMTELEvalue(tmpSessionName, tmpDatabaseName, Cond:String):String;
var
  Query: TQuery;
begin
  Result := 'null';

  Query := getMTELEs(tmpSessionName, tmpDatabaseName, Cond);
  If Not Query.IsEmpty then
  begin
    Result := Query.FieldByName('MTELE').AsString;
  end;
  Query.Free;
end;

function _SYSPABCP.setMTELEvalue(tmpSessionName, tmpDatabaseName: String; Value:String; Cond:String):Boolean;
begin
  Result := execSQL(tmpSessionName, tmpDatabaseName, Format('Update %s set MTELE = %s where %s',
                           ['SYSPABCP', Value, Cond])
                   );
end;

function _SYSPABCP.getNOTEs(tmpSessionName, tmpDatabaseName: String):TQuery;
begin
  Result := openSQL(tmpSessionName, tmpDatabaseName, Format('Select NOTE from %s',['SYSPABCP']));
end;

function _SYSPABCP.getNOTEs(tmpSessionName, tmpDatabaseName, Cond:String):TQuery;
begin
  Result := openSQL(tmpSessionName, tmpDatabaseName, Format('Select NOTE from %s where %s',['SYSPABCP', Cond]));
end;

function _SYSPABCP.getNOTE(tmpSessionName, tmpDatabaseName, Cond:String):TField;
var
  Query: TQuery;
begin
  Result := nil;

  Query := getNOTEs(tmpSessionName, tmpDatabaseName, Cond);
  If Not Query.IsEmpty then
  begin
    Result := Query.FieldByName('NOTE');
  end;
  Query.Free;
end;

function _SYSPABCP.getNOTEvalue(tmpSessionName, tmpDatabaseName, Cond:String):String;
var
  Query: TQuery;
begin
  Result := 'null';

  Query := getNOTEs(tmpSessionName, tmpDatabaseName, Cond);
  If Not Query.IsEmpty then
  begin
    Result := Query.FieldByName('NOTE').AsString;
  end;
  Query.Free;
end;

function _SYSPABCP.setNOTEvalue(tmpSessionName, tmpDatabaseName: String; Value:String; Cond:String):Boolean;
begin
  Result := execSQL(tmpSessionName, tmpDatabaseName, Format('Update %s set NOTE = %s where %s',
                           ['SYSPABCP', Value, Cond])
                   );
end;
end.
