Coder Social home page Coder Social logo

angular-websql's People

Contributors

atwright147 avatar coleim avatar coliva avatar dbtek avatar gfauchart avatar jaapjanfrans avatar jorge-ivan avatar paulocaldeira17 avatar vanarman 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  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  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

angular-websql's Issues

Support NPM

Is it possible to add a package.json file for us who are sticking with NPM?

Getting more done in GitHub with ZenHub

Hola! @txukytruky has created a ZenHub account for the paulocaldeira17 organization. ZenHub is the only project management tool integrated natively in GitHub – created specifically for fast-moving, software-driven teams.


How do I use ZenHub?

To get set up with ZenHub, all you have to do is download the browser extension and log in with your GitHub account. Once you do, you’ll get access to ZenHub’s complete feature-set immediately.

What can ZenHub do?

ZenHub adds a series of enhancements directly inside the GitHub UI:

  • Real-time, customizable task boards for GitHub issues;
  • Multi-Repository burndown charts, estimates, and velocity tracking based on GitHub Milestones;
  • Personal to-do lists and task prioritization;
  • Time-saving shortcuts – like a quick repo switcher, a “Move issue” button, and much more.

Add ZenHub to GitHub

Still curious? See more ZenHub features or read user reviews. This issue was written by your friendly ZenHub bot, posted by request from @txukytruky.

ZenHub Board

Not Equal operator

Hello!
how can i call 'not equal' != or 'Different' <> operators with angular-websql ?
i want to put a dynamic parameter into my query condition like that:

db.del("Table", {"id_element":{'value':id ,'union':'AND'},'id_person' !=   id_parameter })

it's possible to do something like that using angular-websql?
thank's

Feature proposal: table relationship automation

I would like to add a feature, and i'm interested in your opinion:

create table with reference to an other table
an orm mapping like

has many
createTable('article', {
   /* ...  */
  "comments" : {
     "type" : "HAS_MANY",
     "table": "comment"
      "field" : "ID_ARTICLE"
   }
});

then you could optionally load comments objects as an array in the user object

$scope.db.select("article", {"id" : 5}, {"comments" : true}).then(function(){
     console.log(results.rows.item(0).comments[0].name)
})
belong to
createTable('comment', {
   /* ...  */
  "article" : {
     "type" : "BELONG_TO",
     "table": "article"
      "field" : "ID_ARTICLE"
   }
});
$scope.db.select("comment", {"id" : 9}, {"article" : true})

Check for null values in the select function

I have to change all the funcions in my programs or simply to change the select function in angular-websql to check for null values in the select function to return selectAll instead.

Getting more done in GitHub with ZenHub

Hola! @paulocaldeira17 has created a ZenHub account for the paulocaldeira17 organization. ZenHub is the only project management tool integrated natively in GitHub – created specifically for fast-moving, software-driven teams.


How do I use ZenHub?

To get set up with ZenHub, all you have to do is download the browser extension and log in with your GitHub account. Once you do, you’ll get access to ZenHub’s complete feature-set immediately.

What can ZenHub do?

ZenHub adds a series of enhancements directly inside the GitHub UI:

  • Real-time, customizable task boards for GitHub issues;
  • Multi-Repository burndown charts, estimates, and velocity tracking based on GitHub Milestones;
  • Personal to-do lists and task prioritization;
  • Time-saving shortcuts – like a quick repo switcher, a “Move issue” button, and much more.

Add ZenHub to GitHub

Still curious? See more ZenHub features or read user reviews. This issue was written by your friendly ZenHub bot, posted by request from @paulocaldeira17.

ZenHub Board

Suggestion: Order By on select

Hi.

Here's my suggestion to implement order by.

I've made a simple and fast implementation, didn't send pull request cause I'm no sure if it's well formatted, or if it's better just implement another param in select, anyway, just keep the suggestion

selectOrder: function (b, c, o, od) {
                            if(!od)
                                od = "ASC";
                            var d = "SELECT * FROM `{tableName}` WHERE {where} ORDER BY {order} {direction};";
                            var a = this.whereClause(c);
                            return this.executeQuery(this.replace(d, {
                                "{tableName}": b,
                                "{where}": a.w,
                                "{order}": o,
                                "{direction}": od
                            }), a.p);
                        },             

Usage:

selectOrder(string tableName, object where, string field, string direction)
$scope.db.selectOrder("user", {
            "condition": 1
        }, "id",
        "ASC")
        .then(function (results) { 
                  for (i = 0; i < results.rows.length; i++) { 
                            console.log(results.rows.item(i));
                  }
        });

Insert Or Replace add

Hey man, first i want congratz you for share this!

I wanna ask if you could add Insert or replace in the source?

insertOrReplace: function(c, e) {
var f = "INSERT OR REPLACE INTO {tableName} ({fields}) VALUES({values});";
var a = "",
b = "",
v = [];
for (var d in e) {
a += (Object.keys(e)[Object.keys(e).length - 1] == d) ? "" + d + "" : "" + d + ", ";
b += (Object.keys(e)[Object.keys(e).length - 1] == d) ? "?" : "?, ";
v.push(e[d]);
}
return this.executeQuery(this.replace(f, {
"{tableName}": c,
"{fields}": a,
"{values}": b
}), v);
}

