ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

11-2-2 «Ø¥ß¸ê®ÆªíÃöÁp©Ê

11-2-2 «Ø¥ß¸ê®ÆªíÃöÁp©Ê

11-2-2   «Ø¥ß¸ê®ÆªíÃöÁp©Ê
¤F¸Ñ¤FMainTitle¡]¥D¼ÐÃD¡^¸ê®Æªí»PSubTitle¡]¦¸¼ÐÃD¡^¸ê®Æªí¤¤¡y¥D½s¸¹¡z¡B¡y¦¸½s¸¹¡zªº¹ïÀ³Ãö«Y«á¡A§Ú­Ì´N¨Ó¶i¦æMainTitle¡]¥D¼ÐÃD¡^¸ê®Æªí»PSubTitle¡]¦¸¼ÐÃD¡^¸ê®Æªíªº¡yÃöÁp©Ê¡z³]©w¡I²{¦bµ§ªÌ´N¬°±z²¤¶¤@¤U¦p¦ó¨Ï¥ÎphpMyAdmin¬°MySQL¸ê®Æ®w¤¤ªº¸ê®Æªí«Ø¥ßÃöÁp©Ê¡C

­n¨Ï¥ÎphpMyAdmin¬°MySQL¸ê®Æ®w¤¤ªº¸ê®Æªí«Ø¥ßÃöÁp©Ê¤§«e¡A¥ý¨Ó¸Ñ¨M¤@¤U¡uºÞ²z¡v¥\¯à¤¤¡uÃöÁp¸ê®Æªíªºªþ¥[¥\¯à¥¼¯à±Ò°Ê, ½Ð«ö¦¹¬d¥X°ÝÃD­ì¦].¡vªº°ÝÃD¡A¿ï©w¸ê®Æ®w«á¡A«ö¤U¡uºÞ²z¡v¶W³sµ²¹Ï¥Ü¡G

¹Ï11-24   ¸ê®ÆªíÃöÁp¥\¯àµLªk¨Ï¥Î¡C

­¶­±³Ì¤U¤è¡A¥X²{¿ù»~°T®§¡G¡uÃöÁp¸ê®Æªíªºªþ¥[¥\¯à¥¼¯à±Ò°Ê, ½Ð«ö¦¹¬d¥X°ÝÃD­ì¦].¡v¡A³o¬O¦]¬°­n¨Ï¥ÎphpMyAdmin¨Ó«Ø¥ß¸ê®ÆªíÃöÁp¥²¶·¦³°O¿ýÃöÁp©Êªº¸ê®Æ®w¦s¦b¡AphpMyAdmin¥²¶·§Q¥Î³o¨Ç°O¿ý¨Ó±Ò°ÊºÞ²zÃöÁp¸ê®Æªíªºªþ¥[¥\¯à¡A¸Ñ¨M¤èªk»P¨BÆJ¦p¤U¡G
1¡B¶}±ÒphpMyAdminªº³]©wÀÉ¡uconfig.inc.php¡v¡C
2¡B±N¬ÛÃö²ÕºA§ó§ï³]©w¦p¤U¡G
  1. $cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';
  2. $cfg['Servers'][$i]['bookmarktable'] = 'bookmark';
  3. $cfg['Servers'][$i]['relation'] = 'relation';
  4. $cfg['Servers'][$i]['table_info'] = 'table_info';
  5. $cfg['Servers'][$i]['table_coords'] = 'table_coords';
  6. $cfg['Servers'][$i]['pdf_pages'] = 'pdf_pages';
  7. $cfg['Servers'][$i]['column_info'] = 'column_info';
  8. $cfg['Servers'][$i]['history'] = 'history';
½Æ»s¥N½X

¹Ï11-25   ¡uconfig.inc.php¡v³]©w¡C

3¡B§Q¥ÎphpMyAdmin«Ø¥ß¤@­Ó¦W¬°¡uphpmyadmin¡vªº¸ê®Æ®w¡C

¹Ï11-26   «Ø¥ß¡uphpmyadmin¡v¸ê®Æ®w¡C
¤ß¦w¡A¥­¦w   
µoªí¥ô¦óµL·N¸qªº·PÁ©ÎÄé¤ô¤å³¹¤@«ß¬å,¬Ã±¤±b¸¹,½Ð¸Ô¾\ª©³W!!

