Skip to content

Commit 3a07b22

Browse files
committed
Warn user about doom and gloom surrounding custom typecasting
1 parent c87ba17 commit 3a07b22

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Readme.md

+14
Original file line numberDiff line numberDiff line change
@@ -850,6 +850,20 @@ connection.query({
850850
}
851851
});
852852
```
853+
WARNING: YOU MUST INVOKE the parser before returning from a custom typeCast function.
854+
```
855+
field.string()
856+
field.buffer()
857+
field.geometry()
858+
```
859+
are aliases for
860+
```
861+
parser.parseLengthCodedString()
862+
parser.parseLengthCodedBuffer()
863+
parser.parseGeometryValue()
864+
```
865+
You can find which field function you need to use by looking at: [RowDataPacket.prototype._typeCast](https://github.com/felixge/node-mysql/blob/master/lib/protocol/packets/RowDataPacket.js#L41)
866+
853867

854868
If you need a buffer there's also a `.buffer()` function and also a `.geometry()` one
855869
both used by the default type cast that you can use.

0 commit comments

Comments
 (0)