mirror of
https://github.com/chatmail/core.git
synced 2026-05-05 06:16:30 +03:00
Refactor the internal sql interface somewhat
Experiment with refactoring the internal sql interface a bit. My original goal was to modify the schema and thus refactor to a state where it would be sane to write tests for dc_sqlite_open() (and/or however it ends up refactored) to assert schame changes before/after.
This commit is contained in:
@@ -140,7 +140,7 @@ pub unsafe fn dc_mimefactory_load_msg(
|
||||
stmt =
|
||||
dc_sqlite3_prepare(
|
||||
context,
|
||||
&context.sql.clone().read().unwrap(),
|
||||
&context.sql,
|
||||
b"SELECT c.authname, c.addr FROM chats_contacts cc LEFT JOIN contacts c ON cc.contact_id=c.id WHERE cc.chat_id=? AND cc.contact_id>9;\x00"
|
||||
as *const u8 as
|
||||
*const libc::c_char);
|
||||
@@ -179,7 +179,7 @@ pub unsafe fn dc_mimefactory_load_msg(
|
||||
);
|
||||
let self_addr: *mut libc::c_char = dc_sqlite3_get_config(
|
||||
context,
|
||||
&context.sql.clone().read().unwrap(),
|
||||
&context.sql,
|
||||
b"configured_addr\x00" as *const u8 as *const libc::c_char,
|
||||
b"\x00" as *const u8 as *const libc::c_char,
|
||||
);
|
||||
@@ -206,7 +206,7 @@ pub unsafe fn dc_mimefactory_load_msg(
|
||||
&& command != 7i32
|
||||
&& 0 != dc_sqlite3_get_config_int(
|
||||
context,
|
||||
&context.sql.clone().read().unwrap(),
|
||||
&context.sql,
|
||||
b"mdns_enabled\x00" as *const u8 as *const libc::c_char,
|
||||
1i32,
|
||||
)
|
||||
@@ -216,7 +216,7 @@ pub unsafe fn dc_mimefactory_load_msg(
|
||||
}
|
||||
stmt = dc_sqlite3_prepare(
|
||||
context,
|
||||
&context.sql.clone().read().unwrap(),
|
||||
&context.sql,
|
||||
b"SELECT mime_in_reply_to, mime_references FROM msgs WHERE id=?\x00" as *const u8
|
||||
as *const libc::c_char,
|
||||
);
|
||||
@@ -245,19 +245,19 @@ pub unsafe fn dc_mimefactory_load_msg(
|
||||
unsafe fn load_from(mut factory: *mut dc_mimefactory_t) {
|
||||
(*factory).from_addr = dc_sqlite3_get_config(
|
||||
(*factory).context,
|
||||
&mut (*factory).context.sql.clone().read().unwrap(),
|
||||
&(*factory).context.sql,
|
||||
b"configured_addr\x00" as *const u8 as *const libc::c_char,
|
||||
0 as *const libc::c_char,
|
||||
);
|
||||
(*factory).from_displayname = dc_sqlite3_get_config(
|
||||
(*factory).context,
|
||||
&mut (*factory).context.sql.clone().read().unwrap(),
|
||||
&(*factory).context.sql,
|
||||
b"displayname\x00" as *const u8 as *const libc::c_char,
|
||||
0 as *const libc::c_char,
|
||||
);
|
||||
(*factory).selfstatus = dc_sqlite3_get_config(
|
||||
(*factory).context,
|
||||
&mut (*factory).context.sql.clone().read().unwrap(),
|
||||
&(*factory).context.sql,
|
||||
b"selfstatus\x00" as *const u8 as *const libc::c_char,
|
||||
0 as *const libc::c_char,
|
||||
);
|
||||
@@ -279,7 +279,7 @@ pub unsafe fn dc_mimefactory_load_mdn(
|
||||
if !(0
|
||||
== dc_sqlite3_get_config_int(
|
||||
(*factory).context,
|
||||
&mut (*factory).context.sql.clone().read().unwrap(),
|
||||
&(*factory).context.sql,
|
||||
b"mdns_enabled\x00" as *const u8 as *const libc::c_char,
|
||||
1i32,
|
||||
))
|
||||
@@ -289,7 +289,7 @@ pub unsafe fn dc_mimefactory_load_mdn(
|
||||
if !(!dc_msg_load_from_db((*factory).msg, (*factory).context, msg_id)
|
||||
|| !dc_contact_load_from_db(
|
||||
contact,
|
||||
&mut (*factory).context.sql.clone().read().unwrap(),
|
||||
&(*factory).context.sql,
|
||||
(*(*factory).msg).from_id,
|
||||
))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user