4¡B°Ñ·Ó¹Ï11-26¡A«ö¤U¡uSQL¡v¶W³sµ²¹Ï¥Ü¡A¥X²{SQL«ü¥O¿é¤Jªº¤å¦r¤è¶ôµe­±¡G

¹Ï11-27   SQL«ü¥O¿é¤J¡C

5¡B©óSQL«ü¥O¿é¤Jªº¤å¦r¤è¶ô¤¤¿é¤J¤U¦C«ü¥O¡A¨Ã«ö¤U¡u°õ¦æ¡v«ö¶s¥H«K«Ø¥ß»P¨BÆJ²ÕºA³]©w¬Û¹ïÀ³ªº¸ê®Æªí¡G
  1. CREATE TABLE `bookmark` (
  2. `id` int(11) NOT NULL auto_increment,
  3. `dbase` varchar(255) NOT NULL default '',
  4. `user` varchar(255) NOT NULL default '',
  5. `label` varchar(255) NOT NULL default '',
  6. `query` text NOT NULL,
  7. PRIMARY KEY (`id`)
  8. ) TYPE=MyISAM COMMENT='Bookmarks' AUTO_INCREMENT=1 ;


  9. CREATE TABLE `column_info` (
  10. `id` int(5) unsigned NOT NULL auto_increment,
  11. `db_name` varchar(64) NOT NULL default '',
  12. `table_name` varchar(64) NOT NULL default '',
  13. `column_name` varchar(64) NOT NULL default '',
  14. `comment` varchar(255) NOT NULL default '',
  15. `mimetype` varchar(255) NOT NULL default '',
  16. `transformation` varchar(255) NOT NULL default '',
  17. `transformation_options` varchar(255) NOT NULL default '',
  18. PRIMARY KEY (`id`),
  19. UNIQUE KEY `db_name` (`db_name`,`table_name`,`column_name`)
  20. ) TYPE=MyISAM COMMENT='Comments for Columns' AUTO_INCREMENT=24 ;

  21. CREATE TABLE `history` (
  22. `id` bigint(20) unsigned NOT NULL auto_increment,
  23. `username` varchar(64) NOT NULL default '',
  24. `db` varchar(64) NOT NULL default '',
  25. `table` varchar(64) NOT NULL default '',
  26. `timevalue` timestamp(14) NOT NULL,
  27. `sqlquery` text NOT NULL,
  28. PRIMARY KEY (`id`),
  29. KEY `username` (`username`,`db`,`table`,`timevalue`)
  30. ) TYPE=MyISAM COMMENT='SQL history' AUTO_INCREMENT=1 ;

  31. CREATE TABLE `pdf_pages` (
  32. `db_name` varchar(64) NOT NULL default '',
  33. `page_nr` int(10) unsigned NOT NULL auto_increment,
  34. `page_descr` varchar(50) NOT NULL default '',
  35. PRIMARY KEY (`page_nr`),
  36. KEY `db_name` (`db_name`)
  37. ) TYPE=MyISAM COMMENT='PDF Relationpages' AUTO_INCREMENT=3 ;

  38. CREATE TABLE `relation` (
  39. `master_db` varchar(64) NOT NULL default '',
  40. `master_table` varchar(64) NOT NULL default '',
  41. `master_field` varchar(64) NOT NULL default '',
  42. `foreign_db` varchar(64) NOT NULL default '',
  43. `foreign_table` varchar(64) NOT NULL default '',
  44. `foreign_field` varchar(64) NOT NULL default '',
  45. PRIMARY KEY (`master_db`,`master_table`,`master_field`),
  46. KEY `foreign_field` (`foreign_db`,`foreign_table`)
  47. ) TYPE=MyISAM COMMENT='Relation table';

  48. CREATE TABLE `table_coords` (
  49. `db_name` varchar(64) NOT NULL default '',
  50. `table_name` varchar(64) NOT NULL default '',
  51. `pdf_page_number` int(11) NOT NULL default '0',
  52. `x` float unsigned NOT NULL default '0',
  53. `y` float unsigned NOT NULL default '0',
  54. PRIMARY KEY (`db_name`,`table_name`,`pdf_page_number`)
  55. ) TYPE=MyISAM COMMENT='Table coordinates for phpMyAdmin PDF output';

  56. CREATE TABLE `table_info` (
  57. `db_name` varchar(64) NOT NULL default '',
  58. `table_name` varchar(64) NOT NULL default '',
  59. `display_field` varchar(64) NOT NULL default '',
  60. PRIMARY KEY (`db_name`,`table_name`)
  61. ) TYPE=MyISAM COMMENT='Table information for phpMyAdmin';
½Æ»s¥N½X
¤ß¦w¡A¥­¦w   
µoªí¥ô¦óµL·N¸qªº·PÁ©ÎÄé¤ô¤å³¹¤@«ß¬å,¬Ã±¤±b¸¹,½Ð¸Ô¾\ª©³W!!

