Merge lp:~ivaldi/midori/midori-database-get-os into lp:midori

Proposed by André Stösel
Status: Work in progress
Proposed branch: lp:~ivaldi/midori/midori-database-get-os
Merge into: lp:midori
Diff against target: 28 lines (+13/-0)
1 file modified
midori/midori-database.vala (+13/-0)
To merge this branch: bzr merge lp:~ivaldi/midori/midori-database-get-os
Reviewer Review Type Date Requested Status
Cris Dywan Needs Fixing
Review via email: mp+198478@code.launchpad.net

Commit message

new sqlite function "midori_get_os()"

To post a comment you must log in.
Revision history for this message
André Stösel (ivaldi) wrote :

I need this function in order to change the extension name (.so|.dll) based on the os.
(In flummi Update$.sql files.)

Revision history for this message
André Stösel (ivaldi) wrote :

example use case is something like this:

INSERT INTO tasks (command) VALUES (CASE WHEN midori_get_os() == 'linux' THEN 'libcolorful-tabs.so=true' ELSE 'libcolorful-tabs.dll=true' END);

Revision history for this message
Cris Dywan (kalikiana) wrote :

I feel this bleeds too much logic which will have to be adjusted in all occurences if other os values or extensions come up. Either we need to eliminate the need for the extension or we should have function of the sort expand_filename(foo) that contains the logic.

review: Needs Fixing
Revision history for this message
Olivier Duchateau (duchateau-olivier) wrote :

Currently BSD systems are not supported, beside they also use dynamics libs.

Why lets CMake detect system host. There're UNIX, WIN32 and APPLE variables.

Unmerged revisions

6515. By André Stösel

new sqlite function "midori_get_os()"

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'midori/midori-database.vala'
2--- midori/midori-database.vala 2013-12-10 21:51:01 +0000
3+++ midori/midori-database.vala 2013-12-10 23:29:57 +0000
4@@ -158,6 +158,8 @@
5 db.exec ("PRAGMA synchronous = NORMAL; PRAGMA temp_store = MEMORY;");
6 db.exec ("PRAGMA count_changes = OFF;");
7
8+ db.create_function ("midori_get_os", 0, Sqlite.UTF8, null, SqliteHelper.get_os, null, null);
9+
10 int64 user_version;
11 Sqlite.Statement stmt;
12 if (db.prepare_v2 ("PRAGMA user_version;", -1, out stmt, null) != Sqlite.OK)
13@@ -239,4 +241,15 @@
14 return statement;
15 }
16 }
17+
18+ namespace SqliteHelper {
19+ internal static void get_os (Sqlite.Context context, Sqlite.Value[] values) {
20+ #if HAVE_WIN32
21+ string os = "win";
22+ #else
23+ string os = "linux";
24+ #endif
25+ context.result_text (os);
26+ }
27+ }
28 }

Subscribers

People subscribed via source and target branches

to all changes: