* Initializes a pgbson structure from an extended json * syntax string. */
| 192 | * syntax string. |
| 193 | */ |
| 194 | pgbson * |
| 195 | PgbsonInitFromJson(const char *jsonString) |
| 196 | { |
| 197 | bson_t bson; |
| 198 | bson_error_t error; |
| 199 | bool parseResult = bson_init_from_json(&bson, jsonString, -1, &error); |
| 200 | if (!parseResult) |
| 201 | { |
| 202 | ereport(ERROR, (errcode(ERRCODE_DOCUMENTDB_BADVALUE), errmsg( |
| 203 | "invalid input syntax JSON for BSON: Code: '%d', Message '%s'", |
| 204 | error.code, error.message))); |
| 205 | } |
| 206 | |
| 207 | return CreatePgbsonfromBson_t(&bson, true /* destroyDocument */); |
| 208 | } |
| 209 | |
| 210 | |
| 211 | /* |