2

I came accross a Exception with two devices a Honeywell CT50 and a Zebra TC75. Both running on a 4.x android version where I tried to use the printf SQLite function.

The exception:

android.database.sqlite.SQLiteException: no such function: printf (code 1): , while compiling: xxx

The related query:

SELECT 
  rowid, 
  printf('GPS;%s;%f;%f;%f;%f', Timestamp, Longitude, Latitude, Speed, Bearing) 
FROM CapturedLocation;

On different Devices e.g. Nexus, Galaxy, Sony, Opticon everything works as intended.

Basically I wonder if I can rely on using SQLite functions and that they are implemented as stated in the offical SQLite documentation or if it's manufacturer specific and I have to hope that Manufacturers implement SQLite completely.

In my current implementation I handle the exception with a try/catch block but I wonder if there are any other solutions to this problem.

RĂ¼diger
  • 1,674
  • 1
  • 20
  • 28

1 Answers1

5

sqlite printf was added in version 3.8.3 and many platform versions have older version of sqlite.

Consider formatting the output in your application code rather than in SQL.

Community
  • 1
  • 1
laalto
  • 150,114
  • 66
  • 286
  • 303