File tree 2 files changed +33
-5
lines changed
2 files changed +33
-5
lines changed Original file line number Diff line number Diff line change @@ -74,6 +74,36 @@ SQLite3TableTest >> testPrintString [
74
74
self assert: table printString equals: ' a SQLite3Table("SAMPLE")'
75
75
]
76
76
77
+ { #category : #' tests - sample' }
78
+ SQLite3TableTest >> testRows [
79
+
80
+ self assert: table rows isEmpty
81
+ ]
82
+
83
+ { #category : #' tests - sample' }
84
+ SQLite3TableTest >> testRowsHasOneRow [
85
+
86
+ | rows |
87
+ db execute: ' INSERT INTO SAMPLE(NAME) VALUES (' ' first example' ' );' .
88
+ rows := table rows.
89
+ self deny: rows isEmpty.
90
+ self assert: rows size equals: 1 .
91
+ self assert: (rows first at: ' NAME' ) equals: ' first example'
92
+ ]
93
+
94
+ { #category : #' tests - sample' }
95
+ SQLite3TableTest >> testRowsHasTwoRows [
96
+
97
+ | rows |
98
+ db execute:
99
+ ' INSERT INTO SAMPLE(NAME) VALUES (' ' first example' ' ), (' ' second example' ' );' .
100
+ rows := table rows.
101
+ self deny: rows isEmpty.
102
+ self assert: rows size equals: 2 .
103
+ self assert: (rows first at: ' NAME' ) equals: ' first example' .
104
+ self assert: (rows second at: ' NAME' ) equals: ' second example'
105
+ ]
106
+
77
107
{ #category : #' tests - sample' }
78
108
SQLite3TableTest >> testSampleTable [
79
109
Original file line number Diff line number Diff line change @@ -84,11 +84,9 @@ SQLite3Table >> properties: anObject [
84
84
{ #category : #accessing }
85
85
SQLite3Table >> rows [
86
86
87
- ^ self database
88
- execute: ' SELECT *
89
- FROM ' , self name, '
90
- LIMIT 1000;'
91
- doing: [ :result | result rows collect: [ :each | each ] ]
87
+ ^ (self database execute: ' SELECT *
88
+ FROM ' , self name , '
89
+ LIMIT 1000;' ) rows
92
90
]
93
91
94
92
{ #category : #accessing }
You can’t perform that action at this time.
0 commit comments