Project

General

Profile

0001-Cache-app-db-config-to-speed-up-checking-account-ali.patch

rhabacker, 01/30/2020 11:09 PM

Download (3.67 KB)

View differences:

src/libs/aqbanking/banking.c
118 118
  ab->appName=strdup(appName);
119 119
  ab->cryptTokenList=GWEN_Crypt_Token_List2_new();
120 120
  ab->dbRuntimeConfig=GWEN_DB_Group_new("runtimeConfig");
121
  ab->dbAppConfig = NULL;
121 122

  
122 123
  GWEN_Buffer_free(nbuf);
123 124

  
......
166 167
    AB_Banking_ClearCryptTokenList(ab);
167 168
    GWEN_Crypt_Token_List2_free(ab->cryptTokenList);
168 169
    GWEN_ConfigMgr_free(ab->configMgr);
170
    GWEN_DB_Group_free(ab->dbAppConfig);
169 171
    free(ab->startFolder);
170 172
    free(ab->appName);
171 173
    free(ab->appEscName);
src/libs/aqbanking/banking_compat.c
33 33
  }
34 34
  GWEN_DB_Group_free(dbConfig);
35 35

  
36
  // delete read cache used by AB_Banking_GetAccountSpecByAlias
37
  GWEN_DB_Group_free(ab->dbAppConfig);
38
  ab->dbAppConfig = NULL;
39

  
36 40
  return 0;
37 41
}
38 42

  
......
40 44

  
41 45
AB_ACCOUNT_SPEC *AB_Banking_GetAccountSpecByAlias(AB_BANKING *ab, const char *alias)
42 46
{
43
  GWEN_DB_NODE *dbConfig=NULL;
44 47
  GWEN_DB_NODE *db;
45 48
  AB_ACCOUNT_SPEC *as=NULL;
46 49
  uint32_t aid;
47 50
  int rv;
48 51

  
49
  rv=AB_Banking_ReadNamedConfigGroup(ab, AB_CFG_GROUP_APPS, ab->appName, 1, 1, &dbConfig);
50
  if (rv<0) {
51
    DBG_INFO(AQBANKING_LOGDOMAIN, "here (%d)", rv);
52
    return NULL;
52
  if (!ab->dbAppConfig) {
53
    rv=AB_Banking_ReadNamedConfigGroup(ab, AB_CFG_GROUP_APPS, ab->appName, 1, 1, &ab->dbAppConfig);
54
    if (rv<0) {
55
      DBG_INFO(AQBANKING_LOGDOMAIN, "here (%d)", rv);
56
      return NULL;
57
    }
53 58
  }
54

  
55
  db=GWEN_DB_GetGroup(dbConfig, GWEN_DB_FLAGS_DEFAULT, "banking/aliases");
59
  db=GWEN_DB_GetGroup(ab->dbAppConfig, GWEN_DB_FLAGS_DEFAULT, "banking/aliases");
56 60
  aid=GWEN_DB_GetIntValue(db, alias, 0, 0);
57 61
  if (aid<1) {
58 62
    DBG_ERROR(AQBANKING_LOGDOMAIN, "Invalid account id for alias \"%s\"", alias);
59
    GWEN_DB_Group_free(dbConfig);
60 63
    return NULL;
61 64
  }
62
  GWEN_DB_Group_free(dbConfig);
63 65

  
64 66
  rv=AB_Banking_GetAccountSpecByUniqueId(ab, aid, &as);
65 67
  if (rv<0) {
src/libs/aqbanking/banking_p.h
76 76
  GWEN_CONFIGMGR *configMgr;
77 77

  
78 78
  GWEN_DB_NODE *dbRuntimeConfig;
79
  GWEN_DB_NODE *dbAppConfig;
79 80
};
80 81

  
81 82

  
82
-