Class Postgres
Allows in/out operations and/or data validations with a PostgreSQL instance.
Implements
Inherited Members
Namespace: AutoCheck.Core.Connectors
Assembly: AutoCheck.dll
Syntax
public class Postgres : Connector, IDisposable
Constructors
| Improve this Doc View SourcePostgres(String, String, String, String, String)
Creates a new connector instance.
Declaration
public Postgres(string host, string database, string username, string password = null, string binPath = "C:\\Program Files\\PostgreSQL\\10\\bin")
Parameters
Type | Name | Description |
---|---|---|
System.String | host | Host address in order to connect with the running PostgreSQL service. |
System.String | database | The PostgreSQL database name. |
System.String | username | The PostgreSQL database username, which will be used to perform operations. |
System.String | password | The PostgreSQL database password, which will be used to perform operations. |
System.String | binPath | The path to the bin folder [only needed for windows systems]. |
Properties
| Improve this Doc View SourceBinPath
The path to the bin folder [only needed for windows systems].
Declaration
public string BinPath { get; }
Property Value
Type | Description |
---|---|
System.String |
Conn
The connection used for communication between PostgreSQL and the current application.
Declaration
public NpgsqlConnection Conn { get; }
Property Value
Type | Description |
---|---|
Npgsql.NpgsqlConnection |
Database
The PostgreSQL database host address, with a running instance allowing remote connections.
Declaration
public string Database { get; }
Property Value
Type | Description |
---|---|
System.String |
Host
PostgreSQL host address.
Declaration
public string Host { get; }
Property Value
Type | Description |
---|---|
System.String |
Password
The PostgreSQL database password, which will be used to perform operations.
Declaration
protected string Password { get; }
Property Value
Type | Description |
---|---|
System.String |
Student
The student name wich is the original database creator.
Declaration
public string Student { get; }
Property Value
Type | Description |
---|---|
System.String |
User
The PostgreSQL database username, which will be used to perform operations.
Declaration
public string User { get; }
Property Value
Type | Description |
---|---|
System.String |
Methods
| Improve this Doc View SourceCompareSelects(String, String)
Compares two select queries, executing them and comparing the exact amount of rows and its data (doesn't compare the column names).
Declaration
public bool CompareSelects(string expected, string compared)
Parameters
Type | Name | Description |
---|---|---|
System.String | expected | The left-side select query. |
System.String | compared | The right-side select query. |
Returns
Type | Description |
---|---|
System.Boolean | True if both select queries are equivalent (returns exactly the same rows). |
CountRegisters(Postgres.Source)
Counts how many registers appears in a table.
Declaration
public long CountRegisters(Postgres.Source source)
Parameters
Type | Name | Description |
---|---|---|
Postgres.Source | source | The unique schema and table from which the data will be loaded. |
Returns
Type | Description |
---|---|
System.Int64 | Amount of registers found. |
CountRegisters(Postgres.Source, Postgres.Filter)
Counts how many registers appears in a table.
Declaration
public long CountRegisters(Postgres.Source source, Postgres.Filter filter)
Parameters
Type | Name | Description |
---|---|---|
Postgres.Source | source | The unique schema and table from which the data will be loaded. |
Postgres.Filter | filter | A filter over a single field which will be used to screen the data, subqueries are allowed but must start with '@' and surrounded by parenthesis like '@(SELECT MAX(id)+1 FROM t)'. |
Returns
Type | Description |
---|---|
System.Int64 | Amount of registers found. |
CountRegisters(String, String)
Counts how many registers appears in a table.
Declaration
public long CountRegisters(string source, string filter = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | source | The set of schemas and tables from which the data will be loaded, should be an SQL FROM sentence (without FROM) allowing joins and alisases. |
System.String | filter | The set of filters which will be used to screen the data, should be an SQL WHERE sentence (without WHERE). |
Returns
Type | Description |
---|---|
System.Int64 | Amount of registers found. |
CountRoles()
Counts how many roles are in the database.
Declaration
public long CountRoles()
Returns
Type | Description |
---|---|
System.Int64 | A dataset containing the requested data. |
CountUsers()
Counts how many user accounts are in the database.
Declaration
public long CountUsers()
Returns
Type | Description |
---|---|
System.Int64 | A dataset containing the requested data. |
CreateDataBase()
Creates a new and empty database.
Declaration
public void CreateDataBase()
CreateDataBase(String)
Creates a new database instance using an SQL Dump file.
Declaration
public void CreateDataBase(string filePath)
Parameters
Type | Name | Description |
---|---|---|
System.String | filePath | The SQL Dump file path. |
CreateDataBase(String, String)
Creates a new database using a SQL Dump file.
Declaration
[Obsolete("This overload has been deprecated, use other overloads and set the binPath (if needed) using the constructor.")]
public void CreateDataBase(string filePath, string binPath)
Parameters
Type | Name | Description |
---|---|---|
System.String | filePath | The SQL Dump file path. |
System.String | binPath | The path to the bin folder [only needed for windows systems]. |
CreateRole(String)
Creates a new role.
Declaration
public void CreateRole(string role)
Parameters
Type | Name | Description |
---|---|---|
System.String | role | The role name to create. |
CreateUser(String, String)
Creates a new user.
Declaration
public void CreateUser(string user, string password = "")
Parameters
Type | Name | Description |
---|---|---|
System.String | user | |
System.String | password |
Delete(Postgres.Destination)
Deletes some data from a table, the 'ExecuteNonQuery' method can be used for complex filters (and, or, etc.).
Declaration
public void Delete(Postgres.Destination destination)
Parameters
Type | Name | Description |
---|---|---|
Postgres.Destination | destination | The unique schema and table where the data will be added. |
Delete(Postgres.Destination, Postgres.Filter)
Deletes some data from a table, the 'ExecuteNonQuery' method can be used for complex filters (and, or, etc.).
Declaration
public void Delete(Postgres.Destination destination, Postgres.Filter filter)
Parameters
Type | Name | Description |
---|---|---|
Postgres.Destination | destination | The unique schema and table where the data will be added. |
Postgres.Filter | filter | A filter over a single field which will be used to screen the data, subqueries are allowed but must start with '@' and surrounded by parenthesis like '@(SELECT MAX(id)+1 FROM t)'. |
Delete(Postgres.Destination, Postgres.Source, Postgres.Filter)
Deletes some data from a table, the 'ExecuteNonQuery' method can be used for complex filters (and, or, etc.).
Declaration
public void Delete(Postgres.Destination destination, Postgres.Source source, Postgres.Filter filter)
Parameters
Type | Name | Description |
---|---|---|
Postgres.Destination | destination | The unique schema and table where the data will be added. |
Postgres.Source | source | The set of schemas and tables from which the data will be loaded, should be an SQL FROM sentence (without FROM) allowing joins and alisases. |
Postgres.Filter | filter | A filter over a single field which will be used to screen the data, subqueries are allowed but must start with '@' and surrounded by parenthesis like '@(SELECT MAX(id)+1 FROM t)'. |
Delete(String, String, String)
Delete some data from a table, the 'ExecuteNonQuery' method can be used for complex filters (and, or, etc.).
Declaration
public void Delete(string destination, string source, string filter)
Parameters
Type | Name | Description |
---|---|---|
System.String | destination | The unique schema and table where the data will be added. |
System.String | source | The set of schemas and tables from which the data will be loaded, should be an SQL FROM sentence (without FROM) allowing joins and alisases. |
System.String | filter | The set of filters which will be used to screen the data, should be an SQL WHERE sentence (without WHERE). |
Dispose()
Cleans and releases memory for unnatended objects.
Declaration
public override void Dispose()
Overrides
DropDataBase()
Drops the current database.
Declaration
public void DropDataBase()
DropRole(String)
Removes an existing role.
Declaration
public void DropRole(string role)
Parameters
Type | Name | Description |
---|---|---|
System.String | role | The role name to remove. |
DropUser(String)
Removes an existing user.
Declaration
public void DropUser(string user)
Parameters
Type | Name | Description |
---|---|---|
System.String | user |
ExecuteNonQuery(String)
Runs a query that produces no output.
Declaration
public void ExecuteNonQuery(string query)
Parameters
Type | Name | Description |
---|---|---|
System.String | query | The query to run. |
ExecuteQuery(String)
Runs a query that produces an output as a set of data.
Declaration
public DataSet ExecuteQuery(string query)
Parameters
Type | Name | Description |
---|---|---|
System.String | query | The query to run. |
Returns
Type | Description |
---|---|
System.Data.DataSet | The dataset containing all the output. |
ExecuteScalar<T>(String)
Runs a query that produces an output as a single data.
Declaration
public T ExecuteScalar<T>(string query)
Parameters
Type | Name | Description |
---|---|---|
System.String | query | The query to run. |
Returns
Type | Description |
---|---|
T | The requested item. |
Type Parameters
Name | Description |
---|---|
T |
ExistsDataBase()
Checks if the database exists.
Declaration
public bool ExistsDataBase()
Returns
Type | Description |
---|---|
System.Boolean | True if the database exists. |
ExistsRole(String)
Declaration
public bool ExistsRole(string role)
Parameters
Type | Name | Description |
---|---|---|
System.String | role |
Returns
Type | Description |
---|---|
System.Boolean |
ExistsUser(String)
Declaration
public bool ExistsUser(string user)
Parameters
Type | Name | Description |
---|---|---|
System.String | user |
Returns
Type | Description |
---|---|
System.Boolean |
GetField<T>(Postgres.Source, Postgres.Filter, String, ListSortDirection)
Returns the requested field's value for the first found item.
Declaration
public T GetField<T>(Postgres.Source source, Postgres.Filter filter, string field, ListSortDirection sort = ListSortDirection.Descending)
Parameters
Type | Name | Description |
---|---|---|
Postgres.Source | source | The unique schema and table from which the data will be loaded. |
Postgres.Filter | filter | A filter over a single field which will be used to screen the data, subqueries are allowed but must start with '@' and surrounded by parenthesis like '@(SELECT MAX(id)+1 FROM t)'. |
System.String | field | The wanted field's name. |
System.ComponentModel.ListSortDirection | sort | Defines how to order the list, so the max value will be returned when "descending" and min value when "ascending".. |
Returns
Type | Description |
---|---|
T | The item's field value, NULL if not found. |
Type Parameters
Name | Description |
---|---|
T |
Remarks
Use the overload with only string parameters for complex queries.
GetField<T>(Postgres.Source, String, ListSortDirection)
Returns the requested field's value for the first found item.
Declaration
public T GetField<T>(Postgres.Source source, string field, ListSortDirection sort = ListSortDirection.Descending)
Parameters
Type | Name | Description |
---|---|---|
Postgres.Source | source | The unique schema and table from which the data will be loaded. |
System.String | field | The wanted field's name. |
System.ComponentModel.ListSortDirection | sort | Defines how to order the list, so the max value will be returned when "descending" and min value when "ascending".. |
Returns
Type | Description |
---|---|
T | The item's field value, NULL if not found. |
Type Parameters
Name | Description |
---|---|
T |
Remarks
Use the overload with only string parameters for complex queries.
GetField<T>(String, String, String, ListSortDirection)
Returns the requested field's value for the first found item.
Declaration
public T GetField<T>(string source, string filter, string field, ListSortDirection sort = ListSortDirection.Descending)
Parameters
Type | Name | Description |
---|---|---|
System.String | source | The set of schemas and tables from which the data will be loaded, should be an SQL FROM sentence (without FROM) allowing joins and alisases. |
System.String | filter | The set of filters which will be used to screen the data, should be an SQL WHERE sentence (without WHERE). |
System.String | field | The wanted field's name. |
System.ComponentModel.ListSortDirection | sort | Defines how to order the list, so the max value will be returned when "descending" and min value when "ascending".. |
Returns
Type | Description |
---|---|
T | The item's field value, NULL if not found. |
Type Parameters
Name | Description |
---|---|
T |
GetForeignKeys(Postgres.Source)
Returns the information about all the foreign keys defined over a table.
Declaration
public DataSet GetForeignKeys(Postgres.Source source)
Parameters
Type | Name | Description |
---|---|---|
Postgres.Source | source | The unique schema and table from which the foreign keys will be loaded. |
Returns
Type | Description |
---|---|
System.Data.DataSet | The view definition as an SQL SELECT query. |
GetForeignKeys(String)
Returns the information about all the foreign keys defined over a table.
Declaration
public DataSet GetForeignKeys(string source)
Parameters
Type | Name | Description |
---|---|---|
System.String | source | The unique schema and table from which the foreign keys will be loaded, as 'schema.table'. |
Returns
Type | Description |
---|---|
System.Data.DataSet | The foreign keys data. |
GetMembership(String)
Get a list of groups and roles where the given item (user, role or group) belongs.
Declaration
public DataSet GetMembership(string item)
Parameters
Type | Name | Description |
---|---|---|
System.String | item | The role to check. |
Returns
Type | Description |
---|---|
System.Data.DataSet | The requested data (rolname, memberOf) |
GetRoles()
Requests for all the roles created.
Declaration
public DataSet GetRoles()
Returns
Type | Description |
---|---|
System.Data.DataSet | A dataset containing the requested data ('rolname'). |
GetSchemaPrivileges(String, String)
Returns the schema privileges.
Declaration
public DataSet GetSchemaPrivileges(string schema, string role = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | schema | The schema containing the table to check. |
System.String | role | The role which privileges will be checked. |
Returns
Type | Description |
---|---|
System.Data.DataSet | The requested data (grantee, privilege). |
GetTablePrivileges(Postgres.Source, String)
Returns the table privileges.
Declaration
public DataSet GetTablePrivileges(Postgres.Source source, string role = null)
Parameters
Type | Name | Description |
---|---|---|
Postgres.Source | source | The source which permissions will be requested. |
System.String | role | The role which privileges will be checked. |
Returns
Type | Description |
---|---|
System.Data.DataSet | The requested data (grantee, privilege). |
GetTablePrivileges(String, String)
Returns the table privileges.
Declaration
public DataSet GetTablePrivileges(string source, string role = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | source | The table which permissions will be requested as 'schema.table'. |
System.String | role | The role which privileges will be checked. |
Returns
Type | Description |
---|---|
System.Data.DataSet | The table privileges. |
GetUsers()
Requests for all the users created.
Declaration
public DataSet GetUsers()
Returns
Type | Description |
---|---|
System.Data.DataSet | A dataset containing the requested data ('username', 'attributes'). |
GetViewDefinition(Postgres.Source)
Given a view, return its definition as a select query.
Declaration
public string GetViewDefinition(Postgres.Source source)
Parameters
Type | Name | Description |
---|---|---|
Postgres.Source | source | The unique schema and table from which the data will be loaded. |
Returns
Type | Description |
---|---|
System.String | The view definition as an SQL SELECT query. |
GetViewDefinition(String)
Given a view, return its definition as a select query.
Declaration
public string GetViewDefinition(string source)
Parameters
Type | Name | Description |
---|---|---|
System.String | source | The unique schema and table from which the data will be loaded, as 'schema.table'. |
Returns
Type | Description |
---|---|
System.String | The view definition as an SQL SELECT query. |
Grant(String, Postgres.Destination, String)
Grants an item (role, group or permission) to a destination (role, group or user).
Declaration
public void Grant(string what, Postgres.Destination where, string who)
Parameters
Type | Name | Description |
---|---|---|
System.String | what | What to grant (permission). |
Postgres.Destination | where | Where to grant (table). |
System.String | who | Who to grant (role, group or user). |
Grant(String, String)
Grants an item (role, group or permissio) to a destination (role, group or user).
Declaration
public void Grant(string what, string where)
Parameters
Type | Name | Description |
---|---|---|
System.String | what | Who to grant (role, group or user) or the permission to grant as an SQL compatible statement like 'permission ON schema.table'. |
System.String | where | Where to grant (destination: role, group or user). |
Grant(String, String, String)
Grants an item (role, group or permission) to a destination (role, group or user).
Declaration
public void Grant(string what, string where, string who)
Parameters
Type | Name | Description |
---|---|---|
System.String | what | What to grant (permission). |
System.String | where | Where to grant (schema). |
System.String | who | Who to grant (role, group or user). |
ImportSqlFile(String)
Imports an SQL into the current database.
Declaration
public void ImportSqlFile(string filePath)
Parameters
Type | Name | Description |
---|---|---|
System.String | filePath |
Insert(Postgres.Destination, Dictionary<String, Object>)
Inserts new data into a table.
Declaration
public void Insert(Postgres.Destination destination, Dictionary<string, object> fields)
Parameters
Type | Name | Description |
---|---|---|
Postgres.Destination | destination | The unique schema and table where the data will be added. |
System.Collections.Generic.Dictionary<System.String, System.Object> | fields | Key-value pairs of data [field, value], subqueries as values must start with @. |
Remarks
Use the overload with only string parameters for complex queries.
Insert(String, Dictionary<String, Object>)
Inserts new data into a table.
Declaration
public void Insert(string destination, Dictionary<string, object> fields)
Parameters
Type | Name | Description |
---|---|---|
System.String | destination | The schema and table where the data will be added, should be an SQL INTO sentence (schema.table). |
System.Collections.Generic.Dictionary<System.String, System.Object> | fields | Key-value pairs of data [field, value], subqueries are allowed but must start with '@' and surrounded by parenthesis like '@(SELECT MAX(id)+1 FROM t)'. |
Insert<T>(Postgres.Destination, String, Dictionary<String, Object>)
Declaration
public T Insert<T>(Postgres.Destination destination, string primaryKey, Dictionary<string, object> fields)
Parameters
Type | Name | Description |
---|---|---|
Postgres.Destination | destination | |
System.String | primaryKey | |
System.Collections.Generic.Dictionary<System.String, System.Object> | fields |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
Insert<T>(String, String, Dictionary<String, Object>)
Declaration
public T Insert<T>(string destination, string primaryKey, Dictionary<string, object> fields)
Parameters
Type | Name | Description |
---|---|---|
System.String | destination | |
System.String | primaryKey | |
System.Collections.Generic.Dictionary<System.String, System.Object> | fields |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
Revoke(String, Postgres.Destination, String)
Revokes an item (role, group or permission) from a destination (role, group or user).
Declaration
public void Revoke(string what, Postgres.Destination where, string who)
Parameters
Type | Name | Description |
---|---|---|
System.String | what | What to revoke (permission). |
Postgres.Destination | where | Where to revoke (schema). |
System.String | who | Who to revoke (role, group or user). |
Revoke(String, String)
Revokes an item (role, group or permissio) from a destination (role, group or user).
Declaration
public void Revoke(string what, string where)
Parameters
Type | Name | Description |
---|---|---|
System.String | what | Who to revoke (role, group or user) or the permission to revoke as an SQL compatible statement like 'permission FROM schema.table'. |
System.String | where | Where to revoke (destination: role, group or user). |
Revoke(String, String, String)
Revokes an item (role, group or permission) from a destination (role, group or user).
Declaration
public void Revoke(string what, string where, string who)
Parameters
Type | Name | Description |
---|---|---|
System.String | what | What to revoke (permission). |
System.String | where | Where to revoke (schema). |
System.String | who | Who to revoke (role, group or user). |
Select(Postgres.Source, Postgres.Filter, String)
Selects some data from the database.
Declaration
public DataSet Select(Postgres.Source source, Postgres.Filter filter, string field = "*")
Parameters
Type | Name | Description |
---|---|---|
Postgres.Source | source | The unique schema and table from which the data will be loaded. |
Postgres.Filter | filter | A filter over a single field which will be used to screen the data, subqueries are allowed but must start with '@' and surrounded by parenthesis like '@(SELECT MAX(id)+1 FROM t)'. |
System.String | field | The field's data to load (a single one, or comma-separated set). |
Returns
Type | Description |
---|---|
System.Data.DataSet | A dataset containing the requested data. |
Remarks
Use the overload with only string parameters for complex queries.
Select(Postgres.Source, Postgres.Filter, String[])
Selects some data from the database.
Declaration
public DataSet Select(Postgres.Source source, Postgres.Filter filter, string[] fields)
Parameters
Type | Name | Description |
---|---|---|
Postgres.Source | source | The unique schema and table from which the data will be loaded. |
Postgres.Filter | filter | A filter over a single field which will be used to screen the data, subqueries are allowed but must start with '@' and surrounded by parenthesis like '@(SELECT MAX(id)+1 FROM t)'. |
System.String[] | fields | The set of field's data to load. |
Returns
Type | Description |
---|---|
System.Data.DataSet | A dataset containing the requested data. |
Remarks
Use the overload with only string parameters for complex queries.
Select(Postgres.Source, String)
Selects some data from the database.
Declaration
public DataSet Select(Postgres.Source source, string field = "*")
Parameters
Type | Name | Description |
---|---|---|
Postgres.Source | source | The unique schema and table from which the data will be loaded. |
System.String | field | The field's data to load (a single one, or comma-separated set). |
Returns
Type | Description |
---|---|
System.Data.DataSet | A dataset containing the requested data. |
Remarks
Use the overload with only string parameters for complex queries.
Select(Postgres.Source, String[])
Selects some data from the database.
Declaration
public DataSet Select(Postgres.Source source, string[] fields)
Parameters
Type | Name | Description |
---|---|---|
Postgres.Source | source | The unique schema and table from which the data will be loaded. |
System.String[] | fields | The set of field's data to load. |
Returns
Type | Description |
---|---|
System.Data.DataSet | A dataset containing the requested data. |
Remarks
Use the overload with only string parameters for complex queries.
Select(String, String, String)
Selects some data from the database.
Declaration
public DataSet Select(string source, string filter, string field = "*")
Parameters
Type | Name | Description |
---|---|---|
System.String | source | The set of schemas and tables from which the data will be loaded, should be an SQL FROM sentence (without FROM) allowing joins and alisases. |
System.String | filter | The set of filters which will be used to screen the data, should be an SQL WHERE sentence (without WHERE). |
System.String | field | The field's data to load (a single one, or comma-separated set). |
Returns
Type | Description |
---|---|
System.Data.DataSet | A dataset containing the requested data. |
Select(String, String, String[])
Selects some data from the database.
Declaration
public DataSet Select(string source, string filter, string[] fields)
Parameters
Type | Name | Description |
---|---|---|
System.String | source | The set of schemas and tables from which the data will be loaded, should be an SQL FROM sentence (without FROM) allowing joins and alisases. |
System.String | filter | The set of filters which will be used to screen the data, should be an SQL WHERE sentence (without WHERE). |
System.String[] | fields | The set of field's data to load. |
Returns
Type | Description |
---|---|
System.Data.DataSet | A dataset containing the requested data. |
TestConnection()
Test the connection to the database, so an exception will be thrown if any problem occurs.
Declaration
public void TestConnection()
Update(Postgres.Destination, Postgres.Filter, Dictionary<String, Object>)
Updates some data from a table, the 'ExecuteNonQuery' method can be used for complex filters (and, or, etc.).
Declaration
public void Update(Postgres.Destination destination, Postgres.Filter filter, Dictionary<string, object> fields)
Parameters
Type | Name | Description |
---|---|---|
Postgres.Destination | destination | The unique schema and table where the data will be added. |
Postgres.Filter | filter | A filter over a single field which will be used to screen the data, subqueries are allowed but must start with '@' and surrounded by parenthesis like '@(SELECT MAX(id)+1 FROM t)'. |
System.Collections.Generic.Dictionary<System.String, System.Object> | fields | Key-value pairs of data [field, value], subqueries are allowed but must start with '@' and surrounded by parenthesis like '@(SELECT MAX(id)+1 FROM t)'. |
Remarks
Use the overload with only string parameters for complex queries.
Update(Postgres.Destination, Postgres.Source, Postgres.Filter, Dictionary<String, Object>)
Updates some data from a table, the 'ExecuteNonQuery' method can be used for complex filters (and, or, etc.).
Declaration
public void Update(Postgres.Destination destination, Postgres.Source source, Postgres.Filter filter, Dictionary<string, object> fields)
Parameters
Type | Name | Description |
---|---|---|
Postgres.Destination | destination | The unique schema and table where the data will be added. |
Postgres.Source | source | The set of schemas and tables from which the data will be loaded, should be an SQL FROM sentence (without FROM) allowing joins and alisases. |
Postgres.Filter | filter | A filter over a single field which will be used to screen the data, subqueries are allowed but must start with '@' and surrounded by parenthesis like '@(SELECT MAX(id)+1 FROM t)'. |
System.Collections.Generic.Dictionary<System.String, System.Object> | fields | Key-value pairs of data [field, value], subqueries are allowed but must start with '@' and surrounded by parenthesis like '@(SELECT MAX(id)+1 FROM t)'. |
Remarks
Use the overload with only string parameters for complex queries.
Update(Postgres.Destination, Dictionary<String, Object>)
Updates some data from a table, the 'ExecuteNonQuery' method can be used for complex filters (and, or, etc.).
Declaration
public void Update(Postgres.Destination destination, Dictionary<string, object> fields)
Parameters
Type | Name | Description |
---|---|---|
Postgres.Destination | destination | The unique schema and table where the data will be added. |
System.Collections.Generic.Dictionary<System.String, System.Object> | fields | Key-value pairs of data [field, value], subqueries are allowed but must start with '@' and surrounded by parenthesis like '@(SELECT MAX(id)+1 FROM t)'. |
Remarks
Use the overload with only string parameters for complex queries.
Update(String, String, String, Dictionary<String, Object>)
Updates some data from a table, the 'ExecuteNonQuery' method can be used for complex filters (and, or, etc.).
Declaration
public void Update(string destination, string source, string filter, Dictionary<string, object> fields)
Parameters
Type | Name | Description |
---|---|---|
System.String | destination | The unique schema and table where the data will be added. |
System.String | source | The set of schemas and tables from which the data will be loaded, should be an SQL FROM sentence (without FROM) allowing joins and alisases. |
System.String | filter | The set of filters which will be used to screen the data, should be an SQL WHERE sentence (without WHERE). |
System.Collections.Generic.Dictionary<System.String, System.Object> | fields | Key-value pairs of data [field, value], subqueries are allowed but must start with '@' and surrounded by parenthesis like '@(SELECT MAX(id)+1 FROM t)'. |