{"issue":{"pull_request":{"diff_url":null,"html_url":null,"patch_url":null},"state":"open","user":{"avatar_url":"https://secure.gravatar.com/avatar/d5c9f6dcbe9a84da18ea63b3eb36cf4b?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"d5c9f6dcbe9a84da18ea63b3eb36cf4b","url":"https://api.github.com/users/botic","login":"botic","id":193023},"milestone":null,"assignee":null,"labels":[],"updated_at":"2011-11-01T19:13:16Z","comments":3,"closed_at":null,"url":"https://api.github.com/repos/grob/ringo-sqlstore/issues/10","body":"I think this is not the best way to get the number of stored entities from the DB:\r\n\r\n```javascript\r\nvar count = Photos.all().length;\r\n```\r\n\r\nBetter, but not implemented and missing in ringo-storable:\r\n\r\n```javascript\r\nvar count = Photos.count();\r\n```\r\n\r\nAn alternative would be a direct SQL support to send a count(*) query to the DB.","html_url":"https://github.com/grob/ringo-sqlstore/issues/10","number":10,"title":"DirectSQL support / count() missing","id":2055653,"created_at":"2011-10-26T11:20:29Z"},"action":"created","comment":{"user":{"avatar_url":"https://secure.gravatar.com/avatar/d5c9f6dcbe9a84da18ea63b3eb36cf4b?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"d5c9f6dcbe9a84da18ea63b3eb36cf4b","url":"https://api.github.com/users/botic","login":"botic","id":193023},"updated_at":"2011-11-01T19:13:16Z","url":"https://api.github.com/repos/grob/ringo-sqlstore/issues/comments/2594498","body":"To the direct SQL support: I need MySQL fulltext search and like queries. At the moment there is just equals() and no like(). Is there a reason for this? I added 4 lines to my local sqlstore's query.js:\r\n\r\n```javascript\r\nvar LIKE = \"LIKE\";\r\n\r\n/**\r\n * Adds an \"like\"-clause to this query\r\n * @param {String} property The property\r\n * @param {Object} value The value. If the value is an array, the clause added\r\n * leads to an \"where property in (value)\" SQL clause.\r\n * @returns The query\r\n * @type Query\r\n */\r\nQuery.prototype.like = function(property, value) {\r\n    this.clauses.push(new OperatorClause(this, LIKE, property, value));\r\n    return this;\r\n};\r\n```\r\n\r\nThe result is the following LIKE-query:\r\n\r\n```sql\r\nSELECT `t_photo`.`id` FROM `t_photo` WHERE `t_photo`.`keywords` LIKE '%tennis%' ORDER BY `t_photo`.`id` desc LIMIT 100\r\n```\r\n\r\nBut like() is no fulltext search. MySQL uses a special syntax and there is no way to add this to the query – or did I failed to see this in the query.js again?\r\n\r\n```sql\r\nWHERE MATCH(title, caption) AGAINST ('My query') \r\n```\r\n\r\nSomething like this could be useful:\r\n\r\n```javascript\r\nPhoto.query().equals(\"public\", true).plainClause(\"MATCH(title, caption) AGAINST ('My Query')\");\r\n```","id":2594498,"created_at":"2011-11-01T19:13:16Z"}}