IAdvancedQueryPlugin

class IAdvancedQueryPlugin

Bases: ImpactCOMWrapperBase

Description:

Provides an interface for extending the advanced query functionality within the Impact Browser.

Remarks:

The IAdvancedQueryPlugin interface can be used to extend an advanced query within the Impact Browser. This includes the ability to display dialogs to the user for entering custom query values, saving and restoring custom values with each query, and generating advanced Sql statements to extend the built-in query generator. To implement an advanced query plugin you must create a new interface derived from IAdvancedQueryPlugin. The plugin can then be associated with an advanced query within Impact. The plugin will used to present a dialog to the user and to generate the Sql used to query the database. If the user is searching mulitple Impact databases then the display_dialog() function will be called once at the start, then the generate_join_sql/generate_where_sql functions will be called at least once for each database being searched. Introduced in Impact 7.0.0.99.

Wraps a COM object or another wrapper instance. Accepts: - A valid impact_object - An existing impact_com_wrapper_base-derived instance

display_dialog(h_w_n_d, variables, position)
Description:

This function is called when your dialog needs to be displayed.

Remarks:

You should implement this function to display a dialog to the user. The dialog should present options to the user that will control how the advanced query will operate.

Returns:

The function should return true if the user pressed Ok and false otherwise.

Parameters:
  • hwnd (int) – The parent window handle. w_hen displaying a modal dialog this windows handle should be assigned as the parent of your dialog to ensure the windows order is maintained.

  • variables (IVariables) – An IVariables object that can be used to save and restore values used within your dialog. These values will also be passed to generate_join_sql and generate_where_sql.

  • position (IRect) – An IRect object that can be used to save and restore the position of the dialog.

finished()
Description:

This function is called when the advanced query plugin is no longer required and is being released.

Remarks:

You should use this function to release any resources no longer required.

generate_join_sql(d_b_type, variables, table_name)
Description:

This function is called so you can inject join statements into the generated Sql.

Remarks:

This function may be called multiple times, once for each database being searched and for each built-in Impact table that is involved in the search.

Returns:

You should return the Sql join to be injected.

Parameters:
  • db_type (ipDatabaseType) – The database type that the Sql is being generated for. If your plugin needs to work with multiple databases you may need to adjust the Sql generated depending on the target database.

  • variables (IVariables) – The user values saved with the query.

  • table_name (str) – The name of the built-in Impact table you should generate an Sql join if required.

generate_where_sql(d_b_type, variables)
Description:

This function is called to generate Sql for each database being searched.

Remarks:

This function may be called multiple times, once for each database being searched.

Returns:

You should return the Sql where clause to be added to the internally generated advanced query clause.

Parameters:
  • db_type (ipDatabaseType) – The database type that the Sql is being generated for. If your plugin needs to work with multiple databases you may need to adjust the Sql generated depending on the target database.

  • variables (IVariables) – The user values saved with the query.