The Ingres .NET Data Provider is the runtime component that provides the interface between the .NET application and Ingres.
The Ingres .NET Data Provider namespace (Ingres.Client) and its contents follow the same pattern as the Microsoft data providers.
All public static members are safe for multithreaded operations. To reduce unnecessary overhead, instance members are not guaranteed to be thread-safe. If a thread-safe operation on the instance is needed, wrap the operation in one of .NET's System.Threading synchronization methods to protect the state of the critical section of code.
The base class and interface definition for each class is provided in C# and VB.NET syntax as shown below. However, .NET's language interoperability feature allows any managed language to use the Ingres .NET Data Provider.
C#: Public sealed class IngresParameter : System.Data.Common.DbParameter, IDataParameter, IDbDataParameter, ICloneable
VB.NET: NotInheritable public class IngresParameter
Inherits System.Data.Common.DbParameter
Implements IDataParameter, IDbDataParameter, ICloneable
For more information on data provider classes, including information on other .NET language syntax and inherited methods and properties, see the Microsoft .NET Framework Developer's Guide and Microsoft .NET Framework Class Library documentation.
The IngresCommand class represents an SQL command or a database procedure that executes against an Ingres or Enterprise Access database.
Parameter placeholders in the SQL command text are represented by a question mark (?).
Database procedures can be invoked by either setting CommandText="myproc" and CommandType=CommandType.StoredProcedure, or by using the escape sequence format and setting CommandText="{ call myproc }" and CommandType=CommandType.Text.
Ingres .NET Data Provider does not currently support the following features:
The IngresCommand class declarations are:
C#: public sealed class IngresCommand : System.Data.Common.DbCommand, IDbCommand, IDisposable, ICloneable
VB.NET: NotInheritable Public Class IngresCommand
Inherits System.Data.Common.DbCommand
Implements IDbCommand, IDisposable, ICloneable
IngresCommand cmd = new IngresCommand(
"SELECT id, name FROM employee WHERE id = ?");
The IngresCommand class properties are:
Property |
Accessor |
Description |
---|---|---|
CommandText |
get set |
SQL statement string to execute or procedure name to call. |
CommandTimeOut |
get set |
The time, in seconds, for an attempted query to time-out if the query has not yet completed. Default is 30 seconds. |
CommandType |
get set |
An enumeration describing how to interpret the CommandText property. Valid values are Text, TableDirect, or StoredProcedure. |
Connection |
get set |
The IngresConnection object that is used to identify the connection to execute a command. For more information, see IngresConnection Class. |
Parameters |
get |
The IngresParameterCollection for the parameters associated with the SQL query or database procedure. For more information, see IngresParameterCollection Class. |
Transaction |
get set |
The IngresTransaction object in which the IngresCommand executes. This transaction object must be compatible with the transaction object that is associated with the Connection, (that is, the IngresTransaction must be the object (or a copy) returned by IngresConnection.BeginTransaction). |
UpdateRowSource |
get set |
Defines how results are applied to a rowset by the DbDataAdapter.Update method. (Inherited from DbDataAdapter.) |
The public methods for the IngresCommand class are:
Method |
Description |
---|---|
Cancel |
Cancels the execution of the SQL command or database procedure. |
CreateParameter |
Creates a new instance of IngresParameter. For more information, see IngresParameter Class. |
Dispose |
Releases allocated resources of the IngresCommand and base Component. |
ExecuteNonQuery |
Executes a command that does not return results. Returns the number of rows affected by the update, delete, or insert SQL command. |
ExecuteReader |
Executes a command and builds an IngresDataReader. For more information, see IngresDataReader Class. |
ExecuteScalar |
Executes a command and returns the first column of the first row of the result set. |
Prepare |
Prepares the SQL statement to be executed later. |
ResetCommandTimeout |
Resets the CommandTimeout property to its default value of 30 seconds. |
The constructors for the IngresCommand class are:
Constructor Overloads |
Description |
---|---|
IngresCommand() |
Instantiates a new instance of the IngresCommand class using default property values |
IngresCommand(string) |
Instantiates a new instance of the IngresCommand class using the defined SQL command or database procedure |
IngresCommand(string, IngresConnection) |
Instantiates a new instance of the IngresCommand class using the defined SQL command or database procedure and the connection to the Ingres or Enterprise Access database |
IngresCommand(string, IngresConnection, IngresTransaction) |
Instantiates a new instance of the IngresCommand class using the defined SQL command or database procedure, the connection to the Ingres or Enterprise Access database, and the IngresTransaction object |
To construct an application using the Ingres .NET Data Provider, the developer creates a series of objects from the data provider's classes. The following is a simple C# program employing four data provider classes.
using System;
using System.Configuration;
using System.Data;
using System.IO;
using Ingres.Client;
class App
{
static public void Main()
{
ConnectionStringSettingsCollection connectionSettings =
ConfigurationManager.ConnectionStrings;
if (connectionSettings.Count == 0)
throw new InvalidOperationException(
"No connection information specified in application configuration file.");
ConnectionStringSettings connectionSetting = connectionSettings[0];
string invariantName = connectionSetting.ProviderName;
string myConnectionString = connectionSetting.ConnectionString;
DbProviderFactory factory = GetFactory(invariantName);
DbConnection conn =
factory.CreateConnection();
conn.ConnectionString = myConnectionString;
conn.Open(); // open the Ingres connection
string cmdtext =
"select table_owner, table_name, " +
" create_date from iitables " +
" where table_type in ('T','V') and " +
" table_name not like 'ii%' and" +
" table_name not like 'II%'";
DbCommand cmd = conn.CreateCommand();
cmd.CommandText = cmdtext;
// read the data using the DataReader method
DbDataReader datareader = cmd.ExecuteReader();
// write header labels
Console.WriteLine(datareader.GetName(0).PadRight(18) +
datareader.GetName(1).PadRight(34) +
datareader.GetName(2).PadRight(34));
int i = 0;
while (i++ < 10 && datareader.Read())
// read and write out a few data rows
{ // write out the three columns to the console
Console.WriteLine(
datareader.GetString(0).Substring(0,16).PadRight(18) +
datareader.GetString(1).PadRight(34) +
datareader.GetString(2));
}
datareader.Close();
DataSet ds = new DataSet("my_list_of_tables");
// read the data using the DataAdapter method
DbDataAdapter adapter = factory.CreateDataAdapter();
DbCommand adapterCmd = conn.CreateCommand();
adapterCmd.CommandText = cmdtext;
adapter.SelectCommand = adapterCmd;
adapter.Fill(ds); // fill the dataset
// write the dataset to an XML file
ds.WriteXml("c:/temp/temp.xml");
conn.Close(); // close the connection
} // end Main()
} // end class App
using System;
using System.IO;
using System.Data;
using Ingres.Client;
class App
{
static public void Main()
{
string myConnectionString =
"Host=myserver.mycompany.com;" +
"User Id=myname;PWD=mypass;" +
"Database=mydatabase";
IngresConnection conn = new IngresConnection(
myConnectionString );
conn.Open(); // open the Ingres connection
string cmdtext = "select table_owner, table_name, " +
"create_date from iitables " +
" where table_type in ('T','V') and " +
" table_name not like 'ii%' and" +
" table_name not like 'II%'";
IngresCommand cmd = new IngresCommand(cmdtext, conn);
// read the data using the DataReader method
IngresDataReader datareader = cmd.ExecuteReader();
// write header labels
Console.WriteLine(datareader.GetName(0).PadRight(18) +
datareader.GetName(1).PadRight(34) +
datareader.GetName(2).PadRight(34));
int i = 0;
while (i++ < 10 && datareader.Read())
// read and write out a few data rows
{ // write out the three columns to the console
Console.WriteLine(
datareader.GetString(0).Substring(0,16).PadRight(18) +
datareader.GetString(1).PadRight(34) +
datareader.GetString(2));
}
datareader.Close();
DataSet ds = new DataSet("my_list_of_tables");
// read the data using the DataAdapter method
IngresDataAdapter adapter = new IngresDataAdapter();
adapter.SelectCommand = new IngresCommand(cmdtext, conn);
adapter.Fill(ds); // fill the dataset
// write the dataset to an XML file
ds.WriteXml("c:/temp/temp.xml");
conn.Close(); // close the connection
} // end Main()
} // end class App
The IngresCommandBuilder class automatically generates INSERT, DELETE, and UPDATE commands into an IngresDataAdapter object for a simple single-table SELECT query. These commands can be used to reconcile DataSet changes through the IngresDataAdapter associated with the Ingres database.
The IngresCommandBuilder class can be declared as follows:
C##: public sealed class IngresCommandBuilder : DbCommandBuilder
VB.NET: NotInheritable Public Class IngresCommandBuilder
Inherits DbCommandBuilder
The IngresCommandBuilder class properties are:
Property |
Accessor |
Description |
---|---|---|
CatalogLocation |
get set |
Position of the catalog name in a qualified table name. |
CatalogSeparator |
get set |
The string of characters that defines the separation between a catalog name and the table name. |
ConflictOption |
get set |
Controls how to compare for update conflicts. |
DataAdapter |
get set |
The IngresDataAdapter object that is associated with the CommandBuilder. The IngresDataAdapter contains the InsertCommand, DeleteCommand, and UpdateCommand objects that are automatically derived from the SelectCommand. |
QuotePrefix |
get set |
The string of characters that are used as the starting delimiter of a quoted table or column name in an SQL statement. |
QuoteSuffix |
get set |
The string of characters that are used as the ending delimiter of a quoted table or column name in an SQL statement. |
SchemaSeparator |
get set |
The string of characters that defines the separation between a table name and column name. Always a period (.) |
The public methods available to the IngresCommandBuilder class are:
Method |
Description |
---|---|
Derive Parameters |
Retrieves the parameter metadata of the database procedure specified in the IngresCommand object and populates the IngresCommand.Parameters collection. |
GetDeleteCommand |
Gets the generated IngresCommand to perform DELETE operations on the table. |
GetInsertCommand |
Gets the generated IngresCommand to perform INSERT operations on the table. |
GetUpdateCommand |
Gets the generated IngresCommand to perform UPDATE operations on the table. |
QuoteIdentifier |
Wrap quotes around an identifier. |
RefreshSchema |
Refreshes the IngresCommandBuilder's copy of the metadata of a possibly changed SELECT statement in the IngresDataAdapter.SelectCommand object. |
UnquoteIdentifier |
Removes quotes from an identifier. |
The IngresCommandBuilder class has the following constructors:
Constructor Overloads |
Description |
---|---|
IngresCommandBuilder () |
Instantiates a new instance of the IngresCommandBuilder class using default property values |
IngresCommandBuilder (IngresDataAdapter) |
Instantiates a new instance of the IngresCommandBuilder class using the specified IngresDataAdapter |
The IngresConnection class represents an open connection to an Ingres database. This class requires a connection string to connect to a target server and database.
Important! An application must Close( ) or Dispose( ) on the Connection object to return it to the connection pool for reuse by other applications.
The IngresConnection class declaration method signature is:
C#: public sealed class IngresConnection : System.Data.Common.DbConnection, IDbConnection, IDisposable
VB.NET: NotInheritable Public Class IngresConnection
Inherits System.Data.Common.DbConnection
Implements IDbConnection, IDisposable
IngresConnection conn = new IngresConnection(
"Host=myserver.mycompany.com;Database=mydatabase;" +
"User ID=myuid;Password=mypassword;");
conn.Open( );
The IngresConnection class has the following properties:
Property |
Accessor |
Description |
---|---|---|
ConnectionString |
get set |
String that specifies the target server machine and database to connect to, the credentials of the user who is connecting, and the parameters that define connection pooling and security. Default is "". Consists of keyword=value pairs, separated by semicolons. Leading and trailing blanks around the keyword or value are ignored. Case and embedded blanks in the keyword are ignored. Case and embedded blanks in the value are retained. Can only be set if connection is closed. Resetting the connection string resets the ConnectionTimeOut and Database properties. For a list of valid keywords and their descriptions, see Connection String Keywords. |
ConnectionTimeOut |
get |
The time, in seconds, for an attempted connection to abort if the connection cannot be established. Default is 15 seconds. |
Database |
get |
The database name specified in the ConnectionString's Database value. Default is "". |
DataSource |
get |
The name of the target server. |
ServerVersion |
get |
The server version number. May include additional descriptive information about the server. This property uses an IngresDataReader. For this reason, no other IngresDataReader can be active at the time that this property is first invoked. |
State |
get |
The current state of the connection: ConnectionState.Closed or ConnectionState.Open. |
The public methods for the IngresConnection class are:
Method |
Description |
---|---|
BeginTransaction |
Begins a local transaction. The connection must be open before this method can be called. Nested or parallel transactions are not supported. Mutually exclusive with the EnlistDistributedTransaction method. |
ChangeDatabase |
Changes the database to be used for the connection. The connection must be closed before this method can be called. |
Close |
Closes the connection (rollback pending transaction) and returns the connection to the connection pool. |
CreateCommand |
Creates an IngresCommand object. |
Dispose |
Closes the connection and releases allocated resources. |
EnlistDistributedTransaction |
Enlist in an existing distributed transaction (ITransaction). Mutually exclusive with the BeginTransaction method. |
Open |
Opens a database connection or uses one from the connection pool. |
The events generated by the IngresConnection are:
Event |
Description |
---|---|
InfoMessage |
Generated when the database returns a warning or informational message. |
StateChange |
Generated when the State property changes from Closed to Open or from Open to Close. For a definition of State, see IngresConnection Class Properties. |
The constructors for the IngresConnection class are:
Constructor Overloads |
Description |
---|---|
IngresConnection() |
Instantiates a new instance of the IngresConnection class using default property values |
IngresConnection(string) |
Instantiates a new instance of the IngresConnection class using the defined connection string |
Connection string keywords are case-insensitive. Certain keywords are accepted as synonyms of each other. For example, keywords "Server" and "Address" are synonyms of "Host." Spaces in values are retained. Values may be delimited by double-quotes.
The connection string keywords for the IngresConnection class are:
Keyword |
Description |
---|---|
BlankDate |
BlankDate=null specifies that an Ingres blank (empty) date result value is to be returned to the application as a null value. The default is to return an Ingres blank date as a DateTime value of "9999-12-31 23:59:59". |
Connect Timeout |
The time, in seconds, to wait for an attempted connection to time out if the connection has not completed. Default is 15 seconds. |
Cursor_Mode |
Default cursor concurrency mode, which determines the concurrency of cursors that are not explicitly assigned in the command text, for example, "FOR UPDATE" or "FOR READONLY." Available options are:
|
Database |
Name of the database being connected to. If a server is required, use the syntax dbname/server_class. |
Date_format |
Specifies the Ingres format for date literals. It corresponds to the Ingres environment variable II_DATE_FORMAT and is assigned the same values. This option is not used directly by the data provider, but is sent to the DBMS and affects the parsing of date literals in query text. |
Decimal_char |
Decimal_char=',' specifies that the DBMS Server is to use the comma (,) character to separate fractional and non-fractional parts of a number. It corresponds to the Ingres environment variable II_DECIMAL and is assigned the same values. This option is not used directly by the data provider, but is sent to the DBMS and affects the parsing and construction of numeric literals. The default value is the period (.) as in 12.34. |
Enlist |
If set to true and if the creation thread is within a transaction context as established by System.EnterpriseServices.ServicedComponent, the IngresConnection in the transaction context is automatically enlisted. Default is true. |
Group ID |
Group identifier that has permissions for a group of users. |
Host |
Name of the target host server machine with the Data Access Server. |
Max Pool Size |
Maximum number of connections that can be in the pool. Default is 100. |
Min Pool Size |
Minimum number of connections that can be in the pool. Default is 0. |
Money_format |
Specifies the Ingres format for money literals. It corresponds to the Ingres environment variable II_MONEY_FORMAT and is assigned the same values. This option is not used directly by the data provider, but is sent to the DBMS and affects the processing of query text. |
Money_precision |
Specifies the precision of money data values. It corresponds to the Ingres environment variable II_MONEY_PREC and is assigned the same values. This option is not used directly by the data provider, but is sent to the DBMS and affects the processing of money values. |
Password |
The password to the database. This value may be case-sensitive depending on the target server. |
Persist Security Info |
If set to 'false,' password information from the connection string is not returned in a get of the ConnectionString property. Default is 'false.' If 'true,' then password information from the connection string is returned in a get of the ConnectionString property. |
Pooling |
Enables or disables connection pooling. By default, connection pooling is enabled (true). If set to 'false,' connection pooling is disabled. |
Port |
Port number on the target host server machine that the Data Access Server is listening to. Default is II7. |
Role ID |
Role identifier that has associated privileges for the role. |
Role Password |
Role password associated with the Role ID. |
Timezone TZ |
Specifies the Ingres time zone associated with the client's location. Corresponds to the Ingres environment variable II_TIMEZONE_NAME and is assigned the same values. This information is not used directly by the data provider, but is sent to the DBMS and affects the processing of dates. |
User ID |
The name of the authorized user connecting to the DBMS Server. This value may be case-sensitive depending on the target server. |
Vnode_usage |
Allows the .NET application to control the portions of the vnode information that are used to establish the connection to the remote DBMS server through the DAS server. Available options are:
|
The Ingres .NET Data provider does not require a user ID and password to establish a connection when the Ingres DAS is running on the same machine as the .NET client application. When a user ID and password is not provided, the .NET client process user ID is used to establish the DBMS connection.
If the target database name specification includes a VNODE name specification, the VNODE login information is used to access the DBMS machine. Optionally, a user ID and password can be provided and is handled as described below.
When the DAS and DBMS servers are on different machines, a VNODE name is required in the target database specification of the form vnodename::dbname. The VNODE provides the connection and (optionally) login information needed to establish the DBMS connection.
The connection string keyword Vnode_usage determines how the VNODE is used to access the DBMS. Vnode_usage also determines the context (DAS or DBMS) in which the application user ID/password is used. If the target database specification does not contain a VNODE name, the Vnode_usage specification is ignored.
When Vnode_usage is set to connect, only global VNODE connection information is used to establish the DBMS connection. The application-provided user ID and password are used in the DBMS context to access the DBMS machine.
When Vnode_usage is set to login, both connection and login VNODE information is used to access the DBMS machine. The application-provided User ID and Password are used in the DAS context, allowing access to private and global VNODEs on the DAS server.
The Ingres .NET Data Provider supports IPv6 addressing. IPv6 addresses should be enclosed in brackets [ ] because of the different address format—for example: [fe80::127:dff:fe7c:fecc].
If a hostname is associated with multiple IP addresses, the data provider sequentially tries to connect to each IP address in the AddressList returned by System.Net.Dns.GetHostEntry until it achieves a successful socket connection or until it reaches the end of the list. If the connection to the first address is down, the driver attempts a connection to the next entry in the AddressList. Although performance will suffer as each Exception from a failed connection is caught, this re-attempt allows a secondary IP (backup) for a connection to a server.
The Ingres .NET Data Provider supports enlistment in distributed transactions through the MS Distributed Transaction Coordinator (MSDTC) and the XA two-phase commit protocol.
Developers should be aware of MSDTC performance with distributed transactions and the lag time in communicating with all voters of the two-phase commit protocol. For performance reasons, distributed transactions should be used carefully. While the enlistment in a distributed transaction is not slow, it is not as fast as an enlistment in a local transaction.
To use the distributed transaction support in the data provider, the administrator of the Windows machine must enable XA transactions through Component Services.
The IngresConnectionStringBuilder class represents provides a series of properties and methods to create syntactically correct connection string and to parse and rebuild existing connection strings.
The IngresConnectionStringBuilder class can be declared as follows:
C##: public sealed class IngresConnectionStringBuilder : DbConnectionStringBuilder
VB.NET: NotInheritable Public Class IngresConnectionStringBuilder
Inherits DbConnectionStringBuilder
The IngresConnectionStringBuilder class has the following properties:
Property |
Accessor |
Description |
---|---|---|
BrowsableConnectionString |
get set |
Indicates whether the ConnectionString Property is visible in Visual Studio designers. |
ConnectionString |
get set |
The connection string associated with the IngresConnectionStringBuilder. |
Count |
get |
The number of keys contained within the ConnectionString property. |
DataSource |
get set |
The name of the target server. |
Item |
get set |
The value associated with the key. This property is the C# indexer for the IngresConnectionStringBuilder class. |
Keys |
get |
An ICollection of keys of type String in the IngresConnectionStringBuilder. |
Values |
get |
An ICollection of values of type Object in the IngresConnectionStringBuilder. |
The public methods available to the IngresConnectionStringBuilder class are:
Method |
Description |
---|---|
Add |
Adds a key and value to the collection within IngresConnectionStringBuilder. |
Clear |
Clears all keys and values from IngresConnectionStringBuilder. Sets ConnectionString propery to "". |
ContainsKey |
Returns true if IngresConnectionStringBuilder contains the specified key. |
EquivalentTo |
Returns true if keys and values are comparable to the specified IngresConnectionStringBuilder object. |
Remove |
Removes the entry with the specified key from IngresConnectionStringBuilder. |
ToString |
Returns the ConnectionString associated in the IngresConnectionStringBuilder. |
TryGetValue |
Returns a value corresponding to the specified key from the IngresConnectionStringBuilder. Returns false if the key was not found. |
The IngresConnectionStringBuilder class has the following constructors:
Constructor Overloads |
Description |
---|---|
IngresConnectionStringBuilder () |
Instantiates a new instance of the IngresConnectionStringBuilder class using default property values |
IngresConnectionStringBuilder (string) |
Instantiates a new instance of the IngresConnectionStringBuilder class using the specified connection string. |
IngresDataReader provides a means of reading a forward-only stream of rows from a result-set created by a SELECT query or a row-producing database procedure.
When an IngresDataReader is open, the IngresConnection is busy and no other operations are allowed on the IngresConnection (other than IngresConnection.Close) until IngresDataReader.Close is issued. Created by the IngresCommand.ExecuteReader methods.
The IngresDataReader can be declared as follows:
C#: public sealed class IngresDataReader : System.Data.Common.DbDataReader
VB.NET: NotInheritable Public Class IngresDataReader
Inherits System.Data.Common.DbDataReader
The following is an example implementation of the IngresDataReader class:
static void ReaderDemo(string connstring)
{
IngresConnection conn = new IngresConnection(connstring);
string strNumber;
string strName;
string strSSN;
conn.Open();
IngresCommand cmd = new IngresCommand(
"select number, name, ssn from personnel", conn);
IngresDataReader reader = cmd.ExecuteReader();
Console.Write(reader.GetName(0) + "\t");
Console.Write(reader.GetName(1) + "\t");
Console.Write(reader.GetName(2));
Console.WriteLine();
while (reader.Read())
{
strNumber= reader.IsDBNull(0)?
"<none>":reader.GetInt32(0).ToString();
strName = reader.IsDBNull(1)?
"<none>":reader.GetString(1);
strSSN = reader.IsDBNull(2)?
"<none>":reader.GetString(2);
Console.WriteLine(
strNumber + "\t" + strName + "\t" + strSSN);
}
reader.Close();
conn.Close();
}
The IngresDataReader class contains the following properties:
Property |
Accessor |
Description |
---|---|---|
Depth |
get |
The depth of nesting for the current row. This data provider always returns a depth of zero to indicate no nesting of tables. |
FieldCount |
get |
The number of columns in the current row. |
HasRows |
get |
Returns true if the data reader contains one or more rows. Returns false if the data reader contains zero rows. |
IsClosed |
get |
A true/false indicator as to whether the data reader is closed. |
Item |
get |
Gets the column value in its native format for a given column name or column ordinal. This property is the C# indexer for the IngresDataReader class. |
RecordsAffected |
get |
The number of rows updated, inserted, or deleted by execution of the SQL statement. -1 is returned for SELECT statements. |
The public methods available to the IngresDataReader class are:
Method |
Description |
---|---|
Close |
Closes the IngresDataReader. |
GetBoolean |
Gets the column value as a Boolean. |
GetByte |
Gets the column value as an unsigned 8-bit Byte. |
GetBytes |
Gets the column value as a byte stream into a Byte array. |
GetChar |
Gets the column value as a Char. |
GetChars |
Gets the column value as a character stream into a Char array. |
GetDataTypeName |
Gets the column's data type name as known in Ingres. |
GetDateTime |
Gets the column value as a DateTime. |
GetDecimal |
Gets the column value as a Decimal. |
GetDouble |
Gets the column value as a double. |
GetFieldType |
Gets the column's .NET Type. |
GetFloat |
Gets the column value as a Float. |
GetGuid |
Gets the column value as a Guid. |
GetInt16 |
Gets the column value as a signed 16-bit integer. |
GetInt32 |
Gets the column value as a signed 32-bit integer. |
GetInt64 |
Gets the column value as a signed 64-bit integer. |
GetName |
Gets the column's name using a specified ordinal. |
GetOrdinal |
Gets the column's ordinal using a specified name. |
GetSchemaTable |
Returns a DataTable that describes the resultset column metadata. If ExecuteReader( CommandBehavior.KeyInfo ) was called, additional information about primary key columns, unique columns, and base names is retrieved from the database catalog and included in the returned DataTable. For column information returned, see GetSchemaTable Columns Returned. |
GetString |
Gets the column value as a string. |
GetTimeSpan |
Gets the column value as a TimeSpan. |
GetValue |
Gets the column value in its native format. |
GetValues |
Gets all of the column values into an Object array. |
IsDBNull |
Returns true/false indicating whether the column value is null. |
NextResult |
Advances the data reader to the next result set if present. |
Read |
Advances the data reader to the next row in the result set. |
Important! There are no conversions performed by the GetXXX methods. If the data is not of the correct type, an InvalidCastException is thrown.
Always call IsDBNull on a column if there is any chance of it being null before attempting to call one of the GetXXX accessor to retrieve the data.
The GetSchemaTable describes the column metadata of the IngresDataReader.
Note: The column information is not necessarily returned in the order shown.
Column Information |
Data Type |
Description |
---|---|---|
ColumnName |
String |
The name of the column, which reflects the renaming of the column in the command text (that is, the alias). |
ColumnOrdinal |
Int32 |
The number of the column, beginning with 1. |
ColumnSize |
Int32 |
Maximum possible length of a value in the column. |
NumericPrecision |
Int16 |
This is the maximum precision of the column if the column is a numeric data type; otherwise the value is null. |
NumericScale |
Int16 |
This is the number of decimal places in the column if the column is a numeric data type; otherwise the value is null. |
DataType |
Type |
The .NET Framework data type of the column. |
ProviderType |
IngresType |
The indicator of the column's data type |
IsLong |
Boolean |
Set to true if the column contains a long varchar, long varbinary, or long nvarchar object; otherwise false. |
AllowDBNull |
Boolean |
Set to true if the application can set the column to a null value or if the data provider cannot determine if the application can set the column to a null value. Set to false if it is known that the application is not permitted to set the column to a null. Note that a column value may be null even if the application is not permitted to set the null value. |
IsReadOnly |
Boolean |
Set to true if it is known that the column cannot be modified; otherwise false. |
IsRowVersion |
Boolean |
Set to true if column has a persistent row identifier that cannot be written to and serves only to identify the row. The Ingres .NET Data Provider always returns false. |
IsUnique |
Boolean |
Set to true if no two rows in the table can have the same value in this column. Set to false if not unique or if uniqueness cannot be determined. Only set if ExecuteReader(CommandBehavior.KeyInfo) was called. |
IsKeyColumn |
Boolean |
Set to true if this column is in the set of columns that, taken together, uniquely identify the row. Only set if ExecuteReader( CommandBehavior.KeyInfo ) was called. |
IsAutoIncrement |
Boolean |
Set to true if the column assigns values to new rows in fixed increments. The Ingres .NET Data Provider always returns false. |
BaseCatalogName |
String |
The name of the database catalog that contains the column. This value is null if the catalog name cannot be determined. The Ingres .NET Data Provider always returns a null value. |
BaseSchemaName |
String |
The name of the database schema that contains the column. This value is null if the schema name cannot be determined. Only set if ExecuteReader(CommandBehavior.KeyInfo) was called. |
BaseTableName |
String |
The name of the database table or view that contains the column. This value is null if the table name cannot be determined. Only set if ExecuteReader(CommandBehavior.KeyInfo) was called. |
BaseColumnName |
String |
The name of the column in the database. This value is null if the column name cannot be determined. Only set if |