Re: [Firebird-devel] Handling FbException

2019-09-11 Thread Dimitry Sibiryakov
11.09.2019 15:48, Alex Peshkoff via Firebird-devel wrote: if you mean getParam(n) together with getNumberOfParams() - I tend to agree. I see no need in getNumberOfParams, but may be someone does. I'm afraid that getting data by attribute like 'name of failed FK' is close to AI task. If we ex

Re: [Firebird-devel] Handling FbException

2019-09-11 Thread Alex Peshkoff via Firebird-devel
On 11.09.2019 16:19, Dimitry Sibiryakov wrote: 11.09.2019 15:05, Alex Peshkoff via Firebird-devel wrote: One more related idea - return text in firebird-allocated buffer which is later released by explicit cliens call. The main visible disadvantage is possible deadlock when error is OOM.   If

Re: [Firebird-devel] Handling FbException

2019-09-11 Thread Alex Peshkoff via Firebird-devel
On 11.09.2019 12:59, Dimitry Sibiryakov wrote: 11.09.2019 9:13, Alex Peshkoff via Firebird-devel wrote: No other method - but if you have reasonable suggestion we will be happy to implement it. Just an idea - language details are not needed.   How about an iterator on error lines? It could hav

Re: [Firebird-devel] Handling FbException

2019-09-11 Thread Alex Peshkoff via Firebird-devel
On 11.09.2019 16:07, Jiří Činčura wrote: No - at least in advance. What can be done is request to calculate it. Is that in API today? No. Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel

Re: [Firebird-devel] Handling FbException

2019-09-11 Thread Dimitry Sibiryakov
11.09.2019 15:05, Alex Peshkoff via Firebird-devel wrote: One more related idea - return text in firebird-allocated buffer which is later released by explicit cliens call. The main visible disadvantage is possible deadlock when error is OOM. If you return not plain pointer but a smart one yo

Re: [Firebird-devel] Handling FbException

2019-09-11 Thread Jiří Činčura
> No - at least in advance. What can be done is request to calculate it. Is that in API today? -- Mgr. Jiří Činčura https://www.tabsoverspaces.com/ Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel

Re: [Firebird-devel] Handling FbException

2019-09-11 Thread Alex Peshkoff via Firebird-devel
On 11.09.2019 11:32, Jiří Činčura wrote: No other method - but if you have reasonable suggestion we will be happy to implement it. Just an idea - language details are not needed. Is the size of the message known? No - at least in advance. What can be done is request to calculate it. That wou

Re: [Firebird-devel] Handling FbException

2019-09-11 Thread Dimitry Sibiryakov
11.09.2019 9:13, Alex Peshkoff via Firebird-devel wrote: No other method - but if you have reasonable suggestion we will be happy to implement it. Just an idea - language details are not needed. How about an iterator on error lines? It could have methods like getGdsCode(), getLine(), getPara

Re: [Firebird-devel] Handling FbException

2019-09-11 Thread Mark Rotteveel
On 11-9-2019 10:31, Jiří Činčura wrote: In other words, this is a buffer overflow risk? Nope. You just might to loose some part of the message if it's longer, because it will not fit into buffer. A right, I had overlooked the use of sizeof. Mark -- Mark Rotteveel Firebird-Devel mailing li

Re: [Firebird-devel] Handling FbException

2019-09-11 Thread Jiří Činčura
> No other method - but if you have reasonable suggestion we will be happy > to implement it. Just an idea - language details are not needed. Is the size of the message known? That would allow to either allocate the right size buffer or have some logic on upper limit. -- Mgr. Jiří Činčura http

Re: [Firebird-devel] Handling FbException

2019-09-11 Thread Jiří Činčura
> In other words, this is a buffer overflow risk? Nope. You just might to loose some part of the message if it's longer, because it will not fit into buffer. -- Mgr. Jiří Činčura https://www.tabsoverspaces.com/ Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/list

Re: [Firebird-devel] Handling FbException

2019-09-11 Thread Mark Rotteveel
On 11-9-2019 09:13, Alex Peshkoff via Firebird-devel wrote: On 10.09.2019 18:32, Jiří Činčura wrote: Hi *, every example I've found uses this structure: catch (const FbException& error) {    char buf[256];    utl->formatStatus(buf, sizeof(buf), error.getStatus());    // ... } Is is guaranteed

Re: [Firebird-devel] Handling FbException

2019-09-11 Thread Alex Peshkoff via Firebird-devel
On 10.09.2019 18:32, Jiří Činčura wrote: Hi *, every example I've found uses this structure: catch (const FbException& error) { char buf[256]; utl->formatStatus(buf, sizeof(buf), error.getStatus()); // ... } Is is guaranteed that the 256 buffer is enough? Not - though given buffer ap

[Firebird-devel] Handling FbException

2019-09-10 Thread Jiří Činčura
Hi *, every example I've found uses this structure: catch (const FbException& error) { char buf[256]; utl->formatStatus(buf, sizeof(buf), error.getStatus()); // ... } Is is guaranteed that the 256 buffer is enough? I'm no expert in C++, but I would expect no and hence some other way to get