Skip to content

Commit e0b8aa5

Browse files
committed
build cf
1 parent 3f6138b commit e0b8aa5

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

cf/src/index.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ function Postgres(a, b) {
8383

8484
return sql
8585

86-
function Sql(handler, instant) {
86+
function Sql(handler) {
8787
handler.debug = options.debug
8888

8989
Object.entries(options.types).reduce((acc, [name, type]) => {
@@ -112,7 +112,6 @@ function Postgres(a, b) {
112112
: typeof strings === 'string' && !args.length
113113
? new Identifier(options.transform.column.to ? options.transform.column.to(strings) : strings)
114114
: new Builder(strings, args)
115-
instant && query instanceof Query && query.execute()
116115
return query
117116
}
118117

@@ -123,7 +122,6 @@ function Postgres(a, b) {
123122
...options,
124123
simple: 'simple' in options ? options.simple : args.length === 0
125124
})
126-
instant && query.execute()
127125
return query
128126
}
129127

@@ -141,7 +139,6 @@ function Postgres(a, b) {
141139
...options,
142140
simple: 'simple' in options ? options.simple : args.length === 0
143141
})
144-
instant && query.execute()
145142
return query
146143
}
147144
}

cf/src/subscribe.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,15 @@ export default function Subscribe(postgres, options) {
9797
}
9898

9999
stream.on('data', data)
100-
stream.on('error', sql.close)
100+
stream.on('error', error)
101101
stream.on('close', sql.close)
102102

103103
return { stream, state: xs.state }
104104

105+
function error(e) {
106+
console.error('Unexpected error during logical streaming - reconnecting', e)
107+
}
108+
105109
function data(x) {
106110
if (x[0] === 0x77)
107111
parse(x.subarray(25), state, sql.options.parsers, handle, options.transform)
@@ -191,7 +195,7 @@ function parse(x, state, parsers, handle, transform) {
191195
i += 4
192196
const key = x[i] === 75
193197
handle(key || x[i] === 79
194-
? tuples(x, key ? relation.keys : relation.columns, i += 3, transform).row
198+
? tuples(x, relation.columns, i += 3, transform).row
195199
: null
196200
, {
197201
command: 'delete',
@@ -205,7 +209,7 @@ function parse(x, state, parsers, handle, transform) {
205209
i += 4
206210
const key = x[i] === 75
207211
const xs = key || x[i] === 79
208-
? tuples(x, key ? relation.keys : relation.columns, i += 3, transform)
212+
? tuples(x, relation.columns, i += 3, transform)
209213
: null
210214

211215
xs && (i = xs.i)

0 commit comments

Comments
 (0)