Sphinx QLConnection Class
Represents a connection to Sphinx. This class cannot be inherited.
Definition
Namespace: SphinxConnector.SphinxQL
Assembly: SphinxConnector (in SphinxConnector.dll) Version: 6.1.0
Assembly: SphinxConnector (in SphinxConnector.dll) Version: 6.1.0
C#
public sealed class SphinxQLConnection : DbConnectionVB
Public NotInheritable Class SphinxQLConnection
Inherits 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
| CanCreateBatch | Gets 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) |
| Container | Gets 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) |
| Site | Gets 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) |
| CreateBatch | Returns 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. |
| Dispose | Releases 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)) |
| Equals | Determines whether the specified object is equal to the current object. (Inherited from Object) |
| GetHashCode | Serves as the default hash function. (Inherited from Object) |
| GetLifetimeService | Retrieves the current lifetime service object that controls the lifetime policy for this instance. (Inherited from MarshalByRefObject) |
| 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) |
| GetType | Gets the Type of the current instance. (Inherited from Object) |
| InitializeLifetimeService | Obtains a lifetime service object to control the lifetime policy for this instance. (Inherited from MarshalByRefObject) |
| Open |
Opens a connection to Sphinx.
(Overrides DbConnectionOpen) |
| OpenAsync | 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) |
| OpenAsync(CancellationToken) |
Opens a connection to Sphinx.
(Overrides DbConnectionOpenAsync(CancellationToken)) |
| ToString | Returns a String containing the name of the Component, if any. This method should not be overridden. (Inherited from Component) |
Events
| Disposed | Occurs when the component is disposed by a call to the Dispose method. (Inherited from Component) |
| StateChange | Occurs when the state of the connection changes. (Inherited from DbConnection) |
Explicit Interface Implementations
| IDbConnectionBeginTransaction | Begins a database transaction. (Inherited from DbConnection) |
| IDbConnectionBeginTransaction(IsolationLevel) | Begins a database transaction with the specified isolation level. (Inherited from DbConnection) |
| IDbConnectionCreateCommand | Creates 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.