unit i_SYSPATEL;

interface

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

type
   _SYSPATEL = 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 getTELLNOs(tmpSessionName, tmpDatabaseName: String):TQuery;overload;
      function getTELLNOs(tmpSessionName, tmpDatabaseName, Cond:String):TQuery;overload;
      function getTELLNO(tmpSessionName, tmpDatabaseName, Cond:String):TField;overload;
      function getTELLNOvalue(tmpSessionName, tmpDatabaseName, Cond:String):Real;overload;
      function setTELLNOvalue(tmpSessionName, tmpDatabaseName:String; Value:String; Cond:String):Boolean;

      function getSLEVELs(tmpSessionName, tmpDatabaseName: String):TQuery;overload;
      function getSLEVELs(tmpSessionName, tmpDatabaseName, Cond:String):TQuery;overload;
      function getSLEVEL(tmpSessionName, tmpDatabaseName, Cond:String):TField;overload;
      function getSLEVELvalue(tmpSessionName, tmpDatabaseName, Cond:String):Real;overload;
      function setSLEVELvalue(tmpSessionName, tmpDatabaseName:String; Value:String; Cond: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 getNAMEs(tmpSessionName, tmpDatabaseName: String):TQuery;overload;
      function getNAMEs(tmpSessionName, tmpDatabaseName, Cond:String):TQuery;overload;
      function getNAME(tmpSessionName, tmpDatabaseName, Cond:String):TField;overload;
      function getNAMEvalue(tmpSessionName, tmpDatabaseName, Cond:String):String;overload;
      function setNAMEvalue(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 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 getPSWs(tmpSessionName, tmpDatabaseName: String):TQuery;overload;
      function getPSWs(tmpSessionName, tmpDatabaseName, Cond:String):TQuery;overload;
      function getPSW(tmpSessionName, tmpDatabaseName, Cond:String):TField;overload;
      function getPSWvalue(tmpSessionName, tmpDatabaseName, Cond:String):Real;overload;
      function setPSWvalue(tmpSessionName, tmpDatabaseName:String; Value:String; Cond:String):Boolean;

      function getSIGNDATEs(tmpSessionName, tmpDatabaseName: String):TQuery;overload;
      function getSIGNDATEs(tmpSessionName, tmpDatabaseName, Cond:String):TQuery;overload;
      function getSIGNDATE(tmpSessionName, tmpDatabaseName, Cond:String):TField;overload;
      function getSIGNDATEvalue(tmpSessionName, tmpDatabaseName, Cond:String):String;overload;
      function setSIGNDATEvalue(tmpSessionName, tmpDatabaseName:String; Value:String; Cond:String):Boolean;

      function getEXPIREDATEs(tmpSessionName, tmpDatabaseName: String):TQuery;overload;
      function getEXPIREDATEs(tmpSessionName, tmpDatabaseName, Cond:String):TQuery;overload;
      function getEXPIREDATE(tmpSessionName, tmpDatabaseName, Cond:String):TField;overload;
      function getEXPIREDATEvalue(tmpSessionName, tmpDatabaseName, Cond:String):String;overload;
      function setEXPIREDATEvalue(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_SYSPATEL: _SYSPATEL;

implementation

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

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

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

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

function _SYSPATEL.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 ',['SYSPATEL']);

      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 _SYSPATEL.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(',['SYSPATEL']);

      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 _SYSPATEL.Delete(tmpSessionName, tmpDatabaseName, Cond:String):Boolean;
begin
   Result := execSQL(tmpSessionName, tmpDatabaseName, Format('Delete from %s where %s',['SYSPATEL', Cond]));
end;

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


function _SYSPATEL.getTELLNOs(tmpSessionName, tmpDatabaseName: String):TQuery;
begin
  Result := openSQL(tmpSessionName, tmpDatabaseName, Format('Select TELLNO from %s',['SYSPATEL']));
end;

function _SYSPATEL.getTELLNOs(tmpSessionName, tmpDatabaseName, Cond:String):TQuery;
begin
  Result := openSQL(tmpSessionName, tmpDatabaseName, Format('Select TELLNO from %s where %s',['SYSPATEL', Cond]));
end;

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

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

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

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

function _SYSPATEL.setTELLNOvalue(tmpSessionName, tmpDatabaseName: String; Value:String; Cond:String):Boolean;
begin
  Result := execSQL(tmpSessionName, tmpDatabaseName, Format('Update %s set TELLNO = %s where %s',
                           ['SYSPATEL', Value, Cond])
                   );
end;

function _SYSPATEL.getSLEVELs(tmpSessionName, tmpDatabaseName: String):TQuery;
begin
  Result := openSQL(tmpSessionName, tmpDatabaseName, Format('Select SLEVEL from %s',['SYSPATEL']));
end;

function _SYSPATEL.getSLEVELs(tmpSessionName, tmpDatabaseName, Cond:String):TQuery;
begin
  Result := openSQL(tmpSessionName, tmpDatabaseName, Format('Select SLEVEL from %s where %s',['SYSPATEL', Cond]));
end;

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

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

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

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

function _SYSPATEL.setSLEVELvalue(tmpSessionName, tmpDatabaseName: String; Value:String; Cond:String):Boolean;
begin
  Result := execSQL(tmpSessionName, tmpDatabaseName, Format('Update %s set SLEVEL = %s where %s',
                           ['SYSPATEL', Value, Cond])
                   );
end;

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

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

function _SYSPATEL.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 _SYSPATEL.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 _SYSPATEL.setZONENOvalue(tmpSessionName, tmpDatabaseName: String; Value:String; Cond:String):Boolean;
begin
  Result := execSQL(tmpSessionName, tmpDatabaseName, Format('Update %s set ZONENO = %s where %s',
                           ['SYSPATEL', Value, Cond])
                   );
end;

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

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

function _SYSPATEL.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 _SYSPATEL.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 _SYSPATEL.setBRCHNOvalue(tmpSessionName, tmpDatabaseName: String; Value:String; Cond:String):Boolean;
begin
  Result := execSQL(tmpSessionName, tmpDatabaseName, Format('Update %s set BRCHNO = %s where %s',
                           ['SYSPATEL', Value, Cond])
                   );
end;

function _SYSPATEL.getNAMEs(tmpSessionName, tmpDatabaseName: String):TQuery;
begin
  Result := openSQL(tmpSessionName, tmpDatabaseName, Format('Select NAME from %s',['SYSPATEL']));
end;

function _SYSPATEL.getNAMEs(tmpSessionName, tmpDatabaseName, Cond:String):TQuery;
begin
  Result := openSQL(tmpSessionName, tmpDatabaseName, Format('Select NAME from %s where %s',['SYSPATEL', Cond]));
end;

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

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

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

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

function _SYSPATEL.setNAMEvalue(tmpSessionName, tmpDatabaseName: String; Value:String; Cond:String):Boolean;
begin
  Result := execSQL(tmpSessionName, tmpDatabaseName, Format('Update %s set NAME = %s where %s',
                           ['SYSPATEL', Value, Cond])
                   );
end;

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

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

function _SYSPATEL.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 _SYSPATEL.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 _SYSPATEL.setIDCODEvalue(tmpSessionName, tmpDatabaseName: String; Value:String; Cond:String):Boolean;
begin
  Result := execSQL(tmpSessionName, tmpDatabaseName, Format('Update %s set IDCODE = %s where %s',
                           ['SYSPATEL', Value, Cond])
                   );
end;

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

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

function _SYSPATEL.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 _SYSPATEL.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 _SYSPATEL.setSTATUSvalue(tmpSessionName, tmpDatabaseName: String; Value:String; Cond:String):Boolean;
begin
  Result := execSQL(tmpSessionName, tmpDatabaseName, Format('Update %s set STATUS = %s where %s',
                           ['SYSPATEL', Value, Cond])
                   );
end;

function _SYSPATEL.getPSWs(tmpSessionName, tmpDatabaseName: String):TQuery;
begin
  Result := openSQL(tmpSessionName, tmpDatabaseName, Format('Select PSW from %s',['SYSPATEL']));
end;

function _SYSPATEL.getPSWs(tmpSessionName, tmpDatabaseName, Cond:String):TQuery;
begin
  Result := openSQL(tmpSessionName, tmpDatabaseName, Format('Select PSW from %s where %s',['SYSPATEL', Cond]));
end;

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

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

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

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

function _SYSPATEL.setPSWvalue(tmpSessionName, tmpDatabaseName: String; Value:String; Cond:String):Boolean;
begin
  Result := execSQL(tmpSessionName, tmpDatabaseName, Format('Update %s set PSW = %s where %s',
                           ['SYSPATEL', Value, Cond])
                   );
end;

function _SYSPATEL.getSIGNDATEs(tmpSessionName, tmpDatabaseName: String):TQuery;
begin
  Result := openSQL(tmpSessionName, tmpDatabaseName, Format('Select SIGNDATE from %s',['SYSPATEL']));
end;

function _SYSPATEL.getSIGNDATEs(tmpSessionName, tmpDatabaseName, Cond:String):TQuery;
begin
  Result := openSQL(tmpSessionName, tmpDatabaseName, Format('Select SIGNDATE from %s where %s',['SYSPATEL', Cond]));
end;

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

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

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

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

function _SYSPATEL.setSIGNDATEvalue(tmpSessionName, tmpDatabaseName: String; Value:String; Cond:String):Boolean;
begin
  Result := execSQL(tmpSessionName, tmpDatabaseName, Format('Update %s set SIGNDATE = %s where %s',
                           ['SYSPATEL', Value, Cond])
                   );
end;

function _SYSPATEL.getEXPIREDATEs(tmpSessionName, tmpDatabaseName: String):TQuery;
begin
  Result := openSQL(tmpSessionName, tmpDatabaseName, Format('Select EXPIREDATE from %s',['SYSPATEL']));
end;

function _SYSPATEL.getEXPIREDATEs(tmpSessionName, tmpDatabaseName, Cond:String):TQuery;
begin
  Result := openSQL(tmpSessionName, tmpDatabaseName, Format('Select EXPIREDATE from %s where %s',['SYSPATEL', Cond]));
end;

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

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

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

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

function _SYSPATEL.setEXPIREDATEvalue(tmpSessionName, tmpDatabaseName: String; Value:String; Cond:String):Boolean;
begin
  Result := execSQL(tmpSessionName, tmpDatabaseName, Format('Update %s set EXPIREDATE = %s where %s',
                           ['SYSPATEL', Value, Cond])
                   );
end;

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

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

function _SYSPATEL.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 _SYSPATEL.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 _SYSPATEL.setNOTEvalue(tmpSessionName, tmpDatabaseName: String; Value:String; Cond:String):Boolean;
begin
  Result := execSQL(tmpSessionName, tmpDatabaseName, Format('Update %s set NOTE = %s where %s',
                           ['SYSPATEL', Value, Cond])
                   );
end;
end.
