loentar / ngrest-db Goto Github PK
View Code? Open in Web Editor NEWSimple ORM to use with ngrest
License: Apache License 2.0
Simple ORM to use with ngrest
License: Apache License 2.0
Add mechanism to store schema version and upgrade schema using migration, for example, like as android db helper.
Implement method update existing table records.
what do you think about adding mongodb, i did some test and it works.
Make possible to create whole schema from DbManager.
Must regard table dependencies (FKs) when creating.
Seems like there is a problem when adding ngrest-db package on Mac OS X with the MySQL option. looking through the CMakeLists.txt, it seems that CMAKE_REQUIRED_INCLUDE is not set, so check_include_file_cxx(mysql/mysql.h HAS_MYSQL) will only check the XCode Mac OS X SDK, which does not contain mysql.h nor the PostGRES lib required (but it does contain sqlite3.h, so that option works). I think CMAKE_REQUIRED_INCLUDE should be set by default to "/usr/local/include", so that CMake will search that path for the proper header files.
I had installed MSYS2 and executed by "Installation guide with screenshots Windows"(https://github.com/loentar/ngrest/wiki/Installation-guide-with-screenshots-Windows),
but I'm using Windows and I don't know how to Add it to my project,all examples are running in the LINUX environment as the command line .Or may I should run it in the linux environment?
Finally,hope to receive your reply.
Thanks!
I got this error:
#1071 - Specified key was too long; max key length is 767 bytes
from the mysql backend, while trying to set a
//*unique: true
std::string mystring;
on a c++ std::string
type.
A quick search got me these results:
varchar(255)
; on ngrest-db the default string is varchar(256)
. Source of info: http://bugs.mysql.com/bug.php?id=6604 which is not a bug, but a declared limitationSince I needed it in a project I considered few possibilities:
innodb_large_prefix
, which was introduced in MySQL 5.5.14 and allows you to include columns up to 3072 bytes long in InnoDB indexes.set global innodb_large_prefix = ON;
LIMITATION: This might be useful, but it affects all dbs, and I don't know how much overhead it will cost in terms of storage dimensions.
ALTER TABLE `mytable` ADD UNIQUE KEY `mystring` ( `mystring`(255) );
It is also possible to do it inside the table creation query, with this code inserted after the fields declaration:
CONSTRAINT mystring UNIQUE (mystring(255))
LIMITATION: This affects only the first 255 bystes, i.e., if there are sequential keys 256 bytes long, and of these the last one only the last one changes, they can't be indexed, because 255 bytes are still the same... this however is a very specific case, not one actually happening any day soon (imho).
static const std::string types[size] = {
"VOID",
"TINYINT",
"INTEGER",
"BIGINT",
"DOUBLE",
"INTEGER",
"VARCHAR(255)" //changed from "VARCHAR(256)" for InnoDb unique key issues
};
LIMITATION: This change effectively breacks the compatibility with the postgres backend (which is still 256); however, there is still no compat with sqlite where a text doesn't have a fixed lenght, so it should not be a problem to have default strings larger/shorter in different DB backends. Additionally, it may breack the code somewhere else, because it is setting a more restrictive contraint than there was before (strings shorter by a byte)
Personally, I chose to recompile the code with a VARCHAR(255) because it was the quickest fix to the problem, and since it is my project I don't mind the limitation, as long as i know it's in place.
However I found solution 2 a better option, if it were possible to apply consistently inside the code, upoon table creation (with either of the two methods); the only thing is that it means a larger change to the code, and since I didn't have a chance to study the code better, to see where and how implement the changes, I was afraid of messing up and have code breaking somewhere else. (note aside, it could be useful in this case the snippet of code you put at the end of the README.md, where after creating all tables, you apply changes to them to insert data and set the autoinsertion... it is sufficient to pass a query with the unique key
creation there, instead of setting the // *unique: true
inside the struct. However, I have an issue, by which the code doesn't get executed, and I don't know if it's my code or a real bug, so for now I didn't try that method)
Anyway, thank you for this project, it's great and really it's solving some serious problems I have (the only other real solution is to use python, or worse java... I like the idea of having some code that I can test in a small server, and then compile as module of apach, so three thumbs up for the great job you did!)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.