Sub check_unique( strTable As String, strColumn As String) as Boolean
Dim ddl As String
Dim isUnique As Boolean = False
'Get table DDL
ddl = Main.SQ.ExecQuerySingleResult($"SELECT sql FROM sqlite_master WHERE type = 'table' AND tbl_name = '${strTable}'"$)
'Clean up brackets, opening parenthesis and replacing closing parenthesis with a comma
ddl = ddl.SubString(ddl.IndexOf("(")+1).Replace(")",",").Replace("[","").Replace("]","")
'extracts the desired field definiion from DDL and check if it contains the UNIQUE clause
ddl = ddl.SubString(ddl.IndexOf(strColumn))
ddl = ddl.SubString2(0, ddl.IndexOf(","))
If ddl.Contains("UNIQUE") Then
isUnique=True
End If
Return isUnique
End Sub