(Redirected from How to use quotation in SQL)

Archived:How to use quotation in SQL in PySymbian

From Nokia Developer Wiki
Jump to: navigation, search

Archived.pngAquivado: Este artigo foi arquivado, pois o conteúdo não é mais considerado relevante para se criar soluções comerciais atuais. Se você achar que este artigo ainda é importante, inclua o template {{ForArchiveReview|escreva a sua justificativa}}.

All PySymbian articles have been archived. PySymbian is no longer maintained by Nokia and is not guaranteed to work on more recent Symbian devices. It is not possible to submit apps to Nokia Store.

Article Metadata
Created: cyke64 (29 Mar 2007)
Last edited: hamishwillee (31 May 2013)

It's not always easy to remember how to use quotation in Symbian SQL database. Here's a simple reminder.

  • date/time need to be quoted with # and formatted with e32db.format_time
  • int/float need no quotation
  • string need to be quoted with single quote and repeat the quote if it happen to be inside.
  • binary can't be used. You may need to encode it (eg. base64)

Here's a simple example :

import e32db, time
timestamp = time.time()
distance = 10.5
comment = "I'm fine, thanks!"
# for date/time, int/float, and string respectively
sql = "INSERT INTO events VALUES (#%s#, %d, '%s')" %\
comment.replace("'", "''") )
This page was last modified on 31 May 2013, at 04:05.
28 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.


Thank you!

We appreciate your feedback.