Module: sip-router
Branch: master
Commit: 21583d47751fc7f684dac41a3bfbfc3b2c0bf3a3
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=21583d4…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Thu Aug 30 10:15:26 2012 +0200
db_cluster: safety check for existence of several DB API members
---
modules_k/db_cluster/dbcl_api.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/modules_k/db_cluster/dbcl_api.c b/modules_k/db_cluster/dbcl_api.c
index 20d689c..0269343 100644
--- a/modules_k/db_cluster/dbcl_api.c
+++ b/modules_k/db_cluster/dbcl_api.c
@@ -309,7 +309,8 @@ int db_cluster_fetch_result(const db1_con_t* _h, db1_res_t** _r, const
int nrows
dbcl_cls_t *cls=NULL;
LM_DBG("executing db cluster fetch-result command\n");
cls = (dbcl_cls_t*)_h->tail;
- if(cls->usedcon==NULL || cls->usedcon->dbh==NULL)
+ if(cls->usedcon==NULL || cls->usedcon->dbh==NULL
+ || cls->usedcon->dbf.fetch_result==NULL)
return -1;
return cls->usedcon->dbf.fetch_result(cls->usedcon->dbh, _r, nrows);
}
@@ -376,7 +377,8 @@ int db_cluster_last_inserted_id(const db1_con_t* _h)
dbcl_cls_t *cls=NULL;
LM_DBG("executing db cluster last inserted id command\n");
cls = (dbcl_cls_t*)_h->tail;
- if(cls->usedcon==NULL || cls->usedcon->dbh==NULL)
+ if(cls->usedcon==NULL || cls->usedcon->dbh==NULL
+ || cls->usedcon->dbf.last_inserted_id==NULL)
return -1;
return cls->usedcon->dbf.last_inserted_id(cls->usedcon->dbh);
}
@@ -390,7 +392,8 @@ int db_cluster_affected_rows(const db1_con_t* _h)
dbcl_cls_t *cls=NULL;
LM_DBG("executing db cluster affected-rows command\n");
cls = (dbcl_cls_t*)_h->tail;
- if(cls->usedcon==NULL || cls->usedcon->dbh==NULL)
+ if(cls->usedcon==NULL || cls->usedcon->dbh==NULL
+ || cls->usedcon->dbf.affected_rows==NULL)
return -1;
return cls->usedcon->dbf.affected_rows(cls->usedcon->dbh);
}