tvplanit: declare IDs as Integer again, not Int64 - causing too much trouble with TVpIniDataStore

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4853 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2016-06-28 13:43:32 +00:00
parent ad9d8a833d
commit e2c8f958b2
12 changed files with 48 additions and 48 deletions

View File

@ -71,7 +71,7 @@ type
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
function GetNextID(TableName: string): int64; override; function GetNextID(TableName: string): integer; override;
procedure Load; override; procedure Load; override;
procedure CreateTable(TableName: string); procedure CreateTable(TableName: string);
procedure CreateIndexDefs(const TableName : string; procedure CreateIndexDefs(const TableName : string;
@ -220,7 +220,7 @@ begin
end; end;
{=====} {=====}
function TVpAdvDataStore.GetNextID(TableName: string): Int64; function TVpAdvDataStore.GetNextID(TableName: string): Integer;
var var
Query: TAdsQuery; Query: TAdsQuery;
GotIt: Boolean; GotIt: Boolean;

View File

@ -239,7 +239,7 @@ type
procedure DeregisterAllWatchers; procedure DeregisterAllWatchers;
procedure DeregisterWatcher (Watcher : THandle); procedure DeregisterWatcher (Watcher : THandle);
function GetNextID(TableName: string): Int64; virtual; abstract; function GetNextID(TableName: string): Integer; virtual; abstract;
property Resources: TVpResources read FResources; property Resources: TVpResources read FResources;
procedure Load; virtual; procedure Load; virtual;
procedure LoadEvents; virtual; abstract; procedure LoadEvents; virtual; abstract;

View File

@ -79,7 +79,7 @@ type
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
function GetNextID(TableName: string): int64; override; function GetNextID(TableName: string): integer; override;
procedure Load; override; procedure Load; override;
procedure CreateTable(TableName: string); procedure CreateTable(TableName: string);
procedure CreateIndexDefs(const TableName : string; procedure CreateIndexDefs(const TableName : string;
@ -250,7 +250,7 @@ begin
end; end;
{=====} {=====}
function TVpBDEDataStore.GetNextID(TableName: string): Int64; function TVpBDEDataStore.GetNextID(TableName: string): Integer;
var var
Query: TQuery; Query: TQuery;
GotIt: Boolean; GotIt: Boolean;

View File

@ -28,7 +28,7 @@ type
function GetTasksTable: TDataset; override; function GetTasksTable: TDataset; override;
{ ancestor methods } { ancestor methods }
function GetNextID(TableName: string): int64; override; function GetNextID(TableName: string): integer; override;
procedure Loaded; override; procedure Loaded; override;
procedure SetConnected(const Value: boolean); override; procedure SetConnected(const Value: boolean); override;
@ -153,7 +153,7 @@ begin
Result := FContactsTable; Result := FContactsTable;
end; end;
function TVpBufDSDataStore.GetNextID(TableName: string): int64; function TVpBufDSDataStore.GetNextID(TableName: string): integer;
begin begin
{ This is not needed in the BufDataset datastore as these tables use { This is not needed in the BufDataset datastore as these tables use
autoincrement fields. } autoincrement fields. }

View File

@ -74,20 +74,20 @@ type
FOwner: TObject; FOwner: TObject;
FResourceList: TList; FResourceList: TList;
function Compare(Descr1, Descr2: string): Integer; function Compare(Descr1, Descr2: string): Integer;
function GetItem(Index: Int64): TVpResource; function GetItem(Index: Integer): TVpResource;
function GetCount: Integer; function GetCount: Integer;
function NextResourceID: Int64; function NextResourceID: Integer;
public public
constructor Create(Owner: TObject); constructor Create(Owner: TObject);
destructor Destroy; override; destructor Destroy; override;
function AddResource(ResID: Int64): TVpResource; function AddResource(ResID: Integer): TVpResource;
function FindResourceByName(AName : string) : TVpResource; function FindResourceByName(AName : string) : TVpResource;
function GetResource(ID: Integer): TVpResource; function GetResource(ID: Integer): TVpResource;
procedure ClearResources; procedure ClearResources;
procedure RemoveResource(Resource: TVpResource); procedure RemoveResource(Resource: TVpResource);
procedure Sort; procedure Sort;
property Count: Integer read GetCount; property Count: Integer read GetCount;
property Items[Index: Int64]: TVpResource read GetItem; property Items[Index: Integer]: TVpResource read GetItem;
property Owner: TObject read FOwner; property Owner: TObject read FOwner;
end; end;
@ -172,9 +172,9 @@ type
public public
constructor Create(Owner: TVpResource); constructor Create(Owner: TVpResource);
destructor Destroy; override; destructor Destroy; override;
function AddEvent(RecordID: Int64; StartTime, EndTime: TDateTime): TVpEvent; function AddEvent(RecordID: Integer; StartTime, EndTime: TDateTime): TVpEvent;
procedure DeleteEvent(Event: TVpEvent); procedure DeleteEvent(Event: TVpEvent);
function GetEvent(Index: Int64): TVpEvent; function GetEvent(Index: Integer): TVpEvent;
function RepeatsOn(Event: TVpEvent; Day: TDateTime): Boolean; function RepeatsOn(Event: TVpEvent; Day: TDateTime): Boolean;
procedure Sort; procedure Sort;
procedure ClearEvents; procedure ClearEvents;
@ -203,7 +203,7 @@ type
FAlarmAdv: Integer; FAlarmAdv: Integer;
FAlertDisplayed: Boolean; FAlertDisplayed: Boolean;
FAlarmAdvType: TVpAlarmAdvType; FAlarmAdvType: TVpAlarmAdvType;
FRecordID: Int64; FRecordID: Integer;
FLocation: string; FLocation: string;
FNotes: string; FNotes: string;
FDescription: string; FDescription: string;
@ -238,7 +238,7 @@ type
procedure SetEndTime(Value: TDateTime); procedure SetEndTime(Value: TDateTime);
procedure SetLocation(const Value: String); procedure SetLocation(const Value: String);
procedure SetNotes(const Value: string); procedure SetNotes(const Value: string);
procedure SetRecordID(Value: Int64); procedure SetRecordID(Value: Integer);
procedure SetStartTime(Value: TDateTime); procedure SetStartTime(Value: TDateTime);
procedure SetCustInterval(Value: Integer); procedure SetCustInterval(Value: Integer);
procedure SetRepeatCode(Value: TVpRepeatType); procedure SetRepeatCode(Value: TVpRepeatType);
@ -253,7 +253,7 @@ type
property Changed: Boolean read FChanged write SetChanged; property Changed: Boolean read FChanged write SetChanged;
property Deleted: Boolean read FDeleted write SetDeleted; property Deleted: Boolean read FDeleted write SetDeleted;
property ItemIndex: Integer read FItemIndex; property ItemIndex: Integer read FItemIndex;
property RecordID : Int64 read FRecordID write SetRecordID; property RecordID : Integer read FRecordID write SetRecordID;
property StartTime : TDateTime read FStartTime write SetStartTime; property StartTime : TDateTime read FStartTime write SetStartTime;
property EndTime : TDateTime read FEndTime write SetEndTime; property EndTime : TDateTime read FEndTime write SetEndTime;
property Description : string read FDescription write SetDescription; property Description : string read FDescription write SetDescription;
@ -302,7 +302,7 @@ type
procedure BatchUpdate(value: Boolean); procedure BatchUpdate(value: Boolean);
procedure Sort; procedure Sort;
function Compare(Item1, Item2: TVpTask): Integer; function Compare(Item1, Item2: TVpTask): Integer;
function AddTask(RecordID: Int64): TVpTask; function AddTask(RecordID: Integer): TVpTask;
function Count : Integer; function Count : Integer;
function CountByDay(Date: TDateTime): Integer; function CountByDay(Date: TDateTime): Integer;
function Last: TVpTask; function Last: TVpTask;
@ -580,7 +580,7 @@ begin
end; end;
{=====} {=====}
function TVpResources.GetItem(Index: Int64): TVpResource; function TVpResources.GetItem(Index: Integer): TVpResource;
begin begin
result := TVpResource(FResourceList.List^[Index]); result := TVpResource(FResourceList.List^[Index]);
end; end;
@ -592,10 +592,10 @@ begin
end; end;
{=====} {=====}
function TVpResources.NextResourceID: Int64; function TVpResources.NextResourceID: Integer;
var var
I : Integer; I : Integer;
ID: Int64; ID: Integer;
Res: TVpResource; Res: TVpResource;
begin begin
ID := 0; ID := 0;
@ -609,7 +609,7 @@ begin
end; end;
{=====} {=====}
function TVpResources.AddResource(ResID: Int64): TVpResource; function TVpResources.AddResource(ResID: Integer): TVpResource;
var var
Resource : TVpResource; Resource : TVpResource;
begin begin
@ -980,7 +980,7 @@ begin
end; end;
{=====} {=====}
procedure TVpEvent.SetRecordID(Value: Int64); procedure TVpEvent.SetRecordID(Value: Integer);
begin begin
if Value <> FRecordID then begin if Value <> FRecordID then begin
FRecordID := Value; FRecordID := Value;
@ -1119,7 +1119,7 @@ end;
{=====} {=====}
{Adds the event to the eventlist and returns a pointer to it, or nil on failure} {Adds the event to the eventlist and returns a pointer to it, or nil on failure}
function TVpSchedule.AddEvent(RecordID: Int64; StartTime, function TVpSchedule.AddEvent(RecordID: Integer; StartTime,
EndTime: TDateTime): TVpEvent; EndTime: TDateTime): TVpEvent;
begin begin
result := nil; result := nil;
@ -1175,7 +1175,7 @@ begin
end; end;
{=====} {=====}
function TVpSchedule.GetEvent(Index: Int64): TVpEvent; function TVpSchedule.GetEvent(Index: Integer): TVpEvent;
begin begin
{ Returns an event on success or nil on failure } { Returns an event on success or nil on failure }
result := FEventList.Items[Index]; result := FEventList.Items[Index];
@ -2132,7 +2132,7 @@ begin
end; end;
{=====} {=====}
function TVpTasks.AddTask(RecordID: Int64): TVpTask; function TVpTasks.AddTask(RecordID: Integer): TVpTask;
var var
Task: TVpTask; Task: TVpTask;
begin begin

View File

@ -75,7 +75,7 @@ type
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
function GetNextID(TableName: string): Int64; override; function GetNextID(TableName: string): Integer; override;
procedure Load; override; procedure Load; override;
procedure CreateTable(TableName: string); procedure CreateTable(TableName: string);
procedure CreateIndexDefs(const TableName : string; IndexDefs : TIndexDefs); override; procedure CreateIndexDefs(const TableName : string; IndexDefs : TIndexDefs); override;
@ -249,7 +249,7 @@ begin
end; end;
{=====} {=====}
function TVpDBISAMDataStore.GetNextID(TableName: string): Int64; function TVpDBISAMDataStore.GetNextID(TableName: string): Integer;
var var
Query: TDBISAMQuery; Query: TDBISAMQuery;
GotIt: Boolean; GotIt: Boolean;

View File

@ -77,7 +77,7 @@ type
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
function GetNextID(TableName: string): int64; override; function GetNextID(TableName: string): integer; override;
// procedure PurgeResource(Res: TVpResource); override; // procedure PurgeResource(Res: TVpResource); override;
procedure PurgeEvents(Res: TVpResource); override; procedure PurgeEvents(Res: TVpResource); override;
@ -138,7 +138,7 @@ begin
end; end;
{=====} {=====}
function TVpFF2DataStore.GetNextID(TableName: string): int64; function TVpFF2DataStore.GetNextID(TableName: string): integer;
begin begin
{ this is not used in the FlashFiler Datastore as the FlashFiler tables use } { this is not used in the FlashFiler Datastore as the FlashFiler tables use }
{ autoincrement fields } { autoincrement fields }

View File

@ -160,7 +160,7 @@ type
procedure PurgeTasks(Res: TVpResource); override; procedure PurgeTasks(Res: TVpResource); override;
function GetFieldName(Mappings: TCollection; VPField: string): string; function GetFieldName(Mappings: TCollection; VPField: string): string;
function GetNextID(TableName: string): Int64; override; function GetNextID(TableName: string): Integer; override;
{ These are published via the TVpDataSources class, which allows them to } { These are published via the TVpDataSources class, which allows them to }
{ be clustered in the Object Inspector Don't publish them individually } { be clustered in the Object Inspector Don't publish them individually }
@ -2041,7 +2041,7 @@ begin
end; end;
{=====} {=====}
function TVpFlexDataStore.GetNextID(TableName: string): Int64; function TVpFlexDataStore.GetNextID(TableName: string): Integer;
begin begin
{ The FlexDataStore has no idea what type of database you are connected to } { The FlexDataStore has no idea what type of database you are connected to }
{ beyond TDataset compatibility, so it cannot presume to generate record } { beyond TDataset compatibility, so it cannot presume to generate record }

View File

@ -30,7 +30,7 @@ type
procedure SetConnected(const AValue: Boolean); override; procedure SetConnected(const AValue: Boolean); override;
procedure Split(const AString: String; AList: TStrings); procedure Split(const AString: String; AList: TStrings);
function UniqueID(AValue: Int64): Boolean; function UniqueID(AValue: Integer): Boolean;
procedure ReadFromIni; procedure ReadFromIni;
procedure WriteToIni; procedure WriteToIni;
@ -39,7 +39,7 @@ type
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
function GetNextID(TableName: string): Int64; override; function GetNextID(TableName: string): Integer; override;
procedure LoadEvents; override; procedure LoadEvents; override;
procedure LoadContacts; override; procedure LoadContacts; override;
procedure LoadTasks; override; procedure LoadTasks; override;
@ -169,14 +169,14 @@ begin
AEvent.UserField9 + '}'; AEvent.UserField9 + '}';
end; end;
function TVpIniDatastore.GetNextID(TableName: string): Int64; function TVpIniDatastore.GetNextID(TableName: string): Integer;
begin begin
repeat repeat
Result := Random(High(Int64)); Result := Random(High(Integer));
until UniqueID(Result); until UniqueID(Result) and (Result <> -1);
end; end;
function TVpIniDatastore.UniqueID(AValue: Int64): Boolean; function TVpIniDatastore.UniqueID(AValue: Integer): Boolean;
var var
i, j: Integer; i, j: Integer;
res: TVpResource; res: TVpResource;
@ -572,7 +572,7 @@ var
i,j: Integer; i,j: Integer;
s: String; s: String;
key: String; key: String;
resID, id: Int64; resID, id: Integer;
begin begin
if FFileName = '' then if FFileName = '' then
exit; exit;
@ -588,7 +588,7 @@ begin
s := ini.ReadString('Resources', ResList[i], ''); s := ini.ReadString('Resources', ResList[i], '');
if s = '' then if s = '' then
IniError(RSIniFileStructure); IniError(RSIniFileStructure);
resID := StrToInt64(ResList[i]); resID := StrToInt(ResList[i]);
res := Resources.AddResource(resID); res := Resources.AddResource(resID);
StrToResource(s, res); StrToResource(s, res);
@ -596,7 +596,7 @@ begin
L.Clear; L.Clear;
ini.ReadSection(key, L); ini.ReadSection(key, L);
for j:=0 to L.Count-1 do begin for j:=0 to L.Count-1 do begin
id := StrToInt64(L[j]); id := StrToInt(L[j]);
contact := res.Contacts.AddContact(id); contact := res.Contacts.AddContact(id);
s := ini.ReadString(key, L[j], ''); s := ini.ReadString(key, L[j], '');
StrToContact(s, contact); StrToContact(s, contact);
@ -607,7 +607,7 @@ begin
L.Clear; L.Clear;
ini.ReadSection(key, L); ini.ReadSection(key, L);
for j:=0 to L.Count-1 do begin for j:=0 to L.Count-1 do begin
id := StrToInt64(L[j]); id := StrToInt(L[j]);
event := res.Schedule.AddEvent(id, 0, 1); event := res.Schedule.AddEvent(id, 0, 1);
s := ini.ReadString(key, L[j], ''); s := ini.ReadString(key, L[j], '');
StrToEvent(s, event); StrToEvent(s, event);
@ -617,7 +617,7 @@ begin
L.Clear; L.Clear;
ini.ReadSection(key, L); ini.ReadSection(key, L);
for j:=0 to L.Count-1 do begin for j:=0 to L.Count-1 do begin
id := StrToInt64(L[j]); id := StrToInt(L[j]);
task := res.Tasks.AddTask(id); task := res.Tasks.AddTask(id);
s := ini.ReadString(key, L[j], ''); s := ini.ReadString(key, L[j], '');
StrToTask(s, task); StrToTask(s, task);

View File

@ -106,7 +106,7 @@ type
// returns the next id for a store by doing an equivalent of select max(id) from table // returns the next id for a store by doing an equivalent of select max(id) from table
// and increasing the number by one // and increasing the number by one
function GetNextID(TableName: string): Int64; override; function GetNextID(TableName: string): Integer; override;
// post changes to the store // post changes to the store
procedure PostResources; override; procedure PostResources; override;
@ -333,7 +333,7 @@ begin
result:=Stores[TasksTableName].Dataset; result:=Stores[TasksTableName].Dataset;
end; end;
function TVPSQLDataStore.GetNextID(TableName: string): Int64; function TVPSQLDataStore.GetNextID(TableName: string): Integer;
var var
FldName : string; FldName : string;
begin begin

View File

@ -33,7 +33,7 @@ type
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
procedure CreateTables; procedure CreateTables;
function GetNextID(TableName: string): int64; override; function GetNextID(TableName: string): integer; override;
procedure PostEvents; override; procedure PostEvents; override;
procedure PostContacts; override; procedure PostContacts; override;
procedure PostTasks; override; procedure PostTasks; override;
@ -277,7 +277,7 @@ begin
Result := FEventsTable; Result := FEventsTable;
end; end;
function TVpSqlite3DataStore.GetNextID(TableName: string): int64; function TVpSqlite3DataStore.GetNextID(TableName: string): integer;
begin begin
{ This is not needed in the SQLITE3 datastore as these tables use { This is not needed in the SQLITE3 datastore as these tables use
autoincrement fields. } autoincrement fields. }

View File

@ -33,7 +33,7 @@ type
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
procedure CreateTables; procedure CreateTables;
function GetNextID(TableName: string): int64; override; function GetNextID(TableName: string): integer; override;
property ResourceTable; property ResourceTable;
property EventsTable; property EventsTable;
@ -257,7 +257,7 @@ begin
Result := FEventsTable; Result := FEventsTable;
end; end;
function TVpZeosDataStore.GetNextID(TableName: string): int64; function TVpZeosDataStore.GetNextID(TableName: string): integer;
begin begin
{ This is not needed in the ZEOS datastore as these tables use { This is not needed in the ZEOS datastore as these tables use
autoincrement fields. } autoincrement fields. }