Hy Art,

I'm certainly not asking you to roll back all your changes. But is a point
release really the best time for something like this?

Perhaps, as a compromise, you could count the number of ? place holders and,
if 1, then keep the old behavior.

First...
The change is within the trunk but not within branch. Which means that the problematic change will not be released with 1.0.3 This is what makes me wonder that it sould no longer work within the next release.

Second...
I had already this idea before but as people are angry about the change within the trunk which solved 3 issues. But it would be better if someone from the devteam writes a comment on the situation and how to go on with this thing and the two issues which I was also told to solve.

For now I will stop all my help on Zend_Db and related until this has been cleared.

Greetings
Thomas
I18N Team Leader



----- Original Message ----- From: "Art Hundiak" <[EMAIL PROTECTED]>
To: <fw-general@lists.zend.com>
Sent: Wednesday, November 21, 2007 8:05 PM
Subject: Re: [fw-general] Zend_Db_Select::where() malfunction



Zend 0.8.0 had the use of where IN (?) array documented. As well as previous
versions.
Zend 0.9.0 did not have it documented
Zend 0.9.1 was the first release with Zend_Db_Select unit test cases and, as
you say, did not have an array test or any tests with multiple ? place
holders

Zend 1.0.2 Zend_Db_Select source code has
   /**
    * Adds a WHERE condition to the query by AND.
    *
    * If a value is passed as the second param, it will be quoted
    * and replaced into the condition wherever a question-mark
    * appears. Array values are quoted and comma-separated.

I'm certainly not asking you to roll back all your changes. But is a point
release really the best time for something like this?

Perhaps, as a compromise, you could count the number of ? place holders and,
if 1, then keep the old behavior.


Thomas Weidner-2 wrote:

Art,

as I said in past we reviewed what was written within the documentation
and
within the testbed.
The usecases did not brake anyone of the behaviour mentioned there.

Then we looked over the opened issues and discussed about the additional
usecases we want to support.
This mentioned usecase with one array integrated in one placeholder is
actually not supported and from my understanding of the documentation it
was
not in the past.

The change itself was discussed within the dev team and with simon.
I was just the one who made the work.

If this is problematic I would also accept to reject my help and let all
Zend_Db issues as they were before.
I would be willing to redo my changes, delete the new features already
done
and not implement the additional features which are already issued.
Please ask darby and simon how we should behave.

It would be nice if you give me the related documentation with the example
or text where you found the mentioned array behaviour.
Just give file and svn to check for us where we oversee this usecase.

Greetings
Thomas
I18N Team Leader


----- Original Message ----- From: "Art Hundiak" <[EMAIL PROTECTED]>
To: <fw-general@lists.zend.com>
Sent: Wednesday, November 21, 2007 4:18 PM
Subject: Re: [fw-general] Zend_Db_Select::where() malfunction



Thomas,

Don't take this the wrong way but these casual massive changes to the way existing code works is the reason why I stopped using Zend_Db back in the
.8
days.  By taking away the array imploding functionality you have just
broken
a considerable amount of existing code.  Code written in accordance with
the
published documentation.

Your use case rational: where("price > ? and price <= ?", array(2, 10));
can already be handled by calling where twice.

Did you talk to anybody before deciding to break existing behavior? If I
was still using Zend_Db then I'd be pretty upset to have my queries
broken
without warning and for no particular reason.  Especially since it
appears
you plan on delivering these last minute changes without offering a
useful
alternative.

Art


Thomas Weidner-2 wrote:

Shekar,

to get my snippet working with previous versions you would just have to
add
a version check...

if (Zend_Version::compareVersions('1.0.2') > 0) {
  // change where
}

or you wait for the issue to be solved...
1.0.4 I think as in 4 days the new release comes out.

Greetings
Thomas
I18N Team Leader

----- Original Message ----- From: "Shekar C Reddy" <[EMAIL PROTECTED]>
To: "Thomas Weidner" <[EMAIL PROTECTED]>
Cc: "Zend Framework General" <fw-general@lists.zend.com>
Sent: Wednesday, November 21, 2007 11:02 AM
Subject: Re: [fw-general] Zend_Db_Select::where() malfunction


Thomas,

I encourage you to test the where() method with v1.0.2 and see the
results -
it generates SQL imploding all the array values into a single
placeholder
as
expected. The documentation used to have this usage listed but now it
seems
to have been removed. The code snipped you gave generated the following
SQL
with 1.0.2:

price IN (2, 10, 14, 20, 2, 10, 14, 20, 2, 10, 14, 20, 2, 10, 14, 20)

and the following SQL with the current SVN:

price IN (2, 10, 14, 20)

indicating they are generating different SQL. Enhancements are welcome
but
I
thought they would be backwards compatible - I had to revert to 1.0.2
:(
The old code used to be generic and would apply to both - a normal
where
clause with a boolean operator or an IN operator because it used to
implode
the array into a list of values to replace a single placeholder but the
new
enhancements need IN-operators handled differently using arrays and
multiple
placeholders. I guess having a separate in() function for such
expressions
is more ideal and desired at the component level.

Here is the issue to get started:

http://framework.zend.com/issues/browse/ZF-2223


Keep up the good work!





On 11/21/07, Thomas Weidner <[EMAIL PROTECTED]> wrote:

Shekar,

actually the documentation does not mention this usage.

And there are also no testcases.
All testcases have approved before I did my commit.

Actually, giving an array as input would result in each single
placeholder
to be replaced.

where("price > ? and price <= ?", array(2, 10));
becomes
"where (price > 2 and price <= 10)"

This is the reason why the automatic imploding does not work anymore.

Principially there are several ways:
You could for example do the following:

$array = array(2,10,14,20);
$addwhere = "";
for($i = 1; $i < count($array); ++$i) {
   $addwhere .= ", ?";
}

$where = "price IN (?". $addwhere.")";
$db->where($where, $array);

In my eyes it would be better to have a own "IN" function avaiable for
such
clauses.
I am actually also working on a BEWTEEN function which adds between to
be
avaiable.

So eighter you use a the codesnippet I gave you or you add a new issue
for
creating a "IN" function which handles the IN within the where clause.

Greetings
Thomas
I18N Team Leader


----- Original Message -----
From: "Shekar C Reddy" <[EMAIL PROTECTED]>
To: "Thomas Weidner" <[EMAIL PROTECTED]>
Cc: "Zend Framework General" <fw-general@lists.zend.com>
Sent: Wednesday, November 21, 2007 8:28 AM
Subject: Re: [fw-general] Zend_Db_Select::where() malfunction


> Thomas,
>
> This feature of imploding an array of values into a single
place-holder
> was
> there from the the days of ZF v0.1.5 or earlier. My code was > working
fine
> all these days. There were code examples in the documentation that
showed
> how an array would be imploded into the SQL using where(). I even
created
> an
> issue in the past to avoid quoting numeric values in the resulting
> SQL's
> array (look for the issue that reads: "quote() quotes numeric
values"
a
> bug
> that was attributed to PDO). I just did a diff on Select.php > between
> the
> current SVN and 1.0.2 and noticed that where() method actually
> invokes
and
> delegates to _where() in the current SVN whereas there is no
_where()
> method
> in 1.0.2. My same code with ZF 1.0.2 works fine as expected but not
> with
> the
> latest SVN update.
>
> If this is not supported, what's the syntax for the expected SQL? I
> need
> to
> generate a where clause as under:
>
> WHERE status IN ( 'A', 'I' )
>
> Thanks,
>
>
>
>
> On 11/20/07, Thomas Weidner <[EMAIL PROTECTED]> wrote:
>>
>> Hy Shekar,
>>
>> this is not supported, and it was not supported in the past.
>> Because ? is a placeholder for only ONE variable.
>> And you gave two within your array :-)
>>
>> Actually I am working on a array integration which adds several >> new
>> features
>> to where.
>> But the behaviour you are expecting would break things with other
>> new
>> where
>> features.
>>
>> For now it is not planned to support such a use case.
>>
>> Btw: Before my improvement several days ago even the first >> variable
would
>> not have been integrated.
>> That the array value is inserted for a placeholder is also one of
>> the
new
>> features :-)
>>
>> Greetings
>> Thomas
>> I18N Team Leader
>>
>> ----- Original Message -----
>> From: "Shekar C Reddy" <[EMAIL PROTECTED]>
>> To: "Zend Framework General" <fw-general@lists.zend.com>
>> Sent: Tuesday, November 20, 2007 10:55 AM
>> Subject: [fw-general] Zend_Db_Select::where() malfunction
>>
>>
>> > Bill,
>> >
>> > I downloaded the latest SVN today and noticed a strange behavior
>> > with
>> the
>> > select component:
>> >
>> > $select->where( 'status IN ( ? )', array( 'A', 'I' ));
>> >
>> >
>> > SQL generated:
>> >
>> > WHERE status IN ( 'A' )
>> >
>> >
>> > SQL expected:
>> >
>> > WHERE status IN ( 'A', 'I' )
>> >
>>
>>
>







--
View this message in context:
http://www.nabble.com/Zend_Db_Select%3A%3Awhere%28%29-malfunction-tf4842393s16154.html#a13879162
Sent from the Zend Framework mailing list archive at Nabble.com.




--
View this message in context: http://www.nabble.com/Zend_Db_Select%3A%3Awhere%28%29-malfunction-tf4842393s16154.html#a13883897 Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to