Android Question How to determine if the specified MYSQL database name data table exists?

Solution
The following function is extracted from my MiniORMUtils library:
MiniORM.bas:
' Tests whether the table exists in the given database (MySQL)
Public Sub TableExists2 (TableName As String, DatabaseName As String) As Boolean
    Dim qry As String = $"SELECT count(TABLE_NAME) FROM TABLES WHERE TABLE_SCHEMA = ? AND TABLE_NAME = ?"$
    Dim count As Int = SQL.ExecQuerySingleResult2(qry, Array As String(DatabaseName, TableName))
    Return count > 0
End Sub

aeric

Expert
Licensed User
Longtime User
The following function is extracted from my MiniORMUtils library:
MiniORM.bas:
' Tests whether the table exists in the given database (MySQL)
Public Sub TableExists2 (TableName As String, DatabaseName As String) As Boolean
    Dim qry As String = $"SELECT count(TABLE_NAME) FROM TABLES WHERE TABLE_SCHEMA = ? AND TABLE_NAME = ?"$
    Dim count As Int = SQL.ExecQuerySingleResult2(qry, Array As String(DatabaseName, TableName))
    Return count > 0
End Sub
 
Upvote 1
Solution
Top