GAStatement

Object subclass: #'GAStatement' 

Overview

I am a statement object. I can be prepared or directly executed in the database.

If I support being prepared, I also support the configuration of bindings with the #at:bind: method.

Finally, I support the configuration of a #fetchSize: to use batch queries.

Class Method Details

onConnection:

onConnection: aPGConnection 
^self new 
connection: aPGConnection;
yourself

Instance Method Details

at:bind:

Binds a column at a particular index with an object. Objects are automatically transformed by the driver into the corresponding database representation.

at: aColumn bind: anObject 

connection:

connection: anOpenDBXConnection 
connection := anOpenDBXConnection

execute

It executes the current statement.

fetchListener:

Sets a fetch listener to listen when the statement performs a roundtrip to the database.

fetchListener: aGAFetchListener 
fetchListener := aGAFetchListener

fetchSize:

It sets the fetch size or the current statement, for batch retrieving.

fetchSize: anInteger 

initialize

placeholderAt:

Returns the placeholder that should correspond for a prepared statement at a given index. This method is meant to handle compatibility between databases that accept '?' like placeholders and others that accept '$1' like placeholders.

placeholderAt: anInteger 

prepare

It prepares the current statement if the driver supports prepared statements.

propertyAt:

Obtains the property set at a key

propertyAt: aKey 
^self propertyAt: aKey ifAbsent: self error: 'unexistent key: ' , aKey ]

propertyAt:ifAbsent:

Obtains the property set at a key. If absent, aBlock is executed.

propertyAt: aKey ifAbsent: aBlock 
properties ifNil: ^aBlock value ].
^properties at: aKey ifAbsent: aBlock

propertyAt:put:

Sets the property with the given key with the given value

propertyAt: aKey put: aValue 

statementString

Gets the SQL query string of the statement

statementString

statementString:

Sets the SQL query string of the statement

statementString: queryStatement 
statement := queryStatement