Git Product home page Git Product logo

schizoduckie / createreadupdatedelete.js Goto Github PK

View Code? Open in Web Editor NEW
38.0 38.0 5.0 792 KB

CreateReadUpdateDelete.js aims to bring you a tiny footprint (18kb compressed), platform independent ORM/ActiveRecord implementation for Javascript that works flawlessly on SQLite / WebSQL databases, or any flavor of remote database you can think of via serverside JSON API. Written in Plain Old JavaScript without any framework dependencies, you can use this with Mootools, Jquery, Zepto, Ember, or whatever your drug of choice is.

Home Page: http://schizoduckie.github.io/CreateReadUpdateDelete.js/

License: MIT License

JavaScript 87.37% HTML 8.51% CSS 4.06% Shell 0.06%

createreadupdatedelete.js's People

Contributors

garfield69 avatar js41637 avatar schizoduckie avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

createreadupdatedelete.js's Issues

Publish to npm

Hi, are you interested in publish this library into npm? That would be easier to manage it.

Object.observe(CRUD.stats: not working on mobile

Hello SchizoDuckie,

The following code works fine on Chrome but not on the mobile:
Any idea where to look for?

        Object.observe(CRUD.stats, function(newValues) {
           progress.innerHTML = Math.floor((CRUD.stats.writesExecuted / CRUD.stats.writesQueued) * 100);
           writesQueued.innerHTML = CRUD.stats.writesQueued;
           writesExecuted.innerHTML = CRUD.stats.writesExecuted; 
            if(CRUD.stats.writesQueued == CRUD.stats.writesExecuted) {
                updateCount();
            }
        });

Kind regards,
Mario

Github page broken

Hi, your gh-pages branch don't have any .html file, so it's broken. Could you please, fix it?

I could access your docs and demo with /demo and /docs btw
Cheers

Trigger when table is build (this is a priority issue for me)

Hello SchizoDuckie,

I am building a table and fill it with data.
I am running into problems when I run these 2 actions in serie because sometimes the table is not build when I want to insert the data.
Can I get a completed trigger when a table is build?

Kind regards,
Mario

Remote server synchronization

Hello SchizoDuckie,

Our present project is a sharepoint mobile extension with which we use the SharePoint API to sync the data from and to remote.
For another project we are free to choose a remote server sync. Do you have experience and can advise a solution that works good and can scale up to large data traffic?

Kind regards,
Mario

ERROR TypeError: Cannot read property 'onConnect' of undefined

Hello CRUD team,

When calling the database with the basic code below I get this alert: ERROR TypeError: Cannot read property 'onConnect' of undefined
Everthing else seems to work fine.

window.dbAdapter = new CRUD.SQLiteAdapter('mydatabase.sqlite');

Please advise.
Kind regards,
Mario

Migration not working

Hello SchizoDuckie,

Tried everything I can think of but cannot get migration to work.
Can you advise on the code below?

I get error code:
message: "could not prepare statement (1 table challengestest has no column named description)"

    function ChallengesTest() {
        CRUD.Entity.call(this);
    }

    CRUD.define(ChallengesTest, {
        className: 'ChallengesTest',
        table: 'challengestest',
        primary: 'ID_Challenge',
        fields: [
            'ID_Challenge',
            'title',
            'description'
        ],
        orderProperty: 'startDate',
        orderDirection: 'DESC',
        indexes: [
            'title'
        ],
        createStatement: 'CREATE TABLE challengestest (ID_Challenge TEXT PRIMARY KEY, title TEXT, description TEXT)',
        migrations: {
            1: [
                'ALTER TABLE challengestest RENAME TO challengestest_bak',
                'CREATE TABLE challengestest (ID_Challenge TEXT PRIMARY KEY, title TEXT)',
                'INSERT OR IGNORE INTO challengestest (ID_Challenge, title) select ID_Challenge, title from challengestest_bak',
                'DROP TABLE challengestest_bak'
            ]
        },
        relations: [],
        fixtures: [{
            ID_Challenge:'CH13',
            title:'PUSH-UP'
        }]
    }, {});

    CRUD.DEBUG = true;

    CRUD.setAdapter(new CRUD.SQLiteAdapter('MyPTtest', { 
      estimatedSize: 25 * 1024 * 1024 
    }));

    function addItem(){
        var ChallengesTestItem = new ChallengesTest();
        ChallengesTestItem.title = 'Arrow';
        ChallengesTestItem.description = 'description';

        ChallengesTestItem.Persist().then(function(result) {
            console.log("ChallengesTestItem persisted! ", result);
        });
    }

Joints

Hello SchizoDuckie,

(Hope this is a Crud question:-)
I want to read x fields from table1 and y fields from a related table 2 (1 on 1)
(And as a result show them in a table.)
How do we do this the crud way?

Kind regards,
Mario

Using FIND or FINDONE on related tables

Hello SchizoDuckie,

Adding a relationship to a table probably modifies the object structure?
I ask because after adding the relationship below function findFood() only returns objects and I don't know how to get inside the objects.
The function findFoodFav = the related table and also only return an [object Object]

function findFood(){
    CRUD.Find('Food', {}, { limit: '0,10000' }).then(function(results) {
        return results.map(function(entity) {return entity.asObject()})
        }).then(function(result){
            console.log(JSON.stringify("Food: "+result));
    });
}

function findFoodFav(){     
    CRUD.FindOne('Food', { ID_Food: 3}).then(function(food) {
        food.Find('FoodFav').then(function(foodfav) {
            console.log("FoodFav: "+foodfav);
        });
    });
}

Can you advise?

Kind regards,
Mario

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.