Skip to content

Core\Db

Opens a connection to a database. The name of a connection in the server's configuration is enough, or the program can give the settings itself.

Members

4 members.

MemberSignature
connectconnect(string $name, { shared?: bool, timeout?: Core\Time\Duration }): Core\Db\Connection
openopen({ driver: Core\Db\Driver::MySql|Core\Db\Driver::MariaDb|Core\Db\Driver::Postgres|Core\Db\Driver::SqlServer, host: string, port?: uint, database: tainted string, user: tainted string, password: secret tainted string, tlsCa?: string, tlsPin?: string|array<string>, tlsVerifyHost?: bool, tlsVerify?: bool, tlsMinVersion?: string, timeZone?: Core\Time\Zone, timeout?: Core\Time\Duration, statementCache?: uint }|{ driver: Core\Db\Driver::Sqlite, path: string, timeZone?: Core\Time\Zone, timeout?: Core\Time\Duration } $settings, { shared?: bool }): Core\Db\Connection
inListinList(array<mixed> $values): Core\Db\InList
quoteIdentifierquoteIdentifier(string $name): string

Example apps

These complete apps use this class. You can download and run each one.

  • Chat: A chat app with rooms, WebSockets and SQLite. One Novis server sends the pages and runs every connection, with no separate WebSocket server and no library.
  • Notes: A small notes app with SQLite, HTML pages, a JSON API, form checks and tests. Download it, run it and start your own app from it.
  • Poll: A live poll with SQLite and server-sent events. Every open page shows each new vote at once, with no extra server and no library.