4 ms·
Writing additional code to check things that you'd reasonably expect the DB to handle is a slippery slope. It can work well if you are going into it with an app
by cirrus3 5y ago
Writing additional code to check things that you'd reasonably expect the DB to handle is a slippery slope. It can work well if you are going into it with an application geared towards that mindset and behavior, it works pretty bad introducing it into an existing codebase that historically works a more strict way.
- LAC-Tech 5y agoYeah don't get me wrong, I'd prefer it if SQLite took care of it. But I don't know of any embedded DBs that do loads of type-checking. Apart from SQLite they all seem to be key value stores that operate on sequences of bytes.
- john-shaffer 5y agoIt's pretty easy to run embedded postgres on the JVM: https://github.com/opentable/otj-pg-embedded https://github.com/opentable/otj-pg-embedded The defaults create a temporary DB which is useful for dev & tests, but a pair of calls to .setCleanDataDirectory(false) and .setDataDirectory("...") will change that. If you don't like the default postgres version, you may select one from https://search.maven.org/search?q=io.zonky.test.postgres https://search.maven.org/search?q=io.zonky.test.postgres or include your own postgres binary.
- formerly_proven 5y agoYou can put check constraints into your schema to make sure no one puts strings in your integer columns (for example). If you have an ORM you likely can automatically make it generate check constraints for each column based on the declared properties.
- CRConrad 5y ago> But I don't know of any embedded DBs that do loads of type-checking. Firebird Embedded: https://www.firebirdsql.org/pdfmanual/html/ufb-cs-embedded.html https://www.firebirdsql.org/pdfmanual/html/ufb-cs-embedded.h...