Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

documentation update

  • Loading branch information...
commit 577f20621bbe090898966f3ad902c52e4d45e005 1 parent 43614b1
@danielb2 danielb2 authored
Showing with 19 additions and 0 deletions.
  1. +19 −0 README.md
View
19 README.md
@@ -48,6 +48,7 @@ Basic support of MySQL commands
* LIMIT and OFFSET
* ORDER BY
* GROUP BY
+ * COUNT
Methods
=======
@@ -204,6 +205,12 @@ Produces and executes a SELECT query.
db.get('people', function(err, rows, fields) { ... });
// This would produce: SELECT … FROM people …
+## .count(tableName, responseCallback)
+Produces and executes a SELECT query with count.
+
+ db.get('people', function(err, rows, fields) { ... });
+ // This would produce: SELECT count(*) FROM people …
+
## .query(sqlQueryString, responseCallback)
Produces and executes a raw query. Note that while no set query conditions will be used in this query, they will all be reset nevertheless with the execution.
@@ -289,6 +296,18 @@ SELECT query with custom fields, WHERE, JOIN and LIMIT
console.log(results);
});
+Basic counting
+------------------------------------------------------
+
+ db
+ .where({
+ 'people.name': 'Martin',
+ 'songs.title': 'Yesterday'
+ })
+ .count('people', function(err, results, fields) {
+ console.log(results);
+ });
+
SELECT query with custom fields and GROUP BY
--------------------------------------------
Please sign in to comment.
Something went wrong with that request. Please try again.