Skip to content

Commit

Permalink
Use clearer quoting in examples
Browse files Browse the repository at this point in the history
  • Loading branch information
otoolep committed Feb 26, 2016
1 parent 1e0536c commit 9b202c4
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions README.md
Expand Up @@ -88,10 +88,10 @@ Note that this is the SQLite file that is under `node 3`, which is not the node
### Bulk Updates
Bulk updates are supported. To execute multipe statements in one HTTP call, simply include the statements in the JSON array:

curl -L -XPOST 'localhost:4001/db?pretty' -H "Content-Type: application/json" -d '[
"INSERT INTO foo(name) VALUES(\"fiona\")",
"INSERT INTO foo(name) VALUES(\"sinead\")"
]'
curl -L -XPOST 'localhost:4001/db?pretty' -H "Content-Type: application/json" -d "[
\"INSERT INTO foo(name) VALUES('fiona')\",
\"INSERT INTO foo(name) VALUES('sinead')\"
]"

The response is of the form:

Expand Down Expand Up @@ -161,10 +161,10 @@ Another approach is to read the database file directly via `sqlite3`, the comman
### Transactions
Transactions are supported. To execute statements within a transaction, add `transaction` to the URL. An example of the above operation executed within a transaction is shown below.

curl -L -XPOST 'localhost:4001/db?pretty&transaction' -H "Content-Type: application/json" -d '[
"INSERT INTO foo(name) VALUES(\"fiona\")",
"INSERT INTO foo(name) VALUES(\"sinead\")""
]'
curl -L -XPOST 'localhost:4001/db?pretty&transaction' -H "Content-Type: application/json" -d "[
\"INSERT INTO foo(name) VALUES('fiona')\",
\"INSERT INTO foo(name) VALUES('sinead')\"
]"

When a transaction takes place either both statements will succeed, or neither. Performance is *much, much* better if multiple SQL INSERTs or UPDATEs are executed via a transaction. Note the execution ceases the moment any single query results in an error.

Expand All @@ -173,10 +173,10 @@ The behaviour of rqlite when using `BEGIN`, `COMMIT`, or `ROLLBACK` to control t
### Handling Errors
If an error occurs while processing a statement, it will be marked as such in the response. For example.

curl -L -XPOST 'localhost:4001/db?pretty' -H "Content-Type: application/json" -d '[
"INSERT INTO foo(name) VALUES(\"fiona\")",
"INSERT INTO nonsense"
]'
curl -L -XPOST 'localhost:4001/db?pretty' -H "Content-Type: application/json" -d "[
\"INSERT INTO foo(name) VALUES('fiona')\",
\"INSERT INTO nonsense\"
]"
{
"results": [
{
Expand Down

0 comments on commit 9b202c4

Please sign in to comment.