[bug_fixed] Zeos 6.6-Beta: func GetTableNames() / PingServer
Moderators: EgonHugeist, mdaems
[bug_fixed] Zeos 6.6-Beta: func GetTableNames() / PingServer
This for notice following bugs:
1) Function PingServer no has result value; This crashes application when
TZConnection.Disconnect:
function TZAbstractConnection.PingServer: Integer;
begin
RaiseUnsupportedException;
end;
2) TZConnection.GetTableNames() allways return empty TString.
Regards,
Paulo
1) Function PingServer no has result value; This crashes application when
TZConnection.Disconnect:
function TZAbstractConnection.PingServer: Integer;
begin
RaiseUnsupportedException;
end;
2) TZConnection.GetTableNames() allways return empty TString.
Regards,
Paulo
- mdaems
- Zeos Project Manager
- Posts: 2766
- Joined: 20.09.2005, 15:28
- Location: Brussels, Belgium
- Contact:
Concerning GetTableNames : This could be fixed in the latest SVN Build (location see portal announcement). We did changes for PostGreSQL. Is that the database you use?
Concerning PingServer: Can it be implemented for your database server? That would be best solution.
Generally : Can it be solved by putting 'result := 1' before raising the exception? (Using mysql so no problem for me...)
Mark
Concerning PingServer: Can it be implemented for your database server? That would be best solution.
Generally : Can it be solved by putting 'result := 1' before raising the exception? (Using mysql so no problem for me...)
Mark
- mdaems
- Zeos Project Manager
- Posts: 2766
- Joined: 20.09.2005, 15:28
- Location: Brussels, Belgium
- Contact:
Hi Paulonki,
What SVN version did you get? It's only in Testing branch yet.
Please check if this GetTables function ends like this:
Mark
What SVN version did you get? It's only in Testing branch yet.
Please check if this GetTables function ends like this:
Code: Select all
if (Types = nil) or (High(Types) = 0) then
begin
SetLength(LTypes, 5);
LTypes[0] := 'TABLE';
LTypes[1] := 'VIEW';
LTypes[2] := 'INDEX';
LTypes[3] := 'SEQUENCE';
LTypes[4] := 'TEMPORARY TABLE';
end
else
LTypes := Types;
SQL := SQL + ' AND c.relname LIKE ''' + EscapeQuotes(ToLikeString(TableNamePattern))
+ ''' AND (false ';
for I := 0 to High(LTypes) do
SQL := SQL + ' OR ( ' + TableTypeSQLExpression(LTypes[i], UseSchemas) + ' ) ';
SQL := SQL + ' )' + OrderBy;
Result := CopyToVirtualResultSet(
GetConnection.CreateStatement.ExecuteQuery(SQL),
ConstructVirtualResultSet(TableColumnsDynArray));
AddResultSetToCache(Key, Result);
end;
end;
Hi Mark, about PingServer Solution i think setting 'result := 1' can be the best solution for databases that doesn't implement yet PinServer functionality.
But something we have to be sure is what result does MySQL Ping functions returns if Pinging server is successfully, don't remember if it is 1 or 0.
But something we have to be sure is what result does MySQL Ping functions returns if Pinging server is successfully, don't remember if it is 1 or 0.
- mdaems
- Zeos Project Manager
- Posts: 2766
- Joined: 20.09.2005, 15:28
- Location: Brussels, Belgium
- Contact:
0=successfull.
Can we still raise the 'unsupported' exception AND returning the function value? I don't think that makes sense.
And in my opinion we should only return a correct value if we do not raise an exception.
Do you know how current situation could crash the application? I think Paulonki should use a 'try...exception...' block when he does not know the protocol used and wants to call Pingserver when possible. So he can react to the event of the nonsupported call. The call itself doesn't change anything to the status of the Connection component when it fails. I don't understand how that could cause an error in the zeos components.
Paulonki, can you create (and eventually sent) a sample program only doing the ping which causes the error?
Mark
Mark
Can we still raise the 'unsupported' exception AND returning the function value? I don't think that makes sense.
And in my opinion we should only return a correct value if we do not raise an exception.
Do you know how current situation could crash the application? I think Paulonki should use a 'try...exception...' block when he does not know the protocol used and wants to call Pingserver when possible. So he can react to the event of the nonsupported call. The call itself doesn't change anything to the status of the Connection component when it fails. I don't understand how that could cause an error in the zeos components.
Paulonki, can you create (and eventually sent) a sample program only doing the ping which causes the error?
Mark
Mark
Well I think it would only return a value and not an exception, coz i think this function cxan be used later internally in zeoslib components.
One important thing where we can add the PingServer a similar TestConnection function that can resume a connection if it is lost. Currently, for example, if mysql is shutted down and there is connection of zeoslib, when zeoslib connection tries to send a query or retreive data it will send a mysql connection errror, and there is no way, in an application, that w ecan resume or try to reconnect after this error. maybe we can add an event to tzconnection that can be called before tzconnection sends or retreives a query or resultset so we can manage that if there is an error we can tell zeoslib to resume the connection, like libmysql does.
One important thing where we can add the PingServer a similar TestConnection function that can resume a connection if it is lost. Currently, for example, if mysql is shutted down and there is connection of zeoslib, when zeoslib connection tries to send a query or retreive data it will send a mysql connection errror, and there is no way, in an application, that w ecan resume or try to reconnect after this error. maybe we can add an event to tzconnection that can be called before tzconnection sends or retreives a query or resultset so we can manage that if there is an error we can tell zeoslib to resume the connection, like libmysql does.
Hello,
They forgive me for the delay in answering.
I am getting the Zeos in the address svn: /firmos.at/zeos/trunk.
The source of GetTableNames is:
procedure TZConnection.GetTableNames(const Pattern: string; List: TStrings);
var
Metadata: IZDatabaseMetadata;
ResultSet: IZResultSet;
begin
CheckConnected;
List.Clear;
Metadata := DbcConnection.GetMetadata;
ResultSet := Metadata.GetTables('', '', Pattern, nil);
while ResultSet.Next do
List.Add(ResultSet.GetStringByName('TABLE_NAME'));
end;
About crashing (not only my application, but delphi too).
First receive the message:
"SQL Error: could not transalate host name 'port=5432' to address: unkown host".
This is occurring since that I started to test the FastMM4 that report that a virtual method was called afther the destruction the component (disconnect) and alone I obtained to monitor until the function to pingserver ().
Regards,
Paulonki
They forgive me for the delay in answering.
I am getting the Zeos in the address svn: /firmos.at/zeos/trunk.
The source of GetTableNames is:
procedure TZConnection.GetTableNames(const Pattern: string; List: TStrings);
var
Metadata: IZDatabaseMetadata;
ResultSet: IZResultSet;
begin
CheckConnected;
List.Clear;
Metadata := DbcConnection.GetMetadata;
ResultSet := Metadata.GetTables('', '', Pattern, nil);
while ResultSet.Next do
List.Add(ResultSet.GetStringByName('TABLE_NAME'));
end;
About crashing (not only my application, but delphi too).
First receive the message:
"SQL Error: could not transalate host name 'port=5432' to address: unkown host".
This is occurring since that I started to test the FastMM4 that report that a virtual method was called afther the destruction the component (disconnect) and alone I obtained to monitor until the function to pingserver ().
Regards,
Paulonki
- mdaems
- Zeos Project Manager
- Posts: 2766
- Joined: 20.09.2005, 15:28
- Location: Brussels, Belgium
- Contact:
Hi Paulonki,
I was refering to the Metadata.GetTables function. Never mind. As you use the trunk version, the latest bugfix is not in there yet. Just use the file in attach instead of yours. Can you confirm it works?
Mark
I was refering to the Metadata.GetTables function. Never mind. As you use the trunk version, the latest bugfix is not in there yet. Just use the file in attach instead of yours. Can you confirm it works?
Mark
You do not have the required permissions to view the files attached to this post.