kamailio.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
List overview
Download
sr-dev
January 2016
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
sr-dev@lists.kamailio.org
34 participants
295 discussions
Start a n
N
ew thread
git:master:97a921ca: db_text: add support for replace
by lazedo
Module: kamailio Branch: master Commit: 97a921ca63bd5482a690fe8ba399b05fd0134129 URL:
https://github.com/kamailio/kamailio/commit/97a921ca63bd5482a690fe8ba399b05…
Author: lazedo <luis.azedo(a)factorlusitano.com> Committer: lazedo <luis.azedo(a)factorlusitano.com> Date: 2016-01-04T05:12:42Z db_text: add support for replace implements replace with update/insert tries to update, inserts if not found --- Modified: modules/db_text/dbt_base.c Modified: modules/db_text/dbtext.c Modified: modules/db_text/dbtext.h --- Diff:
https://github.com/kamailio/kamailio/commit/97a921ca63bd5482a690fe8ba399b05…
Patch:
https://github.com/kamailio/kamailio/commit/97a921ca63bd5482a690fe8ba399b05…
--- diff --git a/modules/db_text/dbt_base.c b/modules/db_text/dbt_base.c index 6d70ce5..4ab9a16 100644 --- a/modules/db_text/dbt_base.c +++ b/modules/db_text/dbt_base.c @@ -617,3 +617,132 @@ int dbt_update(db1_con_t* _h, db_key_t* _k, db_op_t* _o, db_val_t* _v, return -1; } +int dbt_replace(db1_con_t* _h, db_key_t* _k, db_val_t* _v, + int _n, int _nk, int _m) +{ + dbt_table_p _tbc = NULL; + dbt_row_p _drp = NULL; + int i, j; + int *lkey=NULL, *lres=NULL; + + if (!_h || !CON_TABLE(_h) || _nk <= 0) + { + LM_ERR("invalid parameters\n"); + return -1; + } + + ((dbt_con_p)_h->tail)->affected = 0; + + /* lock database */ + _tbc = dbt_db_get_table(DBT_CON_CONNECTION(_h), CON_TABLE(_h)); + if(!_tbc) + { + LM_ERR("table %.*s does not exist!\n", CON_TABLE(_h)->len, CON_TABLE(_h)->s); + return -1; + } + + if(_k) + { + lkey = dbt_get_refs(_tbc, _k, _nk); + if(!lkey) + goto error; + } + lres = dbt_get_refs(_tbc, _k, _n); + if(!lres) + goto error; + _drp = _tbc->rows; + while(_drp) + { + if(dbt_row_match(_tbc, _drp, lkey, NULL, _v, _nk)) + { // update fields + for(i=0; i<_n; i++) + { + if(dbt_is_neq_type(_tbc->colv[lres[i]]->type, _v[i].type)) + { + LM_ERR("incompatible types!\n"); + goto error; + } + + if(dbt_row_update_val(_drp, &(_v[i]), + _tbc->colv[lres[i]]->type, lres[i])) + { + LM_ERR("cannot set v[%d] in c[%d]!\n", + i, lres[i]); + goto error; + } + } + + ((dbt_con_p)_h->tail)->affected++; + + } + _drp = _drp->next; + } + + if(((dbt_con_p)_h->tail)->affected == 0) { + _drp = dbt_row_new(_tbc->nrcols); + if(!_drp) + { + LM_ERR("no shm memory for a new row!!\n"); + goto error; + } + + for(i=0; i<_n; i++) + { + j = lres[i]; + if(dbt_is_neq_type(_tbc->colv[j]->type, _v[i].type)) + { + LM_ERR("incompatible types v[%d] - c[%d]!\n", i, j); + goto error; + } + if(_v[i].type == DB1_STRING && !_v[i].nul) + _v[i].val.str_val.len = strlen(_v[i].val.string_val); + if(dbt_row_set_val(_drp, &(_v[i]), _tbc->colv[j]->type, j)) + { + LM_ERR("cannot set v[%d] in c[%d]!\n", i, j); + goto error; + } + } + + if(dbt_table_add_row(_tbc, _drp)) + { + LM_ERR("cannot insert the new row!!\n"); + goto error; + } + + ((dbt_con_p)_h->tail)->affected = 1; + + } + + if( ((dbt_con_p)_h->tail)->affected ) + dbt_table_update_flags(_tbc, DBT_TBFL_MODI, DBT_FL_SET, 1); + + /* dbt_print_table(_tbc, NULL); */ + + /* unlock database */ + dbt_release_table(DBT_CON_CONNECTION(_h), CON_TABLE(_h)); + + if(lkey) + pkg_free(lkey); + if(lres) + pkg_free(lres); + + return 0; + +error: + + if(lkey) + pkg_free(lkey); + if(lres) + pkg_free(lres); + if(_drp) // free row + dbt_row_free(_tbc, _drp); + + /* unlock database */ + dbt_release_table(DBT_CON_CONNECTION(_h), CON_TABLE(_h)); + + LM_ERR("failed to update the table!\n"); + + return -1; +} + + diff --git a/modules/db_text/dbtext.c b/modules/db_text/dbtext.c index 4f1d4a6..f601398 100644 --- a/modules/db_text/dbtext.c +++ b/modules/db_text/dbtext.c @@ -125,9 +125,10 @@ int dbt_bind_api(db_func_t *dbb) dbb->insert = (db_insert_f)dbt_insert; dbb->delete = (db_delete_f)dbt_delete; dbb->update = (db_update_f)dbt_update; + dbb->replace = (db_replace_f)dbt_replace; dbb->affected_rows = (db_affected_rows_f) dbt_affected_rows; dbb->raw_query = (db_raw_query_f) dbt_raw_query; - dbb->cap = DB_CAP_ALL | DB_CAP_AFFECTED_ROWS | DB_CAP_RAW_QUERY; + dbb->cap = DB_CAP_ALL | DB_CAP_AFFECTED_ROWS | DB_CAP_RAW_QUERY | DB_CAP_REPLACE; return 0; } diff --git a/modules/db_text/dbtext.h b/modules/db_text/dbtext.h index 92e6236..5cbacae 100644 --- a/modules/db_text/dbtext.h +++ b/modules/db_text/dbtext.h @@ -82,6 +82,12 @@ int dbt_update(db1_con_t* _h, db_key_t* _k, db_op_t* _o, db_val_t* _v, db_key_t* _uk, db_val_t* _uv, int _n, int _un); /* + * replace a row in table + */ +int dbt_replace(db1_con_t* _h, db_key_t* _k, db_val_t* _v, + int _n, int _nk, int _m); + +/* * Affected rows */ int dbt_affected_rows(db1_con_t* _h);
8 years, 11 months
1
0
0
0
[kamailio] db_text: add support for replace (#459)
by lazedo
implements replace with update/insert tries to update, inserts if not found You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/459
-- Commit Summary -- * db_text: add support for replace -- File Changes -- M modules/db_text/dbt_base.c (129) M modules/db_text/dbtext.c (3) M modules/db_text/dbtext.h (6) -- Patch Links --
https://github.com/kamailio/kamailio/pull/459.patch
https://github.com/kamailio/kamailio/pull/459.diff
--- Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/459
8 years, 11 months
2
2
0
0
git:master:59c1823b: Merge pull request #458 from kamailio/lazedo/presence_logs
by lazedo
Module: kamailio Branch: master Commit: 59c1823b71871c4e35550414b7169ee28f50d53a URL:
https://github.com/kamailio/kamailio/commit/59c1823b71871c4e35550414b7169ee…
Author: lazedo <luis.azedo(a)factorlusitano.com> Committer: lazedo <luis.azedo(a)factorlusitano.com> Date: 2016-01-04T10:17:57Z Merge pull request #458 from kamailio/lazedo/presence_logs presence: additional info in logs --- Modified: modules/presence/notify.c --- Diff:
https://github.com/kamailio/kamailio/commit/59c1823b71871c4e35550414b7169ee…
Patch:
https://github.com/kamailio/kamailio/commit/59c1823b71871c4e35550414b7169ee…
--- diff --git a/modules/presence/notify.c b/modules/presence/notify.c index f6a0ba9..d92182b 100644 --- a/modules/presence/notify.c +++ b/modules/presence/notify.c @@ -1612,11 +1612,12 @@ int send_notify_request(subs_t* subs, subs_t * watcher_subs, } LM_GEN1(pres_local_log_level, - "NOTIFY %.*s via %.*s on behalf of %.*s for event %.*s\n", + "NOTIFY %.*s via %.*s on behalf of %.*s for event %.*s : %.*s\n", td->rem_uri.len, td->rem_uri.s, td->hooks.next_hop->len, td->hooks.next_hop->s, - td->loc_uri.len, td->loc_uri.s, subs->event->name.len, - subs->event->name.s); + td->loc_uri.len, td->loc_uri.s, + subs->event->name.len, subs->event->name.s, + subs->callid.len, subs->callid.s); ps_free_tm_dlg(td); @@ -2859,7 +2860,13 @@ int process_dialogs(int round, int presence_winfo) if (dialog->n > 1) { - LM_ERR("multiple records found\n"); + LM_ERR("multiple records found for %.*s, ci : %.*s, tt : %.*s, ft : %.*s, ev : %.*s\n", + sub.pres_uri.len, sub.pres_uri.s, + sub.callid.len, sub.callid.s, + sub.to_tag.len, sub.to_tag.s, + sub.from_tag.len, sub.from_tag.s, + ev_sname.len, ev_sname.s + ); goto delete_dialog; }
8 years, 11 months
1
0
0
0
git:master:ad168dd5: presence: additional info in logs
by lazedo
Module: kamailio Branch: master Commit: ad168dd580d21e1896c21a41b91b7eee5e5e7f8b URL:
https://github.com/kamailio/kamailio/commit/ad168dd580d21e1896c21a41b91b7ee…
Author: lazedo <luis.azedo(a)factorlusitano.com> Committer: lazedo <luis.azedo(a)factorlusitano.com> Date: 2016-01-04T05:17:09Z presence: additional info in logs adds callid to NOTIFY log adds log when multiple records are found in process_dialogs --- Modified: modules/presence/notify.c --- Diff:
https://github.com/kamailio/kamailio/commit/ad168dd580d21e1896c21a41b91b7ee…
Patch:
https://github.com/kamailio/kamailio/commit/ad168dd580d21e1896c21a41b91b7ee…
--- diff --git a/modules/presence/notify.c b/modules/presence/notify.c index f6a0ba9..d92182b 100644 --- a/modules/presence/notify.c +++ b/modules/presence/notify.c @@ -1612,11 +1612,12 @@ int send_notify_request(subs_t* subs, subs_t * watcher_subs, } LM_GEN1(pres_local_log_level, - "NOTIFY %.*s via %.*s on behalf of %.*s for event %.*s\n", + "NOTIFY %.*s via %.*s on behalf of %.*s for event %.*s : %.*s\n", td->rem_uri.len, td->rem_uri.s, td->hooks.next_hop->len, td->hooks.next_hop->s, - td->loc_uri.len, td->loc_uri.s, subs->event->name.len, - subs->event->name.s); + td->loc_uri.len, td->loc_uri.s, + subs->event->name.len, subs->event->name.s, + subs->callid.len, subs->callid.s); ps_free_tm_dlg(td); @@ -2859,7 +2860,13 @@ int process_dialogs(int round, int presence_winfo) if (dialog->n > 1) { - LM_ERR("multiple records found\n"); + LM_ERR("multiple records found for %.*s, ci : %.*s, tt : %.*s, ft : %.*s, ev : %.*s\n", + sub.pres_uri.len, sub.pres_uri.s, + sub.callid.len, sub.callid.s, + sub.to_tag.len, sub.to_tag.s, + sub.from_tag.len, sub.from_tag.s, + ev_sname.len, ev_sname.s + ); goto delete_dialog; }
8 years, 11 months
1
0
0
0
[kamailio] presence: additional info in logs (#458)
by lazedo
adds callid to NOTIFY log adds log when multiple records are found in process_dialogs You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/458
-- Commit Summary -- * presence: additional info in logs -- File Changes -- M modules/presence/notify.c (15) -- Patch Links --
https://github.com/kamailio/kamailio/pull/458.patch
https://github.com/kamailio/kamailio/pull/458.diff
--- Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/458
8 years, 11 months
2
2
0
0
← Newer
1
...
27
28
29
30
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Results per page:
10
25
50
100
200