Skip to content

Commit

Permalink
Update adapters to conform to new structure
Browse files Browse the repository at this point in the history
- Added a parent sql adapter class to handle the common behavior between the different adapters
  • Loading branch information
boskoramen committed Sep 26, 2024
1 parent 6780ab2 commit cd35b40
Show file tree
Hide file tree
Showing 12 changed files with 635 additions and 1,050 deletions.
8 changes: 7 additions & 1 deletion .github/guides/NDATABASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ TBD
TBD
### Filters
TBD
# Query
## Query
## Read Single (read_single)
Executes the given query,
## Connection
Expand Down Expand Up @@ -109,3 +109,9 @@ BYOND internal database driver: http://www.byond.com/docs/ref/#/database

Uses SQLite as its DB
> A /database datum gives you the ability to create or access a database using SQLite
# Database Operations
## Select
## Delete
## Update
## Insert

3 changes: 3 additions & 0 deletions code/__DEFINES/text.dm
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@
#define MAX_PAPER_MESSAGE_LEN 3072
#define MAX_BOOK_MESSAGE_LEN 9216
#define MAX_NAME_LEN 28

#define COPY_FROM_START(T, loc) copytext(T, 1, loc)
#define COPY_AFTER_FOUND(T, loc) copytext(T, loc+1)
583 changes: 52 additions & 531 deletions code/datums/_ndatabase/code/brsql_adapter.dm

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion code/datums/_ndatabase/code/brsql_persistent_connection.dm
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,6 @@
return null

/datum/db/connection/brsql_connection/get_adapter()
var/datum/db/adapter/brsql_adapter/adapter = new()
var/datum/db/adapter/sql/brsql/adapter = new()
adapter.connection = src
return adapter
1 change: 1 addition & 0 deletions code/datums/_ndatabase/code/entity/entity_meta.dm
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

var/list/datum/entity/managed
var/list/datum/entity/key_managed
/// List of valid entities that exist in the table
var/list/datum/entity/to_read
var/list/datum/entity/to_insert
var/list/datum/entity/to_update
Expand Down
5 changes: 3 additions & 2 deletions code/datums/_ndatabase/code/entity/link.dm
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@
/// Entity that is referencing a different entity
var/child_entity
/// Column on child entity to reference parent entity.
/// A typepath to the db_field datum that represents the column
var/child_foreign_key
/// A typepath to the db_field datum that represents the column that is casted for access to
/// values from the field's type definition
var/datum/db_field/child_foreign_key

var/datum/entity_meta/parent_meta
var/datum/entity_meta/child_meta
Expand Down
Loading

0 comments on commit cd35b40

Please sign in to comment.