Skip to content

Commit

Permalink
Merge f3de216 into b906872
Browse files Browse the repository at this point in the history
  • Loading branch information
travistrue2008 committed Apr 25, 2018
2 parents b906872 + f3de216 commit e993c12
Show file tree
Hide file tree
Showing 10 changed files with 260 additions and 262 deletions.
2 changes: 1 addition & 1 deletion __tests__/parse_response.re
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ open Jest;

describe("MySql2.parse_response", () => {
test("Should return an error when given an unexpected boolean.", () => {
let invalid = Js.Json.boolean(Js.true_);
let invalid = Js.Json.boolean(true);
let message =
switch (MySql2.parse_response(invalid, [||])) {
| `Select(_,_) => Failure("invalid_select_result")
Expand Down
4 changes: 2 additions & 2 deletions examples/prepared_statements.re
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

/*
let conn =
MySql2.connect(~host="127.0.0.1", ~port=3306, ~user="root", ());
Expand Down Expand Up @@ -28,4 +28,4 @@ MySql2.execute(conn, "SELECT :x + :y AS result", named, res =>
}
);
MySql2.close(conn);
MySql2.close(conn); */
37 changes: 0 additions & 37 deletions examples/simple.ml

This file was deleted.

33 changes: 33 additions & 0 deletions examples/simple.re
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
let conn = MySql2.connect(~host="127.0.0.1", ~port=3306, ~user="root", ());

let test_handler =
fun
| `Error e => Js.log2("ERROR: ", e)
| `Select(rows, meta) => Js.log3("SELECT: ", rows, meta)
| `Mutation(count, id) => Js.log3("MUTATION: ", count, id);

let _ = MySql2.execute(conn, "SHOW DATABASES", None, test_handler);

let table_sql = {|
CREATE TABLE IF NOT EXISTS test.simple (
id bigint(20) NOT NULL AUTO_INCREMENT
, code varchar(32) NOT NULL
, PRIMARY KEY(id)
)
|};

let _ = MySql2.execute(conn, table_sql, None, test_handler);

let simple_insert_sql = "INSERT INTO test.simple (code) VALUES ('foo')";

let _ = MySql2.execute(conn, simple_insert_sql, None, test_handler);

let simple_update_sql = "UPDATE test.simple SET code='foo2' WHERE code='foo'";

let _ = MySql2.execute(conn, simple_update_sql, None, test_handler);

let _ = MySql2.execute(conn, "SELECT NULL FROM test.simple WHERE false", None, test_handler);

let _ = MySql2.execute(conn, "SELECT * FROM test.simple", None, test_handler);

let _ = MySql2.close(conn);
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
"author": "Nathan Sculli <scull7@gmail.com>",
"license": "MIT",
"dependencies": {
"@glennsl/bs-json": "^1.3.2",
"bs-platform": "^3.0.0",
"mysql2": "^1.5.1"
},
"devDependencies": {
Expand Down
161 changes: 0 additions & 161 deletions src/MySql2.ml

This file was deleted.

55 changes: 0 additions & 55 deletions src/MySql2.mli

This file was deleted.

Loading

0 comments on commit e993c12

Please sign in to comment.