Re: return values(table) from stored function from MS visual foxpro
| От | Ilija Vidoevski |
|---|---|
| Тема | Re: return values(table) from stored function from MS visual foxpro |
| Дата | |
| Msg-id | 1337942989.93449.YahooMailNeo@web113114.mail.gq1.yahoo.com обсуждение исходный текст |
| Ответ на | Re: return values(table) from stored function from MS visual foxpro (Willy-Bas Loos <willybas@gmail.com>) |
| Ответы |
Re: return values(table) from stored function from MS visual foxpro
|
| Список | pgsql-novice |
Thank's WBL
I change table structure and input parametars, but the problem still exist.
When I sent SQL script from Foxpro side, result data types are OK. Strange!
It is not problem to fix this on Foxpro side, but many times thousands of rows are returned from server.
I want almost everything to do on server side.
I try within same function to create temp table on server side and alter fields structure, but nothig is changed.
Maybe this is ODBC problem ?
Ilija
From: Willy-Bas Loos <willybas@gmail.com>
To: Ilija Vidoevski <ilija.vidoevski@yahoo.com>
Cc: "pgsql-novice@postgresql.org" <pgsql-novice@postgresql.org>
Sent: Friday, May 25, 2012 10:41 AM
Subject: Re: [NOVICE] return values(table) from stored function from MS visual foxpro
To: Ilija Vidoevski <ilija.vidoevski@yahoo.com>
Cc: "pgsql-novice@postgresql.org" <pgsql-novice@postgresql.org>
Sent: Friday, May 25, 2012 10:41 AM
Subject: Re: [NOVICE] return values(table) from stored function from MS visual foxpro
The result data type is not related to your existing table. You're using the datatype char for both result columns.
That type is padded with spaces.
I would always advise to use varchar(n) or "text" unless you need the result to be exacly some length, like 254.
However you seem to be using numbers, why don't you use the "integer" data type?
http://www.postgresql.org/docs/9.1/static/datatype.html
HTH
WBL
--
"Quality comes from focus and clarity of purpose" -- Mark Shuttleworth
That type is padded with spaces.
I would always advise to use varchar(n) or "text" unless you need the result to be exacly some length, like 254.
However you seem to be using numbers, why don't you use the "integer" data type?
http://www.postgresql.org/docs/9.1/static/datatype.html
HTH
WBL
On Thu, May 24, 2012 at 12:48 PM, Ilija Vidoevski <ilija.vidoevski@yahoo.com> wrote:
I want to migrate from MS Sqlserver 2008 r2 express to PostgresqlI use postgresql 9.1.3I create this stored function (on Postgres side)CREATE OR REPLACE FUNCTION public.a_getkonta_table (mkontoa char,mkontob char)RETURNS TABLE (kontochar,naziv char) AS$body$beginreturn querySELECTkonta.konto,konta.nazivFROM kontaWHERE konta.konto between mkontoa and mkontob;end ;$body$LANGUAGE 'plpgsql'VOLATILECALLED ON NULL INPUTSECURITY INVOKERCOST 100 ROWS 1000;I call this function with this code (from Microsoft VisualFoxPro side)mkontoa = '000000000'mkontob = '099999999'If SQLExec(handle,"select * from a_getkonta_table(?mkontoa,?mkontob)",'temp101') < 0Aerror(laError)Messagebox(laError[1,2])returnENDIFReturned result set contains correct row numbers but fields length is 254.Structure of table konta isKonto char(9)Naziv char(45)I use this connection string:Connstr="DRIVER={PostgreSQL odbc driver(unicode)};server=localhost;Port=5432;Database=mydatabase; Uid=postgres;Pwd=mypwd; UseServerSidePrepare=1;MaxVarcharSize=254;UnknownsAsLongVarchar=0;TextAsLongVarchar=0;"OS Window 7 profesionalAny solutions ?
--
"Quality comes from focus and clarity of purpose" -- Mark Shuttleworth
В списке pgsql-novice по дате отправления: