My Database

My Database | Boco Apps

Tutorial

This How-To provides a step-by-step guide to using all features of My Database on your smartphone. The app opens on the Databases screen by default (or loads the default database/table if configured). Navigation is intuitive, using buttons, long-press gestures for options, and dialogs for inputs.

Note: The app requests permissions for storage, photos, and camera as needed—grant them for full functionality. If denied, enable them in your phone's settings. For Android 11+, enable "All files access" in the app's settings for imports/exports. Heavy tasks like exports/imports run in background isolates to display progress and prevent UI freezes.

Getting Started and Settings

Managing Databases

The Database list screen lists all databases. Tap a database to open its Tables screen (prompts for password if encrypted).

Creating a Database

  1. Tap the "+" button at the top.
  2. Select "Create Database".
  3. Enter a name (e.g., "MyNotes") in the dialog and tap "Create".

Importing a Database

  1. Tap "+" and choose "Import ZIP (Database + Images)", "Import SQLite DB", or "Import from CSV".
  2. Grant storage permissions if prompted.
    • ZIP Import: Select a .zip file; it extracts the .db and images to the app's documents directory, with a progress dialog.
    • SQLite Import: Select a .db/.sqlite/.sqlite3 file; copies it and adds 'image_paths' if missing.
    • CSV Import: Select a .csv file; creates a new database/table with columns from headers (sanitized names), imports rows in batches with a progress dialog.
  3. Imports process in a background isolate (showing % progress) and refresh the list.

Database Options (Long-Press a Database Name)

Managing Tables (Inside a Database)

From the Databases screen, tap a database to view its tables list (queried via sqlite_master, excluding system tables).

Creating a Table

  1. Tap the floating "+" button.
  2. Enter a table name (e.g., "Entries", sanitized to letters/numbers/underscores) and optional columns (comma-separated, e.g., "title,description"). The 'image_paths' (TEXT) column is auto-added for image support.
  3. Tap "Create".

Table Options (Long-Press a Table Name)

Managing Posts (Records in a Table)

The Posts screen displays paginated entries (100 per load, infinite scroll via ScrollController). Each post is a card with fields (via PRAGMA) and thumbnails. Long-press a card to toggle edit/delete buttons. Tap a card to open the detailed view.

Adding a Post

  1. Tap the floating "+" button.
  2. Fill text fields for each column.
  3. If images are supported: Tap "+Gallery" or "+Camera" (grants permissions, rotates via EXIF, compresses via flutter_image_compress based on quality setting, creates thumbnail). Reorder/delete thumbnails in the dialog.
  4. Tap "Add" to insert (JSON-encodes image_paths).

Editing a Post

  1. Long-press card > "Edit" (or in detailed view).
  2. Update fields/images.
  3. Tap "Update" (uses rowid or PK for WHERE).

Deleting a Post

  1. Long-press card > "Delete" (red) > Confirm.

Adding Images to a Post

Viewing Images

Detailed Post View (Single Post Screen)

Searching and Filtering Posts

Simple Search

Showing All Posts

Advanced Search (Tune Icon)

Exporting Search Results

Count Display

Additional Tips

SSH Terminal Usage

The SSH Terminal allows you to connect to remote servers (e.g., Linux servers) for command-line access. It's useful for managing servers, running scripts, or troubleshooting.

Adding and Managing SSH Connections

  1. Open the app and navigate to the "SSH Connections" menu (accessible from the main screen or database list).
  2. Tap the "+" icon in the app bar to add a new connection.
  3. Enter:
    • Connection Name: A friendly name (e.g., "My Server").
    • Host IP: The server's IP address or domain (e.g., "192.168.1.100" or "example.com").
    • Port: Default is 22 (standard SSH port).
    • Username: Your server username (e.g., "root" or "user").
    • Password: Your server password (stored securely in the app).
  4. Tap "Add" to save. If there's an error (e.g., duplicate name or invalid port), it will be shown.
  5. Connections are listed and can be reordered by dragging (long-press and move).
  6. To edit: Tap the "more" icon (three dots) next to a connection and select "Edit".
  7. To delete: Select "Delete" from the same menu (confirmation required).

Connecting to a Server

  1. Tap a connection from the list to open the terminal.
  2. The app will attempt to connect automatically using the provided credentials.
  3. Once connected, you'll see a terminal interface (powered by xterm.dart).
  4. Type commands as usual. Special keys:
    • Use the on-screen buttons for CTRL, ALT, TAB, ESC, arrows, ENTER, etc.
    • CTRL/ALT modifiers: Toggle them on/off; they apply to the next key press.
  5. The terminal supports resizing and basic input/output.
  6. Connection status is shown (e.g., "Connecting..." or "Connected successfully").
  7. To disconnect: Close the screen or let the session end naturally.

Important Notes for SSH

MySQL Database Usage

MySQL support lets you connect to remote MySQL databases, browse tables, query data, add/edit/delete posts, and handle images (uploaded to the server).

Adding and Managing MySQL Connections

  1. From the main "Databases" screen, tap the "+" icon and select "Add MySQL Connection" (or similar UI element).
  2. Enter:
    • Connection Name: A display name (e.g., "My Remote DB").
    • Host: Server hostname/IP (e.g., "mysql.example.com").
    • Port: Default 3306.
    • Username: MySQL user (e.g., "dbuser").
    • Password: MySQL password.
    • Database Name: The specific database to connect to (e.g., "mydatabase").
    • Use SSL: Toggle for secure connections (recommended).
    • CA Certificate, Client Certificate, Client Key: Optional PEM-encoded certs for SSL (paste or load from files).
    • Server API Key: Must match the key in my_database_api.php on your server (default '8888'—change it!).
  3. Tap "Add". Connections appear as ".mysql" entries in the database list.
  4. Edit/Delete: Similar to SSH—use the "more" menu.
  5. Connections are reordered by dragging.

Working with MySQL Databases

Battery Optimization for MySQL

Similar to SSH: Disable battery optimization to prevent disconnections in the background (e.g., during long queries or uploads).

Server-Side Installation for MySQL (Required only for images)

To enable full MySQL functionality (especially images), set up a PHP script on your server. This API handles image uploads/lists/deletes/reorders, as the app can't directly access server files.

Steps to Install

1. Upload the PHP Script

2. Create Images Folder

3. Change the API Key

4. SSL Certificate

5. Test the API

My Database | Boco Apps