Coverage Report

Created: 2026-02-14 09:00

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/gdal/ogr/ogrsf_frmts/elastic/ogrelasticdriver.cpp
Line
Count
Source
1
/******************************************************************************
2
 *
3
 * Project:  Elasticsearch Translator
4
 * Purpose:
5
 * Author:
6
 *
7
 ******************************************************************************
8
 * Copyright (c) 2011, Adam Estrada
9
 *
10
 * SPDX-License-Identifier: MIT
11
 ****************************************************************************/
12
13
#include "ogr_elastic.h"
14
#include "cpl_conv.h"
15
#include "ogrelasticdrivercore.h"
16
17
/************************************************************************/
18
/*                     OGRElasticsearchDriverOpen()                     */
19
/************************************************************************/
20
21
static GDALDataset *OGRElasticsearchDriverOpen(GDALOpenInfo *poOpenInfo)
22
23
46
{
24
46
    if (!OGRElasticsearchDriverIdentify(poOpenInfo))
25
0
        return nullptr;
26
27
46
    OGRElasticDataSource *poDS = new OGRElasticDataSource();
28
46
    if (!poDS->Open(poOpenInfo))
29
46
    {
30
46
        delete poDS;
31
46
        poDS = nullptr;
32
46
    }
33
34
46
    return poDS;
35
46
}
36
37
/************************************************************************/
38
/*                    OGRElasticsearchDriverCreate()                    */
39
/************************************************************************/
40
static GDALDataset *OGRElasticsearchDriverCreate(const char *pszName,
41
                                                 CPL_UNUSED int nXSize,
42
                                                 CPL_UNUSED int nYSize,
43
                                                 CPL_UNUSED int nBands,
44
                                                 CPL_UNUSED GDALDataType eDT,
45
                                                 CSLConstList papszOptions)
46
0
{
47
0
    OGRElasticDataSource *poDS = new OGRElasticDataSource();
48
49
0
    if (!poDS->Create(pszName, papszOptions))
50
0
    {
51
0
        delete poDS;
52
0
        poDS = nullptr;
53
0
    }
54
55
0
    return poDS;
56
0
}
57
58
/************************************************************************/
59
/*                         RegisterOGRElastic()                         */
60
/************************************************************************/
61
62
void RegisterOGRElastic()
63
22
{
64
22
    if (!GDAL_CHECK_VERSION("OGR/Elastic Search driver"))
65
0
        return;
66
67
22
    if (GDALGetDriverByName(DRIVER_NAME) != nullptr)
68
0
        return;
69
70
22
    GDALDriver *poDriver = new GDALDriver();
71
22
    OGRElasticsearchDriverSetCommonMetadata(poDriver);
72
22
    poDriver->pfnOpen = OGRElasticsearchDriverOpen;
73
22
    poDriver->pfnCreate = OGRElasticsearchDriverCreate;
74
75
22
    GetGDALDriverManager()->RegisterDriver(poDriver);
76
22
}