Class: PgPipeline::PreparedStatement

Inherits:
Object
  • Object
show all
Defined in:
lib/pg_pipeline/prepared_statement.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:, name:, physical_name:, sql:, param_types: nil) ⇒ PreparedStatement

Returns a new instance of PreparedStatement.



10
11
12
13
14
15
16
17
# File 'lib/pg_pipeline/prepared_statement.rb', line 10

def initialize(client:, name:, physical_name:, sql:, param_types: nil)
  @client = client
  @name = PreparedStatementOps.snapshot_name(name)
  @physical_name = PreparedStatementOps.snapshot_name(physical_name)
  @sql = RequestOps.snapshot_sql(sql)
  @param_types = RequestOps.snapshot_param_types(param_types)
  freeze
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



8
9
10
# File 'lib/pg_pipeline/prepared_statement.rb', line 8

def name
  @name
end

#param_typesObject (readonly)

Returns the value of attribute param_types.



8
9
10
# File 'lib/pg_pipeline/prepared_statement.rb', line 8

def param_types
  @param_types
end

#physical_nameObject (readonly)

Returns the value of attribute physical_name.



8
9
10
# File 'lib/pg_pipeline/prepared_statement.rb', line 8

def physical_name
  @physical_name
end

#sqlObject (readonly)

Returns the value of attribute sql.



8
9
10
# File 'lib/pg_pipeline/prepared_statement.rb', line 8

def sql
  @sql
end

Instance Method Details

#inspectObject



22
23
24
# File 'lib/pg_pipeline/prepared_statement.rb', line 22

def inspect
  "#<#{self.class} name=#{@name.inspect} sql=#{@sql.inspect}>"
end

#query(params = []) ⇒ Object Also known as: call



19
# File 'lib/pg_pipeline/prepared_statement.rb', line 19

def query(params = []) = PreparedStatementOps.query(self, params)