History

History automatically logs executed SQL queries, allowing you to review, reuse, and manage past queries with ease.

By default, the History feature is disabled. It can be enabled in two ways:

Enable via the History Panel:

  • In the DBCode Explorer, click the History view and click the Enable History button.

history panel

Enable via Settings

  • In Visual Studio Code, click on the gear icon in the lower-left corner and select Settings.
  • In the settings search bar, type DBCode History.
  • Locate the option to enable query history and toggle it on. Once activated, DBCode will start recording all executed SQL queries.

enable history

Accessing Query History

  1. Open DBCode in Visual Studio Code:

    • Launch Visual Studio Code and click the DBCode icon in the Activity Bar on the left.

    dbcode icon

  2. Open the History Panel:

    • In the DBCode sidebar, click the History view to access the list of previously executed queries.

    history panel

Using the History Panel

  1. View Past Queries:

    • The History panel shows a chronological list of queries group by connection and database.
    • Use the Expand All icon to see all details or the Queries Only icon to show a list of queries from all connections and databases.
    • Apply filters using the Filter icon to narrow your view based on specific criteria.

    query list

  2. Re-Run a Query:

    • Click the Load Query icon next to any query to reload it into a new editor tab for the selected database connection.

    run query

  3. Edit and Copy Queries:

    • Use the Copy SQL icon to duplicate a query. Paste it into the editor to modify or use as a new template.

    copy query

  4. Delete History:

    • To delete a query, click the Delete icon next to it. Confirm the action by selecting “Yes” in the prompt. Individual queries or all queries for a database can be deleted.

    clear history

Benefits of Using Query History

  • Time-Saving: Quickly re-run frequently used queries without retyping.
  • Efficient Troubleshooting: Easily review past queries to identify and resolve issues.
  • Organized Workflow: Maintain a comprehensive log of query development for easy reference.

Enabling and using the History can streamline your workflow and make database interactions in Visual Studio Code more efficient and organized.