Branch: Tag:

2017-11-06

2017-11-06 12:51:51 by Henrik Grubbström (Grubba) <grubba@grubba.org>

CertDB: Cleaned up types.

Add and use the typedef sql_row.

18:   protected local constant Identifier = Standards.ASN1.Types.Identifier;   protected local constant Sequence = Standards.ASN1.Types.Sequence;    + protected typedef mapping(string:int|string) sql_row; +    //! - array(mapping(string:int|string)) list_keys() + array(sql_row) list_keys()   {    Sql.Sql db = DBManager.cached_get("roxen");    return db->typed_query("SELECT * "
28:   }      //! - array(mapping(string:int|string)) list_keypairs() + array(sql_row) list_keypairs()   {    Sql.Sql db = DBManager.cached_get("roxen");    return db->typed_query("SELECT * "
37:   }      //! - mapping(string:int|string) get_cert(int cert_id) + sql_row get_cert(int cert_id)   {    Sql.Sql db = DBManager.cached_get("roxen");    array(mapping(string:int|string)) res =
95:   {    Sql.Sql db = DBManager.cached_get("roxen");    -  array(mapping(string:int|string)) tmp = +  array(sql_row) tmp =    db->typed_query("SELECT * "    " FROM cert_pem_files "    " WHERE id = %d",    pem_id);    if (!sizeof(tmp)) return;    -  mapping(string:int|string) pem_info = tmp[0]; +  sql_row pem_info = tmp[0];    -  array(mapping(string:int|string)) certs = ({}); -  array(mapping(string:int|string)) keys = ({}); +  array(sql_row) certs = ({}); +  array(sql_row) keys = ({});       string pem_file = pem_info->path;   
237:    master()->handle_error(err);    }    -  foreach(keys, mapping(string:string|int) key_info) { +  foreach(keys, sql_row key_info) {    tmp = db->typed_query("SELECT * "    " FROM cert_keys "    " WHERE keyhash = %s",
257:    " WHERE keyhash = %s "    " ORDER BY id ASC",    key_info->keyhash), -  mapping(string:string|int) cert_info) { +  sql_row cert_info) {    if (sizeof(db->query("SELECT * "    " FROM cert_keypairs "    " WHERE cert_id = %d",
287:    }    }    -  foreach(certs, mapping(string:string|int) cert_info) { +  foreach(certs, sql_row cert_info) {    tmp = db->typed_query("SELECT * "    " FROM certs "    " WHERE keyhash = %s "
429:   {    Sql.Sql db = DBManager.cached_get("roxen");    -  array(mapping(string:int|string)) row = +  array(sql_row) row =    db->typed_query("SELECT * "    " FROM cert_pem_files "    " WHERE path = %s",
524:       Sql.Sql db = DBManager.cached_get("roxen");    -  array(mapping(string:string|int)) tmp = +  array(sql_row) tmp =    db->typed_query("SELECT * "    " FROM cert_keypairs "    " WHERE id = %d",