parameters: (esri_code: str, esri_name: str, epsg_code: str, epsg_name: str,
                            params: Dict[str, ParameterValue],
                            param_mapping: Dict[int, str],
                            extent_auth_name: str, extent_code: str,
                            geogcs_auth_name: str, geogcs_code: str,
                            cs: CoordinateSystem,
                            deprecated: bool = False)
return_statement: return results
docstring: Generates INSERT sql command for conversion
docstring_summary: Generates INSERT sql command for conversion
docstring_tokens: Generates INSERT sql command for conversion
function: def insert_conversion_sql(esri_code: str, esri_name: str, epsg_code: str, epsg_name: str,
                            params: Dict[str, ParameterValue],
                            param_mapping: Dict[int, str],
                            extent_auth_name: str, extent_code: str,
                            geogcs_auth_name: str, geogcs_code: str,
                            cs: CoordinateSystem,
                            deprecated: bool = False) -> List[str]:
      """
      Generates INSERT sql command for conversion
      """
      param_strings = []
      for param_epsg_code, param_name in param_mapping.items():
          param_strings.append("'EPSG','{}','{}',{},'{}','{}'".format(
              param_epsg_code,
              EPSG_CONVERSION_PARAM_NAMES[param_epsg_code],
              params[param_name].value,
              params[param_name].unit.uom_auth_name,
              params[param_name].unit.uom_code
          ))
  
      if len(param_strings) < 7:
          for _ in range(len(param_strings), 7):
              param_strings.append('NULL,NULL,NULL,NULL,NULL,NULL')
  
      assert len(param_strings) == 7, 'Too many parameters'
  
      sql = "INSERT INTO \"conversion\" VALUES('ESRI','{code}','{name}',NULL,'{method_auth_name}','{method_code}','{method_name}'," \
            "{param1},{param2},{param3},{param4},{param5},{param6},{param7},{deprecated});".format(
          code=esri_code,
          name='unnamed',
          method_auth_name='EPSG',
          method_code=epsg_code,
          method_name=epsg_name,
          param1=param_strings[0],
          param2=param_strings[1],
          param3=param_strings[2],
          param4=param_strings[3],
          param5=param_strings[4],
          param6=param_strings[5],
          param7=param_strings[6],
          deprecated=1 if deprecated else 0)
  
      conv_name = 'unnamed'
      conv_auth_name = 'ESRI'
      conv_code = esri_code
  
      results = []
      sql_extract = sql[sql.find('NULL'):]
      if conv_name != 'unnamed' or sql_extract not in MAP_CONVERSION_SQL_TO_CODE:
          results.append(sql)
  
          sql = f"""INSERT INTO "usage" VALUES('ESRI', 'CONV_{esri_code}_USAGE','conversion','ESRI','{esri_code}','{extent_auth_name}','{extent_code}','EPSG','1024');"""
          results.append(sql)
  
          MAP_CONVERSION_SQL_TO_CODE[sql_extract] = conv_code
      else:
          conv_code = MAP_CONVERSION_SQL_TO_CODE[sql_extract]
  
      sql = f"""INSERT INTO "projected_crs" VALUES('ESRI','{esri_code}','{esri_name}',NULL,'{cs.auth_name}','{cs.code}','{geogcs_auth_name}',""" \
            f"""'{geogcs_code}','{conv_auth_name}','{conv_code}',NULL,{1 if deprecated else 0});"""
      results.append(sql)
      sql = f"""INSERT INTO "usage" VALUES('ESRI', 'PCRS_{esri_code}_USAGE','projected_crs','ESRI','{esri_code}','{extent_auth_name}','{extent_code}','EPSG','1024');"""
      results.append(sql)
  
      return results
function_tokens: def insert_conversion_sql ( esri_code : str , esri_name : str , epsg_code : str , epsg_name : str , params : Dict [ str , ParameterValue ] , param_mapping : Dict [ int , str ] , extent_auth_name : str , extent_code : str , geogcs_auth_name : str , geogcs_code : str , cs : CoordinateSystem , deprecated : bool = False ) -> List [ str ] : param_strings = [ ] for param_epsg_code , param_name in param_mapping . items ( ) : param_strings . append ( "'EPSG','{}','{}',{},'{}','{}'" . format ( param_epsg_code , EPSG_CONVERSION_PARAM_NAMES [ param_epsg_code ] , params [ param_name ] . value , params [ param_name ] . unit . uom_auth_name , params [ param_name ] . unit . uom_code ) ) if len ( param_strings ) < 7 : for _ in range ( len ( param_strings ) , 7 ) : param_strings . append ( 'NULL,NULL,NULL,NULL,NULL,NULL' ) assert len ( param_strings ) == 7 , 'Too many parameters' sql = "INSERT INTO \"conversion\" VALUES('ESRI','{code}','{name}',NULL,'{method_auth_name}','{method_code}','{method_name}'," "{param1},{param2},{param3},{param4},{param5},{param6},{param7},{deprecated});" . format ( code = esri_code , name = 'unnamed' , method_auth_name = 'EPSG' , method_code = epsg_code , method_name = epsg_name , param1 = param_strings [ 0 ] , param2 = param_strings [ 1 ] , param3 = param_strings [ 2 ] , param4 = param_strings [ 3 ] , param5 = param_strings [ 4 ] , param6 = param_strings [ 5 ] , param7 = param_strings [ 6 ] , deprecated = 1 if deprecated else 0 ) conv_name = 'unnamed' conv_auth_name = 'ESRI' conv_code = esri_code results = [ ] sql_extract = sql [ sql . find ( 'NULL' ) : ] if conv_name != 'unnamed' or sql_extract not in MAP_CONVERSION_SQL_TO_CODE : results . append ( sql ) sql = f"""INSERT INTO "usage" VALUES('ESRI', 'CONV_{esri_code}_USAGE','conversion','ESRI','{esri_code}','{extent_auth_name}','{extent_code}','EPSG','1024');""" results . append ( sql ) MAP_CONVERSION_SQL_TO_CODE [ sql_extract ] = conv_code else : conv_code = MAP_CONVERSION_SQL_TO_CODE [ sql_extract ] sql = f"""INSERT INTO "projected_crs" VALUES('ESRI','{esri_code}','{esri_name}',NULL,'{cs.auth_name}','{cs.code}','{geogcs_auth_name}',""" f"""'{geogcs_code}','{conv_auth_name}','{conv_code}',NULL,{1 if deprecated else 0});""" results . append ( sql ) sql = f"""INSERT INTO "usage" VALUES('ESRI', 'PCRS_{esri_code}_USAGE','projected_crs','ESRI','{esri_code}','{extent_auth_name}','{extent_code}','EPSG','1024');""" results . append ( sql ) return results