I have tested this and it works great.
can you please proceed to backport it.

thanks

Jay




On 7 February 2014 01:09, Daniel-Constantin Mierla <miconda@gmail.com> wrote:
I pushed a rework-ed patch. Can you try with the patch from commit:

- http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=3cde37cf10795b4eb785ffd141a8b28e64864f5d

I don't use cassandra, so didn't test it. If all goes fine with the tests, then I can backport.

Cheersm
Daniel



On 06/02/14 05:30, jay binks wrote:
So I posted this to the user list in December, and got nowhere..

Can someone familiar with db_cassandra review my patch ( possibly clean this up and commit it )


# git diff dbcassa_base.cpp 
diff --git a/modules/db_cassandra/dbcassa_base.cpp b/modules/db_cassandra/dbcassa_base.cpp
index e9d3a32..155221d 100644
--- a/modules/db_cassandra/dbcassa_base.cpp
+++ b/modules/db_cassandra/dbcassa_base.cpp
@@ -439,6 +439,7 @@ ColumnVecPtr cassa_translate_query(const db1_con_t* _h, const db_key_t* _k,
        int key_len=0, seckey_len = 0;
        int no_kc, no_sec_kc;
        dbcassa_table_p tbc;
+       char pk[255];
 
        /** Lock table schema and construct primary and secondary key **/
        if(_k) {
@@ -495,8 +496,12 @@ ColumnVecPtr cassa_translate_query(const db1_con_t* _h, const db_key_t* _k,
                } else { /* the table doesn't have any secondary key defined */
                        if(_c) {
                                for(int i=0; i< _nc; i++) {
-                                       sp.column_names.push_back(_c[i]->s);
-                                       LM_DBG("Query col: %s\n", _c[i]->s);
+                                       sprintf(pk, "%.*s", _c[i]->len, _c[i]->s );
+                                       sp.column_names.push_back( pk);
+                                       //sp.column_names.push_back(_c[i]->s);
+                                       LM_DBG("Query col: %s\n", pk );
+                                       //LM_DBG("Query col: %s\n", _c[i]->s);
+                                       LM_DBG("JAY Query col: %.*s\n", _c[i]->len, _c[i]->s);
                                }
                                LM_DBG("get %d columns\n", _nc);
                                sp.__isset.column_names = true; // set




yea I know I left crap in there, but it gives you an idea... also...
yea pk is a crap name... copy paste... and I havnt given any thought to the size 255 ,  but thats probably fairly safe and anything smaller might not be so safe.
( unless there is a limit elsewhere I should observe )

Jay


_______________________________________________
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

_______________________________________________
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev




--
Sincerely

Jay