This patch adds a function TableExists which checks for the existence of a given table and returns 1 or 0 accordingly. This allows us to check for the existence of a given table when doing operations on tables which may not exist in a given database which, in turn, will reduce the number of red errors which show up after an upgrade. An example of its use is included in this patch.
Created attachment 8915 [details] [review] Patch to add feature
QA Comment, Why don't you simply use the following syntax: DROP TABLE IF NOT EXISTS $tablename It is supported by mysql and postgresql http://dev.mysql.com/doc/refman/5.1/en/drop-table.html http://www.postgresql.org/docs/8.2/static/sql-droptable.html
(In reply to comment #2) > QA Comment, > > Why don't you simply use the following syntax: > DROP TABLE IF NOT EXISTS $tablename > > It is supported by mysql and postgresql > > http://dev.mysql.com/doc/refman/5.1/en/drop-table.html > http://www.postgresql.org/docs/8.2/static/sql-droptable.html The included syntax is truly DB agnostic, whereas some DBs may implement EXISTS differently.
Created attachment 8921 [details] [review] Bug 7902 - Adding Function to Check for Existence of Tables This patch adds a function TableExists which checks for the existence of a given table and returns 1 or 0 accordingly. This allows us to check for the existence of a given table when doing operations on tables which may not exist in a given database which, in turn, will reduce the number of red errors which show up after an upgrade. An example of its use is included in this patch. Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
QA comment: small new sub that will be usefull for table existence checking. Should be independant from mysql if i'm not mistaking passed QA
There have been no further reports of problems so I am marking this bug resolved.