comet.CQuery¶
- class comet.CQuery¶
This section describes all functions for the comet.CQuery class.
Methods¶
- CQuery.setMethod(method)¶
Set the SOAP call methods for the query. SOAP calls to call expect a method name and a command string. Set the command string with send.
This function only works on query for SOAP connections.
- Parameters:
method (str) – Method to be executed.
- Return type:
None
- Raises:
TypeError – When parameter types are invalid
ValueError – When parameter method is empty.
On internal error
When the parent connection is not a SOAP connection
- Available:
InDesign® comet_pdf® Illustrator®
- CScript:
- CQuery.send(command)¶
Send an instruction or parts of an instruction. The instructions should contain placeholders in place of input values. Placeholders for input values can be specified in two forms :
?
:1, :2, …
The first format is certainly the easier to use, but input values have be connected in the sequence of their application. If this is not possible, the second format can be used, input values will then be connected according to the numbering.
If strings are connected, no quotations marks need be inserted around the value placeholders. It is likewise not necessary to mask quotation marks in the strings.
All instructions sent with send are collected in the query and executed with
execute()
as one instruction. Following the execution of the instruction, the instruction buffer in the query is emptied. The connections to the entry values are likewise deleted following execution.- Parameters:
command (str) – Instruction
- Return type:
None
- Raises:
TypeError – When parameter types are invalid
ValueError – When parameter command is empty.
CometError – On internal error
- Available:
InDesign® comet_pdf® Illustrator®
- CScript:
- CQuery.input(value)¶
Connect an input variable to the corresponding placeholder in the command.
- Parameters:
- Return type:
None
- Raises:
TypeError – When parameter types are invalid
CometError – On internal error
- Available:
InDesign® comet_pdf® Illustrator®
- CScript:
- CQuery.output(type)¶
Define the output type for the next column of a select command. The output types must be given in the same order as the columns are returned from executing the command.
The provided types determine the types in the result tuple from
fetch()
It is not necessary to define all output columns, but if you want to receive the results of the n-th column, all the preceding n-th columns must be defined.
- Parameters:
type (int) – The output type of the next column. One of Basic types
- Return type:
None
- Raises:
TypeError – When parameter types are invalid
ValueError – When parameter type is invalid.
CometError – On internal error
- Available:
InDesign® comet_pdf® Illustrator®
- CScript:
- CQuery.execute(replaceBindings=True)¶
Send all command parts as one instruction. All value placeholders in the command are replaced by the defined input value and the command is executed. After the command is executed, the command buffer is emptied and all connections to the input values are deleted.
- Parameters:
replaceBindings (bool) –
Replace placeholder markers before executing?
- Return type:
None
- Raises:
TypeError – When parameter types are invalid
CometError – On internal error
- Available:
InDesign® comet_pdf® Illustrator®
- CScript:
- CQuery.fetch()¶
Fetch the next line of the results of the command. This command is to be called in a loop, after each command from which a result is expected, until it returns False. After the last data has been fetched, the query can be used for the processing of another command.
- Returns:
The loaded data from the command or
None
when no data is available.When the result is not
None
, the entries are returned in the order of the selected columns of the command as a list of tuples.Types in the tuples depend on the values provided by
output()
:- Return type:
- Raises:
CometError – On internal error
- Available:
InDesign® comet_pdf® Illustrator®
- CQuery.commit(message='')¶
Confirm the changes of this query.
- Parameters:
message (str) – Description for the command
- Return type:
None
- Raises:
TypeError – When parameter types are invalid
CometError – On internal error
- Available:
InDesign® comet_pdf® Illustrator®
- CScript:
- CQuery.rollback(message='')¶
Rollback the changes of this query.
- Parameters:
message (str) – Description for the command
- Return type:
None
- Raises:
TypeError – When parameter types are invalid
CometError – On internal error
- Available:
InDesign® comet_pdf® Illustrator®
- CScript:
- CQuery.getCommand(replaceBindings=False)¶
Get the completed command which has been
send()
to this query but not yet executed.- Parameters:
replaceBindings (bool) –
Replace placeholder markers inside the command by their current values?
- Returns:
The prepared command
- Return type:
- Raises:
TypeError – When parameter types are invalid
CometError – On internal error
- Available:
InDesign® comet_pdf® Illustrator®
- CScript: