The C# ISqlConnection Interface

ISqlConnection defines the common SQL execution contract implemented by SqlLocalConnection, SqlRemoteConnection, and SqlAggregator. It is the shared interface used by helper code and samples that need to execute SQL statements without depending on a specific connection type.

For an overview see page SQL Classes

Interface Definition

    public interface ISqlConnection {
        SqlResultSet ExecuteQuery(String query, params Object[] args);
        int ExecuteStatement(String stmt, params Object[] args);
        void Disconnect();
        void DetachResultSet(SqlResultSet result);
        IDatabaseWrapper Wrapper { get; }
    }

Member Descriptions

ExecuteQuery(String, params Object[])
Executes a SQL query that returns rows and produces a SqlResultSet for iterating through the selected tuples. The SQL text can use positional placeholders such as ? and, where supported by the eXtremeDB SQL engine, typed format placeholders such as %i, %s, and %w. Implementations can throw SqlException when the SQL connection has already been closed.
ExecuteStatement(String, params Object[])
Executes a SQL statement that does not return a result set, such as INSERT, UPDATE, DELETE, DDL, or control statements, and returns the statement result count reported by the SQL engine. Implementations can throw SqlException when the SQL connection has already been closed.
Disconnect()
Closes the SQL connection and releases associated native SQL resources. Any result sets still attached to the connection should be closed or disposed before the connection itself is disconnected.
DetachResultSet(SqlResultSet)
Internal callback used by SqlResultSet when a result set is closed or disposed. Applications should not call this method directly.
Wrapper
Gets the internal IDatabaseWrapper instance used by the C# runtime layer for low-level SQL operations. This property is not normally needed in application-level code.
Thread Safety Note
Each thread working with the database should use its own ISqlConnection instance. Implementations may keep per-thread state or native resources, so a single SQL connection object should not be shared across threads without external coordination.
Parameter Binding
Both ExecuteQuery and ExecuteStatement support parameter binding through the params Object[] argument list. In most cases the standard ? placeholder can be used, while the SQL engine also supports typed %x placeholders when the statement needs explicit argument formatting.
String Encoding
Implementations use the database object's defaultStringEncoding to convert .NET strings to the format expected by the eXtremeDB SQL engine.
Implementation Notes
The interface defines only the common execution contract. Transaction control, result set attachment rules, buffering limits, networking, and server-specific behavior depend on the concrete implementation.
Related Implementations
See SqlLocalConnection for in-process SQL access, SqlRemoteConnection for remote SQL access through SqlServer, and SqlAggregator for aggregated SQL execution across multiple local engines.