lib/mini_sql/connection.rb in mini_sql-0.1.3 vs lib/mini_sql/connection.rb in mini_sql-0.1.4

- old
+ new

@@ -12,10 +12,12 @@ @type_map ||= begin map = PG::BasicTypeMapForResults.new(conn) map.add_coder(MiniSql::Coders::NumericCoder.new(name: "numeric", oid: 1700, format: 0)) map.add_coder(MiniSql::Coders::IPAddrCoder.new(name: "inet", oid: 869, format: 0)) + map.add_coder(MiniSql::Coders::IPAddrCoder.new(name: "cidr", oid: 650, format: 0)) + map.add_coder(PG::TextDecoder::String.new(name: "tsvector", oid: 3614, format: 0)) end end # Initialize a new MiniSql::Connection object # @@ -70,9 +72,17 @@ def exec(sql, *params) result = run(sql, params) result.cmd_tuples ensure result.clear if result + end + + def query_hash(sql, *params) + result = run(sql, params) + result.type_map = @type_map + result.to_a + ensure + result.clear end def build(sql) Builder.new(self, sql) end