hellios78 / flexviews

Automatically exported from code.google.com/p/flexviews
0 stars 0 forks source link

[Feature] Handling sockets in consumer.ini file #7

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Bug:
- To support this todo feature
/*TODO: support unix domain sockets */

File ini

- consumer/consumer.ini
- Another optional value socket is provided in the sample consumer.ini.sample

54,57c54,56
< host=localhost
< port=3307
< password=root
< socket=/var/lib/mysql/mysql.sock

---
> host=127.0.0.1
> port=3306
> password=

- Attached patch for flexcdc.php checks if the socket parameter is supplied and 
if yes will go ahead and create the link to the DB using the sockets instead of 
the port.

What is the expected output? What do you see instead?
mysql link gets created as expected.

What version of the product are you using? On what operating system?
MySQL 5.1+
PHP 5.1+
CentOS 5.5

Please provide any additional information below.

Original issue reported on code.google.com by poorna.s...@gmail.com on 5 Jul 2011 at 6:15

Attachments:

GoogleCodeExporter commented 9 years ago
[ec2-user@ip-10-245-67-14 consumer]$ svn diff
Index: include/flexcdc.php
===================================================================
--- include/flexcdc.php (revision 236)
+++ include/flexcdc.php (working copy)
@@ -171,10 +171,13 @@
                if(!empty($settings['flexcdc']['bulk_insert']) && $settings['flexcdc']['bulk_insert'] != 'false') {
                        $this->bulk_insert = true;
                }
-
+
+               if(empty($D['host']) && !empty($D['socket'])) $D['host'] = 
'localhost';
+               if(empty($S['host']) && !empty($S['socket'])) $S['host'] = 
'localhost';
+
                /*TODO: support unix domain sockets */
-               $this->source = mysql_connect($S['host'] . ':' . $S['port'], 
$S['user'], $S['password'], true) or die1('Could not connect to MySQL server:' 
. mysql_error());
-               $this->dest = mysql_connect($D['host'] . ':' . $D['port'], 
$D['user'], $D['password'], true) or die1('Could not connect to MySQL server:' 
. mysql_error());
+               $this->source = mysql_connect( $S['host'] . ':' . 
(!empty($S['socket']) ? $S['socket'] : $S['port']), $S['user'], $S['password'], 
true) or die1('Could not connect to MySQL server:' . mysql_error());
+               $this->dest = mysql_connect(   $D['host'] . ':' . 
(!empty($D['socket']) ? $D['socket'] : $D['port']), $D['user'], $D['password'], 
true) or die1('Could not connect to MySQL server:' . mysql_error());

                $this->settings = $settings;

Original comment by greenlion@gmail.com on 12 Jul 2011 at 11:20

GoogleCodeExporter commented 9 years ago
This enhancement has been committed to SVN and will be available in the next 
release of Flexviews.

Original comment by greenlion@gmail.com on 12 Jul 2011 at 11:20