TOP

6¡B¨BÆJ5ªº«ü¥O°õ¦æ«á±N©ó¨BÆJ3©Ò«Ø¥ßªº¡uphpmyadmin¡v¸ê®Æ®w¤¤·s¼W7­Ó¸ê®Æªí¡G

¹Ï11-28   ¡uphpmyadmin¡v¸ê®Æ®w¤¤·s¼W7­Ó¸ê®Æªí¡C

   ´£¥Ü!!
¦b½d¨Ò¥úºÐ\DataBase¥Ø¿ý¤¤¦³¤@­ÓMySQL¸ê®Æ®w¡uphpmyadmin¡v¡AÀɮצWºÙ¬°¡uphpmyadmin.sql¡v¡A½Ð±z±NÀɮ׽ƻs¨ì±zªºµwºÐ¸Ì¨Ã¨Ï¥ÎphpMyAdmin±N¨ä¸ü¤J¨ìMySQL Server¤¤¡A±z¥iª½±µ¥[¥H§Q¥Î¡A¦ý¬O¨BÆJ1¡B2¤´¶·¥Ñ±z¦Û¤v¤â°Ê§¹¦¨³á¡C
phpmyadmin.sql (4.28 KB)
¤ß¦w¡A¥­¦w   
µoªí¥ô¦óµL·N¸qªº·PÁ©ÎÄé¤ô¤å³¹¤@«ß¬å,¬Ã±¤±b¸¹,½Ð¸Ô¾\ª©³W!!

TOP

¸Ñ¨M¤F¡uÃöÁp¸ê®Æªíªºªþ¥[¥\¯à¥¼¯à±Ò°Ê, ½Ð«ö¦¹¬d¥X°ÝÃD­ì¦].¡vªº°ÝÃD«á¡A§Ú­Ì±µµÛ¨Ó«Ø¥ßMainTitle¸ê®Æªí»PSubTitle¸ê®ÆªíªºÃö³s©Ê¡G
1¡B¿ï¨úBBS¸ê®Æ®w->ÂI¿ïSubTitle¸ê®Æªí¶µ¥Ø¤Wªº¡uµ²ºc¡v¶W³sµ²¹Ï¥Ü¡G

¹Ï11-29   ¬d¬ÝSubTitle¸ê®Æªíªºµ²ºc¡C

2¡B¦b¬d¬ÝSubTitle¸ê®Æªíªºµ²ºcµe­±¤¤¡A·|¦C¥XSubTitle¸ê®Æªí¤¤¥þ³¡Äæ¦ìªº¬ÛÃö¸ê°T¡A¦bÄæ¦ì¸ê°T¦Cªíªº¤U¤è¦³¤@­Ó¡uÃöÁpÀ˵ø¡vªº¶W³sµ²¹Ï¥Ü¶µ¥Ø¡A½ÐÂI¿ï¸Ó¶W³sµ²¹Ï¥Ü¶µ¥Ø¡G

¹Ï11-30  ¡uÃöÁpÀ˵ø¡vªº¶W³sµ²¹Ï¥Ü¶µ¥Ø¡C

3¡B¶i¤JSubTitle¸ê®ÆªíªºÃöÁpÀ˵øµe­±«á¡A¦b¥D½s¸¹Äæ¦ì¤¤¡G¤º³¡ÃöÁp¿ï¨ú¡usubtitle->¥D½s¸¹¡v¡AÃöÁpÄæ¦ì¿ï¨ú¡umaintitle->¥D½s¸¹¡v¡AON DELETE¡BON UPDATEÄæ¦ì«h¿ï¨ú¡uCASCADE¡v¡G

¹Ï11-31  ÃöÁpÄæ¦ì³]©w¡C

ON DELETE¡BON UPDATEÄæ¦ì
·í§Ú­Ì¿ï¨ú¡uCASCADE¡v¡G

  • ¦ê±µ§ó·s¡]UPDATE¡^¬ÛÃöÄæ¦ì¡G·íMainTitle¡]¥D¼ÐÃD¡^¸ê®Æªí¤¤ªº¥D½s¸¹Äæ¦ì¸ê®Æ­È§ïÅܮɡASubTitle¡]¦¸¼ÐÃD¡^¸ê®Æªí¤¤¬Û¹ïÀ³ªº¥D½s¸¹Äæ¦ì­È¤]·|¸òµÛ¤@°_Åܧó¡C
  • ¦ê±µ§R°£¡]DELETE¡^¬ÛÃö¬ö¿ý¡G·íMainTitle¡]¥D¼ÐÃD¡^¸ê®Æªí¤¤ªº¬Y¤@µ§¸ê®Æ¿ý³Q§R°£®É¡A°²³]¨ä¥D½s¸¹Äæ¦ì­È¬°¢°¡A«hSubTitle¡]¦¸¼ÐÃD¡^¸ê®Æªí¤¤¬Û¹ïÀ³¥D½s¸¹Äæ¦ì­È¬°¢°ªº¸ê®Æ¿ý¤]·|¥þ³¡³Q¦Û°Ê§R°£¡C
