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()); }
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); }
internal static string ToIndexName(this DbObjectName name, string prefix, params string[] columnNames) { return($"{prefix}_{name.Name}_{columnNames.Join("_")}"); }
public static Task <Function> FindExistingFunction(this NpgsqlConnection conn, DbObjectName functionName) { var function = new Function(functionName, null); return(function.FetchExisting(conn)); }
protected bool Equals(DbObjectName other) { return(GetType() == other.GetType() && string.Equals(QualifiedName, other.QualifiedName, StringComparison.OrdinalIgnoreCase)); }
public Sequence(DbObjectName identifier, long startWith) { Identifier = identifier; _startWith = startWith; }
public Sequence(DbObjectName identifier) { Identifier = identifier; }
public Sequence(string identifier) { Identifier = DbObjectName.Parse(identifier); }
public Sequence(string identifier) { Identifier = DbObjectName.Parse(PostgresqlProvider.Instance, identifier); }