 | SphinxQLCommandCommandType Property |
Indicates or specifies how the
CommandText property is interpreted.
Setting this property to
TableDirect is not supported.
Namespace: SphinxConnector.SphinxQLAssembly: SphinxConnector (in SphinxConnector.dll) Version: 6.0.0
Syntaxpublic override CommandType CommandType { get; set; }Public Overrides Property CommandType As 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
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