QuoteIdentifier() public method

Given an unquoted identifier in the correct catalog case, returns the correct quoted form of that identifier, including properly escaping any embedded quotes in the identifier.
Unquoted identifier parameter cannot be null
public QuoteIdentifier ( string unquotedIdentifier ) : string
unquotedIdentifier string The original unquoted identifier.
return string
        private static string InitSnapshotStoreSql(string tableName, string schemaName = null)
        {
            if (string.IsNullOrEmpty(tableName)) throw new ArgumentNullException("tableName", "Akka.Persistence.PostgreSql snapshot store table name is required");
            schemaName = schemaName ?? "public";

            var cb = new NpgsqlCommandBuilder();
            return string.Format(SqlSnapshotStoreFormat, cb.QuoteIdentifier(schemaName), cb.QuoteIdentifier(tableName), cb.UnquoteIdentifier(schemaName), cb.UnquoteIdentifier(tableName));
        }
 public static string QuoteSchemaAndTable(this string sqlQuery, string schemaName, string tableName)
 {
     var cb = new NpgsqlCommandBuilder();
     return string.Format(sqlQuery, cb.QuoteIdentifier(schemaName), cb.QuoteIdentifier(tableName));
 }
示例#3
0
 public void CommandBuilderQuoting()
 {
     var cb = new NpgsqlCommandBuilder();
     const string orig = "some\"column";
     var quoted = cb.QuoteIdentifier(orig);
     Assert.That(quoted, Is.EqualTo("\"some\"\"column\""));
     Assert.That(cb.UnquoteIdentifier(quoted), Is.EqualTo(orig));
 }