I'm using the Tangram perl module, which makes MySQL act like an object
oriented database.
My database has a table of stories (STORY). Each STORY is written by an
AUTHOR. So, the database design is like this:
CREATE TABLE story (
id int PRIMARY KEY NOT NULL,
title VARCHAR(80),
author int # references author.id
);
CREATE TABLE author (
id int PRIMARY KEY NOT NULL
name VARCHAR(80),
email VARCHAR(80)
);
If I want to list all of the stories in a table, along with their author
names, then I would do this in SQL:
SELECT story.*, author.* FROM story, author
WHERE story.author = author.id
But when I'm using the Tangram object oriented interface, it does this:
SELECT * FROM story
SELECT * FROM author WHERE id = 927
SELECT * FROM author WHERE id = 76
SELECT * FROM author WHERE id = 502
(etc., until it gets all the author ids for the stories that it selected)
How inefficient is this compared to simply performing a join? And, does
anyone know how to make Tangram do a join, rather than retrieving the
author objects individually?
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php