ondras / wwwsqldesigner

WWW SQL Designer, your online SQL diagramming tool
https://sql.toad.cz/?keyword=online_library
BSD 3-Clause "New" or "Revised" License
2.87k stars 725 forks source link

php-dbo backend issue with tables/views not found in information_schema.statistics when building $keys[] index #183

Closed ondras closed 9 years ago

ondras commented 9 years ago

From jeremy.s...@gmail.com on October 29, 2013 19:02:28

What steps will reproduce the problem? 1. click save/load

  1. select backend php-pdo
  2. click import from DB
  3. Enter a database that has tables that aren't listed in the information_schema.statistics table. Or a database that has VIEWS.
  4. Alternative Step: Navigate to http://localhost/wwwsqldesigner-2.7/backend/php-pdo/index.php?action=import&database=[database] What is the expected output? What do you see instead? Steps 1 -4: Expected output is the database er diagram.

Instead an alert is presented: XML error: NULL Output

Step 5: Expected output is XML data representing the database er diagram.

Instead a php alert is issued for an undefined index on line 174 of LayerMYSQL.php What version of the product are you using? On what operating system? Version: 2.7 OS: Windows 7 WAMP stack Please provide any additional information below. Problem: public static function Keys($table) { ... line 174: return self::$keys[$table['name']]; ... }

Doesn't take into account that the table name might not exist in the information_schema.statistics table and therefore not be an entry in the $keys[] index.

Fix: Mimicked the public static function Relations() return if clause: public static function Keys($table) { ... if(isset(self::$keys[$table['name']])) return self::$keys[$table['name']]; return array(); ... }

Thanks! Jeremy

Original issue: http://code.google.com/p/wwwsqldesigner/issues/detail?id=176

ondras commented 9 years ago

From ondrej.zara on October 31, 2013 10:12:05

Status: Accepted

ondras commented 9 years ago

From ondrej.zara on October 31, 2013 10:21:49

Shall be fixed in https://code.google.com/p/wwwsqldesigner/source/detail?r=6706800e25899a71c86796f5f48bbf5262035f21 . Can you please confirm?

Status: Fixed

ondras commented 9 years ago

From jeremy.s...@gmail.com on November 04, 2013 09:02:29

Yes, that's it. Thanks for addressing this so quickly!