You are viewing a plain text version of this content. The canonical link for it is here.
Posted to sandesha-dev@ws.apache.org by da...@apache.org on 2007/04/26 12:57:52 UTC

svn commit: r532700 - /webservices/sandesha/trunk/c/src/storage/mysql/permanent_seq_property_mgr.c

Author: damitha
Date: Thu Apr 26 03:57:51 2007
New Revision: 532700

URL: http://svn.apache.org/viewvc?view=rev&rev=532700
Log:
Improved mysql row accessing logic in seq_property_mgr.c

Modified:
    webservices/sandesha/trunk/c/src/storage/mysql/permanent_seq_property_mgr.c

Modified: webservices/sandesha/trunk/c/src/storage/mysql/permanent_seq_property_mgr.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/storage/mysql/permanent_seq_property_mgr.c?view=diff&rev=532700&r1=532699&r2=532700
==============================================================================
--- webservices/sandesha/trunk/c/src/storage/mysql/permanent_seq_property_mgr.c (original)
+++ webservices/sandesha/trunk/c/src/storage/mysql/permanent_seq_property_mgr.c Thu Apr 26 03:57:51 2007
@@ -49,35 +49,36 @@
     void *data)
 {
     MYSQL_ROW row;
+    int num_rows = -1;
+    int i = -1;
     sandesha2_seq_property_bean_t *bean = NULL; 
     sandesha2_bean_mgr_args_t *args = (sandesha2_bean_mgr_args_t *) data;
     const axutil_env_t *env = args->env;
     axutil_array_list_t *data_list = (axutil_array_list_t *) args->data;
-    if((row = mysql_fetch_row(res)) != NULL)
+    num_rows = mysql_num_rows(res);
+    if(num_rows > 0)
     {
         if(!data_list)
         {
             data_list = axutil_array_list_create(env, 0);
             args->data = data_list;
         }
-        bean = sandesha2_seq_property_bean_create(env);
-        sandesha2_seq_property_bean_set_seq_id(bean, env, row[0]);
-        sandesha2_seq_property_bean_set_name(bean, env, row[1]);
-        sandesha2_seq_property_bean_set_value(bean, env, row[2]);
-        axutil_array_list_add(data_list, env, bean);
     }
     else
     {
         args->data = NULL;
         return 0;
     }
-    while((row = mysql_fetch_row(res)) != NULL)
+    for(i = 0; i < num_rows; i++)
     {
-        bean = sandesha2_seq_property_bean_create(env);
-        sandesha2_seq_property_bean_set_seq_id(bean, env, row[0]);
-        sandesha2_seq_property_bean_set_name(bean, env, row[1]);
-        sandesha2_seq_property_bean_set_value(bean, env, row[2]);
-        axutil_array_list_add(data_list, env, bean);
+        if((row = mysql_fetch_row(res)) != NULL)
+        {
+            bean = sandesha2_seq_property_bean_create(env);
+            sandesha2_seq_property_bean_set_seq_id(bean, env, row[0]);
+            sandesha2_seq_property_bean_set_name(bean, env, row[1]);
+            sandesha2_seq_property_bean_set_value(bean, env, row[2]);
+            axutil_array_list_add(data_list, env, bean);
+        }
     }
     return 0;
 }
@@ -88,20 +89,25 @@
     void *data)
 {
     MYSQL_ROW row;
+    int num_rows = -1;
     sandesha2_bean_mgr_args_t *args = (sandesha2_bean_mgr_args_t *) data;
     const axutil_env_t *env = args->env;
     sandesha2_seq_property_bean_t *bean = NULL;
     bean = (sandesha2_seq_property_bean_t *) args->data;
-    if((row = mysql_fetch_row(res)) != NULL)
+    num_rows = mysql_num_rows(res);
+    if(num_rows > 0)
     {
         if(!bean)
         {
             bean = sandesha2_seq_property_bean_create(env);
             args->data = bean;
         }
-        sandesha2_seq_property_bean_set_seq_id(bean, env, row[0]);
-        sandesha2_seq_property_bean_set_name(bean, env, row[1]);
-        sandesha2_seq_property_bean_set_value(bean, env, row[2]);
+        if((row = mysql_fetch_row(res)) != NULL)
+        {
+            sandesha2_seq_property_bean_set_seq_id(bean, env, row[0]);
+            sandesha2_seq_property_bean_set_name(bean, env, row[1]);
+            sandesha2_seq_property_bean_set_value(bean, env, row[2]);
+        }
     }
     else
     {



---------------------------------------------------------------------
To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: sandesha-dev-help@ws.apache.org