Re: Trouble returning a text field from an SRF
От | Gregory Stark |
---|---|
Тема | Re: Trouble returning a text field from an SRF |
Дата | |
Msg-id | 87k5vbx9ti.fsf@oxford.xeocode.com обсуждение исходный текст |
Ответ на | Re: Trouble returning a text field from an SRF ("Rob Tester" <robtester@gmail.com>) |
Ответы |
Re: Trouble returning a text field from an SRF
|
Список | pgsql-interfaces |
"Rob Tester" <robtester@gmail.com> writes: > textOut=palloc(MIN_SIZE*count); > if (textOut){ > strcpy(textOut,"TEST=>"); > for(pointCnt=0;pointCnt<count;pointCnt++){ > if (pointCnt!=0){ > strcat(wktStr,","); > } > sprintf(buffer,"%4.8lf %4.8lf",0.0,0.0); > strcat(textOut,buffer); > } > strcat(wktStr,"==>END"); Fwiw, this isn't the cause of your 64k limit but if you're processing thousands of data points this way you might consider rewriting it without the strcats. As is it's a O(n^2) algorithm. Each time through the loop it'll have to scan the entire string it already has built up (twice even). Instead just keep a pointer to the end of the string and add your stuff there. You can use strcpy and pass it the pointer to the end, or just call sprintf directly on that pointer. > tuple=heap_formtuple(tupDesc, values, nulls); I'm curious about where you got the tupDesc and what it contains. -- Gregory Stark EnterpriseDB http://www.enterprisedb.com
В списке pgsql-interfaces по дате отправления: