Exemple #1
0
        internal static void FieldTypeEquals(FieldType type, string connectionString, string tableName, string fieldName)
        {
            var sql        = "SELECT DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = @tableName AND COLUMN_NAME = @fieldName";
            var actual     = ExecuteScalar(connectionString, sql, new SqliteParameter("tableName", tableName), new SqliteParameter("fieldName", fieldName)).ToString();
            var actualType = SqliteManager.GetFieldType(actual);

            if (type != actualType)
            {
                throw new Exception("Field '" + fieldName + "' in table '" + tableName + "' is not a " + type + ", its " + actual + " (" + actualType + ")");
            }
        }