public static string UnquoteIdentifierIfQuoted(this string identifier)
 {
     if (!string.IsNullOrWhiteSpace(identifier))
     {
         var cb = new OracleCommandBuilder();
         if (identifier.StartsWith(cb.QuotePrefix) && identifier.EndsWith(cb.QuoteSuffix))
         {
             return(cb.UnquoteIdentifier(identifier));
         }
     }
     return(identifier);
 }
 public static string UnquoteIdentifierIfQuoted(this string identifier)
 {
     if (!string.IsNullOrWhiteSpace(identifier))
     {
         var cb = new OracleCommandBuilder();
         if (identifier.StartsWith(cb.QuotePrefix) && identifier.EndsWith(cb.QuoteSuffix))
         {
             return cb.UnquoteIdentifier(identifier);
         }
     }            
     return identifier;
 }
 public static string UnquoteIdentifierIfQuoted(this OracleCommandBuilder commandBuilder, string identifier)
 {
     if (commandBuilder == null)
     {
         throw new ArgumentNullException("commandBuilder");
     }
     if (!string.IsNullOrWhiteSpace(identifier))
     {
         if (identifier.StartsWith(commandBuilder.QuotePrefix) && identifier.EndsWith(commandBuilder.QuoteSuffix))
         {
             return(commandBuilder.UnquoteIdentifier(identifier));
         }
     }
     return(identifier);
 }
Example #4
0
    static void Main(string[] args)
    {
        //create an OracleCommandBuilder object.
        OracleCommandBuilder builder = new OracleCommandBuilder();

        string identifier = "US\"ER";

        Console.WriteLine("Identifier is {0}", identifier);

        // quote the identifier
        string quoteIdentifier = builder.QuoteIdentifier(identifier);

        //quoteIdentifier of "US\"ER" is (\"US\"\"ER\")
        Console.WriteLine("QuotedIdentifier is {0}", quoteIdentifier);
        string unquoteIdentifier = builder.UnquoteIdentifier(quoteIdentifier);

        //And its unquoteIdentifier is US\"ER
        Console.WriteLine("UnquotedIdentifier is {0}", unquoteIdentifier);
    }