query has no destination for result data

query has no destination for result data

Postby Ariwibawa » Sat 10 Oct 2009 05:27

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
Ariwibawa
 
Posts: 12
Joined: Sun 16 Aug 2009 14:18
Location: Indonesia

Postby Ariwibawa » Wed 14 Oct 2009 04:13

I've tried using version 4.55.44 and it still has that problem.
Ariwibawa
 
Posts: 12
Joined: Sun 16 Aug 2009 14:18
Location: Indonesia

Postby AndreyR » Wed 14 Oct 2009 08:55

Could you please post the script of the function causing the problem?
AndreyR
Devart Team
 
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Postby Ariwibawa » Thu 05 Nov 2009 13:45

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
Ariwibawa
 
Posts: 12
Joined: Sun 16 Aug 2009 14:18
Location: Indonesia

Postby Shalex » Fri 06 Nov 2009 16:27

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.
Shalex
Devart Team
 
Posts: 7654
Joined: Thu 14 Aug 2008 12:44

Postby Ariwibawa » Mon 09 Nov 2009 12:46

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
Ariwibawa
 
Posts: 12
Joined: Sun 16 Aug 2009 14:18
Location: Indonesia

Postby Shalex » Wed 11 Nov 2009 16:13

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.
Shalex
Devart Team
 
Posts: 7654
Joined: Thu 14 Aug 2008 12:44

Postby Ariwibawa » Thu 12 Nov 2009 14:59

Dear Shalex,

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

Thanks & Regards,
Ariwibawa
Ariwibawa
 
Posts: 12
Joined: Sun 16 Aug 2009 14:18
Location: Indonesia


Return to dotConnect for PostgreSQL