
    g\                     2    d dl mZ d dlmZ  G d de      Zy)    )OGRGeomType)DatabaseIntrospectionc                   J     e Zd Zi Zej
                  g dz   Z fdZd Z xZS )PostGISIntrospection)geography_columnsgeometry_columnsraster_columnsspatial_ref_sysraster_overviewsc                 P   | j                   s~| j                  j                         5 }|j                  d       t	        |j                               | _         d d d        | j                  j                  d | j                   D               t        | %  ||      S # 1 sw Y   ExY w)NzKSELECT oid, typname FROM pg_type WHERE typname IN ('geometry', 'geography')c              3   $   K   | ]  }|d f 
 yw)GeometryFieldN ).0oids     /var/www/python.vincentserveurtest.ovh/public_html/venv/lib/python3.12/site-packages/django/contrib/gis/db/backends/postgis/introspection.py	<genexpr>z6PostGISIntrospection.get_field_type.<locals>.<genexpr>   s      +2I3o&2Is   )
postgis_oid_lookup
connectioncursorexecutedictfetchalldata_types_reverseupdatesuperget_field_type)self	data_typedescriptionr   	__class__s       r   r   z#PostGISIntrospection.get_field_type   s    && '')VA
 +/v/@*A' * ##** +262I2I+  w%i== *)s   0BB%c                    | j                   j                         5 }|j                  d||j                  f       |j	                         }|st        d|d|j                  d      |\  }}}t        |      j                  }i }| j                  j                  |j                        dk(  rd|d<   |dk7  r||d<   |d	k7  r||d
<   ddd       ||fS # 1 sw Y   fS xY w)a%  
        The geometry type OID used by PostGIS does not indicate the particular
        type of field that a geometry column is (e.g., whether it's a
        PointField or a PolygonField).  Thus, this routine queries the PostGIS
        metadata tables to determine the geometry type.
        a   
                SELECT t.coord_dimension, t.srid, t.type FROM (
                    SELECT * FROM geometry_columns
                    UNION ALL
                    SELECT * FROM geography_columns
                ) AS t WHERE t.f_table_name = %s AND t.f_geometry_column = %s
            z3Could not find a geometry or geography column for "z".""	geographyTi  srid   dimN)r   r   r   namefetchone	Exceptionr   djangor   get	type_code)	r   
table_namer    r   rowr'   r%   
field_typefield_paramss	            r   get_geometry_typez&PostGISIntrospection.get_geometry_type#   s     __##%NN [--.	 //#C!;#3#35  %(!Cz %Z077JL&&**;+@+@A[P,0[)t|'+V$ax&)U#9 &: <''; &: <''s   B+CC)	__name__
__module____qualname__r   r   ignored_tablesr   r2   __classcell__)r!   s   @r   r   r      s(    *99 = N>&$(    r   N)django.contrib.gis.gdalr   +django.db.backends.postgresql.introspectionr   r   r   r8   r   <module>r;      s    / MB(0 B(r8   