Re: [GENERAL] Sample in documentation

Поиск
Список
Период
Сортировка
От Igor Korot
Тема Re: [GENERAL] Sample in documentation
Дата
Msg-id CA+FnnTyVTiRVK6_fq-Ou7SOQ5+tJo8ZFu6RD6RM3VLJ4a8C+MA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [GENERAL] Sample in documentation  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: [GENERAL] Sample in documentation  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Hi, Tom,

On Sat, May 6, 2017 at 8:22 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Igor Korot <ikorot01@gmail.com> writes:
>> I tried to implement the code found in
>> https://www.postgresql.org/docs/current/static/libpq-example.html.
>> ...
>> I am getting an error:
>> [quote]
>> Non-constant-expression cannot be narrowed from type 'size_t' (aka
>> 'unsigned long') to 'int' in initializer list
>> [/quote]
>> on the line that tries to create a length[2] array.
>>
>> Now I should probably change it to "size_t length{2}" instead of "int
>> length[2]", but
>> I feel that this should be changed in the documentation.
>
> I do not see any arrays named "length", nor even any arrays of size 2,
> on that page, so I'm pretty confused what you're talking about.  Please
> be more specific.

I based my code on this:
http://stackoverflow.com/questions/26911855/correct-way-to-bind-numeric-values-to-prepared-sql.
Sorry about that.

Nevertheless, while it did compile by MSVC and gcc, it looks like
Xcode fails with compiling that code.
The code is located inside the C++ dynamic library project. It is
compiled with C++11 mode.
I am trying to compile it on OSX 10.8 with minimum required OSX set to be 10.8.

Nevertheless, it should compile fine.

Now when I tried to switch to size_t, it fails further down on the
call to PQexecPrepared().

So, is there any solution to this which can be used cross-platform?

Thank you.


>
>                         regards, tom lane


В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [GENERAL] Sample in documentation
Следующее
От: Igor Korot
Дата:
Сообщение: [GENERAL]