Subject | Re: Replication, TIB_RPL_Sync and TIB_Query |
---|---|
Author | lbjerregard <ldb@it-group.dk> |
Post date | 2003-01-06T11:00:45Z |
Hi again
On the bottom line, the problem is the names...
The table 'rpl_$ind' and the tablefiled 'rpl$ind_nme' is
auto-created by 'Interbase Simple Replication Setup Utility'
and IBObjects 'rpl$' as a prefix for internal tables.
Is there a some kind of parser included in TIB_Query so
when using internal names in SQL, these are changed to
something else...
Is it possible that I should use Macros in my Sql.
and if So: I can only get the index name ('<<IND_NME>>'),
What is the name of the table, in which the indexnames
exist
And how should I implement this in my program.
On the other hand, I can not understand why I cant get any
results from a query that runs fine in other environments.
*** The code: Start ***
function TMainFrm.Select(iSql : string): integer;
// Returns a stringlist with the query results
var i: Integer;
begin
TmpStrList:= TStringList.create;
i:= 0;
if Qry = nil then
Qry := TIB_Query.Create(Self);
Qry.IB_Connection:= ConnTarget; // TIB_Connection
Qry.DatabaseName:= GetLocalMachineString('DatabaseTarget');
Qry.SQL.Clear;
Qry.Sql.Add(iSql);
try
Qry.Open;
If Not Qry.Eof then
While Not Qry.Eof do
Begin
TmpStrList.Add( Qry.Fields[0].AsString );
Qry.Next;
inc(i);
end;
except
on E:Exception do
GemLog(0, 'Mainform', E.Message );
end;
Result:= i
end;
procedure TMainFrm.AfterConnect;
Var
i: Integer;
Begin
GemLog(1, 'Mainform.AfterConnect', 'Start' );
if IsConnected Then
Begin
If Not IsPrepared Then
Begin
// i:= Select('Select iName from Inventory'); //Result= 7508
i:= Select('select rpl$ind_nme from rpl$_ind');//Result= 0 + err
If i > 0 Then
Begin
rplSync.ReplicatorIndexName:= TmpStrList[i];
rplSync.Prepare;
End;
TmpStrList.Free;
End;
End;
GemLog(1, 'Mainform.AfterConnect', 'End' );
End;
*** The code: End ***
On the bottom line, the problem is the names...
The table 'rpl_$ind' and the tablefiled 'rpl$ind_nme' is
auto-created by 'Interbase Simple Replication Setup Utility'
and IBObjects 'rpl$' as a prefix for internal tables.
Is there a some kind of parser included in TIB_Query so
when using internal names in SQL, these are changed to
something else...
Is it possible that I should use Macros in my Sql.
and if So: I can only get the index name ('<<IND_NME>>'),
What is the name of the table, in which the indexnames
exist
And how should I implement this in my program.
On the other hand, I can not understand why I cant get any
results from a query that runs fine in other environments.
*** The code: Start ***
function TMainFrm.Select(iSql : string): integer;
// Returns a stringlist with the query results
var i: Integer;
begin
TmpStrList:= TStringList.create;
i:= 0;
if Qry = nil then
Qry := TIB_Query.Create(Self);
Qry.IB_Connection:= ConnTarget; // TIB_Connection
Qry.DatabaseName:= GetLocalMachineString('DatabaseTarget');
Qry.SQL.Clear;
Qry.Sql.Add(iSql);
try
Qry.Open;
If Not Qry.Eof then
While Not Qry.Eof do
Begin
TmpStrList.Add( Qry.Fields[0].AsString );
Qry.Next;
inc(i);
end;
except
on E:Exception do
GemLog(0, 'Mainform', E.Message );
end;
Result:= i
end;
procedure TMainFrm.AfterConnect;
Var
i: Integer;
Begin
GemLog(1, 'Mainform.AfterConnect', 'Start' );
if IsConnected Then
Begin
If Not IsPrepared Then
Begin
// i:= Select('Select iName from Inventory'); //Result= 7508
i:= Select('select rpl$ind_nme from rpl$_ind');//Result= 0 + err
If i > 0 Then
Begin
rplSync.ReplicatorIndexName:= TmpStrList[i];
rplSync.Prepare;
End;
TmpStrList.Free;
End;
End;
GemLog(1, 'Mainform.AfterConnect', 'End' );
End;
*** The code: End ***