¤ß¦w¡A¥­¦w   
µoªí¥ô¦óµL·N¸qªº·PÁ©ÎÄé¤ô¤å³¹¤@«ß¬å,¬Ã±¤±b¸¹,½Ð¸Ô¾\ª©³W!!

TOP

4¡B³]©w¦n¬ÛÃöªºÃöÁpÄæ¦ì¸ê°T«á¡A«ö¤U¹Ï11-31¤¤ªº¡u°õ¦æ¡v«ö¶s§Y§¹¦¨MainTitle¡]¥D¼ÐÃD¡^¡BSubTitle¡]¦¸¼ÐÃD¡^¸ê®ÆªíªºÃö³s©Ê³]©w¡A¦¹ÃöÁp©Êªº³]©w¨BÆJµ¥¦P°õ¦æ¤U¦CªºSQL©R¥O¡G
  1. ALTER TABLE `subtitle`
  2. ADD CONSTRAINT `subtitle_ibfk_1`
  3. FOREIGN KEY (`¥D½s¸¹`)
  4. REFERENCES `maintitle` (`¥D½s¸¹`)
  5. ON DELETE CASCADE ON UPDATE CASCADE;
½Æ»s¥N½X
´£¥Ü¡I¡I
«Ø¥ß¸ê®ÆªíªºÃöÁp©Ê´N¬O«Ø¥ß¸ê®Æªí¶¡ªºFOREIGN KEY±ø¥ó¬ù§ô¡A¤÷¸ê®Æªí¡]¥D¼ÐÃD¸ê®Æªí¡^¤¤¥Î¨Ó«Ø¥ßÃöÁp©ÊªºÄæ¦ìºÙ¤§¬°¥~³¡¯Á¤ÞÁä¡]Foreign Key¡^¡A¤SºÙ¥~¨ÓÁä¡A¦Ó¤l¸ê®Æªí¡]¦¸¼ÐÃD¸ê®Æªí¡^¤¤¥Î¨Ó«Ø¥ßÃöÁp©ÊªºÄæ¦ìºÙ¤§¬°¥D¯Á¤ÞÁä¡]Primary Key¡^¡F«Ø¥ß¸ê®ÆÃöÁp©Êªº¥Øªº¬O¬°¤FºûÅ@¸ê®Æªí¶¡ªº¡u°Ñ¦Ò§¹¾ã©Ê¡]Referential Integrity¡^¡v¡C


5¡B¿ï¨úphpmyadmin¸ê®Æ®w->ÂI¿ïrealation¸ê®Æªí->ÂI¿ï¡uÂsÄý¡v¶W³sµ²¹Ï¥Ü¡A±z±Nµo²{§Ú­Ì­è­è«Ø¥ßªº¸ê®ÆªíÃöÁp¸ê°T³Q°O¿ý¦b¨ä¤¤¡G

¹Ï11-32  ¬d¬Ý¸ê®ÆªíÃöÁp¸ê°T¡C
¤ß¦w¡A¥­¦w   
µoªí¥ô¦óµL·N¸qªº·PÁ©ÎÄé¤ô¤å³¹¤@«ß¬å,¬Ã±¤±b¸¹,½Ð¸Ô¾\ª©³W!!

TOP

·Q½Ð°Ý¤@¤U
¦A¶×¤Jphpmyadmin¸ê®Æªí®É
§Ú¥Îªº¬OSQL»yªk
¥i¬O«o¶]¥X

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TYPE=MyISAM COMMENT='Bookmarks' AUTO_INCREMENT=1' at line 8
¨S¿ìªk«Ø¥ß¸ê®Æ®w
½Ð°Ý¬O­þ¤@¬q¿ù¤F©O

TOP

        ÀR«ä¦Û¦b : ¤H¨ÆªºÁ}Ãø»PµZ¿i¡A´N¬O¤@ºØ¦ÒÅç¡C
ªð¦^¦Cªí ¤W¤@¥DÃD