Search Postgresql Archives

Re: SPI_execute_plan and vardata

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



=?UTF-8?B?0JDRgNGB0LXQvSDQkNGA0YPRgtGO0L3Rj9C9?= <arutar@xxxxx> writes:
> Datum Values[2];

> Values[0]-is integer type 
> but Values[1] is string type so 

> Values[0] = SET_4_BYTES(227);

This is really bad practice.  It might accidentally work, but the
right way to do it is more like

	Values[0] = Int32GetDatum(227);

or possibly Int64GetDatum if you're thinking of bigint rather than int4.

> please assist how can i convert som char* string to Datum

You're not being too clear about which "string type" you have in mind,
but if it's text, good practice would be

	Values[1] = CStringGetTextDatum(char-*-ptr);

			regards, tom lane


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux