Example #1
0
        public static async Task <bool> FunctionExists(this NpgsqlConnection conn, DbObjectName functionIdentifier)
        {
            var sql =
                "SELECT specific_schema, routine_name FROM information_schema.routines WHERE type_udt_name != 'trigger' and routine_name like :name and specific_schema = :schema;";

            using var reader = await conn.CreateCommand(sql)
                               .With("name", functionIdentifier.Name)
                               .With("schema", functionIdentifier.Schema)

                               .ExecuteReaderAsync();

            return(await reader.ReadAsync());
        }
Example #2
0
        public static NpgsqlCommand CallsSproc(this NpgsqlCommand cmd, DbObjectName function)
        {
            if (cmd == null)
            {
                throw new ArgumentNullException(nameof(cmd));
            }
            if (function == null)
            {
                throw new ArgumentNullException(nameof(function));
            }

            cmd.CommandText = function.QualifiedName;
            cmd.CommandType = CommandType.StoredProcedure;

            return(cmd);
        }
Example #3
0
 internal static string ToIndexName(this DbObjectName name, string prefix, params string[] columnNames)
 {
     return($"{prefix}_{name.Name}_{columnNames.Join("_")}");
 }
Example #4
0
        public static Task <Function> FindExistingFunction(this NpgsqlConnection conn, DbObjectName functionName)
        {
            var function = new Function(functionName, null);

            return(function.FetchExisting(conn));
        }
Example #5
0
 protected bool Equals(DbObjectName other)
 {
     return(GetType() == other.GetType() && string.Equals(QualifiedName, other.QualifiedName, StringComparison.OrdinalIgnoreCase));
 }
Example #6
0
 public Sequence(DbObjectName identifier, long startWith)
 {
     Identifier = identifier;
     _startWith = startWith;
 }
Example #7
0
 public Sequence(DbObjectName identifier)
 {
     Identifier = identifier;
 }
Example #8
0
 public Sequence(string identifier)
 {
     Identifier = DbObjectName.Parse(identifier);
 }
Example #9
0
 public Sequence(string identifier)
 {
     Identifier = DbObjectName.Parse(PostgresqlProvider.Instance, identifier);
 }