Class wwData

This is the base Data interface that is used by wwBusiness to access the backend database.

This class is an abstract interface that implements only a couple of the worker methods. Most features are implemented in the concrete classes like wwDataSql, wwDataOleDb etc.

The concrete classes implemented are:

Classname Database
wwDataSql Sql Server
wwDataOleDbVfp Visual FoxPro via OleDb
wwDataOracle Oracle
wwDataMySql My Sql
wwDataVistaDb VistaDb Engine
wwDataOdbc Generic Odbc databases
wwDataOleDb Generic Ole Db databases

This class presents the functional interface of all data classes.

System.Object
  Westwind.BusinessObjects.wwData

public class abstract wwData : object, IDisposable

Class Members

MemberDescription
BeginTransaction Starts a new Transaction on this data object.
public virtual IDbTransaction BeginTransaction( IsolationLevel Isolation );
Close Closes the database connection
public virtual bool Close();
CopyDataRow Copies fields from one datarow to another by looking at the target's field list and trying to retrieve the fields with the same name from the source datarow
public static void CopyDataRow( DataRow Source,
DataRow Target );
CreateCommand Creates a command object based on the specified command text and connection
public abstract IDbCommand CreateCommand( string cmdText );
CreateConnection Creates a new connection based on the ConnectionString property.
public abstract IDbConnection CreateConnection();
CreateDataAdapter Creates a data adapter object, passing the specified command object in the constructor.
public abstract IDbDataAdapter CreateDataAdapter( IDbCommand command );

public abstract IDbDataAdapter CreateDataAdapter( string command );

public abstract IDbDataAdapter CreateDataAdapter();

CreateNewId Returns a new numeric PK Id
public virtual int CreateNewId( string Tablename,
string PkField );
CreateParameter Creates a new Parameter object that can be used to add parameters to a Command object.
public abstract IDbDataParameter CreateParameter( string ParameterName );
Dispose Cleans up an open connection.
public virtual void Dispose();
EndTransaction Ends a transaction on the current data object. Transactions can either be committed or rolled back.
public virtual bool EndTransaction( bool Commit );
ExecStoredProcedure Executes the specified stored procedure in the specified database
public abstract bool ExecStoredProcedure( string procName );
Execute Returns a DataSet for the specified command, database key and table name
public abstract DataSet Execute( string command,
string tableName );

public abstract DataSet Execute( IDbCommand SqlCommand,
string tableName );

ExecuteNonQuery Executes the specified SQL statement and returns the number of rows affected
public virtual int ExecuteNonQuery( string command );

public virtual int ExecuteNonQuery( IDbCommand SqlCommand );

ExecuteReader Executes the specified command and returns a DataReader object. Also returns a connection object via the connection output parameter. It is the responsibility of the caller to close the connection when finished with the DataReader
public virtual IDataReader ExecuteReader( string SqlCommandString );

public virtual IDataReader ExecuteReader( IDbCommand command );

public virtual IDataReader ExecuteReader( string SqlCommandString,
IDbDataParameter[] Parameters );

public virtual IDataReader ExecuteReader( IDbCommand command,
IDbDataParameter[] Parameters );

ExecuteScalar Executes a command and returns a single value
public virtual object ExecuteScalar( string command );

public virtual object ExecuteScalar( IDbCommand SqlCommand );

ExecXmlReader Executes the specified command in the specified database and returns an XML Reader object
public abstract XmlReader ExecXmlReader( string command );
GenerateInsertCommand Generates an InsertCommand for a DataRow.
public virtual bool GenerateInsertCommand( DataRow Row,
string ServerTableName,
ref IDbCommand Command,
string FieldsToSkip );
GenerateUpdateCommand Generates an optimized Update Command for a DataRow DataRow.
public virtual bool GenerateUpdateCommand( DataRow Row,
string PkField,
string ServerTableName,
ref IDbCommand Command,
string FieldsToSkip,
bool WriteNonChangedFields,
DataRowUpdateModes DataRowUpdateMode );
GetEmptyDataSet Returns an empty data set that has the table structure in it for empty rows.
public abstract DataSet GetEmptyDataSet( string tableName );
LoadDataAdapterCommands Loads the Insert, Update, Delete Commands for this data adapter
public abstract bool LoadDataAdapterCommands( IDbCommand SelectCommand,
ref IDbDataAdapter Adapter );
LoadProvider Creates an instance of a wwData Provider object. For most types these providers are part of the framework, but for the following they call out into external assemblies that get loaded dynamically at runtime:
  • wwDataMySql
  • wwDataOracle
  • wwDataVistaDb
These providers require special setup.
public static wwData LoadProvider( ServerTypes ServerType );
Open Opens a connection to the specified database
public virtual bool Open();
SaveDataRow Save Routine that doesn't use the Data Adapter and is optimized for single record saves. This is a low level routine meant to be used for optimized saves.
public bool SaveDataRow( DataRow Row,
string PkField,
string ServerTableName,
ref IDbCommand Command,
string FieldsToSkip,
bool WriteNonChangedFields,
DataRowUpdateModes DataRowUpdateMode );
SaveDataSet Saves the specified DataSet and returns the number of rows updated
public abstract int SaveDataSet( DataSet ds );

public abstract int SaveDataSet( DataSet ds,
string Tablename,
string DatabaseTableName );

public abstract int SaveDataSet( DataSet ds,
string Tablename,
string DatabaseTablename,
ref IDbDataAdapter DataAdapter );

SetError Sets the ErrorMessage Property
public void SetError( string ErrorMessage );

public void SetError();

TranslateParameters Translates parameter names to match the type required for each provider as best as possible. Sql Server uses @ Fox uses ? etc. ParmChar is determined via the protected SqlParmChar.
public void TranslateParameters( IDbCommand Command );
Connection Connection object so a connection can be held open
ConnectionString Connection string property
DataSet Dataset reference for this data member. All output goes to this dataset
Error Error flag after an error occurs.
ErrorMessage Error Message set after an error occurs.
ExecuteWithSchema Determines whether schema information is returned with the query. Useful for XML data retrieval which allows full type and size information.
LastSql This property always holds the SQL command text of the last executed query if calling Execute, ExecuteNonQuery etc.
PrimaryKey Primary Database key property
SqlParmChar Parameter used for Parameters in parameterized queries
Transaction Not used at this time.

Requirements

Namespace: Westwind.BusinessObjects
Assembly: westwind.businessobjects.dll


 Last Updated: 3/7/2007 | Send topic feedback