* IndexSpecGetDatum converts given IndexSpec into a Datum of type * index_spec_type. */
| 1262 | * index_spec_type. |
| 1263 | */ |
| 1264 | Datum |
| 1265 | IndexSpecGetDatum(IndexSpec *indexSpec) |
| 1266 | { |
| 1267 | Datum argValues[10]; |
| 1268 | bool argNulls[10]; |
| 1269 | |
| 1270 | argValues[0] = CStringGetTextDatum(indexSpec->indexName); |
| 1271 | argNulls[0] = false; |
| 1272 | |
| 1273 | argValues[1] = PointerGetDatum(indexSpec->indexKeyDocument); |
| 1274 | argNulls[1] = false; |
| 1275 | |
| 1276 | if (indexSpec->indexPFEDocument) |
| 1277 | { |
| 1278 | argValues[2] = PointerGetDatum(indexSpec->indexPFEDocument); |
| 1279 | argNulls[2] = false; |
| 1280 | } |
| 1281 | else |
| 1282 | { |
| 1283 | argNulls[2] = true; |
| 1284 | } |
| 1285 | |
| 1286 | if (indexSpec->indexWPDocument) |
| 1287 | { |
| 1288 | argValues[3] = PointerGetDatum(indexSpec->indexWPDocument); |
| 1289 | argNulls[3] = false; |
| 1290 | } |
| 1291 | else |
| 1292 | { |
| 1293 | argNulls[3] = true; |
| 1294 | } |
| 1295 | |
| 1296 | if (indexSpec->indexSparse != BoolIndexOption_Undefined) |
| 1297 | { |
| 1298 | argValues[4] = BoolGetDatum(indexSpec->indexSparse == BoolIndexOption_True); |
| 1299 | argNulls[4] = false; |
| 1300 | } |
| 1301 | else |
| 1302 | { |
| 1303 | argNulls[4] = true; |
| 1304 | } |
| 1305 | |
| 1306 | if (indexSpec->indexUnique != BoolIndexOption_Undefined) |
| 1307 | { |
| 1308 | argValues[5] = BoolGetDatum(indexSpec->indexUnique == BoolIndexOption_True); |
| 1309 | argNulls[5] = false; |
| 1310 | } |
| 1311 | else |
| 1312 | { |
| 1313 | argNulls[5] = true; |
| 1314 | } |
| 1315 | |
| 1316 | argValues[6] = Int32GetDatum(indexSpec->indexVersion); |
| 1317 | argNulls[6] = false; |
| 1318 | |
| 1319 | if (indexSpec->indexExpireAfterSeconds != NULL) |
| 1320 | { |
| 1321 | argValues[7] = Int32GetDatum(*indexSpec->indexExpireAfterSeconds); |
no test coverage detected