Wednesday, October 24 - 0.3.38 Development Release!

thread: 10 messages  |  last: about 4 years ago  |  started: wednesday, october 24, 2007, 10:41 pm pdt


#1  |  Mike Ho (Sunnyvale, CA) United States of America Qcodo Administrator
Wednesday, October 24, 2007, 10:41 PM PDT

After a slightly longer than anticipated dev/release cycle, I'm happy to announce the 0.3.38 development release.

I'm going to nickname this the integration release, as a majority of the functionality is integration with the contributions from a new set of core contributors.

Highlights of this release include:
** New SubQuery support in Qcodo Query
** Conditional JOins on Expansion in Qcodo Query
** MetaControl and MetaDataGrid subclassing
** Persistent QControls (within a session, across pages)
** Extended Column support on Type Tables
** Friendly Error Pages
** Error Logging

I would like to welcome Shannon Pekary, Vass Arpad and Alex94040 to the core contributor team!  And thanks for their contributions to the codebase.

Please read through the changelog for the details on this current release.

Examples Site pages for the new functionality will be up soon... in the meantime, feel free to post and ask if you have specific questions.

Enjoy!

#2  |  brynjar (M) Iceland
Thursday, October 25, 2007, 6:53 AM PDT

I have one problem with new new release.

In my prepend.inc.php I have:

////////////////
// Include Files
////////////////
// TODO: Include any other include files (if any) here...        
QApplicationBase::$ClassFile['PnlWeek']         =     __DOCROOT__.__SUBDIRECTORY__.'/panels/PnlWeek.class.php';

But in 0.3.38 are some changes in the QApplicationBase.class.php
c.a. line 363

//is now
if (array_key_exists(strtolower($strClassName), QApplication::$ClassFile)) {
//instead of
if (array_key_exists($strClassName, QApplication::$ClassFile)) {

Now my custom panel will not be loaded and I just get error in my log file:
PHP Fatal error:  Class 'PnlWeek' not found in /xxx/xxx/start.php on line 92

Any ideas? Must my custom classes have the name in lower case now?

Brynjar

#3  |  Mike Ho (Sunnyvale, CA) United States of America Qcodo Administrator
Thursday, October 25, 2007, 7:05 AM PDT

no... simply change the array KEY to lowercase.  So:

QApplicationBase::$ClassFile['pnlweek']= __DOCROOT__.__SUBDIRECTORY__.'/panels/PnlWeek.class.php';
.bc
#4  |  brynjar (M) Iceland
Thursday, October 25, 2007, 7:28 AM PDT

..of course :)
Thanks for quick response!

Brynjar

#5  |  VexedPanda (Calgary, AB) Canada
Thursday, October 25, 2007, 2:30 PM PDT

I'm still going through all the actual code changes trying to ensure nothing will break my app, but I'm seeing some exciting stuff in here. :)

Love the integrated alias support
Love the runtime escape character changes
Think I'll love the subquery support, though I'll need no see some examples to be sure it meets all my needs
Love how the QQ and Query functions deal less with raw SQL, and rely on the QQueryBuilder to construct it (Though moving it out one more level to the DB adapter would be ideal)
Love the conditional joins
Love the error logging
Love the Type Table extensions

LOL, overall, this is looking like the biggest bunch of really useful improvements I've seen yet. :) At least for my giant app.

On the downside, that's a whole lot of regression testing I'll need to do now. :P

#6  |  VexedPanda (Calgary, AB) Canada
Wednesday, October 31, 2007, 8:22 AM PDT

So can we get some subquery examples?
Currently I'm using my QQCustomCondition class, and would love to be able to phase it out. Some examples of the stuff I'm doing are:

exists ( select null from users where language = %s )

and

in ( select category_id from products where price < %s )

etc
Where %s is replaced with some node from the outer query.

#7  |  Shannon Pekary (East Palo Alto, CA) United States of America Qcodo Core Contributor
Wednesday, October 31, 2007, 11:05 AM PDT

To give a complete example, I need a little more detail on your queries.

There is no EXISTS operator in QCodo, so I don't think it can help you there. For IN, you can do:

QQ::In(QQN::Table1()->CategoryId, QQ::SubSql("select category_id from products where price < {1}", QQN::Table2()->Price);

Here is an example of defining a virtual attribute from Mike related to the examples database. It tells you how many projects each person is managing, and then sorts by that number.

    $objPersonArray = Person::QueryArray(
        QQ::All(), QQ::Clause(
            QQ::Expand(QQ::Virtual('total_projects', QQ::SubSql('SELECT COUNT(id) FROM project WHERE project.manager_person_id={1}', QQN::Person()->Id))),
            QQ::OrderBy(QQ::Virtual('total_projects'))
        )
    );

So the idea is that you can use QQ::Virtual() to define any sort of virtual attribute once.  And then you can re-use that QQ::Virtual as often as you'd like. They can be used in sort clauses as well in DataGrids.

The QQ::SubSql allows you to define a sql subquery... but if you want to do things like compare it with items that are in the parent query, you'll need to use delimiters like {1}, {2}, {3}, etc. and then specify the QQNodes in the parent query you want to perform operations/comparisons on.

My own tests have shown that you can reuse a node delimiter, (i.e. {1}) multiple times in a query to refer to the same node.

To get the value of a virtual attribute, continue to use $obj->GetVirtualAttribute(“attr_name”);

#8  |  VexedPanda (Calgary, AB) Canada
Wednesday, October 31, 2007, 11:20 AM PDT

Ok, QQ::SubSql is very similar to how I structured my QQCustomCondition class then.
So I can do:

QQ::In(QQN::Table1()->CateogoryId, QQ::SubSql("select category_id from products where price < {1}", QQN::Table1()->PriceLimit));

What I was really hoping for was something more like:

$catIdQuery = new QQ::SubQuery(QQN::Products());
$catIdQuery->AddSelectNode = (QQN::Products()->CategoryId);
$catIdQuery->Conditions = QQ::LessThan(QQN::Products()->Price, $catIdQuery->ParentNode->PriceLimit);
$result = Table1::QueryArray(QQ::In(QQN::Table1()->CategoryId, $catIdQuery));
.bc
#9  |  VexedPanda (Calgary, AB) Canada
Wednesday, October 31, 2007, 11:45 AM PDT

Or maybe having a Products::SubQuery($selectNodes) function to combine the first 2 lines.

#10  |  Shannon Pekary (East Palo Alto, CA) United States of America Qcodo Core Contributor
Wednesday, October 31, 2007, 3:44 PM PDT

Yes, Mike said that he was working on something like that, but it was taking too much time for now. SubSql is a step in that direction.



Copyright © 2005 - 2012, Quasidea Development, LLC
This open-source framework for PHP is released under the terms of The MIT License.