diff options
author | Birte Kristina Friesel <derf@finalrewind.org> | 2023-08-26 09:17:28 +0200 |
---|---|---|
committer | Birte Kristina Friesel <derf@finalrewind.org> | 2023-08-26 09:17:28 +0200 |
commit | f4d71b4d9fb4191c07a9c200d32626175568b4fa (patch) | |
tree | 1903cec1805df51d9b2d9d08e00e7f0a708e04be /lib/Travelynx/Model | |
parent | 559a1cedd7814d101743f718f1db2760338ab51f (diff) |
obtain autocompletion from database2.1.1
Diffstat (limited to 'lib/Travelynx/Model')
-rw-r--r-- | lib/Travelynx/Model/Stations.pm | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/Travelynx/Model/Stations.pm b/lib/Travelynx/Model/Stations.pm index 75b4174..ecd8adb 100644 --- a/lib/Travelynx/Model/Stations.pm +++ b/lib/Travelynx/Model/Stations.pm @@ -50,6 +50,19 @@ sub add_or_update { ); } +sub get_for_autocomplete { + my ($self) = @_; + + my $res = $self->{pg}->db->select( 'stations', ['name'] ); + my %ret; + + while ( my $row = $res->hash ) { + $ret{ $row->{name} } = undef; + } + + return \%ret; +} + # Fast sub get_by_eva { my ( $self, $eva, %opt ) = @_; |