Data Provider-specific Classes
The PSQL ADO.NET Data Provider supports all of the .NET public objects. The PSQL ADO.NET Data Provider attaches the provider-specific prefix Psql to the public .NET objects, for example, PsqlCommand.
The following objects are described in this appendix:
For more information on public objects, refer to the Microsoft .NET Framework Version 2.0 SDK documentation.
PsqlBulkCopy
The PsqlBulkCopy object uses an API pattern similar to the ADO.NET Bulk API patterns, and has no provider-specific properties or methods. For information about the properties and methods supported, refer to the data provider’s online help and the Microsoft .NET Framework SDK documentation.
PsqlBulkCopyColumnMapping
The PsqlBulkCopyColumnMapping object uses an API pattern similar to the ADO.NET Bulk API patterns, and has no provider-specific properties or methods. For information about the properties and methods supported, refer to the data provider’s online help and the Microsoft .NET Framework SDK documentation.
PsqlBulkCopyColumnMappingCollection
The PsqlBulkCopyColumnMappingCollection object follows an API pattern similar to the Microsoft SqlBulkCopyColumnMappingCollection class, and has no provider-specific properties or methods. For information about the properties and methods supported, refer to the data provider’s online help and the Microsoft .NET Framework SDK documentation.
PsqlCommand Object
Table 21 describes the public properties of the PsqlCommand object.
 
Table 22 describes the public methods supported by the PsqlCommand object.
 
PsqlCommandBuilder Object
Using a PsqlCommandBuilder object can have a negative effect on performance. Because of concurrency restrictions, the PsqlCommandBuilder can generate highly inefficient SQL statements. The end-user can often write more efficient update and delete statements than those that the PsqlCommandBuilder generates.
Table 23 describes the public properties supported by the PsqlCommandBuilder object.
 
Table 24 provides the public methods supported for the PsqlCommandBuilder object.
 
PsqlConnection Object
The PsqlConnection object supports the public properties described in Table 25. Some properties return the values specified for the corresponding connection string option. Unlike the connection string options, the PsqlConnection property names do not include a space.
 
Gets or sets the string used to open a database. See Table 27 for a description of the values you can set.
Table 26 describes the public methods of PsqlConnection.
 
You can use the InfoMessage event of the PsqlConnection object to retrieve warnings and informational messages from the database. If the database returns an error, an exception is thrown. Clients that want to process warnings and informational messages sent by the database server should create a PsqlInfoMessageEventHandler delegate to register for this event.
The InfoMessage event receives an argument of type PsqlInfoMessageEventArgs containing data relevant to this event.
PsqlConnectionStringBuilder Object
PsqlConnectionStringBuilder property names are the same as the connection string option names of the PsqlConnection.ConnectionString property. However, the connection string option name can have spaces between the words. For example, the connection string option name Min Pool Size is equivalent to the property name MinPoolSize.
The basic format of a connection string includes a series of keyword/value pairs separated by semicolons. The following example shows the keywords and values for a simple connection string for the PSQL ADO.NET Data Provider:
"Server DSN=SERVERDEMO;Host=localhost"
Table 27 lists the properties that correspond to the connection string options supported by the PSQL data providers, and describes each property.
 
"Host=hostvalue;Port=portvalue[, ...]"
See Using Connection Failover for a discussion of connection failover and information about other connection string options that you can set for this feature.
This option and Connection Retry Delay, which specifies the wait interval between attempts, can be used in conjunction with connection failover. See Using Connection Failover for a discussion of connection failover and for information about other connection string options that you can set for this feature.
Specifies the name or the IP address of the PSQL database server to which you want to connect. For example, you can specify a server name such as Accountingserver. Or, you can specify an IP address such as 199.226.22.34 (IPv4) or 1234:5678:0000:0000:0000:0000:9abc:def0 (IPv6).
The Load Balancing connection string option is an optional setting that you can use in conjunction with connection failover. See Using Connection Failover for more information for a discussion of connection failover and for information about other connection options that you can set for this feature.
See Table 28 for the name and hexadecimal value of the database metadata that the data provider can add.
In most cases, enabling statement caching results in improved performance. See Performance Considerations for information on how this option can affect performance of the ADO.NET data provider.
Table 28 lists the name and the hexadecimal value of the column collection that the data provider will omit from the returned data. To specify multiple values, specify a comma-separated list of the names, or the sum of the hexadecimal values of the column collections that you want to return.
 
