Skip to content

mrmisra/bench

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bench - Enhanced Database Query Tool

A powerful, interactive SQLite database management tool with multi-database support, schema browsing, and database creation wizards.

Features

  • Multi-Database Support - Work with up to 10 databases simultaneously
  • Schema Browser - Explore tables, columns, indexes, and foreign keys
  • Database Creation Wizard - Create databases from templates
  • Query History - Track and replay previous queries
  • Export Results - Save query results to CSV files
  • Interactive Shell - User-friendly command-line interface

Installation

Prerequisites

  • C compiler (GCC/MinGW)
  • SQLite3 development library
  • Windows (uses windows.h for screen clearing)

Compile

gcc -o bench.exe bench.c -lsqlite3

Usage

Starting the Tool

./bench.exe

Basic Commands

Database Management

open <database> [alias]     # Open database with optional alias
close [alias]               # Close database
list / dbs                  # List all open databases
use <alias>                 # Switch to specific database
create                      # Create new database with wizard
info                        # Show database information

Schema Browsing

schema                      # Complete schema overview
tables                      # List all tables
describe <table>            # Show table structure
indexes                     # List all indexes
fkeys                       # Show foreign key relationships

Query Management

history                     # Show query history
load <number>               # Execute query from history
export <filename>           # Set export file for next query

General Commands

help                        # Show help
clear                       # Clear screen
quit / exit                 # Exit program

Examples

Multi-Database Workflow

-- Open multiple databases
open main.db primary
open users.db userstore
open logs.db logdata

-- List open databases
list

-- Switch between databases
use userstore
SELECT * FROM users LIMIT 5;

use logdata
SELECT * FROM error_logs WHERE date > '2024-01-01';

Schema Exploration

-- Browse complete schema
schema

-- Examine specific table
describe users

-- Check relationships
fkeys

Database Creation

-- Create new database with wizard
create

-- Choose from templates:
-- 1. Empty database
-- 2. Blog/CMS (users, posts, comments)
-- 3. E-commerce (products, orders, customers)
-- 4. Project management (projects, tasks, users)

Export Results

-- Set export file
export user_report.csv

-- Next query will be exported
SELECT name, email, created_at FROM users WHERE active = 1;

Database Templates

Blog/CMS Template

  • users - User accounts
  • posts - Blog posts
  • comments - Post comments

E-commerce Template

  • customers - Customer information
  • products - Product catalog
  • orders - Order records
  • order_items - Order line items

Project Management Template

  • users - Team members
  • projects - Project records
  • tasks - Task assignments
  • project_members - Project team associations

Command Reference

Command Description Example
open <path> [alias] Open database open shop.db store
use <alias> Switch database use store
tables List tables tables
desc <table> Table structure desc products
SELECT ... SQL query SELECT * FROM users;
export <file> Set export file export results.csv
history Show query history history
load 5 Execute history item load 5

Tips

  1. Database Aliases - Use meaningful aliases for easier switching
  2. Schema First - Use schema or tables to explore new databases
  3. History Navigation - Use history and load for query replay
  4. Export Workflow - Set export file before running SELECT queries
  5. Template Usage - Use creation wizard for quick database setup

Limitations

  • Windows-specific (uses cls for screen clearing)
  • Maximum 10 simultaneous database connections
  • SQLite databases only
  • CSV export format only

License

Open source - feel free to modify and distribute.

Contributing

Submit issues and pull requests to improve the tool.

About

Interactive SQLite database management tool

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages