PHP Classes

Problem: possible bug in getSchema

Recommend this page to a friend!

      App PHP Model Class  >  All threads  >  Problem: possible bug in getSchema  >  (Un) Subscribe thread alerts  
Subject:Problem: possible bug in getSchema
Summary:getSchema fetches first table by name of different database
Messages:3
Author:Jan Setzer
Date:2022-05-20 16:15:24
 

  1. Problem: possible bug in getSchema   Reply   Report abuse  
Picture of Jan Setzer Jan Setzer - 2022-05-20 16:15:24
Nice class, I'm giving it a try today.

The save() method tries to update a table with identical name but in different database. Those two tables have different column. Save fails due to missing column.

$sql = self::_getDB()->query("SELECT * FROM `information_schema`.`COLUMNS` WHERE TABLE_NAME = '" . $class::getSource() . "'");

This fetches the first table with matching name but does not check for the correct database.

  2. Re: Problem: possible bug in getSchema   Reply   Report abuse  
Picture of Jan Setzer Jan Setzer - 2022-05-20 16:17:32 - In reply to message 1 from Jan Setzer
Additionally Requires:

AND table_schema = 'TABLENAME'

  3. Re: Problem: possible bug in getSchema   Reply   Report abuse  
Picture of SzpaQ SzpaQ - 2022-06-14 10:45:09 - In reply to message 2 from Jan Setzer
Thanks :) Updated I think.