add prepared_statements option to database

* use ?prepared_statements=true|false on connection string (default: true)
* make inmutable state in database
* make mutable state in connection
* change Connection#build to use the current prepared_statements flag to build prepared or unprepared statements.
This commit is contained in:
Brian J. Cardiff 2016-12-02 22:09:27 -03:00
parent fe0ed55ef9
commit 9ef9d19d1d
6 changed files with 80 additions and 3 deletions

View file

@ -97,4 +97,15 @@ describe DB do
DB.open "foobar://baz"
end
end
it "should parse boolean query string params" do
DB.fetch_bool(HTTP::Params.parse("foo=true"), "foo", false).should be_true
DB.fetch_bool(HTTP::Params.parse("foo=True"), "foo", false).should be_true
DB.fetch_bool(HTTP::Params.parse("foo=false"), "foo", true).should be_false
DB.fetch_bool(HTTP::Params.parse("foo=False"), "foo", true).should be_false
DB.fetch_bool(HTTP::Params.parse("bar=true"), "foo", false).should be_false
DB.fetch_bool(HTTP::Params.parse("bar=true"), "foo", true).should be_true
end
end