robotoworks / mechanoid Goto Github PK
View Code? Open in Web Editor NEWEclipse plugin providing a set of DSL's for the rapid development of Android apps
Eclipse plugin providing a set of DSL's for the rapid development of Android apps
its currently possible to reference dropped tables from statements (insert, update,, delete).
Any referenced tables in statements should be validated
For new users it might not be obvious what is expected for each field in a new element wizard.
It would help if an interactive message is displayed as the user focuses each field much like the Android Project Wizard.
A diagram view that illustrates the current state of the database (all migrations applied, or up to a specific migration).
It is possible to comment using standard // and /**/ style comments in mechdb files however when serialized and used in the generated API comments are not stripped out which would cause database errors
Comments should be stripped out
DSL's will benefit from eclipse templates for quick completion of statements
Migrations are pretty cool but during development it can introduce to many migrations especially in the case where you have large view statements.
An option to drop recreate would allow previous migrations to be modified and force all devices for a particular version to drop recreate which would then recreate the new schema.
The syntax could be as follows:
migration {
drop recreate;
}
which would drop all tables, views and triggers and then recreate the database by calling the open helpers onCreate();
Is there a way to use SQLite datetime and/or timestamp fields ?
There does not seem to be a way the specify Foreign key references in MECHDB
when a column is declared as a blob the following illegal methods are called
readByte[]
instead of readByteArray
.getByte[]
instead of getByteArray
.writeByte[]
instead of writeByteArray
.Add an option to delete from all tables, possibly in the contract such as:
RecipesContract.deleteAll();
And possibly some way to delete the database such as:
RecipesContract.dropDatabase();
In the Contract class in the initAuthority()
there is a lookup for the authority in the ContentProviderAuthority class, however it is lookup up in the com.justeat.app.data
namespace, would it not he beter to lookup in the namespace of the database, as declared at the top of the mechdb file.
ie. (for namespace a.b.c
)
Class<?> clz = loader.loadClass("a.b.c.MeterReaderContentProviderAuthority");
not
Class<?> clz = loader.loadClass("com.justeat.app.data.MeterReaderContentProviderAuthority");
When selecting ActiveRecord's with SQuery it would be nice to have a selectMap
method, ie:-
public HashMap<String, T> selectMap(Uri uri, String keyColumnName);
Where keyColumnName
specifies the column that should become the key for items in the map.
After upgrade to 0.1.0.201303051159 my project is uncompileable
All migrationfiles are missing.
Do I miss something ?
...
import info.mypack.mechanoid.migrations.DefaultMyDB2DBMigrationV13; //unresolveable
import info.mypack.mechanoid.migrations.DefaultMyDB2DBMigrationV14; //unresolveable
...
protected SQLiteMigration createMyDB2DBMigrationV13() {
return new DefaultMyDB2DBMigrationV13(); //unresolveable
}
protected SQLiteMigration createMyDB2DBMigrationV14() {
return new DefaultMyDB2DBMigrationV14(); //unresolveable
}
Revert to old version encounters a problem too
No repository found containing: org.eclipse.update.feature,com.robotoworks.mechanoid.feature,0.1.0.201303041255
Support for case statements
This is probably confusing for new users, and those who are bothered about the nature being added can read up on it in the docs maybe?
Add an optional field to the mechnet wizard that allows the user to provide a default url for a service
Add icons and labeling for all grammars (ie:- outline icons and labeling)
Is there a way to tell mechDB the storage place, for example SD-card, path ... ?
This would be very helpful for analyze on external device, e.g. development machine
I think it makes since to create a v1 migration, instead of doing it in the onCreate(). You can do
@Override
public void onCreate(SQLiteDatabase database) {
createMigration(1).up(database);
}
/**
* <p>Migrates from an older version of the database.</p>
* @param database the database
* @param old_version the old version number
* @param new_version the new version number
*/
@Override
public void onUpgrade(SQLiteDatabase database, int old_version, int new_version) {
for (int i = (old_version + 1); i <= new_version; i++)
createMigration(i).up(database);
}
Then it would reflect how it was defined in the .mechdb file. All generated migrations can be in the migrations package.
At the moment its fairly generic and does not help to create an initial file, for instance it could ask for package name, entity name, etc
I try to create a view with cast to float. I need it because of decimal digits, but without success.
create view TableSum as
select single_id as _id, sum(minutes) as minutes, round(cast(sum(minutes) as float) / 60,2) as hours_acc
from TableSingle group by single_id;
As workaround I defined all fields as 'real'.
Maybe you enable float cast in a future version, but it's not important, because there is a workaround.
I like your mechDB, so I start to use mechPrefs, but during last update (thank you)
preferences tracker {
TrackerTime : int = 5
}
the generated source become uncompileable
public int getTrackerTime() {
return mPreferences.getInt(Keys.TRACKER_TIME, 5.0f);
}
as you see, default is not used as int
Currently names for an operation service do allow you to have a QuxService, or FooService, ie:-
service FooService {
}
But the generated service would then have a name of FooServiceService, the generator should not append Service if the name already ends in service.
I guess, it's a not important minor bug. The new field 'datstr' is unknown
migration {
alter table table1 add column datstr text;
drop view view1;
create view view1 as
select _id as _id, datstr as datstr, ....
}
There's code for parsing and building URIs with IDs, which is such a common endeavor that Android provides the ContentUris
clas to perform these actions. see http://developer.android.com/reference/android/content/ContentUris.html#parseId(android.net.Uri) and http://developer.android.com/reference/android/content/ContentUris.html#withAppendedId(android.net.Uri, long)
Also notice that ContentResolver.SCHEME_CONTENT
is "content://".
The generated URLConnection should support connect timeout and read timeout params.
See API:
http://developer.android.com/reference/java/net/URLConnection.html#setConnectTimeout(int)
http://developer.android.com/reference/java/net/URLConnection.html#setReadTimeout(int)
Currently update and insert statements in triggers do not have cross-referencing of columns and tables.
Mechdb support for indexes
Views are read-only (if there is no trigger) so insert/update/delete methods should not be created in the contract class
support for where clauses
Is it possible to use machanoid with this query ?
I need field _id for SimpleCursor, first I try to create a view with generated _id, but rowid is not known by mechanoid
select rowid as _id, strftime('%Y-%m-%d',createdate) , count(*) from mytable
group by strftime('%Y-%m-%d',createdate)
Is there a way ?
Mechanoid.jar has a 404 when downloading from website
The generate keyword seems to be easy to forget and would just add confusion for new users, it would be best to remove it and always generate entities.
If in the future there is a need to no generate then then a nogen keyword would be a better option.
At the moment, each generated Reader and Writer provider will include mappings for all entities in a project, even though the generated providers are generated per client.
There should be some analysis routine to collect referenced and indirectly referenced entities for a client and only generate mappings for that client.
Currently operations are unique by default, there is a grammar feature that allows you to specify which arguments make an operation unique but no way to specify that the operation is not unique.
I'm playing around to use a user-defined-function in SQlite. Ok, for this, I've to attach it
http://stackoverflow.com/questions/6663124/how-to-load-extensions-into-sqlite/8322827#8322827
where is the best place in mechDB to execute
SELECT load_extension('libsqlite-func.so', 'sqlite3_extension_init')
or is there a mechDB-event after connect to call a JNI function containing the connected database ?
java:
public native void registerFunction(database);
c (untested):
#include <jni.h>
#include <sqlite3.h>
#include <stdlib.h>
...
...
void
Java_com_test_MyClass_registerFunction(sqlite3 *db)
{
sqlite3_create_function(db, "myFunction", 1, SQLITE_UTF8, NULL, &myFunction, NULL, NULL);
}
Would it be possible provide a way for custom urls to be generated in the contract, then have abstract methods in the content provider to handle them.
e.g. if I have a table with key-value pairs called map
it would be helpful to have in the contract a method to produce urls in the form: content://authority/map/{key}
and not just content://authority/map/{id}
I try to create a view based on a view, but without success
create table tab1 (
_id integer primary key autoincrement,
name integer
);
create view view1 as
select _id as _id, name as name
from tab1;
create view view2 as
select _id as _id, name as name
from view1;
I would be very nice and extreme helpful to enable this !
Provider action and migration class stubs are generated with the intention that the user can override their abstract counterparts, but it would be better to have a factory like facade (or instance provider so the user can override each class at will, example:-
public abstract class AbstractRecipeDBMigrationProvider {
public Migration getMigrationV2() {
return new DefaultRecipeDBMigrationV2();
}
}
public class RecipeDBMigrationProvider extends AbstractRecipeDBMigrationProvider {
// TODO user may override and provide their own implementation for each migration
}
The same kind of pattern could be employed for provider actions:-
public abstract class AbstractRecipeDBActionsProvider {
public getRecipesActions() { ... }
public getRecipesByIdActions(){ ... }
}
Currently generated execSql statements use concatenation, ideally it should use StringBuilder since we assume dalvik makes no optimisations and this is cheap to do
The current generated API uses the request/reply pattern which is ok.
Going forward some improvements might be:
The mechanoid plugin relies on the mechanoid runtime library as its base library for the generated code, its possible that modifications can be made to the generated code that requires an updated mechanoid library.
Some kind of integrity check (crc?) needs to take place to ensure the mechanoid library in the users classpath is the one that is expected.
Since the mechanoid library is built and shipped as a plugin resource its possible to compare the resource to the one in the users libs folder.
I populate a SQLite list with mechDB
Cursor cursor = getApplicationContext().getContentResolver().query(Customer.CONTENT_URI, null, null, null, null);
adapter = new SimpleCursorAdapter(this, android.R.layout.simple_list_item_1, cursor, projection, to, 0); list.setAdapter(adapter);
on onItemClick I do a delete like
CustomerRecord record = CustomerRecord.get(id);
record.delete(true);
as I understand the documentation
"ActiveRecord makes use of the Content Provider notification system, by default, ActiveRecord’s will issue change notifications"
As I understand, the delete should automatic reflect on ListView, but nothing happen. What do I wrong ?
Mechnet entities should have the option to specify a default value, for example:-
entity Recipe {
title:String = "Lorem Ipsum"
}
This way we can avoid query params in service methods for params that are fixed values ie:-
get getRecipe "?method=getRecipe" {
}
would become:
get getRecipe {
params method:String="getRecipe"
}
There is an extra dirty flag in the array.
03-20 11:02:05.219: E/AndroidRuntime(2708): Caused by: java.lang.RuntimeException: bad array lengths
03-20 11:02:05.219: E/AndroidRuntime(2708): at android.os.Parcel.readBooleanArray(Parcel.java:614)
03-20 11:02:05.219: E/AndroidRuntime(2708): at com.justeat.app.data.BasketsRecord.(Unknown Source)
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.