--- !ruby/object:RI::MethodDescription 
aliases: 
- !ruby/object:RI::AliasName 
  name: query
block_params: 
comment: 
- !ruby/struct:SM::Flow::P 
  body: Sends SQL query request specified by <em>sql</em> to PostgreSQL. Returns a PGresult instance on success. On failure, it raises a PGError exception.
- !ruby/struct:SM::Flow::P 
  body: "<tt>params</tt> is an optional array of the bind parameters for the SQL query. Each element of the <tt>params</tt> array may be either:"
- !ruby/struct:SM::Flow::VERB 
  body: "  a hash of the form:\n    {:value  =&gt; String (value of bind parameter)\n     :type   =&gt; Fixnum (oid of type of bind parameter)\n     :format =&gt; Fixnum (0 for text, 1 for binary)\n    }\n  or, it may be a String. If it is a string, that is equivalent to the hash:\n    { :value =&gt; &lt;string value&gt;, :type =&gt; 0, :format =&gt; 0 }\n"
- !ruby/struct:SM::Flow::P 
  body: PostgreSQL bind parameters are represented as $1, $1, $2, etc., inside the SQL query. The 0th element of the <tt>params</tt> array is bound to $1, the 1st element is bound to $2, etc. <tt>nil</tt> is treated as <tt>NULL</tt>.
- !ruby/struct:SM::Flow::P 
  body: If the types are not specified, they will be inferred by PostgreSQL. Instead of specifying type oids, it's recommended to simply add explicit casts in the query to ensure that the right type is used.
- !ruby/struct:SM::Flow::P 
  body: "For example: &quot;SELECT $1::int&quot;"
- !ruby/struct:SM::Flow::P 
  body: The optional <tt>result_format</tt> should be 0 for text results, 1 for binary.
full_name: PGconn#exec
is_singleton: false
name: exec
params: |
  conn.exec(sql [, params, result_format ] ) -> PGresult

visibility: public