Sugestion: createOrUpdateTable

Hello,

I just discovered your api, and it looks great !

I was just wondering if it could be possible for you to add a method "createOrUpdateTable", which will create a table, if the table does not exist or if the fields are similar, but in case some fields are added, just dingo instead an 'ALTER TABLE ADD COLUMN'.

Do you think it could be possible to have something like this ?

Thanks a lot.
Cheers.

createTable() does not work without "null" property

I came across this small issue today, when I tried to create a table containing columns without specifying the "null" property. Leaving out this property made the whole query fail silently.

e.g. for me this does not work at all:

$rootScope.db.createTable('events', {
    "uid": {
        "type": "INTEGER",
        "null": "NOT NULL",
        "primary": true
    },
    "title": {
        "type": "TEXT",
        "null": "NOT NULL"
    },
    // …
    "website": {
        "type": "TEXT"
    }
});

If I add "null": "NULL" to the website column definition, it works.

This behaviour is unexpected as allowing NULL should be the default (if not specified) besides it is not documented.

Anyway thanks for this useful module!

Check if table exists in DB

Hi

Thanks for the great library.

I needed to know if a table pre-exist in the database, couldn't see how to do it using your library so I added it in before createTable function:

tableExist: function(query){
var deferred = $q.defer();
db.transaction(function(tx) {
tx.executeSql("SELECT count(*) AS textist FROM sqlite_master WHERE type='table' AND name='"+query+"'", [], function(tx, results) {
var ex = results.rows.item(0).textist;
deferred.resolve(ex);
}, function(tx, e){
console.log("There has been an error: " + e.message);
deferred.reject();
});
});
return deferred.promise;
}

Use in code.

$scope.db.tableExist("tablename").then(function(result) {
if(result == 0){
console.log('No table found');
} else {
console.log('Table found');
}
});

Hope this helps someone :)

Operators

Could you provide an example of different types of oporators?

I've tried
db.select('categories', { "supcat_id": { "value": '<5' } }).then(function(results) { console.log(results.rows); })
but the query is always SELECT * FROM categories WHERE supcat_id = ?; with no results.

select with sum

Hi,

i would like to know if i can do complex select? like:
select name, sum(orders) from orders group by name;

thank for your help

SelectAll Promise Rise Infinite Loop

I'm using angular 1.4.8 and using select all rising infinite loop digest on angular ng-repeat
$scope.loadData = function () { $scope.db.selectAll("model").then(function (results) { $scope.data = results.rows; }); };

update with more condition

Hello,
I have problem when i try to update field with more dynamic parameter as condition

db.update("Table", {"notok": '1'}, {"id_person": {'value':id_person_dynamic_parameter  ,'union':'AND'},'id_element': id_second_dynamic_parameter});

i get this error

UPDATE `Table` SET `notok`= ? WHERE `id_person` undefined ? AND `id_element`=?;  ["1", "4377C91AF07E430E949C6E277B072787", 1] angular-websql.min.js:6

There has been an error: could not prepare statement (1 near "undefined": syntax error) 

Each field works when i update just one condition .

it's a bug or just it's impossible to update like that ?

update more fields

Hello,

i have problem when i want update more fields.

$scope.db.update("contacts",
            {   "firstName": $scope.firstName,
                "lastName": $scope.lastName
            },
            {
            "id": $routeParams.id
            }
        ).then(function(){
            $location.path("/contact/"+$routeParams.id);
        })

i have this error :

2014-07-31 11:43:48.293 23rc[49886:60b] UPDATE 'contacts' SET 'firstName'= ?'lastName'= ? WHERE 'id'=?; johne,doe,1

2014-07-31 11:43:48.296 23rc[49886:60b] There has been an error: could not prepare statement (1 near "'lastName'": syntax error)

Each field works when i update just one.

it's a bug or just it's impossible to update more fields ?

Angular 1.3.x support

Hi

I wanted to try out the angular-websql but got an error with bower install:

ECONFLICT Unable to find suitable version for angular

I use Angular 1.3.13. Seems that the angular-websql runs only with Angular 1.2.x.
Is there an update planned to support newer versions of angular?

Thanks

is angular-websql compatible with all browsers

Hello,
I actually use angular-websql perfectly with Goole Chrome browser.But that's not working with firefox.

var db;
db = $webSql.openDatabase('_db', '1.0', 'mydb DB', 2 * 1024 * 1024);
db.dropTable('_Table');
...

i have TypeError: db is undefined error when i call db's functions.
So do you have any idea about this case?
Thank's

Values should be parameterized

Values coming from variables should be passed as parameters to overcome escaping problems.

e.g. instead of using

db.execute('INSERT INTO `{tableName}` ({fields}) VALUES({values})');

the values for each field should be represented with a '?' character and passed as a parameter to the execute()-function (dummy code ahead):

db.execute('INSERT INTO `{tableName}` ({fields}) VALUES(?, ?)', {values}[0], {values}[1]);

See this question on Stack Overflow for more information.

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.