GAEncodingTest
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
performTest
performTest
setUp
super setUp.
setUpfixture := Fixture ifNil: [ self createFixture ].
(fixture driver supportsEncoding: self encoding)
fixture setUp: {('encoding' -> self encoding)} asDictionary.
conn := fixture connection
testEncodeArgumentsInPreparedStatements
testEncodeArgumentsInPreparedStatements| characters result statement |
conn supportsPreparedStatements
characters := 'áèîÑçö'.
statement := conn prepare: 'INSERT INTO student(id, description) VALUES(1, ?)'.
statement at: 1 bind: characters.
statement execute
result := conn execute: 'SELECT description FROM student WHERE id=1'.
self assert: (result first at: 1) equals: characters
testEncoder
testEncoderself assert: conn encoder equals: (ZnCharacterEncoder newForEncoding: self encoding)
testSpecialCharacters
testSpecialCharacters| characters result |
conn supportsAutomaticQueryEncoding
characters := 'áèîÑçö'.
conn execute: ('INSERT INTO student(id, description) VALUES(1, '' , (conn encoder encodeString: characters) asString) , '')'.
result := conn execute: 'SELECT description FROM student WHERE id=1'.
self assert: (result first at: 1) equals: characters
testSpecialCharacters2
testSpecialCharacters2| characters result |
conn supportsAutomaticQueryEncoding
characters := 'î℉ yõù g𐌹ѷЄ ΣϘГくטƏ UTF-8, it stores it'.
conn execute: ('INSERT INTO student(id, description) VALUES(1, '' , (conn encoder encodeString: characters) asString) , '')'.
result := conn execute: 'SELECT description FROM student WHERE id=1'.
self assert: (result first at: 1) equals: characters
testSpecialCharacters2WithoutQueryEncoding
testSpecialCharacters2WithoutQueryEncoding| characters result |
conn supportsAutomaticQueryEncoding
characters := 'î℉ yõù g𐌹ѷЄ ΣϘГくטƏ UTF-8, it stores it'.
conn execute: ('INSERT INTO student(id, description) VALUES(1, '' , characters) , '')'.
result := conn execute: 'SELECT description FROM student WHERE id=1'.
self assert: (result first at: 1) equals: characters
testSpecialCharacters3
testSpecialCharacters3| characters result |
conn supportsAutomaticQueryEncoding
characters := 'öäüßøæ¢'.
conn execute: ('INSERT INTO student(id, description) VALUES(1, '' , (conn encoder encodeString: characters) asString) , '')'.
result := conn execute: 'SELECT description FROM student WHERE id=1'.
self assert: (result first at: 1) equals: characters
testSpecialCharacters3WithoutQueryEncoding
testSpecialCharacters3WithoutQueryEncoding
testSpecialCharactersWithoutQueryEncoding
testSpecialCharactersWithoutQueryEncoding