From GiderosMobile

This page contains changes which are not marked for translation.

Supported platforms: Platform android.pngPlatform ios.pngPlatform mac.pngPlatform pc.pngPlatform html5.pngPlatform winrt.pngPlatform win32.png
Available since: Gideros 2012.2.1


Gideros runtime supports public domain SQLite3 database engine for iOS, Android and Desktop platforms.
For more information and detailed documentation, please visit [1](http://lua.sqlite.org).

<h3>SQLite3 on Android platforms</h3>
Currently, LuaSQLite3 plugin cannot open databases stored in APK files. Therefore, database file should be
copied from resource directory to documents directory.

To copy a file, this function can be used:

local function copy(src, dst)
local srcf = io.open(src, "rb")
local dstf = io.open(dst, "wb")

local size = 2^13 -- good buffer size (8K)
while true do
local block = srcf:read(size)
if not block then break end


Also it's better to check if the database file is previously copied or not. To check if a file can be found
on the underlying file system, this function can be used:

local function exists(file)
local f = io.open(file, "rb")
if f == nil then
return false
return true

By using these two function, you can copy the database file from resource to documents directory before using it:

if not exists("|D|database.db") then
copy("database.db", "|D|database.db")


<h3>SQLite3 on on WinRT need to add an extension to Visual Studio</h3>

Gideros now supports sqlite and to make this work on Windows Phone, it is necessary to add an extension to Visual Studio. Even if you don't use sqlite, you will need to add this extension or Windows Phone projects exported by Gideros will not compile. It's easy to do as explained next. Of course, you only need to add the extension once. <br/> Open Visual Studio and go to TOOLS > Extensions and Updates. Select the Online tab on the left and type sqlite in the search bar at the top right. Select SQLite for Windows 8.1 or/and Windows Phone 8.1 and select install. You will need to restart VS for the extension to take effect.