Re: [exim] mysql lookup on update: $value is affected rows?

Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: Marilyn Davis
Ημερομηνία:  
Προς: exim-users
Υ/ο: ph10
Αντικείμενο: Re: [exim] mysql lookup on update: $value is affected rows?

The mysql doc says to expect a my_ulonglong from mysql_num_ros:

---
my_ulonglong
    The type used for the number of rows and for
mysql_affected_rows(), mysql_num_rows(), and
mysql_insert_id(). This type provides a range of 0 to
1.84e19. On some systems, attempting to print a value
of type my_ulonglong will not work. To print such a
value, convert it to unsigned long and use a %lu print
format. Example:


printf ("Number of rows: %lu\n", (unsigned long)
mysql_num_rows(result));

---

I'm embarrassed to say that I hacked around and still can't get it to
work. (I thought I was good at C, I've been teaching it for a lot of
years.)

   if ( mysql_field_count(mysql_handle) == 0 )
     {
       unsigned long res;
       static char res_string[100];


       DEBUG(D_lookup) debug_printf("MYSQL: query was not one that returns data\n");
       /*    result = string_sprintf("%lu",(unsigned long)mysql_affected_rows(mysql_handle));*/
       res = (unsigned long)mysql_affected_rows(mysql_handle);
       result = string_sprintf("%lu", res);
       sprintf(res_string, "%lu", res);
       debug_printf("long result = %s\n", res_string);
       *do_cache = FALSE;
       goto MYSQL_EXIT;
     }


But the result is still miserable:

MYSQL query: update in_out set last_use = now() where in_id = 10 and out_id = 64
MYSQL using cached connection for localhost/maildance/root
MYSQL: query was not one that returns data
long result = 0
lookup forced cache cleanup
lookup yielded: 0
expanding: $value
    result: 0


--

Maybe you have an idea I can try?

Marilyn