GAStatementTest
Overview
Please comment me using the following template inspired by Class Responsibility Collaborator (CRC) design:
For the Class part: State the name of the class with one line description: For example, I'm xxx the root of the hierarchy of visitor objects.
For the Responsibility part: Three sentences about my main responsibility, what I'm doing, what services do I offer.
For the Collaborators Part: State my main collaborators and one line about how I interact with them.
Public API and Key Messages
- label item
One simple example is simply gorgeous.
Internal Representation and Key Implementation Points.
Implementation Points
Instance Method Details
testCreateStatement
testCreateStatement| statementString statement |
statementString := 'CREATE TABLE CATS (
name varchar(50),
owner varchar(50))'.
statement := conn createStatement: statementString.
self assert: statement notNil.
self assert: statement statementString equals: statementString
testCreateStatementWithoutStatementString
testCreateStatementWithoutStatementString| statementString statement |
statementString := 'CREATE TABLE CATS (
name varchar(50),
owner varchar(50))'.
statement := conn createStatement.
statement statementString: statementString.
self assert: statement notNil.
self assert: statement statementString equals: statementString
testExecuteStatement
testExecuteStatement| statement result |
conn execute: 'CREATE TABLE CATS (
name varchar(50),
owner varchar(50))'.
conn execute: 'INSERT INTO CATS(name, owner) VALUES('lutz', 'julien')'.
statement := conn createStatement: 'SELECT * FROM CATS'.
result := statement execute.
self assert: (result first at: 1) equals: 'lutz'.
self assert: (result first at: 2) equals: 'julien'
testExecuteStatementTwice
testExecuteStatementTwice| statement result |
conn execute: 'CREATE TABLE CATS (
name varchar(50),
owner varchar(50))'.
conn execute: 'INSERT INTO CATS(name, owner) VALUES('lutz', 'julien')'.
statement := conn createStatement: 'SELECT * FROM CATS'.
result := statement execute.
self assert: (result first at: 1) equals: 'lutz'.
self assert: (result first at: 2) equals: 'julien'.
result := statement execute.
self assert: (result first at: 1) equals: 'lutz'.
self assert: (result first at: 2) equals: 'julien'
testStatementDoesNotAcceptBindings
testStatementDoesNotAcceptBindings| statementString statement |
statementString := 'CREATE TABLE CATS (
name varchar(50),
owner varchar(50))'.
statement := conn createStatement: statementString.
self should: [ statement at: 1 bind: 'unbinded' ] raise: Error