Skip to content
Advertisement

How to check if table exists?

I’m using this function :

JavaScript

I want to check if the table exists, how can I do it?

I saw some examples using XXXX.execute(). What does it mean?

Here is what I saw:

JavaScript

I tried printing MY_T to see if it returns -1 for example but it just prints "select count (*)...... "

How can I check it?

Advertisement

Answer

Use the “TABLES” information schema view. http://dev.mysql.com/doc/refman/5.0/en/information-schema.html

JavaScript

You can apply this view to your code by doing something like the following:

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement