Code Monkey home page Code Monkey logo

sqlitedemo's Introduction

SQLiteDemo

What is this

If you want to lower the persistence level, for any reason, you can easily use the C based library libsqlite3 in iOS.

But, if you want to use Swift instead of Objective-C, you may find some difficulties in importing the library or especially when dealing with the C pointers and structures inside Swift.

Below, you can see how "beautiful" is the translation of a simple function of this library:

func sqlite3_exec(_: COpaquePointer, 
                  sql: UnsafePointer<Int8>, 
                  callback: CFunctionPointer<((UnsafeMutablePointer<Void>, Int32, UnsafeMutablePointer<UnsafeMutablePointer<Int8>>, UnsafeMutablePointer<UnsafeMutablePointer<Int8>>) -> Int32)>, 
                  _: UnsafeMutablePointer<Void>, 
                  errmsg: UnsafeMutablePointer<UnsafeMutablePointer<Int8>>) -> Int32

This project is not a wrapper or something like that, it's only a very simple working example on how to effectively use the basic methods of libsqlite3, like how to:

  • Create and remove a database;
  • Create and remove tables;
  • Insert, Update and Remove elements in a table;
  • Select elements in a table;

Author

Lucas Eduardo, [email protected]

sqlitedemo's People

Contributors

lucasecf avatar maxxgit avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.