vendredi 17 juillet 2015

Parsing SQL to find a specific string in Sqlite

I have an Sqlite column that gives me information in the form of

208|iMessage;-;+12555555555|45|3|188235574-A320-44F9-AA20-4F234B078|bplist00?_%com.apple.iChat.LastArchivedMessageID?_$9757B765-A1FF-4C80-AC8C-7C3BB7220AAF|+1975510555|iMessage||example@gmail.com|0|+12834444444||C56467F2-5318-46B0-8D33-36B93D16608F

And I'm just trying to parse each of these 208 similar lines to find the phone number in this segment: |iMessage;-;+12555555555|

I have tried using select substr('iMessage;-;', charindex('iMessage;-;'+11),11) from chat;

but charindex isn't supported in sqlite3. I also tried select substr('iMessage;-;', instr(select * from chat;, ’iMessage;-;'),11) from chat; but this gave me a hanging prompt.

Any ideas?

Aucun commentaire:

Enregistrer un commentaire