It's really weird that :

SELECT * FROM names where name LIKE '%mic%'

works with the sqlite3 command shell but not with the C librairie ......



On Thu, Jul 3, 2014 at 2:19 PM, Micka <mickamus...@gmail.com> wrote:

> Well,
>
> I would love that to be simple ..... but when I printf my query, I got :
>
> SELECT * FROM names where name LIKE '%mic%'
>
> that the code :
> sprintf( acQuery, "SELECT * FROM names where name  LIKE '%%%s%%'  ",
> acName);
>
>
> So what could it be ? any ideas ?
>
>
> On Tue, Jun 3, 2014 at 4:21 PM, Hick Gunter <h...@scigames.at> wrote:
>
>> Probably you are using a variant of the printf() function to generate
>> your statement and it is interpreting the %m as strerror(errno)  (see man 3
>> printf), whereas it is ignoring %' (thousands separator for decimal
>> conversions) either because it does not support this conversion or it is
>> missing the conversion specifier.
>>
>> Try inserting (3,'icka') into your table.
>>
>> If it works in the shell but not in your program, then it is nearly
>> always your program that is to blame.
>>
>> -----Ursprüngliche Nachricht-----
>> Von: Micka [mailto:mickamus...@gmail.com]
>> Gesendet: Dienstag, 03. Juni 2014 08:58
>> An: sqlite-users@sqlite.org
>> Betreff: [sqlite] Like and percent character
>>
>> Hi,
>>
>> I'm having trouble with the percent character .....
>>
>>
>> By example in my table I have :
>>
>> id name
>> 1 micka
>> 2 mickael
>>
>> I would like to do that :
>>
>> Select * from table name where name LIKE '%micka%'
>>
>> with my linux c program, the result is 0
>>
>> but with the sqlite3 command program it works ....
>>
>> I also tested this :
>>
>> Select * from table name where name LIKE 'micka%'
>>
>> and this time, it works in my linux c program ...
>>
>> I'm using the last package of sqlite3-dev ...
>> https://packages.debian.org/wheezy/sqlite3
>>
>> Why ?
>>
>> Thx you !
>> _______________________________________________
>> sqlite-users mailing list
>> sqlite-users@sqlite.org
>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>
>>
>> -----------------------------------------------------------------------
>> Gunter Hick
>> Software Engineer
>>
>> Scientific Games International GmbH
>> Klitschgasse 2 – 4, A - 1130 Vienna,
>> Austria
>> FN 157284 a, HG Wien
>> Tel: +43 1 80100 0
>> E-Mail: h...@scigames.at
>>
>> This e-mail is confidential and may well also be legally privileged. If
>> you have received it in error, you are on notice as to its status and
>> accordingly please notify us immediately by reply e-mail and then
>> delete this message from your system. Please do not copy it or use it for
>> any purposes, or disclose its contents to any person as to do so could be a
>> breach of confidence. Thank you for your cooperation.
>> _______________________________________________
>> sqlite-users mailing list
>> sqlite-users@sqlite.org
>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>
>
>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to