php-general Digest 12 Dec 2008 15:17:04 -0000 Issue 5841
php-general Digest 12 Dec 2008 15:17:04 - Issue 5841 Topics (messages 284520 through 284541): Re: Foreign Keys Question 284520 by: Waynn Lue 284521 by: Chris 284524 by: clive 284525 by: Robert Cummings 284526 by: clive 284527 by: Waynn Lue 284533 by: Boyd, Todd M. 284537 by: tedd 284538 by: tedd 284539 by: Colin Guthrie 284541 by: tedd Re: Need a brain to bounce some Mysql/DB thoughts off of!! 284522 by: German Geek 284530 by: Jay Blanchard 284531 by: Jay Blanchard 284540 by: tedd How serialize DOMDocument object? 284523 by: íÉÈÁÉÌ çÁ×ÒÉÌÏ× 284528 by: Colin Guthrie Chrome 1.0 released 284529 by: Richard Heyes Re: Poll of Sorts: Application Frameworks--Zend, Cake etc 284532 by: Terion Miller 284534 by: Peter Ford 284535 by: Boyd, Todd M. 284536 by: Colin Guthrie Administrivia: To subscribe to the digest, e-mail: php-general-digest-subscr...@lists.php.net To unsubscribe from the digest, e-mail: php-general-digest-unsubscr...@lists.php.net To post to the list, e-mail: php-gene...@lists.php.net -- ---BeginMessage--- As a side note, FKs do enforce other table specific properties like indexes on the fields being constrained, so they do add value there as well. But there's of course an extra cost on updates and inserts to see if the FK is violated. Waynn On 12/11/08, Colin Guthrie gm...@colin.guthr.ie wrote: 'Twas brillig, and Chris at 12/12/08 01:20 did gyre and gimble: Micah Gersten wrote: Colin Guthrie wrote: The ON DELETE CASCADE option is key here... DELETE FROM students where student_id=1 will remove all traces of that student from the db... all the course they've attended, all the instructors who have taught them etc. keeps things nice and tidy without having to put the structure in your code all over the place. Col Why would you want to delete the instructors when deleting the student? I think he meant the link between the student instructor (in the student_instructor table), not the instructor itself. lol, indeed, that's what I meant... Sorry I thought it was implied in the context! Say you have the following layouts instructors: instructor_id, name students: student_id, name instructor_students: instructor_id, student_id This structure would hold a list of instructors and a list of studends and also a one to many mapping of instructors to students. If you delete a student the FK can cascade to the instructor_students table and thus delete the records that indicate a given instructor (or instructors) taught them. Col -- Colin Guthrie gmane(at)colin.guthr.ie http://colin.guthr.ie/ Day Job: Tribalogic Limited [http://www.tribalogic.net/] Open Source: Mandriva Linux Contributor [http://www.mandriva.com/] PulseAudio Hacker [http://www.pulseaudio.org/] Trac Hacker [http://trac.edgewall.org/] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ---End Message--- ---BeginMessage--- Waynn Lue wrote: As a side note, FKs do enforce other table specific properties like indexes on the fields being constrained, so they do add value there as well. But there's of course an extra cost on updates and inserts to see if the FK is violated. On the external table? No they don't. mysql create table t1(id int primary key, name varchar(255)) engine=innodb; Query OK, 0 rows affected (0.00 sec) mysql create table t2(t2id int, t1id int references t1(id)) engine=innodb; Query OK, 0 rows affected (0.00 sec) mysql show create table t2\G *** 1. row *** Table: t2 Create Table: CREATE TABLE `t2` ( `t2id` int(11) default NULL, `t1id` int(11) default NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 1 row in set (0.00 sec) No auto-index on t2(t1id) at all. You have to define that yourself - you might want it part of a multi-column index for example. You definitely should index it, but it won't happen automatically. -- Postgresql php tutorials http://www.designmagick.com/ ---End Message--- ---BeginMessage--- Colin Guthrie wrote: 'Twas brillig, and tedd at 11/12/08 18:46 did gyre and gimble: As for my Foreign Keys Question, I think the answer is that it enforces rules upon the configuration (i.e., deleting, altering, and such), but does not provide any significant service beyond that. Well that's a fairly significant service in itself. The whole deleting data case is where FK's have saved me significant amount of coding. The ON DELETE CASCADE option is key here... DELETE FROM students where student_id=1 will remove all traces of that student from the db... all the course they've attended, all the instructors who have taught them etc. keeps things nice and tidy
php-general Digest 13 Dec 2008 03:24:35 -0000 Issue 5842
php-general Digest 13 Dec 2008 03:24:35 - Issue 5842 Topics (messages 284542 through 284573): Re: Need a brain to bounce some Mysql/DB thoughts off of!! 284542 by: Robert Cummings 284545 by: ceo.l-i-e.com 284546 by: Daniel Brown 284547 by: Frank Stanovcak 284550 by: Robert Cummings Re: Foreign Keys Question 284543 by: phphelp -- kbk 284553 by: Colin Guthrie 284555 by: tedd Question on if() priorities 284544 by: Frank Stanovcak 284548 by: Maciek Sokolewicz 284549 by: Maciek Sokolewicz 284551 by: Frank Stanovcak 284552 by: Frank Stanovcak Re: Chrome 1.0 released 284554 by: Dotan Cohen 284556 by: Richard Heyes 284557 by: Robert Cummings 284559 by: Dotan Cohen Credit Card processing: Chase PaymenTech 284558 by: phphelp -- kbk question on parameter specification in href tag 284560 by: Xaver Thum 284561 by: Robert Cummings 284562 by: Daniel Brown 284563 by: Xaver Thum Using a class inside of a class 284564 by: Richard Kurth 284573 by: Robert Cummings Resource ID# 5 and Resource id #5 8561 errorshelp 284565 by: Terion Miller 284566 by: Daniel P. Brown 284567 by: Terion Miller 284568 by: Terion Miller 284569 by: Daniel P. Brown 284570 by: Terion Miller 284571 by: Jim Lucas Instructions on compiling PHP 5.2.8 for Mac OS X Server 10.4.11 284572 by: Rene Fournier Administrivia: To subscribe to the digest, e-mail: php-general-digest-subscr...@lists.php.net To unsubscribe from the digest, e-mail: php-general-digest-unsubscr...@lists.php.net To post to the list, e-mail: php-gene...@lists.php.net -- ---BeginMessage--- On Fri, 2008-12-12 at 06:34 -0600, Jay Blanchard wrote: [snip] It's Christmas... the season of giving and tolerance :| [/snip] We will return you to your regularly scheduled Robert Cummings Jan 2nd, 2009 Are you suggesting I'm not tolerant? Pfff. :) Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP ---End Message--- ---BeginMessage--- I would set it up that a person could elect to work with one or more Departments. If they work on a College, they work on all Departments in that college. Another option is to just let them do one Dept at a time, and that's it. Kind of depends on what people actually DO in this work, most of the time. If the whole-college work is rare, then don't bother with it. ---End Message--- ---BeginMessage--- On Fri, Dec 12, 2008 at 10:35, Robert Cummings rob...@interjinn.com wrote: Are you suggesting I'm not tolerant? Pfff. Not since you've let those crosses on the lawn burn out. ;-P And yet, despite all of this, poor ol' php...@lists.php.net is left in the cold. -- /Daniel P. Brown http://www.parasane.net/ daniel.br...@parasane.net || danbr...@php.net 50% Off Hosting! http://www.pilotpig.net/specials.php ---End Message--- ---BeginMessage--- Robert Cummings rob...@interjinn.com wrote in message news:1229096146.22284.27.ca...@localhost... On Fri, 2008-12-12 at 06:34 -0600, Jay Blanchard wrote: [snip] It's Christmas... the season of giving and tolerance :| [/snip] We will return you to your regularly scheduled Robert Cummings Jan 2nd, 2009 Are you suggesting I'm not tolerant? Pfff. :) Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP if you break it down he actually said you are very tollerant, but there is an explicit limiter of Jan 2nd on the degree of tollerance supplied by the said Cummings system. ---End Message--- ---BeginMessage--- On Fri, 2008-12-12 at 11:02 -0500, Daniel Brown wrote: On Fri, Dec 12, 2008 at 10:35, Robert Cummings rob...@interjinn.com wrote: Are you suggesting I'm not tolerant? Pfff. Not since you've let those crosses on the lawn burn out. ;-P Those aren't crosses... they're plus symbols, I was teaching my son basic addition when suddenly a bolt of lightning smacked our car, which then exploded and splashed our symbols with burning gasoline and car wreckage. Yeah, that's what REEALLY happened! And yet, despite all of this, poor ol' php...@lists.php.net is left in the cold. There's a php-db list? What for? ;) Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP ---End Message--- ---BeginMessage--- In my enrollment database, we keep historical information. My client is a big computer training organization (for which I also teach). The enrollment information is quite fluid -- people are always canceling or rescheduling. It is important for us to know a person's history. $.02 Ken On Dec 12, 2008, at 9:16 AM, tedd wrote: At 2:50 PM + 12/12/08, Colin Guthrie wrote: 'Twas brillig, and tedd