Database meta traversal slots

Database meta traversal

All the following slots are a part of the database meta system, and allow you to retrieve meta data about your databases, such as database names, table names, columns names, and foreign keys for tables. These slots are heavily relied upon by the CRUDifier, as it creates a Hyperlambda backend for you, in order to determine which arguments your HTTP endpoints require, and how to validate these during HTTP invocations towards your backend.

All these have at least 4 versions, one for SQLite, one for MySQL, one for PostgreSQL, and a fourth for SQL Server, and their only difference is that the MySQL versions use “mysql” as its slot name, SQL Server uses “mssql”, PostgreSQL uses “pgsql” and SQLite uses “sqlite”. Besides from this, they’re identical in regards to their APIs, which is the point, since it allows for these slots to be used transparently, or “polymorphistically” towards any underlying database type. In the following section, we therefore document their MySQL version, implying you’ll have to exchange the “mysql” parts to test these towards a different database type.

  • magic.db.mysql.databases - This slot returns all databases the system has access to within the specified connection string.
  • magic.db.mysql.tables - This slot returns all tables for the specified [connection-string]/[database] combination.
  • magic.db.mysql.columns - This slot returns all columns for the specified [connection-string]/[database]/[table] combination.
  • magic.db.mysql.foreign_keys - This slot returns all foreign keys for the specified [connection-string]/[database]/[table] combination.
  • magic.db.mysql.indexes - This slot returns all indexes for the specified [connection-string]/[database]/[table] combination.