You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Kevac Marko <ma...@kevac.org> on 2009/10/01 12:10:43 UTC

[PATCH] add some flags to apr_dbd_mysql flags parameter

Hello.

What do you think about this patch?
Without one of these flags CALL does not work. But with them, CALL
works as it should.

diff --git a/dbd/apr_dbd_mysql.c b/dbd/apr_dbd_mysql.c
index 77fa5fb..01afed2 100644
--- a/dbd/apr_dbd_mysql.c
+++ b/dbd/apr_dbd_mysql.c
@@ -1156,9 +1156,16 @@ static apr_dbd_t *dbd_mysql_open(apr_pool_t
*pool, const char *params,
     if (fields[4].value != NULL) {
         port = atoi(fields[4].value);
     }
-    if (fields[6].value != NULL &&
-        !strcmp(fields[6].value, "CLIENT_FOUND_ROWS")) {
-        flags |= CLIENT_FOUND_ROWS; /* only option we know */
+    if (fields[6].value != NULL) {
+        if (strstr(fields[6].value, "CLIENT_FOUND_ROWS")) {
+            flags |= CLIENT_FOUND_ROWS;
+        }
+        else if (strstr(fields[6].value, "CLIENT_MULTI_STATEMENTS")) {
+            flags |= CLIENT_MULTI_STATEMENTS;
+        }
+        else if (strstr(fields[6].value, "CLIENT_MULTI_RESULTS")) {
+            flags |= CLIENT_MULTI_RESULTS;
+        }
     }
     if (fields[7].value != NULL) {
         sql->fldsz = atol(fields[7].value);

-- 
Marko Kevac
Sent from Moscow, Mow, Russia

Re: [PATCH] add some flags to apr_dbd_mysql flags parameter

Posted by Firat Sarlar <sf...@yahoo.com>.
This patch is not enough to make use stored proc.s. correctly.
I'm getting "commands out of sync" errors.
I can avoid this errs. when I switch (mod_dbd) dbpersist param to off
 but it kills whole db pooling .

Also even if it's relevant , I would like to point something else, 
that using 
SQL's like SELECT DATE_FORMAT(dt, '%y %D %M') ..... with dbdprepare don't work.

Forgive my English. 



Re: [PATCH] add some flags to apr_dbd_mysql flags parameter

Posted by Bojan Smojver <bo...@rexursive.com>.
On Fri, 2009-10-09 at 13:39 +0400, Kevac Marko wrote:
> Thank you. I am ready to comment on everything or fix anything, but i
> would not like for patches just to vanish in depths of history.

Got it. No worries. Also, I see you filed bugs, so this will definitely
haunt us :-)

-- 
Bojan


Re: [PATCH] add some flags to apr_dbd_mysql flags parameter

Posted by Kevac Marko <ma...@kevac.org>.
Thank you. I am ready to comment on everything or fix anything, but i
would not like for patches just to vanish in depths of history.

On Fri, Oct 9, 2009 at 1:25 PM, Bojan Smojver <bo...@rexursive.com> wrote:
> On Fri, 2009-10-09 at 13:21 +0400, Kevac Marko wrote:
>> I would like to head word or two from apr-lib mantainers about this
>> patch.
>
> I've seen it, but I'm ENOTIME right now. When I get some time, I'll
> review it.
>
> --
> Bojan
>
>



-- 
Marko Kevac
Sent from Moscow, Mow, Russia

Re: [PATCH] add some flags to apr_dbd_mysql flags parameter

Posted by Bojan Smojver <bo...@rexursive.com>.
On Fri, 2009-10-09 at 13:21 +0400, Kevac Marko wrote:
> I would like to head word or two from apr-lib mantainers about this
> patch.

I've seen it, but I'm ENOTIME right now. When I get some time, I'll
review it.

-- 
Bojan


Re: [PATCH] add some flags to apr_dbd_mysql flags parameter

Posted by Kevac Marko <ma...@kevac.org>.
I would like to head word or two from apr-lib mantainers about this
patch. Thanks.

On Fri, Oct 2, 2009 at 10:47 AM, Kevac Marko <ma...@kevac.org> wrote:
> I have filled the bug - https://issues.apache.org/bugzilla/show_bug.cgi?id=47931
>
> On Thu, Oct 1, 2009 at 2:10 PM, Kevac Marko <ma...@kevac.org> wrote:
>> Hello.
>>
>> What do you think about this patch?
>> Without one of these flags CALL does not work. But with them, CALL
>> works as it should.
>>
>> diff --git a/dbd/apr_dbd_mysql.c b/dbd/apr_dbd_mysql.c
>> index 77fa5fb..01afed2 100644
>> --- a/dbd/apr_dbd_mysql.c
>> +++ b/dbd/apr_dbd_mysql.c
>> @@ -1156,9 +1156,16 @@ static apr_dbd_t *dbd_mysql_open(apr_pool_t
>> *pool, const char *params,
>>     if (fields[4].value != NULL) {
>>         port = atoi(fields[4].value);
>>     }
>> -    if (fields[6].value != NULL &&
>> -        !strcmp(fields[6].value, "CLIENT_FOUND_ROWS")) {
>> -        flags |= CLIENT_FOUND_ROWS; /* only option we know */
>> +    if (fields[6].value != NULL) {
>> +        if (strstr(fields[6].value, "CLIENT_FOUND_ROWS")) {
>> +            flags |= CLIENT_FOUND_ROWS;
>> +        }
>> +        else if (strstr(fields[6].value, "CLIENT_MULTI_STATEMENTS")) {
>> +            flags |= CLIENT_MULTI_STATEMENTS;
>> +        }
>> +        else if (strstr(fields[6].value, "CLIENT_MULTI_RESULTS")) {
>> +            flags |= CLIENT_MULTI_RESULTS;
>> +        }
>>     }
>>     if (fields[7].value != NULL) {
>>         sql->fldsz = atol(fields[7].value);
>>
>> --
>> Marko Kevac
>> Sent from Moscow, Mow, Russia
>>
>
>
>
> --
> Marko Kevac
> Sent from Moscow, Mow, Russia
>



-- 
Marko Kevac
Sent from Moscow, Mow, Russia

Re: [PATCH] add some flags to apr_dbd_mysql flags parameter

Posted by Kevac Marko <ma...@kevac.org>.
I have filled the bug - https://issues.apache.org/bugzilla/show_bug.cgi?id=47931

On Thu, Oct 1, 2009 at 2:10 PM, Kevac Marko <ma...@kevac.org> wrote:
> Hello.
>
> What do you think about this patch?
> Without one of these flags CALL does not work. But with them, CALL
> works as it should.
>
> diff --git a/dbd/apr_dbd_mysql.c b/dbd/apr_dbd_mysql.c
> index 77fa5fb..01afed2 100644
> --- a/dbd/apr_dbd_mysql.c
> +++ b/dbd/apr_dbd_mysql.c
> @@ -1156,9 +1156,16 @@ static apr_dbd_t *dbd_mysql_open(apr_pool_t
> *pool, const char *params,
>     if (fields[4].value != NULL) {
>         port = atoi(fields[4].value);
>     }
> -    if (fields[6].value != NULL &&
> -        !strcmp(fields[6].value, "CLIENT_FOUND_ROWS")) {
> -        flags |= CLIENT_FOUND_ROWS; /* only option we know */
> +    if (fields[6].value != NULL) {
> +        if (strstr(fields[6].value, "CLIENT_FOUND_ROWS")) {
> +            flags |= CLIENT_FOUND_ROWS;
> +        }
> +        else if (strstr(fields[6].value, "CLIENT_MULTI_STATEMENTS")) {
> +            flags |= CLIENT_MULTI_STATEMENTS;
> +        }
> +        else if (strstr(fields[6].value, "CLIENT_MULTI_RESULTS")) {
> +            flags |= CLIENT_MULTI_RESULTS;
> +        }
>     }
>     if (fields[7].value != NULL) {
>         sql->fldsz = atol(fields[7].value);
>
> --
> Marko Kevac
> Sent from Moscow, Mow, Russia
>



-- 
Marko Kevac
Sent from Moscow, Mow, Russia

Re: [PATCH] add some flags to apr_dbd_mysql flags parameter

Posted by Firat Sarlar <sf...@yahoo.com>.
if (fields[6].value != NULL)
{
	if(strstr(fields[6].value, "CLIENT_LONG_PASSWORD")) flags |= 
CLIENT_LONG_PASSWORD;
	if(strstr(fields[6].value, "CLIENT_FOUND_ROWS")) flags |= 
CLIENT_FOUND_ROWS;
	if(strstr(fields[6].value, "CLIENT_LONG_FLAG")) flags |= 
CLIENT_LONG_FLAG;
	if(strstr(fields[6].value, "CLIENT_CONNECT_WITH_DB")) flags |= 
CLIENT_CONNECT_WITH_DB;

	if(strstr(fields[6].value, "CLIENT_NO_SCHEMA")) flags |= 
CLIENT_NO_SCHEMA;
	if(strstr(fields[6].value, "CLIENT_COMPRESS")) flags |= CLIENT_COMPRESS;
	if(strstr(fields[6].value, "CLIENT_ODBC")) flags |= CLIENT_ODBC;
	if(strstr(fields[6].value, "CLIENT_LOCAL_FILES")) flags |= 
CLIENT_LOCAL_FILES;
	if(strstr(fields[6].value, "CLIENT_IGNORE_SPACE")) flags |= 
CLIENT_IGNORE_SPACE;
	if(strstr(fields[6].value, "CLIENT_PROTOCOL_41")) flags |= 
CLIENT_PROTOCOL_41;
	if(strstr(fields[6].value, "CLIENT_INTERACTIVE")) flags |= 
CLIENT_INTERACTIVE;
	if(strstr(fields[6].value, "CLIENT_SSL")) flags |= CLIENT_SSL;

	if(strstr(fields[6].value, "CLIENT_IGNORE_SIGPIPE")) flags |= 
CLIENT_IGNORE_SIGPIPE;
	if(strstr(fields[6].value, "CLIENT_TRANSACTIONS")) flags |= 
CLIENT_TRANSACTIONS;
	if(strstr(fields[6].value, "CLIENT_RESERVED")) flags |= CLIENT_RESERVED;
	if(strstr(fields[6].value, "CLIENT_SECURE_CONNECTION")) flags |= 
CLIENT_SECURE_CONNECTION;
	if(strstr(fields[6].value, "CLIENT_MULTI_STATEMENTS")) flags |= 
CLIENT_MULTI_STATEMENTS;
	if(strstr(fields[6].value, "CLIENT_MULTI_RESULTS")) flags |= 
CLIENT_MULTI_RESULTS;
	if(strstr(fields[6].value, "CLIENT_REMEMBER_OPTIONS")) flags |= 
CLIENT_REMEMBER_OPTIONS;
}


Re: [PATCH] add some flags to apr_dbd_mysql flags parameter

Posted by Kevac Marko <ma...@kevac.org>.
Any more thouhts? Thanks.

On Sat, Oct 10, 2009 at 9:37 AM, Kevac Marko <ma...@kevac.org> wrote:
> You are right - we should. They are not exclusive.
>
> Fixed patch:
>
> diff --git a/dbd/apr_dbd_mysql.c b/dbd/apr_dbd_mysql.c
> index 77fa5fb..3c0d911 100644
> --- a/dbd/apr_dbd_mysql.c
> +++ b/dbd/apr_dbd_mysql.c
> @@ -1156,9 +1156,16 @@ static apr_dbd_t *dbd_mysql_open(apr_pool_t
> *pool, const char *params,
>     if (fields[4].value != NULL) {
>         port = atoi(fields[4].value);
>     }
> -    if (fields[6].value != NULL &&
> -        !strcmp(fields[6].value, "CLIENT_FOUND_ROWS")) {
> -        flags |= CLIENT_FOUND_ROWS; /* only option we know */
> +    if (fields[6].value != NULL) {
> +        if (strstr(fields[6].value, "CLIENT_FOUND_ROWS")) {
> +            flags |= CLIENT_FOUND_ROWS;
> +        }
> +        if (strstr(fields[6].value, "CLIENT_MULTI_STATEMENTS")) {
> +            flags |= CLIENT_MULTI_STATEMENTS;
> +        }
> +        if (strstr(fields[6].value, "CLIENT_MULTI_RESULTS")) {
> +            flags |= CLIENT_MULTI_RESULTS;
> +        }
>     }
>     if (fields[7].value != NULL) {
>         sql->fldsz = atol(fields[7].value);
>
> On Sat, Oct 10, 2009 at 7:21 AM, Bojan Smojver <bo...@rexursive.com> wrote:
>> Question here (I didn't look at the manual to check): are all these
>> flags mutually exclusive? If they are not, we should have 3 ifs instead
>> of if/else if, right?
>>
>> --
>> Bojan
>>
>>
>
>
>
> --
> Marko Kevac
>



-- 
Marko Kevac
Sent from Moscow, Mow, Russia

Re: [PATCH] add some flags to apr_dbd_mysql flags parameter

Posted by Kevac Marko <ma...@kevac.org>.
You are right - we should. They are not exclusive.

Fixed patch:

diff --git a/dbd/apr_dbd_mysql.c b/dbd/apr_dbd_mysql.c
index 77fa5fb..3c0d911 100644
--- a/dbd/apr_dbd_mysql.c
+++ b/dbd/apr_dbd_mysql.c
@@ -1156,9 +1156,16 @@ static apr_dbd_t *dbd_mysql_open(apr_pool_t
*pool, const char *params,
     if (fields[4].value != NULL) {
         port = atoi(fields[4].value);
     }
-    if (fields[6].value != NULL &&
-        !strcmp(fields[6].value, "CLIENT_FOUND_ROWS")) {
-        flags |= CLIENT_FOUND_ROWS; /* only option we know */
+    if (fields[6].value != NULL) {
+        if (strstr(fields[6].value, "CLIENT_FOUND_ROWS")) {
+            flags |= CLIENT_FOUND_ROWS;
+        }
+        if (strstr(fields[6].value, "CLIENT_MULTI_STATEMENTS")) {
+            flags |= CLIENT_MULTI_STATEMENTS;
+        }
+        if (strstr(fields[6].value, "CLIENT_MULTI_RESULTS")) {
+            flags |= CLIENT_MULTI_RESULTS;
+        }
     }
     if (fields[7].value != NULL) {
         sql->fldsz = atol(fields[7].value);

On Sat, Oct 10, 2009 at 7:21 AM, Bojan Smojver <bo...@rexursive.com> wrote:
> Question here (I didn't look at the manual to check): are all these
> flags mutually exclusive? If they are not, we should have 3 ifs instead
> of if/else if, right?
>
> --
> Bojan
>
>



-- 
Marko Kevac

Re: [PATCH] add some flags to apr_dbd_mysql flags parameter

Posted by Bojan Smojver <bo...@rexursive.com>.
On Thu, 2009-10-01 at 14:10 +0400, Kevac Marko wrote:
> +    if (fields[6].value != NULL) {
> +        if (strstr(fields[6].value, "CLIENT_FOUND_ROWS")) {
> +            flags |= CLIENT_FOUND_ROWS;
> +        }
> +        else if (strstr(fields[6].value, "CLIENT_MULTI_STATEMENTS"))
> {
> +            flags |= CLIENT_MULTI_STATEMENTS;
> +        }
> +        else if (strstr(fields[6].value, "CLIENT_MULTI_RESULTS")) {
> +            flags |= CLIENT_MULTI_RESULTS;
> +        }

Question here (I didn't look at the manual to check): are all these
flags mutually exclusive? If they are not, we should have 3 ifs instead
of if/else if, right?

-- 
Bojan