Beispiel #1
0
        private static DecomposeResponse DecomposeSafeName(string schemaId)
        {
            var response = new DecomposeResponse
            {
                Database = "",
                Schema   = "",
                Table    = ""
            };
            var parts = schemaId.Split('.');

            switch (parts.Length)
            {
            case 0:
                return(response);

            case 1:
                response.Table = parts[0];
                return(response);

            case 2:
                response.Schema = parts[0];
                response.Table  = parts[1];
                return(response);

            case 3:
                response.Database = parts[0];
                response.Schema   = parts[1];
                response.Table    = parts[2];
                return(response);

            default:
                return(response);
            }
        }
Beispiel #2
0
        private static DecomposeResponse TrimEscape(this DecomposeResponse response, char escape = '`')
        {
            response.Database = response.Database.Trim(escape);
            response.Schema   = response.Schema.Trim(escape);
            response.Table    = response.Table.Trim(escape);

            return(response);
        }