Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change to https, fix schema mis-match #67

Open
wants to merge 6 commits into
base: gh-pages
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions cartoDB_functions/insert_function.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,26 @@ DROP FUNCTION IF EXISTS insert_bikeways_data(text,text,text,text);

CREATE OR REPLACE FUNCTION insert_bikeways_data (
_geojson TEXT,
_notes TEXT,
_description TEXT,
_name TEXT,
_zip TEXT)
--Has to return something in order to be used in a "SELECT" statement
RETURNS integer
AS $$
DECLARE
DECLARE
_the_geom GEOMETRY;
BEGIN
--Convert the GeoJSON to a geometry type for insertion.
_the_geom := ST_SetSRID(ST_GeomFromGeoJSON(_geojson),4326);
--Convert the GeoJSON to a geometry type for insertion.
_the_geom := ST_SetSRID(ST_GeomFromGeoJSON(_geojson),4326);

EXECUTE ' INSERT INTO bikeways (the_geom, notes, name, zipcode)
EXECUTE ' INSERT INTO bikeways (the_geom, description, name, zipcode)
VALUES ($1, $2, $3, $4)
' USING _the_geom, _notes, _name, _zip;
' USING _the_geom, _description, _name, _zip;

RETURN 1;
END;
$$
LANGUAGE plpgsql SECURITY DEFINER ;

--Grant access to the public user
GRANT EXECUTE ON FUNCTION insert_bikeways_data(text,text,text,text) TO publicuser;
GRANT EXECUTE ON FUNCTION insert_bikeways_data(text,text,text,text) TO publicuser;
Loading