SphinxQLConnection Class

Represents a connection to Sphinx. This class cannot be inherited.

Definition

Namespace: SphinxConnector.SphinxQL
Assembly: SphinxConnector (in SphinxConnector.dll) Version: 6.1.0
C#
public sealed class SphinxQLConnection : DbConnection
Inheritance
Object    MarshalByRefObject    Component    DbConnection    SphinxQLConnection

Remarks

On creation, all properties of the class are set to their initial values. The default ConnectionString is an empty string which is equivalent to "Data Source=localhost;Port=9306;pooling=false;Min Pool Size=5;Max Pool Size=20".

Example

The following example creates a SphinxQLCommand and a SphinxQLConnection to retrieve data from an index.
C#
string connectionString = "Data Source=localhost;Port=9306;pooling=true";

using (SphinxQLConnection connection = new SphinxQLConnection(connectionString))
{
    SphinxQLCommand sphinxQLCommand = new SphinxQLCommand("SELECT * from sakila;", sphinxQLConnection);

    connection.Open();

    using (SphinxQLDataReader sphinxQLDataReader = sphinxQLCommand.ExecuteReader())
    {
        while(sphinxQLDataReader.Read())
        {
            Console.Writeline(sphinxQLDataReader.GetInt32("id");
        }
    }
}

Constructors

SphinxQLConnection Initializes a new instance of the SphinxQLConnection class.
SphinxQLConnection(String) Initializes a new instance of the SphinxQLConnection class.

Properties

CanCreateBatchGets a value that indicates whether this DbConnection instance supports the DbBatch class.
(Inherited from DbConnection)
ConnectionString Gets or sets the string used to open the connection.
(Overrides DbConnectionConnectionString)
ConnectionTimeout Gets the time (in seconds) to wait while establishing a connection before terminating the attempt and generating an error.
(Overrides DbConnectionConnectionTimeout)
ContainerGets the IContainer that contains the Component.
(Inherited from Component)
Database Always returns "Sphinx".
(Overrides DbConnectionDatabase)
DataSource Gets the name of the Sphinx server to which to connect.
(Overrides DbConnectionDataSource)
ServerVersion Gets a string that represents the version of the server to which the object is connected.
(Overrides DbConnectionServerVersion)
SiteGets or sets the ISite of the Component.
(Inherited from Component)
State Gets a string that describes the state of the connection.
(Overrides DbConnectionState)

Methods

BeginTransaction Begins a new transaction.
BeginTransaction(IsolationLevel) Begins a new transaction with the specified isolation level. Not supported.
BeginTransactionAsync Begins a new transaction asynchronously.
BeginTransactionAsync(CancellationToken) Begins a new transaction asynchronously.
BeginTransactionAsync(IsolationLevel, CancellationToken)Asynchronously begins a database transaction.
(Inherited from DbConnection)
ChangeDatabase Changes the current database for an open connection. Not supported.
(Overrides DbConnectionChangeDatabase(String))
ChangeDatabaseAsync Changes the current database for an open connection. Not supported.
(Overrides DbConnectionChangeDatabaseAsync(String, CancellationToken))
Close Closes the connection to searchd. This is the preferred method of closing any open connection.
(Overrides DbConnectionClose)
CloseAsync Asynchronously closes the connection to searchd. This is the preferred method of closing any open connection.
(Overrides DbConnectionCloseAsync)
CreateBatchReturns a new instance of the provider's class that implements the DbBatch class.
(Inherited from DbConnection)
CreateCommand Creates and returns a SphinxQLCommand object associated with the current connection.
CreateCommand(String) Creates and returns a SphinxQLCommand object associated with the current connection and the provided command text.
DisposeReleases all resources used by the Component.
(Inherited from Component)
DisposeAsync Asynchronously diposes the connection object.
(Overrides DbConnectionDisposeAsync)
EnlistTransaction Enlists in the specified transaction.
(Overrides DbConnectionEnlistTransaction(Transaction))
EqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
GetHashCodeServes as the default hash function.
(Inherited from Object)
GetLifetimeServiceRetrieves the current lifetime service object that controls the lifetime policy for this instance.
(Inherited from MarshalByRefObject)
Obsolete
GetSchema Returns schema information for the data source of this SphinxQLConnection. Not supported.
(Overrides DbConnectionGetSchema)
GetSchema(String) Returns schema information for the data source of this SphinxQLConnection using the specified string for the schema name. Not supported.
(Overrides DbConnectionGetSchema(String))
GetSchema(String, String) Returns schema information for the data source of this SphinxQLConnection using the specified string for the schema name and the specified string array for the restriction values. Not supported.
(Overrides DbConnectionGetSchema(String, String))
GetSchemaAsync(CancellationToken)This is an asynchronous version of GetSchema. Providers should override with an appropriate implementation. The cancellationToken can optionally be honored. The default implementation invokes the synchronous GetSchema call and returns a completed task. The default implementation will return a cancelled task if passed an already cancelled cancellationToken. Exceptions thrown by GetSchema will be communicated via the returned Task Exception property.
(Inherited from DbConnection)
GetSchemaAsync(String, CancellationToken)This is the asynchronous version of GetSchema(String). Providers should override with an appropriate implementation. The cancellationToken can optionally be honored. The default implementation invokes the synchronous GetSchema(String) call and returns a completed task. The default implementation will return a cancelled task if passed an already cancelled cancellationToken. Exceptions thrown by GetSchema(String) will be communicated via the returned Task Exception property.
(Inherited from DbConnection)
GetSchemaAsync(String, String, CancellationToken)This is the asynchronous version of GetSchema(String, String). Providers should override with an appropriate implementation. The cancellationToken can optionally be honored. The default implementation invokes the synchronous GetSchema(String, String) call and returns a completed task. The default implementation will return a cancelled task if passed an already cancelled cancellationToken. Exceptions thrown by GetSchema(String, String) will be communicated via the returned Task Exception property.
(Inherited from DbConnection)
GetTypeGets the Type of the current instance.
(Inherited from Object)
InitializeLifetimeServiceObtains a lifetime service object to control the lifetime policy for this instance.
(Inherited from MarshalByRefObject)
Obsolete
Open Opens a connection to Sphinx.
(Overrides DbConnectionOpen)
OpenAsyncAn asynchronous version of Open, which opens a database connection with the settings specified by the ConnectionString. This method invokes the virtual method OpenAsync(CancellationToken) with CancellationToken.None.
(Inherited from DbConnection)
OpenAsync(CancellationToken) Opens a connection to Sphinx.
(Overrides DbConnectionOpenAsync(CancellationToken))
ToStringReturns a String containing the name of the Component, if any. This method should not be overridden.
(Inherited from Component)

Events

DisposedOccurs when the component is disposed by a call to the Dispose method.
(Inherited from Component)
StateChangeOccurs when the state of the connection changes.
(Inherited from DbConnection)

Explicit Interface Implementations

IDbConnectionBeginTransactionBegins a database transaction.
(Inherited from DbConnection)
IDbConnectionBeginTransaction(IsolationLevel)Begins a database transaction with the specified isolation level.
(Inherited from DbConnection)
IDbConnectionCreateCommandCreates and returns a DbCommand object that is associated with the current connection.
(Inherited from DbConnection)

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also