text stringlengths 0 234 |
|---|
procedure Set_Cell (Parser : in out CSV_Parser; |
Value : in String; |
Row : in Util.Serialize.IO.CSV.Row_Type; |
Column : in Util.Serialize.IO.CSV.Column_Type); |
overriding |
procedure Set_Cell (Parser : in out CSV_Parser; |
Value : in String; |
Row : in Util.Serialize.IO.CSV.Row_Type; |
Column : in Util.Serialize.IO.CSV.Column_Type) is |
pragma Unreferenced (Parser, Row); |
Query : ADO.SQL.Query; |
Found : Boolean; |
begin |
case Column is |
when 1 => |
-- The ISO code is unique, find the country |
Query.Bind_Param (1, Value); |
Query.Set_Filter ("iso_code = ?"); |
Country.Find (DB, Query, Found); |
if not Found then |
-- Build a new country object |
Country := AWA.Countries.Models.Null_Country; |
Country.Set_Iso_Code (Value); |
end if; |
Countries.Insert (Value, Country); |
when 2 => |
-- Ada.Text_IO.Put_Line ("ISO3: " & Value); |
null; |
when 3 => |
-- Ada.Text_IO.Put_Line ("ISON: " & Value); |
null; |
when 4 => |
-- Ada.Text_IO.Put_Line ("FIPS: " & Value); |
null; |
-- Country name |
when 5 => |
Country.Set_Name (Value); |
when 6 => |
-- Ada.Text_IO.Put_Line ("Capital: " & Value); |
null; |
when 7 | 8 => -- Area, Population |
null; |
-- Country continent |
when 9 => |
Country.Set_Continent (Value); |
-- Country TLD |
when 10 => |
Country.Set_Tld (Value); |
-- Country CurrencyCode |
when 11 => |
Country.Set_Currency_Code (Value); |
-- Country CurrencyName |
when 12 => |
Country.Set_Currency (Value); |
when 13 | 14 => -- Phone, postal code format |
null; |
when 15 => |
-- Ada.Text_IO.Put_Line ("Postal regex: " & Value); |
null; |
-- Country languages |
when 16 => |
Country.Set_Languages (Value); |
-- Country unique geonameid |
when 17 => |
if Value /= "" then |
Country.Set_Geonameid (Integer'Value (Value)); |
end if; |
when 18 => |
Country.Save (DB); |
Neighbors.Insert (Country.Get_Iso_Code, Value); |
when 19 => -- EquivalentFipsCode |
null; |
when others => |
null; |
end case; |
exception |
when E : others => |
Log.Error ("Column " & Util.Serialize.IO.CSV.Column_Type'Image (Column) |
& " value: " & Value, E, True); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.