(config: BindOpts = {})
| 142 | } |
| 143 | |
| 144 | const bind = (config: BindOpts = {}): Buffer => { |
| 145 | // normalize config |
| 146 | const portal = config.portal || '' |
| 147 | const statement = config.statement || '' |
| 148 | const binary = config.binary || false |
| 149 | const values = config.values || emptyArray |
| 150 | const len = values.length |
| 151 | |
| 152 | writer.addCString(portal).addCString(statement) |
| 153 | writer.addInt16(len) |
| 154 | |
| 155 | try { |
| 156 | writeValues(values, config.valueMapper) |
| 157 | } catch (err) { |
| 158 | writer.clear() |
| 159 | paramWriter.clear() |
| 160 | throw err |
| 161 | } |
| 162 | |
| 163 | writer.addInt16(len) |
| 164 | writer.add(paramWriter.flush()) |
| 165 | |
| 166 | // all results use the same format code |
| 167 | writer.addInt16(1) |
| 168 | // format code |
| 169 | writer.addInt16(binary ? ParamType.BINARY : ParamType.STRING) |
| 170 | return writer.flush(code.bind) |
| 171 | } |
| 172 | |
| 173 | type ExecOpts = { |
| 174 | portal?: string |
nothing calls this directly
no test coverage detected