[Lazarus] Accessing MS SQLServer database from Lazarus/FPC?

Michael Van Canneyt michael at freepascal.org
Tue Jan 25 21:45:31 CET 2011



On Tue, 25 Jan 2011, José Mejuto wrote:

> Hello Lazarus-List,
>
> Sunday, January 23, 2011, 12:06:12 PM, you wrote:
>
> MVC> Attached is a possible patch. I don't have MS-SQL (doesn't
> MVC> run on Linux) so I can't test.
> MVC> Please apply it to packages/fcl-db/src/sqldb/sqldb.pp and
> MVC> report whether this helped you
> MVC> solve your problem. If so, I will commit it to SVN.
>
> I think this piece of code is a problem for your patch (last line):
>
> function TCustomSQLQuery.Fetch : boolean;
> begin
>  if not (Fcursor.FStatementType in [stSelect,stExecProcedure]) then
>    Exit;
>
>  if not FIsEof then FIsEOF := not TSQLConnection(Database).Fetch(Fcursor);
>  Result := not FIsEOF;
>  // A stored procedure is always at EOF after its first fetch
>  if FCursor.FStatementType = stExecProcedure then FIsEOF := True;
> end;

Aha....

This is indeed the problem. However, under Firebird, it is correct. 
An Execute will return only the first values.

To Bo: Please comment the above line, and see if that fixes your problem.
Please report back here on your findings. 
I will talk to Joost and  what to do with this.

Michael.


More information about the Lazarus mailing list