Subject | Re: named parameter always replaced by '?' |
---|---|
Author | robertosmith8 |
Post date | 2004-11-29T13:54:18Z |
Hi All,
Thanks for taking time to reply the post.
regards,
roberto
--- In firebird-support@yahoogroups.com, "Martijn Tonies"
<m.tonies@u...> wrote:
Thanks for taking time to reply the post.
regards,
roberto
--- In firebird-support@yahoogroups.com, "Martijn Tonies"
<m.tonies@u...> wrote:
>earlier
> > > > I'm sorry, I was trying out a few procedures and I paste the wrong
> > > > extract of a different procedure which is not related to the
> post.to the
> > > >
> > > > So the correct modified part of the stored procedure related
> > > > earlier post is as follows:'? /*
> > > >
> > > > -----
> > > > CREATE PROCEDURE TEST (
> > > > FIELD1 INTEGER)
> > > > RETURNS (
> > > > FIELD2 INTEGER)
> > > > AS
> > > > Begin
> > > > FOR SELECT FIELD2 FROM TABLE1
> > > > WHERE FIELD1 = ? /* PRM_0 */
> > > > INTO "FIELD2"
> > > > DO
> > > > BEGIN
> > > > SUSPEND;
> > > > END
> > > > End
> > > > ------
> > > >
> > > > I tried using upscene latest dbexpress trial driver, I notise
> > > > PRM_0 */' was inserted into the procedure. Any clue?stored proc
> > >
> > >And this happens with "ParamCheck" = "False"?
> >
> > The "clue" is that he is getting a ParamCheck happening inside
> > source. He should switch it off to stop the parser treating it as aproblem).
> > parameter (which it's not).
>
> I know that ;-)
>
> > And correct the syntax of the SP to pre-empt the next exception (INTO
> > "FIELD2" will cause an exception once he fixes the ParamCheck
>MS SQL
> I think there's more to it ...
>
> I remember something -- when setting SQL at DESIGN TIME in Delphi,
> the ParamCheck is ignored -> it ALWAYS checks for parameters.
> I reported this in QC, but it was "as designed".
>
> (checking the source now)
> See:
> procedure TSQLQuery.QueryChanged(Sender: TObject);
> var
> List: TSQLParams;
> begin
> if not (csReading in ComponentState) then
> begin
> Close;
> SetPrepared(False);
>
> ----->>
> if ParamCheck or (csDesigning in ComponentState) then
> begin
> List := TSQLParams.Create(Self);
> try
> FText := SQL.Text;
> List.Parse(FText, True);
> List.AssignValues(FParams);
> FParams.Clear;
> FParams.Assign(List);
> finally
> List.Free;
> end;
> end else
> FText := SQL.Text;
> DataEvent(dePropertyChange, 0);
> end else
> FText := FParams.ParseSQL(SQL.Text, False);
> SetFCommandText(FText);
> end;
>
>
> So you cannot get around this, but setting the SQL (if you
> want to create a Procedure) at RUNTIME only.
>
> With regards,
>
> Martijn Tonies
> Database Workbench - developer tool for InterBase, Firebird, MySQL &
> Server.
> Upscene Productions
> http://www.upscene.com