Binds the value at the given index or throws an appropriate error.
| 72 | |
| 73 | // Binds the value at the given index or throws an appropriate error. |
| 74 | void BindValue(Napi::Env env, Napi::Value value, int index) { |
| 75 | int status = Data::BindValueFromJS(env, handle, index, value); |
| 76 | if (status != SQLITE_OK) { |
| 77 | switch (status) { |
| 78 | case -1: |
| 79 | return Fail(ThrowTypeError, env, "SQLite3 can only bind numbers, strings, bigints, buffers, and null"); |
| 80 | case SQLITE_TOOBIG: |
| 81 | return Fail(ThrowRangeError, env, "The bound string, buffer, or bigint is too big"); |
| 82 | case SQLITE_RANGE: |
| 83 | return Fail(ThrowRangeError, env, "Too many parameter values were provided"); |
| 84 | case SQLITE_NOMEM: |
| 85 | return Fail(ThrowError, env, "Out of memory"); |
| 86 | default: |
| 87 | return Fail(ThrowError, env, "An unexpected error occured while trying to bind parameters"); |
| 88 | } |
| 89 | assert(false); |
| 90 | } |
| 91 | } |
| 92 | |
| 93 | // Binds each value in the array or throws an appropriate error. |
| 94 | // The number of successfully bound parameters is returned. |
nothing calls this directly
no test coverage detected