Обсуждение: Dynamic graphics generation inside plperlu query, odbc and MS Access display
Dynamic graphics generation inside plperlu query, odbc and MS Access display
От
"Philippe Lang"
Дата:
Hi, I'm trying to generate an image inside a plperlu function (PG 8.1.4), and to display it in a MS Access form, through ODBC. I'm using the GD library for this. Here is the test code: ---------------------------------------------------------------------------- CREATE OR REPLACE FUNCTION test_gd ( IN a int4, IN b int4, OUT val int4, OUT image bytea ) RETURNS SETOF record AS $$ #---------------------------------------------------------------------------- #-- Configuration des paramètres de la fonction #---------------------------------------------------------------------------- @i = ('a', 'b'); @io = (); @o = ('val','image'); #---------------------------------------------------------------------------- #-- Préparation des paramètres de la fonction #---------------------------------------------------------------------------- &start_sub(@_); #---------------------------------------------------------------------------- #-- Test GD #---------------------------------------------------------------------------- use GD; # create a new image $im = new GD::Image(100,100); # allocate some colors $white = $im->colorAllocate(255,255,255); $black = $im->colorAllocate(0,0,0); # make the background transparent and interlaced $im->transparent($white); # Put a black frame around the picture $im->rectangle(0,0,99,99,$black); # Draw a blue oval $im->arc(50,50,95,75,0,360,$black); # And fill it with red $im->fill(50,50,$black); $output{'image'} = $im->gif; $output{'val'} = $input{'a'} + $input{'b'}; ret(@_); #---------------------------------------------------------------------------- #-- Helper functions #---------------------------------------------------------------------------- end_sub(@_); sub start_sub { init(@_); } sub end_sub { return undef; } sub init { $c = 0; foreach $i (@i) {$input{$i} = @_[$c++]}; foreach $io (@io) {$input{$io} = @_[$c]; $output{$io} = @_[$c++]}; foreach $o (@o) {$output{$o} = @_[$c++]}; } sub ret { while (($key, $value) = each %output) {if (!defined($value)) {elog(ERROR, 'Valeur indéfinie pour ' . $key)}}; return_next \%output; init(@_); } $$ LANGUAGE 'plperlu'; ---------------------------------------------------------------------------- The function looks good. If I run inside pgAdmin: select * from test_gd('7', '3'); I get: val image -------------- 10 GIF89ad The problem is that I'm unable to display anything in a MS Access form, and I'm not quite sure how to do it. I've been usinga "bytea" column type, is that correct? In Ms Access, I've created a pass-through query, linked it to a form with an OLE Dependant Control. But... Nothing. SameProblem id I try wbmp or jpeg images. Does anyone have an idea how to do this? Thanks. Note: I'm using the latest driver: psqlodbc-08_02_0002.zip ---------------------------------- Philippe Lang, Ing. Dipl. EPFL Attik System rte de la Fonderie 2 1700 Fribourg Switzerland http://www.attiksystem.ch Tel: +41 (26) 422 13 75 Fax: +41 (26) 422 13 76
Вложения
Re: Dynamic graphics generation inside plperlu query, odbc and MS Access display
От
Ludek Finstrle
Дата:
> Note: I'm using the latest driver: psqlodbc-08_02_0002.zip Sorry, but this isn't the latest. Please let's try CVS version or compiled version somewhere on Hiroshi pages. You could find the URL in archive or on pgfoundry.org in BiDiMethod bug in MSVS 2005. Regards, Luf
Re: Dynamic graphics generation inside plperlu query, odbc and MS Access display
От
"Philippe Lang"
Дата:
Ludek Finstrle wrote: >> Note: I'm using the latest driver: psqlodbc-08_02_0002.zip > > Sorry, but this isn't the latest. Please let's try CVS > version or compiled version somewhere on Hiroshi pages. You > could find the URL in archive or on pgfoundry.org in BiDiMethod bug > in MSVS 2005. > > Regards, > > Luf Thanks, The URL I found is: http://www.geocities.jp/inocchichichi/psqlodbc/index.html Strange version numbers, though: my version is now: 7.03.02.81. Is that the latest version? Date seems to be OK: 14.07.2006. --------------- Philippe Lang Attik System
Вложения
Re: Dynamic graphics generation inside plperlu query, odbc and MS Access display
От
Ludek Finstrle
Дата:
Mon, Jul 17, 2006 at 11:18:27AM +0200, Philippe Lang wrote: > Ludek Finstrle wrote: > >> Note: I'm using the latest driver: psqlodbc-08_02_0002.zip > > > > Sorry, but this isn't the latest. Please let's try CVS > > version or compiled version somewhere on Hiroshi pages. You > > could find the URL in archive or on pgfoundry.org in BiDiMethod bug > > in MSVS 2005. > > The URL I found is: http://www.geocities.jp/inocchichichi/psqlodbc/index.html It's the right URL. > Strange version numbers, though: my version is now: 7.03.02.81. Hiroshi suggests it. It has a lot of bugfixes. I don't have a clue why Hiroshi use different numbering. > Is that the latest version? Date seems to be OK: 14.07.2006. I think it is the latest. Feel free to try it. Regards, Luf