Results 1 to 6 of 6

Thread: [ClanLib 2.3] PostgreSQL backend

  1. #1

    Default [ClanLib 2.3] PostgreSQL backend

    Hi, here is a PostgreSQL backend for clanLib-2.3.

    It implements more or less the same capabilities of clanSqlite, and allow switching from clanSqlite code to clanPgsql just by changing the connection line*

    It depends on libpq, wich can be installed with distro's packages, and compiled with visual C++ (not tested) : http://www.postgresql.org/docs/8.3/s...n32-libpq.html.
    It has a very liberal bsd-like licence, wich enable using for everything (i think about commercial uses).

    Here, I give you a svn diff from the current clan-2.3 svn HEAD. You should probably read it carefully, since it paches autotools config, and I don't really know how to use them. There is a Setup/Test file to check if libpq is well installed, so basicaly, it should (If I'v done my job well) work out of the box if you have libpq installed (otherwise, it's just an apt/yum/yaourt install with linux distro).

    It also change a little bit of Sqlite & Database, just to add one value to an enum (I take care that it shouldn't brake anything (API/ABI), but I'm not a library maintainer, so please take a look). It's due to the fact that PostgreSQL give more flexibility about transactions than Sqlite, and the Database interface was designed around Sqlite. If I didn't done that, any backend would have to
    1) Lie and do not do what's expected for one of the enumerated types
    2) Only provide realy restricted behavior wich is not the default provided by the database.
    So postgresql or not postgresql, I think it's a good thing to provide a 'default behavior' value.

    If you have any question, I'm ready to answer

    I would also like to write some detailed documentation about wich functionality is/isnt provided, how to connect, some links to the right PostgreSQL documentation pages, and facts like "you can have more than one reader, but only one transaction by connection", "it use the synchronous api", "get all results at the same time", "wich kind of error can happend when doing a query", "when is the query really executed (actualy reader constructor)", ...
    So if you have a good place where to write it, tell me.

    * It's not true. Table and field escaping should be made by '"' and not '`'. Also, you can't use the last_row_id function which will always return -1. Creating a transaction locking everything doesn't make sens with postgreSql, so you have to lock explicitely the tables you are working on, just by executing a one-line query after a transaction was started.

    Edit : The 3.0 backend is available as the master branch of the repository.
    Attached Files Attached Files
    Last edited by Zenol; 09-06-2013 at 10:52 PM.

  2. #2
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    General note.

    This would be nice as an example ClanLib 3.0, in Examples/Database.

    Like how Examples/Sound/Mikmod is a good example of plugin music players.

  3. #3

    Default

    Actualy, the library is now available as a separated binary (.a/.so) at github : https://github.com/Zenol/ClanPgsql

    I can provide easily (and I will) a ClanLib 3.0 version, but I haven't the time to check (and maybe adapt) the build system to windows.

    Maybe I can branch and tag 2.3, move master to 3.0 and branch the build system for windows latter. Sounds the better solution.

  4. #4
    ClanLib Developer
    Join Date
    Sep 2006
    Location
    Bergen, Norway
    Posts
    588

    Default

    Btw, thanks alot for this - I might need it for my project

  5. #5

    Default

    I've just ported the library to Clanlib 3.0 (It's the master branch of the git repository).

    Should install with cmake and make install. For windows, cmake should be generating a visual studio project that should compile (maybe you'll have to set some compile flag by hand, don't know).

    Didn't tested it, but it compile on linux. If anything goes wrong (I really hope it won't) you can tell me and I'll try to find the time to dig it.

  6. #6
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    I have added a link to it, on http://clanlib.org/contributions.html

Similar Threads

  1. ClanLib 2.3.2 Release. ClanLib 2.2.12 Release. Updated Dependencies
    By rombust in forum Official ClanLib SDK Forums
    Replies: 2
    Last Post: 08-30-2011, 11:08 AM
  2. Replies: 7
    Last Post: 08-26-2008, 09:57 PM
  3. Installing ClanLib 0.8 and ClanLib 0.9 on linux
    By rombust in forum Official ClanLib SDK Forums
    Replies: 4
    Last Post: 07-15-2008, 09:51 AM

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •