Click or drag to resize

SphinxQLConnection Class

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

Namespace:  SphinxConnector.SphinxQL
Assembly:  SphinxConnector (in SphinxConnector.dll) Version: 5.3.0
Syntax
public sealed class SphinxQLConnection : DbConnection

The SphinxQLConnection type exposes the following members.

Constructors
  NameDescription
Public methodSphinxQLConnection
Initializes a new instance of the SphinxQLConnection class.
Public methodSphinxQLConnection(String)
Initializes a new instance of the SphinxQLConnection class.
Top
Properties
  NameDescription
Public propertyConnectionString
Gets or sets the string used to open the connection.
(Overrides DbConnectionConnectionString.)
Public propertyConnectionTimeout
Gets the time (in seconds) to wait while establishing a connection before terminating the attempt and generating an error.
(Overrides DbConnectionConnectionTimeout.)
Public propertyContainer
Gets the IContainer that contains the Component.
(Inherited from Component.)
Public propertyDatabase
Always returns "Sphinx".
(Overrides DbConnectionDatabase.)
Public propertyDataSource
Gets the name of the Sphinx server to which to connect.
(Overrides DbConnectionDataSource.)
Public propertyServerVersion
Gets a string that represents the version of the server to which the object is connected.
(Overrides DbConnectionServerVersion.)
Public propertySite
Gets or sets the ISite of the Component.
(Inherited from Component.)
Public propertyState
Gets a string that describes the state of the connection.
(Overrides DbConnectionState.)
Top
Methods
  NameDescription
Public methodBeginTransaction
Begins a new transaction.
Public methodBeginTransaction(IsolationLevel)
Begins a new transaction with the specified isolation level. Not supported.
Public methodBeginTransactionAsync
Begins a new transaction asynchronously.
Public methodBeginTransactionAsync(CancellationToken)
Begins a new transaction asynchronously.
Public methodChangeDatabase
Changes the current database for an open connection. Not supported.
(Overrides DbConnectionChangeDatabase(String).)
Public methodClose
Closes the connection to searchd. This is the preferred method of closing any open connection.
(Overrides DbConnectionClose.)
Public methodCloseAsync
Asynchronously closes the connection to searchd. This is the preferred method of closing any open connection.
Public methodCreateCommand
Creates and returns a SphinxQLCommand object associated with the current connection.
Public methodCreateCommand(String)
Creates and returns a SphinxQLCommand object associated with the current connection and the provided command text.
Public methodCreateObjRef
Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.
(Inherited from MarshalByRefObject.)
Public methodDispose
Releases all resources used by the Component.
(Inherited from Component.)
Public methodDisposeAsync
Asynchronously diposes the connection object.
Public methodEnlistTransaction
Enlists in the specified transaction.
(Overrides DbConnectionEnlistTransaction(Transaction).)
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetLifetimeService
Retrieves the current lifetime service object that controls the lifetime policy for this instance.
(Inherited from MarshalByRefObject.)
Public methodGetSchema
Returns schema information for the data source of this SphinxQLConnection. Not supported.
(Overrides DbConnectionGetSchema.)
Public methodGetSchema(String)
Returns schema information for the data source of this SphinxQLConnection using the specified string for the schema name. Not supported.
(Overrides DbConnectionGetSchema(String).)
Public methodGetSchema(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).)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodInitializeLifetimeService
Obtains a lifetime service object to control the lifetime policy for this instance.
(Inherited from MarshalByRefObject.)
Public methodOpen
Opens a connection to Sphinx.
(Overrides DbConnectionOpen.)
Public methodOpenAsync
An 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.)
Public methodOpenAsync(CancellationToken)
Opens a connection to Sphinx.
(Overrides DbConnectionOpenAsync(CancellationToken).)
Public methodToString
Returns a String containing the name of the Component, if any. This method should not be overridden.
(Inherited from Component.)
Top
Events
  NameDescription
Public eventDisposed
Occurs when the component is disposed by a call to the Dispose method.
(Inherited from Component.)
Public eventStateChange
Occurs when the state of the event changes.
(Inherited from DbConnection.)
Top
Explicit Interface Implementations
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".
Examples
The following example creates a SphinxQLCommand and a SphinxQLConnection to retrieve data from an index.
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");
        }
    }
}
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