From: | "Philippe Lang" <philippe(dot)lang(at)attiksystem(dot)ch> |
---|---|
To: | <pgsql-odbc(at)postgresql(dot)org> |
Subject: | Dynamic graphics generation inside plperlu query, odbc and MS Access display |
Date: | 2006-07-03 09:44:05 |
Message-ID: | 6C0CF58A187DA5479245E0830AF84F421D0EA8@poweredge.attiksystem.ch |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-odbc |
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 using a "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. Same Problem 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
From | Date | Subject | |
---|---|---|---|
Next Message | noreply | 2006-07-03 10:55:56 | [ psqlodbc-Bugs-1000679 ] UNION select returns wrong column type with ADO (VB6) |
Previous Message | noreply | 2006-07-02 23:06:29 | [ psqlodbc-Bugs-1000678 ] Timeout Not Implemented |