[Bug 7902] New: Adding Function to Check for Existence of Tables
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7902 Priority: P5 - low Change sponsored?: --- Bug ID: 7902 Assignee: gmcharlt@gmail.com Summary: Adding Function to Check for Existence of Tables QA Contact: koha.sekjal@gmail.com Severity: enhancement Classification: Unclassified OS: All Reporter: cnighswonger@foundations.edu Hardware: All Status: NEW Version: rel_3_8 Component: Database Product: Koha 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. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7902 Chris Nighswonger <cnighswonger@foundations.edu> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff Assignee|gmcharlt@gmail.com |cnighswonger@foundations.ed | |u --- Comment #1 from Chris Nighswonger <cnighswonger@foundations.edu> --- Created attachment 8915 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=8915&action=edit Patch to add feature -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7902 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jonathan.druart@biblibre.co | |m --- Comment #2 from Jonathan Druart <jonathan.druart@biblibre.com> --- 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 -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7902 --- Comment #3 from Chris Nighswonger <cnighswonger@foundations.edu> --- (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. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7902 Jared Camins-Esakov <jcamins@cpbibliography.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #8915|0 |1 is obsolete| | --- Comment #4 from Jared Camins-Esakov <jcamins@cpbibliography.com> --- Created attachment 8921 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=8921&action=edit 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> -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7902 Jared Camins-Esakov <jcamins@cpbibliography.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7902 Paul Poulain <paul.poulain@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA CC| |paul.poulain@biblibre.com --- Comment #5 from Paul Poulain <paul.poulain@biblibre.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 -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7902 Paul Poulain <paul.poulain@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to Master -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org