Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQL builder should be separated from query/ddl/schema builders #60

Closed
DrewImm opened this issue Nov 4, 2023 · 0 comments
Closed

SQL builder should be separated from query/ddl/schema builders #60

DrewImm opened this issue Nov 4, 2023 · 0 comments

Comments

@DrewImm
Copy link
Contributor

DrewImm commented Nov 4, 2023

Currently, overriding sql building methods such as operators, appendPlaceholder(), etc. must be written for each builder type (ddl, dml, schema). This causes duplicate, hard-to-maintain, and riskier code.

The reason for this is due to inheritance in a language that does not support multiple inheritance. The proposed solution is to use composition instead of inheritance.

With single inheritance, any method in SqlBuilder that needs to be overridden must be done so in both the MySQL DDL Builder and the MySQL Query Builder.

image

However, if composition is used instead of inheritance; any SqlBuilder method can be overridden in a shared way

image

@DrewImm DrewImm closed this as completed Nov 4, 2023
DrewImm added a commit that referenced this issue Nov 10, 2023
* #26 Add count method to QueryRepository (#55)

* #37 Add support for between to select query (#56)

* #35 Add support for select DISTINCT (#57)

* #58 Token usage/implementations are inconsistent (#59)

* #60 SQL builder should be separated from query/ddl/schema builders (#61)

* #62 Only insertOne() should return ID; insert in bulk should not (#65)

* Issue 62 (#68)

* #62 Only insertOne() should return ID; insert in bulk should not

* #66 Update AutoSeed to use insertOne, so IDs can be tracked

* #66 Add DDL Builder access method for getting column types (#69)

* #67 SQLite Prep - Add DDLBuilder::createTablePrimaryKeys() to allow override (#72)

* #70 SQLite Prep - Queries may return no results (#71)

* #64 SQL Syntax Error - Order By with Limit (#73)

* #4 Running query.insert with an empty schema returns undefined id (#74)

* #63 Add "not null" query condition

* #25 Add accessor method/property to Repository to access a repository's table name

* #24 Add "identifiedBy" attribute to model repositories to allow dynamic or DRY primary key references

* #43 Add support for table alias

* npm update

* v2.0.0
DrewImm added a commit that referenced this issue Nov 11, 2023
* #26 Add count method to QueryRepository (#55)

* #37 Add support for between to select query (#56)

* #35 Add support for select DISTINCT (#57)

* #58 Token usage/implementations are inconsistent (#59)

* #60 SQL builder should be separated from query/ddl/schema builders (#61)

* #62 Only insertOne() should return ID; insert in bulk should not (#65)

* Issue 62 (#68)

* #62 Only insertOne() should return ID; insert in bulk should not

* #66 Update AutoSeed to use insertOne, so IDs can be tracked

* #66 Add DDL Builder access method for getting column types (#69)

* #67 SQLite Prep - Add DDLBuilder::createTablePrimaryKeys() to allow override (#72)

* #70 SQLite Prep - Queries may return no results (#71)

* #64 SQL Syntax Error - Order By with Limit (#73)

* #4 Running query.insert with an empty schema returns undefined id (#74)

* #63 Add "not null" query condition

* #25 Add accessor method/property to Repository to access a repository's table name

* #24 Add "identifiedBy" attribute to model repositories to allow dynamic or DRY primary key references

* #43 Add support for table alias

* npm update

* v2.0.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant