@@ -379,11 +379,13 @@ export default function Postgres(url, options) {
379
379
380
380
for ( let i = 1 ; i < xs . length ; i ++ ) {
381
381
arg = args [ i - 1 ]
382
- str += ( arg . rows
383
- ? parseRows ( arg . rows , xargs , types )
384
- : arg . row
385
- ? parseRow ( arg . row , xargs , types )
386
- : parseValue ( arg , xargs , types )
382
+ str += ( ! arg
383
+ ? parseValue ( arg , xargs , types )
384
+ : arg . rows
385
+ ? parseRows ( arg . rows , xargs , types )
386
+ : arg . row
387
+ ? parseRow ( arg . row , xargs , types )
388
+ : parseValue ( arg , xargs , types )
387
389
) + xs [ i ]
388
390
}
389
391
@@ -410,8 +412,11 @@ export default function Postgres(url, options) {
410
412
}
411
413
412
414
function getType ( x ) {
415
+ if ( x == null )
416
+ return { type : types . string . to , value : x }
417
+
413
418
const value = x . type ? x . value : x
414
- , type = x && x . array ? typeArrayMap [ x . type || inferType ( value ) ] : ( x . type || inferType ( value ) )
419
+ , type = x . array ? typeArrayMap [ x . type || inferType ( value ) ] : ( x . type || inferType ( value ) )
415
420
416
421
return {
417
422
type,
@@ -445,10 +450,7 @@ function parseOptions(uri = {}, options) {
445
450
onnotice : o . onnotice ,
446
451
onparameter : o . onparameter ,
447
452
none : crypto . randomBytes ( 18 ) . toString ( 'base64' ) ,
448
- connection : {
449
- application_name : 'postgres.js' ,
450
- ...o . connection
451
- } ,
453
+ connection : { application_name : 'postgres.js' , ...o . connection } ,
452
454
...mergeUserTypes ( o . types )
453
455
}
454
456
}
0 commit comments