Commit 18c9bbfa182ba4c7c02f7a8097d958e332cf6eeb

Authored by Cédric RICARD
1 parent b2882af8

Creating MF_1_6 branch

Showing 1 changed file with 6 additions and 37 deletions   Show diff stats
database/settings.anubis
@@ -6,7 +6,6 @@ @@ -6,7 +6,6 @@
6 */ 6 */
7 7
8 read tools/basis.anubis 8 read tools/basis.anubis
9 -read data_base/db_tools.anubis  
10 read data_base/sqlite.anubis 9 read data_base/sqlite.anubis
11 10
12 read calexium_lib/database/db_utils.anubis 11 read calexium_lib/database/db_utils.anubis
@@ -15,7 +14,7 @@ read calexium_lib/database/db_utils.anubis @@ -15,7 +14,7 @@ read calexium_lib/database/db_utils.anubis
15 public define Maybe(String) 14 public define Maybe(String)
16 select_settings 15 select_settings
17 ( 16 (
18 - Database db, 17 + SQLite3DataBase db,
19 String var, 18 String var,
20 )= 19 )=
21 if sql_query_timeout(db, "SELECT var_value FROM settings WHERE var_name=" + db_make_sql_string(var) + ";", "select_settings") is 20 if sql_query_timeout(db, "SELECT var_value FROM settings WHERE var_name=" + db_make_sql_string(var) + ";", "select_settings") is
@@ -33,7 +32,7 @@ public define Maybe(String) @@ -33,7 +32,7 @@ public define Maybe(String)
33 public define String 32 public define String
34 select_settings 33 select_settings
35 ( 34 (
36 - Database db, 35 + SQLite3DataBase db,
37 String var, 36 String var,
38 String default 37 String default
39 )= 38 )=
@@ -46,7 +45,7 @@ public define String @@ -46,7 +45,7 @@ public define String
46 public define Int 45 public define Int
47 select_settings 46 select_settings
48 ( 47 (
49 - Database db, 48 + SQLite3DataBase db,
50 String var, 49 String var,
51 Int default 50 Int default
52 )= 51 )=
@@ -64,7 +63,7 @@ public define Int @@ -64,7 +63,7 @@ public define Int
64 public define Bool 63 public define Bool
65 select_settings 64 select_settings
66 ( 65 (
67 - Database db, 66 + SQLite3DataBase db,
68 String var, 67 String var,
69 Bool default 68 Bool default
70 )= 69 )=
@@ -78,47 +77,17 @@ public define Bool @@ -78,47 +77,17 @@ public define Bool
78 success(v) then v!=0 77 success(v) then v!=0
79 } 78 }
80 }. 79 }.
81 -  
82 -public define One  
83 - update_settings  
84 - (  
85 - SQLite3DataBase db,  
86 - String var,  
87 - Bool value  
88 - )=  
89 - with binds = (List(SQLite3Bind))[bind_String("@name", var), bind_Int("@value", if value then 1 else 0)],  
90 - if select_settings(db, var) is success(_) then  
91 - forget(sql_query_timeout(db, "UPDATE settings SET var_value = @value WHERE var_name = @name;", binds, "update_settings"))  
92 - else  
93 - forget(sql_query_timeout(db, "INSERT INTO settings (var_name, var_value) VALUES (@name, @value)", binds, "update_settings"))  
94 - .  
95 80
96 public define One 81 public define One
97 update_settings 82 update_settings
98 ( 83 (
99 - Database db,  
100 - String var,  
101 - Int value  
102 - )=  
103 - with binds = (List(SQLite3Bind))[bind_String("@name", var), bind_Int("@value", value)],  
104 - if select_settings(db, var) is success(_) then  
105 - forget(sql_query_timeout(db, "UPDATE settings SET var_value = @value WHERE var_name = @name;", binds, "update_settings"))  
106 - else  
107 - forget(sql_query_timeout(db, "INSERT INTO settings (var_name, var_value) VALUES (@name, @value)", binds, "update_settings"))  
108 - .  
109 -  
110 -  
111 -public define One  
112 - update_settings  
113 - (  
114 SQLite3DataBase db, 84 SQLite3DataBase db,
115 String var, 85 String var,
116 String value 86 String value
117 )= 87 )=
118 - with binds = (List(SQLite3Bind))[bind_String("@name", var), bind_String("@value", value)],  
119 if select_settings(db, var) is success(_) then 88 if select_settings(db, var) is success(_) then
120 - forget(sql_query_timeout(db, "UPDATE settings SET var_value = @value WHERE var_name = @name;", binds, "update_settings")) 89 + forget(sql_query_timeout(db, "UPDATE settings SET var_value = @value WHERE var_name = @name;", [bind_String("@name", var), bind_String("@value", value)], "update_settings"))
121 else 90 else
122 - forget(sql_query_timeout(db, "INSERT INTO settings (var_name, var_value) VALUES (@name, @value)", binds, "update_settings")) 91 + forget(sql_query_timeout(db, "INSERT INTO settings (var_name, var_value) VALUES (@name, @value)", [bind_String("@name", var), bind_String("@value", value)], "update_settings"))
123 . 92 .
124 93