Skip to content

Commit 0840f0e

Browse files
authored
Update README.md
1 parent 422b9f4 commit 0840f0e

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

README.md

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1-
# mod-mysql-postgresql
1+
# Vert.x 2.x is **deprecated** - use instead http://vertx.io/docs/vertx-mysql-postgresql-client/java/
2+
3+
## mod-mysql-postgresql
24

35
This Vert.x module uses the https://github.com/mauricio/postgresql-async drivers to support a fully async module for MySQL and PostgreSQL.
46

5-
## Requirements
7+
### Requirements
68

79
* Vert.x 2.1+ (with Scala language module v1.1.0+)
810
* A working PostgreSQL or MySQL server
911
* For testing PostgreSQL: A `testdb` database on a local PostgreSQL install and a user called `vertx`
1012
* For testing MySQL: A `testdb` database on a local MySQL install and a user called `root`
1113

12-
## Installation
14+
### Installation
1315

1416
Depending on your Scala version, you should download the specific version. If you're using Scala 2.10.x:
1517

@@ -27,7 +29,7 @@ If you get `java.lang.ClassNotFoundException: org.vertx.scala.core.VertxAccess$c
2729

2830
If you're using Scala in your own project and want to use Scala 2.11, you can change `lang-scala_2.10` to `lang-scala_2.11`.
2931

30-
## Configuration
32+
### Configuration
3133

3234
{
3335
"address" : <event-bus-addres-to-listen-on>,
@@ -50,13 +52,13 @@ If you're using Scala in your own project and want to use Scala 2.11, you can ch
5052
* `database` - The name of the database you want to connect to. Defaults to `testdb`.
5153

5254

53-
## Usage
55+
### Usage
5456

5557
All commands are relatively similar. Use JSON with the `action` field and add the needed parameters for each command.
5658

5759
There are only a few commands available currently, but in theory you should be able to invoke any command on the database with the `raw` action.
5860

59-
### Reply messages
61+
#### Reply messages
6062

6163
The module will reply to all requests. In the message, there will be either a `"status" : "ok"` or a `"status" : "error"`. If the request could be processed without problems, it will result in an "ok" status. See an example here:
6264

@@ -83,7 +85,7 @@ If the request resulted in an error, a possible reply message looks like this:
8385
"message" : "column \"ager\" does not exist"
8486
}
8587

86-
### insert
88+
#### insert
8789

8890
Use this action to insert new rows into a table. You need to specify a table, the fields to insert and an array of rows to insert. The rows itself are an array of values.
8991

@@ -97,7 +99,7 @@ Use this action to insert new rows into a table. You need to specify a table, th
9799
]
98100
}
99101

100-
### select
102+
#### select
101103

102104
The `select` action creates a `SELECT` statement to get a projection from a table. You can filter the columns by providing a `fields` array. If you omit the `fields` array, it selects every column available in the table.
103105

@@ -107,7 +109,7 @@ The `select` action creates a `SELECT` statement to get a projection from a tabl
107109
"fields" : ["name", "email", "is_male", "age", "money", "wedding_date"], // Optional
108110
}
109111

110-
### prepared
112+
#### prepared
111113

112114
Creates a prepared statement and lets you fill the `?` with values.
113115

@@ -117,7 +119,7 @@ Creates a prepared statement and lets you fill the `?` with values.
117119
"values" : ["Mr. Test", 15]
118120
}
119121

120-
### raw - Raw commands
122+
#### raw - Raw commands
121123

122124
Use this action to send arbitrary commands to the database. You should be able to submit any query or insertion with this command.
123125

@@ -143,39 +145,39 @@ And if you want to drop it again, you can send the following:
143145
"command" : "DROP TABLE some_test;"
144146
}
145147

146-
### Transactions
148+
#### Transactions
147149

148150
These commands let you begin a transaction and send an arbitrary number of statements within the started transaction. You can then commit or rollback the transaction.
149151
Nested transactions are not possible until now!
150152

151153
Remember to reply to the messages after you send the `begin` command. Look in the docs how this works (e.g. for Java: [http://vertx.io/core_manual_java.html#replying-to-messages](http://vertx.io/core_manual_java.html#replying-to-messages)).
152154
With replying to the messages, the module is able to send all statements within the same transaction. If you don't reply within the `timeoutTransaction` interval, the transaction will automatically fail and rollback.
153155

154-
#### transaction begin
156+
##### transaction begin
155157

156158
This command starts a transaction. You get an Ok message back to which you can then reply with more statements.
157159

158160
{
159161
"action" : "begin"
160162
}
161163

162-
#### transaction commit
164+
##### transaction commit
163165

164166
To commit a transaction you have to send the `commit` command.
165167

166168
{
167169
"action" : "commit"
168170
}
169171

170-
#### transaction rollback
172+
##### transaction rollback
171173

172174
To rollback a transaction you have to send the `rollback` command.
173175

174176
{
175177
"action" : "rollback"
176178
}
177179

178-
#### Example for a transaction
180+
##### Example for a transaction
179181

180182
Here is a small example on how a transaction works.
181183

@@ -218,7 +220,7 @@ If everything worked, the last answer will be:
218220
"status" : "ok"
219221
}
220222

221-
#### old transaction command (deprecated, use the new transaction mechanism with begin and commit)
223+
##### old transaction command (deprecated, use the new transaction mechanism with begin and commit)
222224

223225
Takes several statements and wraps them into a single transaction for the server to process. Use `statement : [...actions...]` to create such a transaction. Only `select`, `insert` and `raw` commands are allowed right now.
224226

@@ -243,7 +245,7 @@ Takes several statements and wraps them into a single transaction for the server
243245
]
244246
}
245247

246-
## Planned actions
248+
### Planned actions
247249

248250
You can always use `raw` to do anything on the database. If the statement is a query, it will return its results just like a `select`.
249251

0 commit comments

Comments
 (0)