sapiens / SqlFu

Fast and versatile .net core data mapper/micro-orm
Other
229 stars 50 forks source link

Typo bug in DbProvider.EscapeTableName #89

Closed gideonkorir closed 8 years ago

gideonkorir commented 8 years ago

Keep getting System.FormatException when I specify the table schema either using conventions or TableAttribute. Tracked the culprit to EscapeTableName:

public string EscapeTableName(TableName table)
        {
            var schema = "";
            if (!table.Schema.IsNullOrEmpty())
            {
                schema = Escape(schema,EscapeChars.Start,EscapeChars.End)+".";
            }

            return schema + Escape(table.Name,EscapeChars.Start, EscapeChars.End);
        }

After we check that table.Schema is not null or empty, we try and escape the empty schema variable which causes us to throw

sapiens commented 8 years ago

Thanks, ver 3.3.2 contains the PR.