The PsqlConnectionStringBuilder object has no provider-specific methods. For information about the methods supported, refer to the data provider’s online help and the Microsoft .NET Framework SDK documentation.
PsqlDataAdapter Object
The PsqlDataAdapter object uses PsqlCommand objects to execute SQL commands on the PSQL database, to load the DataSet with data, and to reconcile the changed data in the DataSet to the database.
Table 29 describes the public properties of PsqlDataAdapter.
 
PsqlDataReader Object
The PsqlDataReader object is a forward-only cursor that retrieves read-only records from a database. Performance is better than using PsqlDataAdapter, but the result set cannot be modified.
Table 30 describes the public properties of PsqlDataReader.
 
Table 31 describes some of the public methods of the PsqlDataReader.
 
PsqlError Object
The PsqlError object collects information relevant to errors and warnings generated by the PSQL server.
Table 32 describes the public properties supported by PsqlError.
 
PsqlErrorCollection Object
The PsqlErrorCollection object is created by a PsqlException to contain all the errors generated by the PSQL server.
Table 33 provides the public provider-specific properties supported for the PsqlErrorCollection object. For information about other properties and methods supported, refer to the data provider's online help and the Microsoft .NET Framework SDK documentation.
 
The PsqlErrorCollection object supports the public methods described in Table 34.
 
PsqlException Object
Provider-specific exceptions are derived directly from the System.Data interface. Only the public properties and methods, for example, the Message property, are directly available on the System.Exception object in a generic sense. The SQLState and Number properties are only accessible through provider-specific code or by using reflection.
ADO.NET 2.0 introduced a new property on the DbException class, Data. This property returns a collection of key-value pair tuples that provide additional user-defined information about an exception. The PSQL ADO.NET Data Provider gets a collection of key/value pairs such as SQLState, Number, and ErrorPosition.
The Psql.Data.SqlClient prefix is applied to each key, for example:
Psql.Data.SqlClient.Data["SQLState"] = 28000;
The properties described in Table 35 apply to the last error generated, if multiple errors exist. The application should check the Count property of the PsqlErrorCollection returned in the Errors property of this object to determine whether multiple errors occurred. See PsqlErrorCollection Object for more information.
 
PsqlFactory Object
Provider Factory classes allow users to program to generic objects. Once instantiated from DbProviderFactory, the factory generates the proper type of concrete class.
Table 36 lists the static methods used to accommodate choosing the PSQL ADO.NET Data Provider and instantiating its DbProviderFactory.
 
PsqlInfoMessageEventArgs Object
The PsqlInfoMessageEventArgs object is passed as an input to the PsqlInfoMessageEventHandler and contains information relevant to a warning generated by the PSQL server.
Table 37 describes the public properties for PsqlInfoMessageEventArgs.
 
PsqlParameter Object
The PsqlParameter object represents a parameter to a PsqlCommand object.
Table 38 describes the public properties for PsqlParameter.
 
NOTE: When array binding is enabled (see the ArrayBindCount property of the PsqlCommand Object), this property is specified as an array of values. Each array's length must match the value of the ArrayBindCount property. When specifying the array's values for binary type columns, the data will actually be specified as byte[]. This is an array of arrays of bytes. The data provider anticipates a "jagged" array as such when using parameter array binding with parameters.
PsqlParameterCollection Object
The PsqlParameterCollection object represents a collection of parameters relevant to a PsqlCommand, and includes their mappings to columns in a DataSet.
Table 39 describes the public properties for PsqlParameterCollection.
 
Table 40 provides the public methods for PsqlParameterCollection.
 
PsqlTrace Object
The PsqlTrace object is created by the application to debug problems during development. Setting the properties in the PsqlTrace object overrides the settings of the environment variables. For your final application, be sure to remove references to the PsqlTrace object.
The following code fragment creates a Trace object named MyTrace.txt. All subsequent calls to the data provider will be traced to that file.
PsqlTrace MyTraceObject = new PsqlTrace();
MyTraceObject.TraceFile="C:\\MyTrace.txt";
MyTraceObject.RecreateTrace = 1;
MyTraceObject.EnableTrace = 1;
Table 41 describes the public properties for the PsqlTrace object.
 
Table 42 describes the public methods for PsqlTrace.
 
PsqlTransaction Object
Table 43 describes the public properties of PsqlTransaction.
 
Table 44 describes the public methods of the PsqlTransaction object.