On 11/14/15, Igor Korot <ikorot01 at gmail.com> wrote:
> Hi, Richard,
>
> On Sat, Nov 14, 2015 at 6:54 PM, Richard Hipp <drh at sqlite.org> wrote:
>> On 11/14/15, Igor Korot <ikorot01 at gmail.com> wrote:
>>> Hi, ALL,
>>> I am trying to use following query:
>>>
>>> "PRAGMA table_info(?)"
>>
>> The argument to a pragma is not an expression, and hence it cannot use
>> bound parameters.
>
> Thank you for that explanation.
> So what is the best and safest way to execute such query?
>

char *z = sqlite3_mprintf("PRAGMA table_info(\"%w\");", zTableName);
The prepare and step z.
Then:  sqlite3_free(z);

Read about the %w format in the penultimate paragraph of
https://www.sqlite.org/c3ref/mprintf.html

-- 
D. Richard Hipp
drh at sqlite.org

Reply via email to