Skip to content
KnightNine edited this page Feb 25, 2022 · 24 revisions

-Manor DB Documentation-


Column Types:

the Data Types Supported by this database manager.

Column Type Summary Value Type Default Value
Primary Key A unique identifier for the row of the table. string `null`
Text A String of text. string `null`
Numerical Any number value. double `null`
Integer A number value without a fractional component. int `null`
Bool A true or false value. bool `false`
SubTable A value containing table data with a structure that is tied to the column. Dictionary<int,<string,dynamic>> `{}`
Foreign Key Reference A value tied to the primary key in the row of another referenced main table (in the mdb file) that is defined upon column creation. cells of this column provide a dropdown menu of primary keys in the table referenced. string `null`
Parent SubTable Foreign Key Reference A value tied to the primary key in the row of subtables at or above the the column within the same dictionary branch. cells of this column provide a dropdown menu of primary keys in the subtable referenced. string `null`
Auto Table Constructor Script A script which defines a table's columns that is used by the "Auto Table Constructor Script Receiver" column type to construct a subtable structure. additional info here string `null`
Auto Table Constructor Script Receiver A subtable structured from another table's "Auto Table Constructor Script" column cell data. additional info here Dictionary<int,<string,dynamic>> `{}`

Table Management:

right click the table's tab for options that alter tables, these options are listed here.

  • Bookmark Table: this option allows you to add a colored line at the top of the tab's text to increase its visibility if you have a lot of tables to sift through.

  • Rename Table: Alter the name of the table. (This will also alter the Foreign Key Reference columns that are linking to the table to use the new name entered.)

Column Management:

right click the column header for options that alter columns, these options are listed here. (this is not accessible to columns that are read-only indicated by a blue column header.)

  • Shift Column Left: Shifts the column to the left in the display order.
  • Shift Column Right: Shifts the column to the right in the display order.
  • Rename Column: Alter the name of the column.
  • Delete Column: Erases the column and all of its data.
  • Adjacent Column Disabler Settings: info here

Row Management:

right click the row for options that affect rows, these options are listed here. (this is not accessible to rows that are read-only indicated by a blue row header.)

  • Shift Row Up: Shifts the row up in the table.
  • Shift Row Down: Shifts the row down in the table.
  • Delete Row: Deletes the row and its data.
  • Insert Row: Creates a new row above at the selected row's index.
  • Duplicate Row: Duplicates the row and inserts it above at the selected row's index (this does not duplicate Primary Key Data).

Restrictors:

Restrictors are features that can be used to minimize mistakes when writing to your database through restrictions imposed via the editor.

  • Subtable Single Row Restriction: If your subtable column data functions more as a folder rather than a list, you can restrict the subtable column's data to a single row to indicate this. (it will appear as an additional option in the dropdown menu that appears when right clicking the subtable's column header.)

  • Adjacent Column Disabler: You can clarify columns that aren't meant to be filled out at the same time in the same row by restricting a column to disable itself when another column at the same row contains data. (this is accessible from the dropdown menu that appears when right clicking the column header)

Adjacent Column Disabler Example: Say you want each row to represent a single object in a character's default inventory but "items" and "equipment" are derived from distinct tables, So you'll be defining two distinct columns for these foreign key references but you only want one of these columns to be filled out per row and not both. Now you can enforce only one of these columns being filled, while two columns are tied together by their ColumnDisablers array, if either column in a row is filled with data the cell for the other unfilled column in that row will be disabled. This works for all column types. disabler

Column Type Condition for cell to Count as "Filled"
Primary Key/Text/Auto Table Constructor Script/Numerical/Integer/Auto Table Constructor Script The cell contains any data.
Foreign Key Reference/Parent Subtable Foreign Key Reference The cell has a non-blank key selected.
Bool The cell is ticked (true).
SubTable/Auto Table Constructor Script Receiver The cell contains one or more rows.

File Regex Reference Table:

A "File Regex Reference Table" can be built when creating a new table and selecting the "File Regex Reference Table" Table Type. The table references its row data from an external file that is defined via the "Regex Reference Table Constructor Editor". It is opened via the "Edit Regex Reference Table Constructor" button in the top menu bar while the table is selected and contains instructions on how to use it. These tables will automatically update to changes in the file(s) they reference upon opening the .mdb file they are contained in.

Constructor Table

Other Functionality:

  • Hide/Unhide Columns: this feature can be used to hide/minimize columns and better see the columns you want to edit if you have a wide and shallow data model that stores many columns across one row. With this feature, there's no need for unnecessary categorization just so the data can be more easily viewed in the editor (this is only for the main table columns and not for subtables).

  • Convert Numeric Columns To Integer Columns and vice versa: in the dropdown menu accessed by right clicking the column header, the option to convert the column type to Numeric exists for Integer Columns and the option to convert the column type to Integer exists for Numeric Columns.

  • Append File: under the "File" dropdown in the top menu bar, the "Append File" adds non-conflicting tables from a selected file to the currently loaded database.

Accessing The Database:

All data regarding your row entries is stored within the MDB file's main table name Database[*tableName*]["@RowEntries"][*index*] and from there that row's column entries are accessed via [*columnName*] . If that data is a SubTable or Auto Table Constructor Script Receiver, its row data is accessed in the same fashion through [*index*].

Installation:

For those unfamiliar with WinForms:

You will need to download Visual Studio and through the installer, you'll need to select the .Net desktop development checkbox under the "Workloads" tab (if you have visual studio already, you can re-run the installer to modify the workloads of existing installations). Net workload

Download the master branch here: https://github.com/KnightNine/ManorDB/archive/refs/heads/master.zip

Then upon opening the project's MDB.sln file (within the MDB folder) with visual studio, follow these steps to create the executable file:

  1. right click the "Manor DB" project in the solution explorer and select "properties" from the dropdown.
  2. select the build tab within the properties section.
  3. modify the directory you want the executable to be located (it is recommended to create a new folder for the built project's files).
  4. press the "build" option then select "build solution" from the dropdown.

building

And there you have it, the project should be located in the desired directory.

Note:

You can open a file with the MDB executable and the file will load upon startup. (You should set MDB as the default application to open .mdb files with)

Misc Notes:

  • The main tables are currently stored in alphabetical order and will reorder themselves upon reloading the database.

  • The data is unindented which I've found might affect other json deserialization methods, so you can use https://json-indent.com/ to indent the data for that or just to view the database.

  • the word "Reference" is misspelled as "Refrence" across the code and I never bothered to fix it yet. There are likely other misspellings I'm yet to be aware of.