List views now work
This commit is contained in:
parent
14abdb0dce
commit
6f09c0841c
36 changed files with 407 additions and 316 deletions
|
|
@ -1,7 +1,7 @@
|
|||
------------------------------------------------------------------------
|
||||
-- File queries.sql
|
||||
--
|
||||
-- autogenerated by adl.to-hugsql-queries at 2018-06-14T17:56:42.346Z
|
||||
-- autogenerated by adl.to-hugsql-queries at 2018-06-15T09:22:07.884Z
|
||||
--
|
||||
-- See [Application Description
|
||||
-- Language](https://github.com/simon-brooke/adl).
|
||||
|
|
@ -380,67 +380,71 @@ ORDER BY visits.address_id,
|
|||
|
||||
-- :name list-addresses :? :*
|
||||
-- :doc lists all existing address records
|
||||
SELECT * FROM addresses
|
||||
ORDER BY addresses.address,
|
||||
addresses.postcode,
|
||||
addresses.id
|
||||
SELECT * FROM lv_addresses
|
||||
ORDER BY lv_addresses.address,
|
||||
lv_addresses.postcode,
|
||||
lv_addresses.id
|
||||
--~ (if (:offset params) "OFFSET :offset ")
|
||||
--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
|
||||
|
||||
-- :name list-addresses-by-district :? :*
|
||||
-- :doc lists all existing address records related to a given district
|
||||
SELECT *
|
||||
FROM addresses
|
||||
WHERE addresses.district_id = :id
|
||||
ORDER BY addresses.address,
|
||||
addresses.postcode,
|
||||
addresses.id
|
||||
FROM lv_addresses, addresses
|
||||
WHERE lv_addresses.id = addresses.id
|
||||
AND addresses.district_id = :id
|
||||
ORDER BY lv_addresses.address,
|
||||
lv_addresses.postcode,
|
||||
lv_addresses.id
|
||||
|
||||
-- :name list-authorities :? :*
|
||||
-- :doc lists all existing authority records
|
||||
SELECT * FROM authorities
|
||||
SELECT * FROM lv_authorities
|
||||
--~ (if (:offset params) "OFFSET :offset ")
|
||||
--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
|
||||
|
||||
-- :name list-canvassers :? :*
|
||||
-- :doc lists all existing canvasser records
|
||||
SELECT * FROM canvassers
|
||||
ORDER BY canvassers.username,
|
||||
canvassers.fullname,
|
||||
canvassers.email,
|
||||
canvassers.id
|
||||
SELECT * FROM lv_canvassers
|
||||
ORDER BY lv_canvassers.username,
|
||||
lv_canvassers.fullname,
|
||||
lv_canvassers.email,
|
||||
lv_canvassers.id
|
||||
--~ (if (:offset params) "OFFSET :offset ")
|
||||
--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
|
||||
|
||||
-- :name list-canvassers-by-address :? :*
|
||||
-- :doc lists all existing canvasser records related to a given address
|
||||
SELECT *
|
||||
FROM canvassers
|
||||
WHERE canvassers.address_id = :id
|
||||
ORDER BY canvassers.username,
|
||||
canvassers.fullname,
|
||||
canvassers.email,
|
||||
canvassers.id
|
||||
FROM lv_canvassers, canvassers
|
||||
WHERE lv_canvassers.id = canvassers.id
|
||||
AND canvassers.address_id = :id
|
||||
ORDER BY lv_canvassers.username,
|
||||
lv_canvassers.fullname,
|
||||
lv_canvassers.email,
|
||||
lv_canvassers.id
|
||||
|
||||
-- :name list-canvassers-by-authority :? :*
|
||||
-- :doc lists all existing canvasser records related to a given authority
|
||||
SELECT *
|
||||
FROM canvassers
|
||||
WHERE canvassers.authority_id = :id
|
||||
ORDER BY canvassers.username,
|
||||
canvassers.fullname,
|
||||
canvassers.email,
|
||||
canvassers.id
|
||||
FROM lv_canvassers, canvassers
|
||||
WHERE lv_canvassers.id = canvassers.id
|
||||
AND canvassers.authority_id = :id
|
||||
ORDER BY lv_canvassers.username,
|
||||
lv_canvassers.fullname,
|
||||
lv_canvassers.email,
|
||||
lv_canvassers.id
|
||||
|
||||
-- :name list-canvassers-by-elector :? :*
|
||||
-- :doc lists all existing canvasser records related to a given elector
|
||||
SELECT *
|
||||
FROM canvassers
|
||||
WHERE canvassers.elector_id = :id
|
||||
ORDER BY canvassers.username,
|
||||
canvassers.fullname,
|
||||
canvassers.email,
|
||||
canvassers.id
|
||||
FROM lv_canvassers, canvassers
|
||||
WHERE lv_canvassers.id = canvassers.id
|
||||
AND canvassers.elector_id = :id
|
||||
ORDER BY lv_canvassers.username,
|
||||
lv_canvassers.fullname,
|
||||
lv_canvassers.email,
|
||||
lv_canvassers.id
|
||||
|
||||
-- :name list-canvassers-by-role :? :*
|
||||
-- :doc links all existing canvasser records related to a given role
|
||||
|
|
@ -455,193 +459,205 @@ ORDER BY canvassers.username,
|
|||
|
||||
-- :name list-districts :? :*
|
||||
-- :doc lists all existing district records
|
||||
SELECT * FROM districts
|
||||
ORDER BY districts.name,
|
||||
districts.id
|
||||
SELECT * FROM lv_districts
|
||||
ORDER BY lv_districts.name,
|
||||
lv_districts.id
|
||||
--~ (if (:offset params) "OFFSET :offset ")
|
||||
--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
|
||||
|
||||
-- :name list-dwellings :? :*
|
||||
-- :doc lists all existing dwelling records
|
||||
SELECT * FROM dwellings
|
||||
ORDER BY dwellings.address_id,
|
||||
dwellings.sub-address,
|
||||
dwellings.id
|
||||
SELECT * FROM lv_dwellings
|
||||
ORDER BY lv_dwellings.address_id,
|
||||
lv_dwellings.sub-address,
|
||||
lv_dwellings.id
|
||||
--~ (if (:offset params) "OFFSET :offset ")
|
||||
--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
|
||||
|
||||
-- :name list-dwellings-by-address :? :*
|
||||
-- :doc lists all existing dwelling records related to a given address
|
||||
SELECT *
|
||||
FROM dwellings
|
||||
WHERE dwellings.address_id = :id
|
||||
ORDER BY dwellings.address_id,
|
||||
dwellings.sub-address,
|
||||
dwellings.id
|
||||
FROM lv_dwellings, dwellings
|
||||
WHERE lv_dwellings.id = dwellings.id
|
||||
AND dwellings.address_id = :id
|
||||
ORDER BY lv_dwellings.address_id,
|
||||
lv_dwellings.sub-address,
|
||||
lv_dwellings.id
|
||||
|
||||
-- :name list-electors :? :*
|
||||
-- :doc lists all existing elector records
|
||||
SELECT * FROM electors
|
||||
ORDER BY electors.name,
|
||||
electors.phone,
|
||||
electors.email,
|
||||
electors.gender,
|
||||
electors.id
|
||||
SELECT * FROM lv_electors
|
||||
ORDER BY lv_electors.name,
|
||||
lv_electors.phone,
|
||||
lv_electors.email,
|
||||
lv_electors.gender,
|
||||
lv_electors.id
|
||||
--~ (if (:offset params) "OFFSET :offset ")
|
||||
--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
|
||||
|
||||
-- :name list-electors-by-dwelling :? :*
|
||||
-- :doc lists all existing elector records related to a given dwelling
|
||||
SELECT *
|
||||
FROM electors
|
||||
WHERE electors.dwelling_id = :id
|
||||
ORDER BY electors.name,
|
||||
electors.phone,
|
||||
electors.email,
|
||||
electors.gender,
|
||||
electors.id
|
||||
FROM lv_electors, electors
|
||||
WHERE lv_electors.id = electors.id
|
||||
AND electors.dwelling_id = :id
|
||||
ORDER BY lv_electors.name,
|
||||
lv_electors.phone,
|
||||
lv_electors.email,
|
||||
lv_electors.gender,
|
||||
lv_electors.id
|
||||
|
||||
-- :name list-electors-by-gender :? :*
|
||||
-- :doc lists all existing elector records related to a given gender
|
||||
SELECT *
|
||||
FROM electors
|
||||
WHERE electors.gender = :id
|
||||
ORDER BY electors.name,
|
||||
electors.phone,
|
||||
electors.email,
|
||||
electors.gender,
|
||||
electors.id
|
||||
FROM lv_electors, electors
|
||||
WHERE lv_electors.id = electors.id
|
||||
AND electors.gender = :id
|
||||
ORDER BY lv_electors.name,
|
||||
lv_electors.phone,
|
||||
lv_electors.email,
|
||||
lv_electors.gender,
|
||||
lv_electors.id
|
||||
|
||||
-- :name list-followupactions :? :*
|
||||
-- :doc lists all existing followupaction records
|
||||
SELECT * FROM followupactions
|
||||
ORDER BY followupactions.date,
|
||||
followupactions.notes,
|
||||
followupactions.id
|
||||
SELECT * FROM lv_followupactions
|
||||
ORDER BY lv_followupactions.date,
|
||||
lv_followupactions.notes,
|
||||
lv_followupactions.id
|
||||
--~ (if (:offset params) "OFFSET :offset ")
|
||||
--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
|
||||
|
||||
-- :name list-followupactions-by-canvasser :? :*
|
||||
-- :doc lists all existing followupaction records related to a given canvasser
|
||||
SELECT *
|
||||
FROM followupactions
|
||||
WHERE followupactions.actor = :id
|
||||
ORDER BY followupactions.date,
|
||||
followupactions.notes,
|
||||
followupactions.id
|
||||
FROM lv_followupactions, followupactions
|
||||
WHERE lv_followupactions.id = followupactions.id
|
||||
AND followupactions.actor = :id
|
||||
ORDER BY lv_followupactions.date,
|
||||
lv_followupactions.notes,
|
||||
lv_followupactions.id
|
||||
|
||||
-- :name list-followupactions-by-followuprequest :? :*
|
||||
-- :doc lists all existing followupaction records related to a given followuprequest
|
||||
SELECT *
|
||||
FROM followupactions
|
||||
WHERE followupactions.request_id = :id
|
||||
ORDER BY followupactions.date,
|
||||
followupactions.notes,
|
||||
followupactions.id
|
||||
FROM lv_followupactions, followupactions
|
||||
WHERE lv_followupactions.id = followupactions.id
|
||||
AND followupactions.request_id = :id
|
||||
ORDER BY lv_followupactions.date,
|
||||
lv_followupactions.notes,
|
||||
lv_followupactions.id
|
||||
|
||||
-- :name list-followupmethods :? :*
|
||||
-- :doc lists all existing followupmethod records
|
||||
SELECT * FROM followupmethods
|
||||
SELECT * FROM lv_followupmethods
|
||||
--~ (if (:offset params) "OFFSET :offset ")
|
||||
--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
|
||||
|
||||
-- :name list-followuprequests :? :*
|
||||
-- :doc lists all existing followuprequest records
|
||||
SELECT * FROM followuprequests
|
||||
ORDER BY followuprequests.elector_id,
|
||||
followuprequests.visit_id,
|
||||
followuprequests.issue_id,
|
||||
followuprequests.id
|
||||
SELECT * FROM lv_followuprequests
|
||||
ORDER BY lv_followuprequests.elector_id,
|
||||
lv_followuprequests.visit_id,
|
||||
lv_followuprequests.issue_id,
|
||||
lv_followuprequests.id
|
||||
--~ (if (:offset params) "OFFSET :offset ")
|
||||
--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
|
||||
|
||||
-- :name list-followuprequests-by-elector :? :*
|
||||
-- :doc lists all existing followuprequest records related to a given elector
|
||||
SELECT *
|
||||
FROM followuprequests
|
||||
WHERE followuprequests.elector_id = :id
|
||||
ORDER BY followuprequests.elector_id,
|
||||
followuprequests.visit_id,
|
||||
followuprequests.issue_id,
|
||||
followuprequests.id
|
||||
FROM lv_followuprequests, followuprequests
|
||||
WHERE lv_followuprequests.id = followuprequests.id
|
||||
AND followuprequests.elector_id = :id
|
||||
ORDER BY lv_followuprequests.elector_id,
|
||||
lv_followuprequests.visit_id,
|
||||
lv_followuprequests.issue_id,
|
||||
lv_followuprequests.id
|
||||
|
||||
-- :name list-followuprequests-by-followupmethod :? :*
|
||||
-- :doc lists all existing followuprequest records related to a given followupmethod
|
||||
SELECT *
|
||||
FROM followuprequests
|
||||
WHERE followuprequests.method_id = :id
|
||||
ORDER BY followuprequests.elector_id,
|
||||
followuprequests.visit_id,
|
||||
followuprequests.issue_id,
|
||||
followuprequests.id
|
||||
FROM lv_followuprequests, followuprequests
|
||||
WHERE lv_followuprequests.id = followuprequests.id
|
||||
AND followuprequests.method_id = :id
|
||||
ORDER BY lv_followuprequests.elector_id,
|
||||
lv_followuprequests.visit_id,
|
||||
lv_followuprequests.issue_id,
|
||||
lv_followuprequests.id
|
||||
|
||||
-- :name list-followuprequests-by-issue :? :*
|
||||
-- :doc lists all existing followuprequest records related to a given issue
|
||||
SELECT *
|
||||
FROM followuprequests
|
||||
WHERE followuprequests.issue_id = :id
|
||||
ORDER BY followuprequests.elector_id,
|
||||
followuprequests.visit_id,
|
||||
followuprequests.issue_id,
|
||||
followuprequests.id
|
||||
FROM lv_followuprequests, followuprequests
|
||||
WHERE lv_followuprequests.id = followuprequests.id
|
||||
AND followuprequests.issue_id = :id
|
||||
ORDER BY lv_followuprequests.elector_id,
|
||||
lv_followuprequests.visit_id,
|
||||
lv_followuprequests.issue_id,
|
||||
lv_followuprequests.id
|
||||
|
||||
-- :name list-followuprequests-by-visit :? :*
|
||||
-- :doc lists all existing followuprequest records related to a given visit
|
||||
SELECT *
|
||||
FROM followuprequests
|
||||
WHERE followuprequests.visit_id = :id
|
||||
ORDER BY followuprequests.elector_id,
|
||||
followuprequests.visit_id,
|
||||
followuprequests.issue_id,
|
||||
followuprequests.id
|
||||
FROM lv_followuprequests, followuprequests
|
||||
WHERE lv_followuprequests.id = followuprequests.id
|
||||
AND followuprequests.visit_id = :id
|
||||
ORDER BY lv_followuprequests.elector_id,
|
||||
lv_followuprequests.visit_id,
|
||||
lv_followuprequests.issue_id,
|
||||
lv_followuprequests.id
|
||||
|
||||
-- :name list-genders :? :*
|
||||
-- :doc lists all existing gender records
|
||||
SELECT * FROM genders
|
||||
SELECT * FROM lv_genders
|
||||
--~ (if (:offset params) "OFFSET :offset ")
|
||||
--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
|
||||
|
||||
-- :name list-intentions :? :*
|
||||
-- :doc lists all existing intention records
|
||||
SELECT * FROM intentions
|
||||
SELECT * FROM lv_intentions
|
||||
--~ (if (:offset params) "OFFSET :offset ")
|
||||
--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
|
||||
|
||||
-- :name list-intentions-by-elector :? :*
|
||||
-- :doc lists all existing intention records related to a given elector
|
||||
SELECT *
|
||||
FROM intentions
|
||||
WHERE intentions.elector_id = :id
|
||||
FROM lv_intentions, intentions
|
||||
WHERE lv_intentions.Id = intentions.Id
|
||||
AND intentions.elector_id = :id
|
||||
|
||||
-- :name list-intentions-by-option :? :*
|
||||
-- :doc lists all existing intention records related to a given option
|
||||
SELECT *
|
||||
FROM intentions
|
||||
WHERE intentions.option_id = :id
|
||||
FROM lv_intentions, intentions
|
||||
WHERE lv_intentions.Id = intentions.Id
|
||||
AND intentions.option_id = :id
|
||||
|
||||
-- :name list-intentions-by-visit :? :*
|
||||
-- :doc lists all existing intention records related to a given visit
|
||||
SELECT *
|
||||
FROM intentions
|
||||
WHERE intentions.visit_id = :id
|
||||
FROM lv_intentions, intentions
|
||||
WHERE lv_intentions.Id = intentions.Id
|
||||
AND intentions.visit_id = :id
|
||||
|
||||
-- :name list-issues :? :*
|
||||
-- :doc lists all existing issue records
|
||||
SELECT * FROM issues
|
||||
SELECT * FROM lv_issues
|
||||
--~ (if (:offset params) "OFFSET :offset ")
|
||||
--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
|
||||
|
||||
-- :name list-options :? :*
|
||||
-- :doc lists all existing option records
|
||||
SELECT * FROM options
|
||||
SELECT * FROM lv_options
|
||||
--~ (if (:offset params) "OFFSET :offset ")
|
||||
--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
|
||||
|
||||
-- :name list-roles :? :*
|
||||
-- :doc lists all existing role records
|
||||
SELECT * FROM roles
|
||||
ORDER BY roles.name,
|
||||
roles.id
|
||||
SELECT * FROM lv_roles
|
||||
ORDER BY lv_roles.name,
|
||||
lv_roles.id
|
||||
--~ (if (:offset params) "OFFSET :offset ")
|
||||
--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
|
||||
|
||||
|
|
@ -656,9 +672,9 @@ ORDER BY roles.name,
|
|||
|
||||
-- :name list-teams :? :*
|
||||
-- :doc lists all existing team records
|
||||
SELECT * FROM teams
|
||||
ORDER BY teams.name,
|
||||
teams.id
|
||||
SELECT * FROM lv_teams
|
||||
ORDER BY lv_teams.name,
|
||||
lv_teams.id
|
||||
--~ (if (:offset params) "OFFSET :offset ")
|
||||
--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
|
||||
|
||||
|
|
@ -674,198 +690,201 @@ ORDER BY teams.name,
|
|||
-- :name list-teams-by-district :? :*
|
||||
-- :doc lists all existing team records related to a given district
|
||||
SELECT *
|
||||
FROM teams
|
||||
WHERE teams.district_id = :id
|
||||
ORDER BY teams.name,
|
||||
teams.id
|
||||
FROM lv_teams, teams
|
||||
WHERE lv_teams.id = teams.id
|
||||
AND teams.district_id = :id
|
||||
ORDER BY lv_teams.name,
|
||||
lv_teams.id
|
||||
|
||||
-- :name list-visits :? :*
|
||||
-- :doc lists all existing visit records
|
||||
SELECT * FROM visits
|
||||
ORDER BY visits.address_id,
|
||||
visits.date,
|
||||
visits.id
|
||||
SELECT * FROM lv_visits
|
||||
ORDER BY lv_visits.address_id,
|
||||
lv_visits.date,
|
||||
lv_visits.id
|
||||
--~ (if (:offset params) "OFFSET :offset ")
|
||||
--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
|
||||
|
||||
-- :name list-visits-by-address :? :*
|
||||
-- :doc lists all existing visit records related to a given address
|
||||
SELECT *
|
||||
FROM visits
|
||||
WHERE visits.address_id = :id
|
||||
ORDER BY visits.address_id,
|
||||
visits.date,
|
||||
visits.id
|
||||
FROM lv_visits, visits
|
||||
WHERE lv_visits.id = visits.id
|
||||
AND visits.address_id = :id
|
||||
ORDER BY lv_visits.address_id,
|
||||
lv_visits.date,
|
||||
lv_visits.id
|
||||
|
||||
-- :name list-visits-by-canvasser :? :*
|
||||
-- :doc lists all existing visit records related to a given canvasser
|
||||
SELECT *
|
||||
FROM visits
|
||||
WHERE visits.canvasser_id = :id
|
||||
ORDER BY visits.address_id,
|
||||
visits.date,
|
||||
visits.id
|
||||
FROM lv_visits, visits
|
||||
WHERE lv_visits.id = visits.id
|
||||
AND visits.canvasser_id = :id
|
||||
ORDER BY lv_visits.address_id,
|
||||
lv_visits.date,
|
||||
lv_visits.id
|
||||
|
||||
-- :name search-strings-address :? :1
|
||||
-- :doc selects existing address records having any string field matching `:pattern` by substring match
|
||||
SELECT * FROM addresses
|
||||
-- :doc selects existing address records having any string field matching the parameter of the same name by substring match
|
||||
SELECT * FROM lv_addresses
|
||||
WHERE
|
||||
address LIKE '%:pattern%'
|
||||
OR phone LIKE '%:pattern%'
|
||||
ORDER BY addresses.address,
|
||||
addresses.postcode,
|
||||
addresses.id
|
||||
address LIKE '%params.address%'
|
||||
OR phone LIKE '%params.phone%'
|
||||
ORDER BY lv_addresses.address,
|
||||
lv_addresses.postcode,
|
||||
lv_addresses.id
|
||||
--~ (if (:offset params) "OFFSET :offset ")
|
||||
--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
|
||||
|
||||
-- :name search-strings-authority :? :1
|
||||
-- :doc selects existing authority records having any string field matching `:pattern` by substring match
|
||||
SELECT * FROM authorities
|
||||
-- :doc selects existing authority records having any string field matching the parameter of the same name by substring match
|
||||
SELECT * FROM lv_authorities
|
||||
WHERE
|
||||
id LIKE '%:pattern%'
|
||||
id LIKE '%params.id%'
|
||||
--~ (if (:offset params) "OFFSET :offset ")
|
||||
--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
|
||||
|
||||
-- :name search-strings-canvasser :? :1
|
||||
-- :doc selects existing canvasser records having any string field matching `:pattern` by substring match
|
||||
SELECT * FROM canvassers
|
||||
-- :doc selects existing canvasser records having any string field matching the parameter of the same name by substring match
|
||||
SELECT * FROM lv_canvassers
|
||||
WHERE
|
||||
username LIKE '%:pattern%'
|
||||
OR fullname LIKE '%:pattern%'
|
||||
OR phone LIKE '%:pattern%'
|
||||
OR email LIKE '%:pattern%'
|
||||
ORDER BY canvassers.username,
|
||||
canvassers.fullname,
|
||||
canvassers.email,
|
||||
canvassers.id
|
||||
username LIKE '%params.username%'
|
||||
OR fullname LIKE '%params.fullname%'
|
||||
OR phone LIKE '%params.phone%'
|
||||
OR email LIKE '%params.email%'
|
||||
ORDER BY lv_canvassers.username,
|
||||
lv_canvassers.fullname,
|
||||
lv_canvassers.email,
|
||||
lv_canvassers.id
|
||||
--~ (if (:offset params) "OFFSET :offset ")
|
||||
--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
|
||||
|
||||
-- :name search-strings-district :? :1
|
||||
-- :doc selects existing district records having any string field matching `:pattern` by substring match
|
||||
SELECT * FROM districts
|
||||
-- :doc selects existing district records having any string field matching the parameter of the same name by substring match
|
||||
SELECT * FROM lv_districts
|
||||
WHERE
|
||||
name LIKE '%:pattern%'
|
||||
ORDER BY districts.name,
|
||||
districts.id
|
||||
name LIKE '%params.name%'
|
||||
ORDER BY lv_districts.name,
|
||||
lv_districts.id
|
||||
--~ (if (:offset params) "OFFSET :offset ")
|
||||
--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
|
||||
|
||||
-- :name search-strings-dwelling :? :1
|
||||
-- :doc selects existing dwelling records having any string field matching `:pattern` by substring match
|
||||
SELECT * FROM dwellings
|
||||
-- :doc selects existing dwelling records having any string field matching the parameter of the same name by substring match
|
||||
SELECT * FROM lv_dwellings
|
||||
WHERE
|
||||
sub-address LIKE '%:pattern%'
|
||||
ORDER BY dwellings.address_id,
|
||||
dwellings.sub-address,
|
||||
dwellings.id
|
||||
sub-address LIKE '%params.sub-address%'
|
||||
ORDER BY lv_dwellings.address_id,
|
||||
lv_dwellings.sub-address,
|
||||
lv_dwellings.id
|
||||
--~ (if (:offset params) "OFFSET :offset ")
|
||||
--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
|
||||
|
||||
-- :name search-strings-elector :? :1
|
||||
-- :doc selects existing elector records having any string field matching `:pattern` by substring match
|
||||
SELECT * FROM electors
|
||||
-- :doc selects existing elector records having any string field matching the parameter of the same name by substring match
|
||||
SELECT * FROM lv_electors
|
||||
WHERE
|
||||
name LIKE '%:pattern%'
|
||||
OR phone LIKE '%:pattern%'
|
||||
OR email LIKE '%:pattern%'
|
||||
ORDER BY electors.name,
|
||||
electors.phone,
|
||||
electors.email,
|
||||
electors.gender,
|
||||
electors.id
|
||||
name LIKE '%params.name%'
|
||||
OR phone LIKE '%params.phone%'
|
||||
OR email LIKE '%params.email%'
|
||||
ORDER BY lv_electors.name,
|
||||
lv_electors.phone,
|
||||
lv_electors.email,
|
||||
lv_electors.gender,
|
||||
lv_electors.id
|
||||
--~ (if (:offset params) "OFFSET :offset ")
|
||||
--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
|
||||
|
||||
-- :name search-strings-followupaction :? :1
|
||||
-- :doc selects existing followupaction records having any string field matching `:pattern` by substring match
|
||||
SELECT * FROM followupactions
|
||||
-- :doc selects existing followupaction records having any string field matching the parameter of the same name by substring match
|
||||
SELECT * FROM lv_followupactions
|
||||
WHERE
|
||||
notes LIKE '%:pattern%'
|
||||
ORDER BY followupactions.date,
|
||||
followupactions.notes,
|
||||
followupactions.id
|
||||
notes LIKE '%params.notes%'
|
||||
ORDER BY lv_followupactions.date,
|
||||
lv_followupactions.notes,
|
||||
lv_followupactions.id
|
||||
--~ (if (:offset params) "OFFSET :offset ")
|
||||
--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
|
||||
|
||||
-- :name search-strings-followupmethod :? :1
|
||||
-- :doc selects existing followupmethod records having any string field matching `:pattern` by substring match
|
||||
SELECT * FROM followupmethods
|
||||
-- :doc selects existing followupmethod records having any string field matching the parameter of the same name by substring match
|
||||
SELECT * FROM lv_followupmethods
|
||||
WHERE
|
||||
id LIKE '%:pattern%'
|
||||
id LIKE '%params.id%'
|
||||
--~ (if (:offset params) "OFFSET :offset ")
|
||||
--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
|
||||
|
||||
-- :name search-strings-followuprequest :? :1
|
||||
-- :doc selects existing followuprequest records having any string field matching `:pattern` by substring match
|
||||
SELECT * FROM followuprequests
|
||||
-- :doc selects existing followuprequest records having any string field matching the parameter of the same name by substring match
|
||||
SELECT * FROM lv_followuprequests
|
||||
WHERE
|
||||
ORDER BY followuprequests.elector_id,
|
||||
followuprequests.visit_id,
|
||||
followuprequests.issue_id,
|
||||
followuprequests.id
|
||||
ORDER BY lv_followuprequests.elector_id,
|
||||
lv_followuprequests.visit_id,
|
||||
lv_followuprequests.issue_id,
|
||||
lv_followuprequests.id
|
||||
--~ (if (:offset params) "OFFSET :offset ")
|
||||
--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
|
||||
|
||||
-- :name search-strings-gender :? :1
|
||||
-- :doc selects existing gender records having any string field matching `:pattern` by substring match
|
||||
SELECT * FROM genders
|
||||
-- :doc selects existing gender records having any string field matching the parameter of the same name by substring match
|
||||
SELECT * FROM lv_genders
|
||||
WHERE
|
||||
id LIKE '%:pattern%'
|
||||
id LIKE '%params.id%'
|
||||
--~ (if (:offset params) "OFFSET :offset ")
|
||||
--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
|
||||
|
||||
-- :name search-strings-intention :? :1
|
||||
-- :doc selects existing intention records having any string field matching `:pattern` by substring match
|
||||
SELECT * FROM intentions
|
||||
-- :doc selects existing intention records having any string field matching the parameter of the same name by substring match
|
||||
SELECT * FROM lv_intentions
|
||||
WHERE
|
||||
--~ (if (:offset params) "OFFSET :offset ")
|
||||
--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
|
||||
|
||||
-- :name search-strings-issue :? :1
|
||||
-- :doc selects existing issue records having any string field matching `:pattern` by substring match
|
||||
SELECT * FROM issues
|
||||
-- :doc selects existing issue records having any string field matching the parameter of the same name by substring match
|
||||
SELECT * FROM lv_issues
|
||||
WHERE
|
||||
url LIKE '%:pattern%'
|
||||
OR id LIKE '%:pattern%'
|
||||
url LIKE '%params.url%'
|
||||
OR id LIKE '%params.id%'
|
||||
--~ (if (:offset params) "OFFSET :offset ")
|
||||
--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
|
||||
|
||||
-- :name search-strings-option :? :1
|
||||
-- :doc selects existing option records having any string field matching `:pattern` by substring match
|
||||
SELECT * FROM options
|
||||
-- :doc selects existing option records having any string field matching the parameter of the same name by substring match
|
||||
SELECT * FROM lv_options
|
||||
WHERE
|
||||
id LIKE '%:pattern%'
|
||||
id LIKE '%params.id%'
|
||||
--~ (if (:offset params) "OFFSET :offset ")
|
||||
--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
|
||||
|
||||
-- :name search-strings-role :? :1
|
||||
-- :doc selects existing role records having any string field matching `:pattern` by substring match
|
||||
SELECT * FROM roles
|
||||
-- :doc selects existing role records having any string field matching the parameter of the same name by substring match
|
||||
SELECT * FROM lv_roles
|
||||
WHERE
|
||||
name LIKE '%:pattern%'
|
||||
ORDER BY roles.name,
|
||||
roles.id
|
||||
name LIKE '%params.name%'
|
||||
ORDER BY lv_roles.name,
|
||||
lv_roles.id
|
||||
--~ (if (:offset params) "OFFSET :offset ")
|
||||
--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
|
||||
|
||||
-- :name search-strings-team :? :1
|
||||
-- :doc selects existing team records having any string field matching `:pattern` by substring match
|
||||
SELECT * FROM teams
|
||||
-- :doc selects existing team records having any string field matching the parameter of the same name by substring match
|
||||
SELECT * FROM lv_teams
|
||||
WHERE
|
||||
name LIKE '%:pattern%'
|
||||
ORDER BY teams.name,
|
||||
teams.id
|
||||
name LIKE '%params.name%'
|
||||
ORDER BY lv_teams.name,
|
||||
lv_teams.id
|
||||
--~ (if (:offset params) "OFFSET :offset ")
|
||||
--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
|
||||
|
||||
-- :name search-strings-visit :? :1
|
||||
-- :doc selects existing visit records having any string field matching `:pattern` by substring match
|
||||
SELECT * FROM visits
|
||||
-- :doc selects existing visit records having any string field matching the parameter of the same name by substring match
|
||||
SELECT * FROM lv_visits
|
||||
WHERE
|
||||
ORDER BY visits.address_id,
|
||||
visits.date,
|
||||
visits.id
|
||||
ORDER BY lv_visits.address_id,
|
||||
lv_visits.date,
|
||||
lv_visits.id
|
||||
--~ (if (:offset params) "OFFSET :offset ")
|
||||
--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue