That's fairly DB specific.

For postgres for example you can do something along these lines:

source:
http://stackoverflow.com/questions/20582500/how-to-check-if-a-table-exists-in-a-given-schema



SELECT EXISTS (
   SELECT 1
   FROM   information_schema.tables
   WHERE  table_schema = 'ui'
   AND    table_name = 'users');

which returns a boolean of true if it exists.  Each DB will have a at
least one way of doing this but it's hardly consistent.

MySQL has a different set of tables to check etc...You can find the
correct tables to query and invoke it via Jooq if you'd like.




On Thu, May 26, 2016 at 2:11 PM, <[email protected]> wrote:

> Hi
>
> I would like to figure out if a table is existing.
>
> I haven't found a cross database way to do it up to now.
>
> As such I'm seriously thinking of throwing some stupid select at it and
> see whether it fails. I'm a bit annoyed by the extra exception (and stack
> compilation), for the performance cost, but I haven't found any better way.
>
> Am I missing some better way?
>
> Thanks again for jOOQ!
>
> NB: I know of createTableIfNotExists, but this isn't on all DB...
>
> cheers
> joseph
>
> --
> You received this message because you are subscribed to the Google Groups
> "jOOQ User Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Thank you
Samir Faci

-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to