Olivier Mascia wrote:
> Milan, against which IB/FB have you seen this ?
> Can you test it against some different IB/FB version ?
Not at this time. But I can try to download and install FB1.5 when I get
> I'm not completely sure, but I think I remember having read some
> discussion about parameter order bugs in Firebird-devel list. Might want
> to search the archive of that list.
Will do so. I'm even subscribed to the list for about a year now, but I
must have missed it.
> I have so seldom used parameters in the column list of a select (maybe
> never, not sure), that I am pretty sure I never tested IBPP for such
> case. So there could be a bug there of course, though this one is most
> probably on the IB/FB side.
Definetly IB/FB side. I just tested it with PHP, and the results are the
same. I don't use it often, but sometimes it's the most elegant solution.
> Oh by the way, I'm about to commit what you know and that I was about to
> commit last week :-) As it is closely related to this matter, I'll write
> a test case just to play with this too. But I'd be interested in seeing
> your test case applied against the current FB 1.5 beta.
> It might well be that the first parameters (numerics 1 -> ...) are those
> from the 'where' part of the select and that those parameters acting as
> column placeholders receive higher parameter numbers.
> That is I wonder how something like this would behave :
>> st->Prepare("insert into m(id,name,third) select id,?,? from m where name
> = ?");
>> st->Set(1, "SRC");
>> st->Set(2, "SRC-THIRD");
>> st->Set(3, "DEST");
> Maybe ?
>> insert into m (id,name,third) select id,'SRC-THIRD','DEST' from m where
> name = 'SRC';
Exactly! I did more tests now. It appears that first all other
parameters get bind, and then the remains to go 'select ...' part. For
st->Prepare("insert into test (id, one, two) select id, ?, ? from test
where id = ? and name = ?");
INSERT INTO TEST (id,one,two) SELECT id, 'C', 'D' from test where id =
'A' and name = 'B'
So the parameters do follow the order, but those in "SELECT" list go at
the end. Be careful if you ever use it ;)