MySQL 8.3.0
Source Code Documentation
srs_fetcher.h
Go to the documentation of this file.
1#ifndef SRS_FETCHER_H_INCLUDED
2#define SRS_FETCHER_H_INCLUDED
3
4/*
5 Copyright (c) 2017, 2023, Oracle and/or its affiliates.
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License, version 2.0,
9 as published by the Free Software Foundation.
10
11 This program is also distributed with certain software (including
12 but not limited to OpenSSL) that is licensed under separate terms,
13 as designated in a particular file or component or in included license
14 documentation. The authors of MySQL hereby grant you an additional
15 permission to link the program and your derivative works with the
16 separately licensed software that they have included with MySQL.
17
18 This program is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License, version 2.0, for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, write to the Free Software
25 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26*/
27
28#include "sql/gis/geometries.h"
29#include "sql/gis/srid.h"
30#include "sql/mdl.h"
31
32namespace dd {
33class Spatial_reference_system;
34}
35
37 private:
39
40 /**
41 Take an MDL lock on an SRID.
42
43 @param[in] srid Spatial reference system ID
44 @param[in] lock_type Type of lock to take
45
46 @retval false Success.
47 @retval true Locking failed. An error has already been flagged.
48 */
49 bool lock(gis::srid_t srid, enum_mdl_type lock_type);
50
51 public:
52 Srs_fetcher(THD *thd) : m_thd(thd) {}
53
54 /**
55 Acquire an SRS from the data dictionary. Take a shared read lock on the
56 SRID.
57
58 @param[in] srid Spatial reference system ID
59 @param[out] srs The spatial reference system
60
61 @retval false Success.
62 @retval true Locking failed. An error has already been flagged.
63 */
64 bool acquire(gis::srid_t srid, const dd::Spatial_reference_system **srs);
65
66 /**
67 Acquire an SRS from the data dictionary with the intent of modifying
68 it. Take an exclusive lock on the SRID.
69
70 @param[in] srid Spatial reference system ID
71 @param[out] srs The spatial reference system
72
73 @retval false Success.
74 @retval true Locking failed. An error has already been flagged.
75 */
78
79 static bool srs_exists(THD *thd, gis::srid_t srid, bool *exists);
80};
81
82#endif // SRS_FETCHER_H_INCLUDED
Definition: srs_fetcher.h:36
bool acquire_for_modification(gis::srid_t srid, dd::Spatial_reference_system **srs)
Acquire an SRS from the data dictionary with the intent of modifying it.
Definition: item_geofunc_internal.cc:91
THD * m_thd
Definition: srs_fetcher.h:38
Srs_fetcher(THD *thd)
Definition: srs_fetcher.h:52
bool acquire(gis::srid_t srid, const dd::Spatial_reference_system **srs)
Acquire an SRS from the data dictionary.
Definition: item_geofunc_internal.cc:82
bool lock(gis::srid_t srid, enum_mdl_type lock_type)
Take an MDL lock on an SRID.
Definition: item_geofunc_internal.cc:61
static bool srs_exists(THD *thd, gis::srid_t srid, bool *exists)
Definition: item_geofunc_internal.cc:100
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:35
Definition: spatial_reference_system.h:52
This file declares the geometry class hierarchy used by the server as the internal representation of ...
The version of the current data dictionary table definitions.
Definition: dictionary_client.h:42
std::uint32_t srid_t
A spatial reference system ID (SRID).
Definition: srid.h:32
static int exists(node_address *name, node_list const *nodes, u_int with_uid)
Definition: node_list.cc:105
enum_mdl_type
Type of metadata lock request.
Definition: sql_lexer_yacc_state.h:105