SphinxQLCommandCommandType Property

Indicates or specifies how the CommandText property is interpreted. Setting this property to TableDirect is not supported.

Definition

Namespace: SphinxConnector.SphinxQL
Assembly: SphinxConnector (in SphinxConnector.dll) Version: 6.1.0
C#
public override CommandType CommandType { get; set; }

Return Value

CommandType
One of the CommandType values. The default is Text.

Implements

IDbCommandCommandType

Remarks

To call the SNIPPETS and KEYOWRDS procedures, set the CommandType to StoredProcedure. The parameters do not need to be named, but they can. Parameters will be added as arguments to the procedure in the order in which they have been added to the Parameters collection. Note how in the example for the SNIPPETS procedure the SphinxType property for the last parameter is set to BigInt. This is done to workaround the fact that the option parameters may not be quoted.

Example

C#
using (SphinxQLConnection connection = new SphinxQLConnection(connectionString))
{
    var command = connection.CreateCommand("KEYWORDS");
    command.CommandType = CommandType.StoredProcedure;
    command.Parameters.Add("My Text");
    command.Parameters.Add("My Index");
    command.Parameters.Add(1);

    connection.Open();

    SphinxQLDataAdapter dataAdapter = new SphinxQLDataAdapter { SelectCommand = command };
    DataTable dt = new DataTable();
    dataAdapter.Fill(dt);
    dataAdapter.Dispose();
}

using (SphinxQLConnection connection = new SphinxQLConnection(connectionString))
{
    var command = connection.CreateCommand("SNIPPETS");
    command.CommandType = CommandType.StoredProcedure;
    command.Parameters.Add("document text");
    command.Parameters.Add("sakila");
    command.Parameters.Add("text");
    command.Parameters.Add(new SphinxQLParameter { Value = "5 AS limit", SphinxType = SphinxType.BigInt });

    connection.Open();

    SphinxQLDataAdapter dataAdapter = new SphinxQLDataAdapter { SelectCommand = command };
    DataTable dt = new DataTable();
    dataAdapter.Fill(dt);
    dataAdapter.Dispose();
 }

See Also