Page 1 of 1

Buggy stored proc (MS SQL)

Posted: 24.03.2010, 13:35
by A99
Problems with MS SQL stored procedures support (6.6.6 stable).

1. Can't enumerate parameters of stored proc if its name contains underline char ("_") because of wrong escaping (ZStoredProcedure.pas:315).
2. Can't bind memo and blob parameter values (not supported?) (ZDbcDbLibStatement.pas:699-703).

Posted: 24.03.2010, 22:37
by mdaems
Can you fix these?
I'm not using mssql, so I can't just fix and test it myself.

Mark

Posted: 25.03.2010, 08:35
by A99
mdaems wrote:Can you fix these?
Not sure. I'm novice in ZeosLib architecture (since yesterday... hehe) and I have Delphi 5 only (so... no unicode support and many others "no").
But I can prepare test scripts, advise and investigate where the problem is.
mdaems wrote:I'm not using mssql, so I can't just fix and test it myself.
There are free editions of MS SQL 2005 and 2008.

Posted: 27.03.2010, 15:11
by mdaems
I suppose you're talking about these lines:

Code: Select all

        SplitQualifiedObjectName(Value, Catalog, Schema, ObjectName);
        ObjectName := Connection.DbcConnection.GetMetadata.AddEscapeCharToWildcards(ObjectName);
        ResultSet := Connection.DbcConnection.GetMetadata.GetProcedureColumns(Catalog, Schema, ObjectName, '');
Well, I did some investigation in the code.
My impression is that the AddEscapeCharToWildcards(ObjectName) function should be called inside each driver's implemention of GetProcedureColumns.
But maybe you read best al little more about the subject. This is the commit message for the 'AddEscapeCharToWildcards' line

Code: Select all

mdaems  5/10/2008 21:47:48            
Escape underscores from the stored procedure name before looking up it's parameters - by mdaems - See http://zeos.firmos.at/viewtopic.php?t=2035
Can you provide a patch to move the 'bad' code deeper into the dbc layer? I suppose best practise is to add it for all drivers where a select statement is used in GetProcedureColumns(). So not for Mssql, which uses 'exec sp_...'.
You don't have to patch both 7.x and 6.6.x separately, as I suppose porting the patch between those two branches should be easy enough to do for me.

If you don't want to do this effort, please file a bug report on the bug tracker, pointing to this forum post.

Mark

P.S. I don't install MSSQL as one more db on my machine because of the weight all thos database put on my system. Professionally I'm developing Oracle application, so I needed to install that one (which eats away 20 % of system memory on it's own). Mysql, Postgres, FB and SQLite are not that heavy. Now starting those databases for the test suite already takes more than 1 Gb of memory away.