| 202 | } |
| 203 | |
| 204 | int cachedb_insert_connection(cachedb_engine *cde,cachedb_con *conn) |
| 205 | { |
| 206 | cachedb_con_list *new,*it; |
| 207 | str grp; |
| 208 | |
| 209 | grp.s = ((cachedb_pool_con *)conn->data)->id->group_name; |
| 210 | if (grp.s) |
| 211 | grp.len = strlen(grp.s); |
| 212 | |
| 213 | if (grp.s == NULL || grp.len == 0) { |
| 214 | LM_DBG("inserting default script connection\n"); |
| 215 | cde->default_connection = conn; |
| 216 | return 0; |
| 217 | } |
| 218 | |
| 219 | LM_DBG("inserting grp connection [%.*s]\n",grp.len,grp.s); |
| 220 | |
| 221 | new = pkg_malloc(sizeof(cachedb_con_list)); |
| 222 | if (new == NULL) { |
| 223 | LM_ERR("no more pkg\n"); |
| 224 | return -1; |
| 225 | } |
| 226 | |
| 227 | memset(new,0,sizeof(cachedb_con_list)); |
| 228 | new->connection = conn; |
| 229 | new->grp = grp; |
| 230 | |
| 231 | if (cde->connections == NULL) { |
| 232 | cde->connections = new; |
| 233 | } else { |
| 234 | for (it=cde->connections;it->next;it=it->next); |
| 235 | it->next = new; |
| 236 | } |
| 237 | |
| 238 | return 0; |
| 239 | } |
| 240 | |
| 241 | int cachedb_put_connection(str *cachedb_name,cachedb_con *con) |
| 242 | { |
no outgoing calls
no test coverage detected