Page 1 of 1

query has no destination for result data

Posted: Sat 10 Oct 2009 05:27
by Ariwibawa
Dear Devart,

Is linq support for function that returns void? Or should i download the latest version? Because whenever i run, it always return error "query has no destination for result data".
my current built is 4.55.39

Thanks & Regards,
Ariwibawa

Posted: Wed 14 Oct 2009 04:13
by Ariwibawa
I've tried using version 4.55.44 and it still has that problem.

Posted: Wed 14 Oct 2009 08:55
by AndreyR
Could you please post the script of the function causing the problem?

Posted: Thu 05 Nov 2009 13:45
by Ariwibawa
Hello Andrey,

Sorry for late reply, here's the script

Code: Select all

CREATE TABLE cachesession
(
  cachename character varying(30) NOT NULL,
  createdtime timestamp without time zone NOT NULL,
  createdfor character varying(20) NOT NULL,
  cachedata text,
  cachetype character varying(200) NOT NULL,
  CONSTRAINT "pk_CacheName" PRIMARY KEY (cachename, createdfor)
) 
WITHOUT OIDS;
ALTER TABLE cachesession OWNER TO postgres;



-- Function: cachemanagerset(cname character varying, cfor character varying, ctyped character varying, cdata text)

-- DROP FUNCTION cachemanagerset(cname character varying, cfor character varying, ctyped character varying, cdata text);

CREATE OR REPLACE FUNCTION cachemanagerset(cname character varying, cfor character varying, ctyped character varying, cdata text)
  RETURNS void AS
$BODY$declare counted bigint;
begin
	select counted = count(*) from cachesession where cachename = cname and createdfor = cfor;
	if counted = 0 then
		insert into cachesession (cachename, createdtime, createdfor, cachetype, cachedata)
			values (cname, now(), cfor, ctyped, cdata);
	else
		update cachesession set cachedata = cdata, createdtime = now(), cachetype = ctyped
			where cachename = cname and createdfor = cfor;
	end if;
end;$BODY$
  LANGUAGE 'plpgsql' VOLATILE;
ALTER FUNCTION cachemanagerset(cname character varying, cfor character varying, ctyped character varying, cdata text) OWNER TO postgres;
Thanks & Regards,
Ariwibawa

Posted: Fri 06 Nov 2009 16:27
by Shalex
Could you please try executing this function with another tool (PgAdmin III, etc)? Does it work correctly?
Please post here pure SQL you are using to call this function.

Posted: Mon 09 Nov 2009 12:46
by Ariwibawa
Shalex wrote:Could you please try executing this function with another tool (PgAdmin III, etc)? Does it work correctly?
Please post here pure SQL you are using to call this function.
Dear Shalex,

Please enlight me how to execute this function, because i'm not programmer postgresql. I thought that devart can execute this function corretly.

Thanks & Regards,
Ariwibawa

Posted: Wed 11 Nov 2009 16:13
by Shalex
Function can be executed with the following SQL:

Code: Select all

select cachemanagerset('aa','bb','cc','dd');
The problem is in the body of your function. Please replace this part of your function body:

Code: Select all

   select counted = count(*) from cachesession where cachename = cname and createdfor = cfor;
with the following select statement:

Code: Select all

   select count(*) into counted from cachesession where cachename = cname and createdfor = cfor;
It should work.

Posted: Thu 12 Nov 2009 14:59
by Ariwibawa
Dear Shalex,

Yes it's working now, thanks you very much. I didn't realize the problem was in there. :D

Thanks & Regards,
Ariwibawa