in reply to I dont understand what it is doing....

Just from looking at it,

It's giving a syntax error because "test:query" is missing a ":".

It's giving a syntax error because the substitution isn't terminated. (s/'/'';s/'/''/g;???)

It's giving a warning because the function has a prototype and a call to it was encountered before its declaration was encountered.