Witam
Nie wiem jak pozbyć się warning -ów
[Warning] Unit1.pas(138): Variable 'ZQuery5' might not have been initialized
[Warning] Unit1.pas(157): Return value of function 'TForm1.VpFlexDataStore1GetNextID' might be undefined
podaje kod
procedure TForm1.Button1Click(Sender: TObject);
begin
VpResourceEditDialog1.AddNewResource;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
close;
end;
procedure TForm1.TrackBar1Change(Sender: TObject);
begin
VpDayView1.NumDays := TrackBar1.Position;
end;
procedure TForm1.GranularityComboChange(Sender: TObject);
begin
case GranularityCombo.ItemIndex of
0: VpDayView1.Granularity := GR05Min;
1: VpDayView1.Granularity := GR06Min;
2: VpDayView1.Granularity := GR10Min;
3: VpDayView1.Granularity := GR15Min;
4: VpDayView1.Granularity := GR20Min;
5: VpDayView1.Granularity := GR30Min;
6: VpDayView1.Granularity := GR60Min;
end;
end;
procedure TForm1.CheckBox1Click(Sender: TObject);
begin
VpDayView1.IncludeWeekends := CheckBox1.Checked;
end;
procedure TForm1.VpFlexDataStore1Connect(Sender: TObject);
begin
ZConnection1.Database := 'fryzjerzy';
ZConnection1.Connect;
ZQuery1.ExecSQL;
ZQuery1.SQL.Clear;
ZQuery1.SQL.Add('select * from resources');
ZQuery1.Active := true;
end;
procedure TForm1.VpFlexDataStore1CreateTable(Sender: TObject;
TableName: String);
begin
ZConnection1.Database := 'fryzjerzy';
ZConnection1.Connect;
ZQuery2.SQL.Clear;
ZQuery2.SQL.Add('DROP TABLE IF EXISTS resources');
ZQuery2.ExecSQL;
ZQuery2.SQL.Clear;
ZQuery2.SQL.Add('CREATE TABLE resource (resourceid INT NOT NULL AUTO_INCREMENT,description VARCHAR(20),notes VARCHAR(20),imageindex INT NOT NULL,resourceactive VARCHAR(20),userfield0 VARCHAR(20),userfield1 VARCHAR(20),userfield2 VARCHAR(20), PRIMARY KEY(resourceid));');
ZQuery2.ExecSQL;
ZQuery2.SQL.Clear;
ZQuery2.SQL.Add('select * from resource');
ZQuery2.Active := true;
end;
function TForm1.VpFlexDataStore1GetNextID(Sender: TObject;
TableName: String): Integer;
var
ZQuery5: TZQuery;
GotIt: Boolean;
recordID : Integer;
FieldName: string;
begin
recordid := 0;
ZConnection1.Database := 'fryzjerzy';
ZConnection1.Connect;
ZQuery5.SQL.Clear;
ZQuery5.SQL.Add('DROP TABLE IF EXISTS recordid');
ZQuery5.ExecSQL;
ZQuery5.SQL.Clear;
ZQuery5.SQL.Add('CREATE TABLE recordid (resourceid INT NOT NULL AUTO_INCREMENT,eventid INT,contactid INT,taskid INT ,PRIMARY KEY(resourceid))');
ZQuery5.ExecSQL;
ZQuery5.SQL.Clear;
ZQuery5.SQL.Add('select * from recordid');
ZQuery5.Active := true;
ZQuery5.SQL.Text := 'Update ' + TableName + ' Set ' + FieldName
+ ' = :NewID Where (' + FieldName + ' = :OldID)';
GotIt := false;
while not GotIt do begin
Inc(recordID);
ZQuery5.ParamByName('recordid').AsInteger := recordID;
zQuery5.ParamByName('recordid').AsInteger := recordID - 1;
end;
end;
end.