[patch_done] Trouble Metadata + Firebird

Code patches written by our users to solve certain "problems" that were not solved, yet.

Moderators: gto, cipto_kh, EgonHugeist, mdaems

Post Reply
seawolf
Zeos Dev Team *
Zeos Dev Team *
Posts: 385
Joined: 04.06.2008, 19:50
Contact:

[patch_done] Trouble Metadata + Firebird

Post by seawolf »

Hi everybody:

on \src\dbc\ZDbcMetadata.pas

function TZAbstractDatabaseMetadata.CloneCachedResultSet(
ResultSet: IZResultSet): IZResultSet;
var
I: Integer;
Metadata: IZResultSetMetadata;
ColumnInfo: TZColumnInfo;
ColumnsInfo: TObjectList;
begin
Result := nil;
Metadata := ResultSet.GetMetadata;
ColumnsInfo := TObjectList.Create;
try
for I := 1 to Metadata.GetColumnCount do
begin
ColumnInfo := TZColumnInfo.Create;
with ColumnInfo do
begin
ColumnLabel := Metadata.GetColumnLabel(I);
ColumnType := Metadata.GetColumnType(I);
ColumnDisplaySize := Metadata.GetPrecision(I);
Precision := Metadata.GetPrecision(I);
end;
ColumnsInfo.Add(ColumnInfo);
end;

ResultSet.BeforeFirst;
Result := CopyToVirtualResultSet(ResultSet,
TZVirtualResultSet.CreateWithColumns(ColumnsInfo, ''));
ResultSet.BeforeFirst;
finally
// ColumnsInfo.Free;
end;
end;

I don't understand why ResultSet.BeforeFirst; is commented, because uncommenting it several test are passed correctly , so I suggest you uncomment it.

Second this test contain several mistakes .. please change it to this solution:

\test\component\ZTestStoredProcedure.pas

procedure TZTestInterbaseStoredProcedure.TestStoredProc;
begin
StoredProc.StoredProcName := 'PROCEDURE1';
try
CheckEquals(2, StoredProc.Params.Count);
CheckEquals('R1', StoredProc.Params[0].Name);
CheckEquals(ord(ptResult), ord(StoredProc.Params[0].ParamType));
CheckEquals('P1', StoredProc.Params[1].Name);
CheckEquals(ord(ptInput), ord(StoredProc.Params[1].ParamType));
StoredProc.Params[1].AsInteger := 12345;
StoredProc.ExecProc;
except
on e: exception do ShowMessage(e.Message);
end;
CheckEquals(12346, StoredProc.Params[0].AsInteger);
CheckEquals(2, StoredProc.Params.Count);
end;

Best regards
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

Seawolf,

I must be blind... What are the real differences you propose? Can you please make ans SVN diff against your code for these changes?

Because :
- for the first change(??) I don't see the BeforeFirst commented in my (=Testing Branch) version
- for the second change I see only the added try...except construct with a showmessage, something that really doesn't belog to a console test program, I believe.
So : is it possible you corrected code that you changed before, yourself?

Mark
Image
seawolf
Zeos Dev Team *
Zeos Dev Team *
Posts: 385
Joined: 04.06.2008, 19:50
Contact:

Post by seawolf »

I didn't update for a while my zeos folder (because of several changes I did) and after your post I downloaded the new trunk snapshot .. and what I wrote is outdate, because on the new shapshot is ok.
So really sorry :oops:
Post Reply