You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@httpd.apache.org by bu...@apache.org on 2009/03/10 10:30:27 UTC

DO NOT REPLY [Bug 46827] New: Execute some SQL statement after database connection has been established

https://issues.apache.org/bugzilla/show_bug.cgi?id=46827

           Summary: Execute some SQL statement after database connection
                    has been established
           Product: Apache httpd-2
           Version: 2.3-HEAD
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: mod_dbd
        AssignedTo: bugs@httpd.apache.org
        ReportedBy: mkevac@gmail.com


Created an attachment (id=23365)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=23365)
add DBDInitSQL parameter to mod_dbd

Usually, after connection to DB has been established, user has to execute some
initialization statement.

For example this one:

SET NAMES 'utf8';

Attached patch adds configuration parameter DBDInitSQL, which enables user to
specify which statement(s) to execute after connection has been established.

Same like parameter for prepared statements:

DBDInitSQL "SET NAMES 'utf8'" label

This patch is part of major change to mod_dbd concerning DBDPool-s. See
http://www.mail-archive.com/dev@httpd.apache.org/msg42922.html

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 46827] Execute some SQL statement after database connection has been established

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46827





--- Comment #2 from Chris Darroch <ch...@pearsoncmg.com>  2009-03-26 11:30:26 PST ---
Comments from Ronald Park on dev@httpd.apache.org:
(http://marc.info/?l=apache-httpd-dev&m=123792143900952&w=2)

I think this is an excellent set of patches.  I had developed a similar
enhancement to allow mod_dbd to connect with multiple databases at my last job
but never had a chance to make it available here.  Your version is far more
clever and configurable.

I did have one minor nit to pick with the implementation of the DBDInitSQL
command.  A user might presume that the order of commands listed in the config
file would be preserved when the commands are run.  By using a hash table,
you'll likely get a random order causing problems.  For example, perhaps the
user needs to first load one table then choose a subset from that first table
to file another; if you run them in the reserve order, the second table will
likely be empty. :(

If you choose not to change the implementation, then the documentation should
make this clear.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 46827] Execute some SQL statement after database connection has been established

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46827


Marko Kevac <mk...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #23482|0                           |1
        is obsolete|                            |




--- Comment #4 from Marko Kevac <mk...@gmail.com>  2009-04-16 10:51:31 PST ---
Created an attachment (id=23500)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=23500)
new patch

Removed DBD_DECLARE_NONSTD(void) from ap_dbd_sql_init function definition.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 46827] Execute some SQL statement after database connection has been established

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46827


Marko Kevac <mk...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #23365|0                           |1
        is obsolete|                            |




--- Comment #1 from Marko Kevac <mk...@gmail.com>  2009-03-13 03:19:31 PST ---
Created an attachment (id=23379)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=23379)
 add DBDInitSQL parameter to mod_dbd

http://www.mail-archive.com/dev@httpd.apache.org/msg43269.html

Nick Kew proposed use of hook instead of function call. So I'v implemented that
and now i am adding new patch.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 46827] Execute some SQL statement after database connection has been established

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46827

Graham Leggett <mi...@sharp.fm> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #5 from Graham Leggett <mi...@sharp.fm> 2009-10-09 15:35:37 UTC ---
My understanding is that this was committed to trunk, can you confirm whether
this was resolved?

Can you reopen this if not.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 46827] Execute some SQL statement after database connection has been established

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46827


Dan Poirier <po...@pobox.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |PatchAvailable
           Severity|normal                      |enhancement




-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 46827] Execute some SQL statement after database connection has been established

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46827


Marko Kevac <mk...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #23379|0                           |1
        is obsolete|                            |




--- Comment #3 from Marko Kevac <mk...@gmail.com>  2009-04-12 08:34:01 PST ---
Created an attachment (id=23482)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=23482)
main patch

This patch adds ability to the mod_dbd Apache module to execute any SQL
statements after DB connection have been established.

Patch is against httpd trunk.

Configuration example:

        DBDriver mysql
        DBDParams host=localhost,user=root,reconnect=0
        DBDPersist On
        DBDInitSQL "USE passport"
        DBDInitSQL "SET NAMES utf8"
        DBDMin 1

Order of the DBDInitSQL statements is preserved (statements will be executed in
same order they were in httpd.conf file).

Also this patch introduces optional post_connection hook, which enables any
other module to hook after connection were established.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org