| 54 | /************************************************************************/ |
| 55 | |
| 56 | bool GDALVectorExportSchemaAlgorithm::RunStep(GDALPipelineStepRunContext &) |
| 57 | { |
| 58 | CPLAssert(m_inputDataset.size() == 1); |
| 59 | auto poSrcDS = m_inputDataset[0].GetDatasetRef(); |
| 60 | CPLAssert(poSrcDS); |
| 61 | |
| 62 | CPLStringList aosOptions; |
| 63 | |
| 64 | aosOptions.AddString("-schema"); |
| 65 | aosOptions.AddString("--cli"); |
| 66 | |
| 67 | // Must be last, as positional |
| 68 | aosOptions.AddString("dummy"); |
| 69 | |
| 70 | for (const std::string &name : m_layerNames) |
| 71 | aosOptions.AddString(name.c_str()); |
| 72 | |
| 73 | if (m_layerNames.empty()) |
| 74 | { |
| 75 | aosOptions.AddString("-al"); |
| 76 | } |
| 77 | |
| 78 | GDALVectorInfoOptions *psInfo = |
| 79 | GDALVectorInfoOptionsNew(aosOptions.List(), nullptr); |
| 80 | |
| 81 | char *ret = GDALVectorInfo(GDALDataset::ToHandle(poSrcDS), psInfo); |
| 82 | GDALVectorInfoOptionsFree(psInfo); |
| 83 | if (!ret) |
| 84 | return false; |
| 85 | |
| 86 | m_output = ret; |
| 87 | CPLFree(ret); |
| 88 | |
| 89 | return true; |
| 90 | } |
| 91 | |
| 92 | GDALVectorExportSchemaAlgorithmStandalone:: |
| 93 | ~GDALVectorExportSchemaAlgorithmStandalone() = default; |
nothing calls this directly
no test coverage detected