How to use mysql function to insert data -


i've created mysql function:

delimiter $$ use `local_sysdb`$$ create function  `addpost` (     postsource char(20),     hashtagid int,     coordinateslat float,     coordinateslon float,     created int(20) unsigned,     filterlevel varchar(45),     postid char(20),     postlanguage char(11),     profanity tinyint(1),     retweeted tinyint(1),     posttext text,     truncated tinyint(1),     userid int(10),     username char(15),     userfullname char(20),     media varchar(255),     mediatype1 char(5),     media1 varchar(255),     mediatype2 char(5),     media2 varchar(255),     mediatype3 char(5),     media3 varchar(255),     mediatype4 char(5),     media4 varchar(255),     filter varchar(45),     urltopost varchar(225),     channeltitle varchar(225),     channelid char(30),     category int(11) ) returns text language sql deterministic begin      if(inhashtagcampaign(hashtagid,created,postsource))         case postsource             when 'twitter'                 insert `posts_twitter` (                     `hashtagid`,                     `coordinates`,                     `created`,                     `filterlevel`,                     `postid`,                     `language`,                     `profanity`,                     `retweeted`,                     `text`,                     `truncated`,                     `userid`,                     `username`,                     `userfullname`,                     `media`,                     `mediatype1`,                     `media1`,                     `mediatype2`,                     `media2`,                     `mediatype3`,                     `media3`,                     `mediatype4`,                     `media4`                 )                 values (                     hashtagid,                     point(coordinateslat,coordinateslon),                     created,                     filterlevel,                     postid,                     postlanguage,                     profanity,                     retweeted,                     posttext,                     truncated,                     userid,                     username,                     userfullname,                     coalesce(media1,media2,media3,media4),                     mediatype1,                     media1,                     mediatype2,                     media2,                     mediatype3,                     media3,                     mediatype4,                     media4                 )                 on duplicate key update `hashtagid` = `hashtagid`;             else                 return false;         end case;     end if;     return returnval; end;$$  delimiter ; show warnings; 

i added function mysql , i'm trying call function this:

addpost(     'twitter',     11,     null,     null,     now(),     'none',     'postid4t3443535',     'en',     0,     0,     'demo tekst blaat',     0,     34579345739254,     'demo account',     'demo_account',     null,     null,     null,     null,     null,     null,     null,     null,     null,     null,     null,     null,     null,     null ) 

but i'm getting error:

#1064 - have error in sql syntax; check manual corresponds mysql server version right syntax use near 'addpost( 'twitter', 11, null, null, now(), 'none', 'posti' @ line 1

is possible call mysql function that? function inhashtagcampaign exist, don't think relevant question didn't add code of function here.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -