-n
On Mar 4, 2008, at 7:38 PM, Arnold Daniels wrote:
> Hi Nat,
>
> 1.) No it shouldn't.
>
> 2.) You're not an idiot. I've never tried using subqueries in the
> SELECT part, I use them in the FROM part. I think that putting the
> subqueries in the SELECT part, will not be good for the
> performance, since a query is executed for each row.
>
> In this example you don't seem to aggregate any of the data from
> the subqueries. If you don't need aggregated subdata, like multiple
> locations for an event, you don't need subqueries, just do a normal
> joint over all the tables. Otherwise you should use xql_agg() in
> the subquery.
>
> 3.) Some small notices:
> - For xql_element() the field name is only used with the
> attributes, so an alias (AS) for the first 2 arguments isn't
> necessary.
> - To output you should use echo, not print_r.
>
> Good luck,
> Arnold
$db->query("SELECT xql_concat(xql_textdecl('1.0', 'UTF-8'),
xql_agg('calendar' AS `xql:root`, xql_element(
'event', xql_forest('content' AS `photo`, event_status AS
`status`,header,headline), id, announce)
)
)
FROM _cms_calendar_shows LEFT JOIN _cms_media ON
_cms_calendar_shows.image_id = _cms_media.id WHERE
_cms_calendar_shows.id = 400");
On Mar 4, 2008, at 8:26 PM, Arnold Daniels wrote:
> It should something like
>
> SELECT ... FROM _cms_calendar_shows LEFT JOIN _cms_media ON
> _cms_calendar_shows.image_id = _cms_media.id LEFT
> JOIN_cms_calendar_venue ON _cms_calendar_shows.venue_id =
> _cms_calendar_venue.id WHERE ...
>
> Try making a query without xql, but with all the data, first.
>
> +a :p
SELECT ... FROM _cms_calendar_shows LEFT JOIN _cms_media ON
_cms_calendar_shows.image_id = _cms_media.id LEFT
JOIN_cms_calendar_venue ON _cms_calendar_shows.venue_id =
_cms_calendar_venue.id WHERE ...
Try making a query without xql, but with all the data, first.
+a :p
1.) No it shouldn't.
2.) You're not an idiot. I've never tried using subqueries in the SELECT
part, I use them in the FROM part. I think that putting the subqueries
in the SELECT part, will not be good for the performance, since a query
is executed for each row.
In this example you don't seem to aggregate any of the data from the
subqueries. If you don't need aggregated subdata, like multiple
locations for an event, you don't need subqueries, just do a normal
joint over all the tables. Otherwise you should use xql_agg() in the
subquery.
3.) Some small notices:
- For xql_element() the field name is only used with the attributes, so
an alias (AS) for the first 2 arguments isn't necessary.
- To output you should use echo, not print_r.
Good luck,
Arnold
Again, try to make a query without xql functions first and get that
working. I don't think you want to quote 'content'. That means "content"
as literal string, not field. You probably want to use backquotes
`_cms_media`.`content` AS `photo`.
So
a.) Write a query with the xql functions.
b.) If you get an error, look closely at the query and error message.
MySQL error messages aren't that clear, but you should be able to figure
it out.
c.) Once the query works, see if the data looks correct.
d.) Add xql functions to make XML.
Please try to do a to c on your own. It might take you some effort, but
that is just a peril of learning MySQL. Remember, google is your friend.
Good luck,
Arnold
>>>>> NOW(),CONCAT('on sale
Hello all,
Hi, I am Varadharajan.A from India. I am doing Masters in Engineering in Computer Science. I am doing my final year project in MySQL. I would like to contribute some advanced functions to MySQL. I have implemented the following simple functions: InitCap(), Sinh(), Cosh(), Tanh(), Asinh(), Acosh(), Atanh() and Binom(). I am now implementing the concept – GiST (Generalized Search Tree). I would like to implement some more functions too.
I have included my functions in the MySQL - Open Source Code. I need to test whether my functions work properly. Is there any software available to test it?
Thank You,
Varadharajan.A
There is a Test Suite for MySQL call mysql-test.
http://dev.mysql.com/doc/refman/5.1/en/mysql-test-suite.html
It works kind of like unit testing. You write your queries, than execute
them. Have a close look at if the results are correct and than use a
flag to store the results. Next time, after modifying your functions,
you can check if nothing broke.
Good luck,
Arnold