@@ -57,24 +57,18 @@ class SQLService extends DatabaseService {
57
57
return super . init ( )
58
58
}
59
59
60
- _changeToStreams ( columns , rows , one , compat ) {
60
+ _changeToStreams ( columns , rows , one ) {
61
61
if ( ! rows || ! columns ) return
62
62
if ( ! Array . isArray ( rows ) ) rows = [ rows ]
63
- if ( ! rows . length || ! Object . keys ( rows [ 0 ] ) . length ) return
64
-
65
- // REVISIT: remove after removing stream_compat feature flag
66
- if ( compat ) {
67
- rows [ 0 ] [ Object . keys ( rows [ 0 ] ) [ 0 ] ] = this . _stream ( Object . values ( rows [ 0 ] ) [ 0 ] )
68
- return
69
- }
63
+ if ( ! rows . length || ! Object . keys ( rows [ 0 ] ) . length ) return
70
64
71
65
let changes = false
72
66
for ( let col of columns ) {
73
67
const name = col . as || col . ref ?. [ col . ref . length - 1 ] || ( typeof col === 'string' && col )
74
68
if ( col . element ?. isAssociation ) {
75
- if ( one ) this . _changeToStreams ( col . SELECT . columns , rows [ 0 ] [ name ] , false , compat )
69
+ if ( one ) this . _changeToStreams ( col . SELECT . columns , rows [ 0 ] [ name ] , false )
76
70
else
77
- changes = rows . some ( row => ! this . _changeToStreams ( col . SELECT . columns , row [ name ] , false , compat ) )
71
+ changes = rows . some ( row => ! this . _changeToStreams ( col . SELECT . columns , row [ name ] , false ) )
78
72
} else if ( col . element ?. type === 'cds.LargeBinary' ) {
79
73
changes = true
80
74
if ( one ) rows [ 0 ] [ name ] = this . _stream ( rows [ 0 ] [ name ] )
@@ -141,23 +135,7 @@ class SQLService extends DatabaseService {
141
135
if ( expand ) rows = rows . map ( r => ( typeof r . _json_ === 'string' ? JSON . parse ( r . _json_ ) : r . _json_ || r ) )
142
136
143
137
if ( ! iterator ) {
144
- // REVISIT: remove after removing stream_compat feature flag
145
- if ( cds . env . features . stream_compat ) {
146
- if ( query . _streaming ) {
147
- if ( ! rows . length ) return
148
- this . _changeToStreams ( cqn . SELECT . columns , rows , true , true )
149
- const result = rows [ 0 ]
150
-
151
- // stream is always on position 0. Further properties like etag are inserted later.
152
- let [ key , val ] = Object . entries ( result ) [ 0 ]
153
- result . value = val
154
- delete result [ key ]
155
-
156
- return result
157
- }
158
- } else {
159
- this . _changeToStreams ( cqn . SELECT . columns , rows , query . SELECT . one , false )
160
- }
138
+ this . _changeToStreams ( cqn . SELECT . columns , rows , query . SELECT . one )
161
139
} else if ( objectMode ) {
162
140
const converter = ( row ) => this . _changeToStreams ( cqn . SELECT . columns , row , true )
163
141
const changeToStreams = new Transform ( {
0 commit comments