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 abstract class 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 System.Data.IDbDataAdapter CreateDataAdapter(System.Data.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 );

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

public virtual bool GenerateInsertCommand( DataRow Row,
    string ServerTableName,
    IDbCommand& Command,
    string FieldsToSkip );

GenerateUpdateCommand

public virtual bool GenerateUpdateCommand( DataRow Row,
    string PkField,
    string ServerTableName,
    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

public abstract bool LoadDataAdapterCommands( IDbCommand SelectCommand,
    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

public bool SaveDataRow( DataRow Row,
    string PkField,
    string ServerTableName,
    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,
    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

LastSql

This property always holds the SQL command text of the last executed query if calling Execute, ExecuteNonQuery etc.

PrimaryKey

Primary Database key property

Transaction

Not used at this time.

Requirements

Namespace: Westwind.BusinessObjects

© West Wind Technologies, 1996-2018 • Updated: 12/07/05
Comment or report problem with topic