1.1.1

Table Of Contents
Table 4: Mapping SQLFire driver classes to System.Data.Common base classes
ADO.NET interfaces (in
System.Data)
ADO.NET base class (in
System.Data.Common)
SQLFire ADO.NET Driver Class
IDbConnectionDbConnectionSQLFClientConnection
IDbCommandDbCommandSQLFCommand
n/aDbCommandBuilderSQLFCommandBuilder
IDbDataAdapterDbDataAdapterSQLFDataAdapter
IDataReaderDbDataReaderSQLFDataReader
n/aDbExceptionSQLFException
IDataParameter, IDbDataParameterDbParameterSQLFParameter
IDataParameterCollectionDbParameterCollectionSQLFParameterCollection
n/aRowUpdatedEventArgsSQLFRowUpdatedEventArgs
n/aRowUpdatingEventArgsSQLFRowUpdatingEventArgs
IDbTransactionDbTransactionSQLFTransaction
See
VMware.Data.SQLFire.SQLFType
on page 696.
(use DbTypes as in Table 41: SQL types
to SQLFType mapping on page 696)
SQLFType
For example:
// Open a new connection to the network server running on localhost:1527
string host = "localhost";
int port = 1527;
string connectionStr = string.Format("server={0}:{1}", host, port);
// use the SQLFire specific class for connection creation
using (SQLFClientConnection conn = new SQLFClientConnection(connectionStr))
{
conn.Open();
// create a table
// using the base DbCommand class rather than SQLFire specific class
DbCommand cmd = conn.CreateCommand();
cmd.CommandText = "create table t1 (id int primary key, addr varchar(20))";
cmd.ExecuteNonQuery();
// insert into the table using named parameters
// using an abstracted method that can deal with difference in the
// conventions of named parameters in different drivers
cmd = conn.CreateCommand();
string idPrm = GetEscapedParameterName("ID");
string addrPrm = GetEscapedParameterName("ADDR");
cmd.CommandText = "insert into t1 values (" + idPrm + "," + addrPrm +
")";
cmd.Prepare();
// using the base DbParameter class
DbParameter prm;
for (int i = 0; i < 1000; i++) {
// first the parameter for ID
cmd.Parameters.Clear();
prm = cmd.CreateParameter();
prm.ParameterName = "ID";
prm.DbType = DbType.Int32;
prm.Value = i;
vFabric SQLFire User's Guide144
Developing Applications with SQLFire