Msql-Mysql-modules

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

            $dsn = "DBI:$driver:$database";
            $dsn = "DBI:$driver:database=$database;host=$hostname";

            $dbh = DBI->connect($dsn, undef, undef);

                or

            $dsn = "DBI:mysql:$database";
            $dsn = "DBI:mysql:database=$database;host=$hostname";
            $dsn = "DBI:mysql:database=$database;host=$hostname;port=$port";

            $dbh = DBI->connect($dsn, $user, $password);

        A `database' must always be specified.

        host
        port    The hostname, if not specified or specified as '', will
                default to an mysql or mSQL daemon running on the local
                machine on the default port for the UNIX socket.

                Should the mysql or mSQL daemon be running on a non-standard
                port number, you may explicitly state the port number to
                connect to in the `hostname' argument, by concatenating the
                *hostname* and *port number* together separated by a colon (
                `:' ) character or by using the `port' argument. This
                doesn't work for mSQL 2: You have to create an alternative
                config file and load it using the msql_configfile attribute,
                see below.

        mysql_client_found_rows
                Enables (TRUE value) or disables (FALSE value) the flag
                CLIENT_FOUND_ROWS while connecting to the MySQL server. This
                has a somewhat funny effect: Without
                mysql_client_found_rows, if you perform a query like

                  UPDATE $table SET id = 1 WHERE id = 1

                then the MySQL engine will always return 0, because no rows
                have changed. With mysql_client_found_rows however, it will
                return the number of rows that have an id 1, as some people
                are expecting. (At least for compatibility to other
                engines.)

                By default this flag is disabled. However, you can enable it
                by default, when installing the Msql-Mysql-modules with

                  perl Makefile.PL --config --mysql-use-client-found-rows
                  make
                  make install

        mysql_compression
                As of MySQL 3.22.3, a new feature is supported: If your DSN
                contains the option "mysql_compression=1", then the
                communication between client and server will be compressed.

        mysql_connect_timeout
                If your DSN contains the option "mysql_connect_timeout=##",
                the connect request to the server will timeout if it has not
                been successful after the given number of seconds.

        mysql_read_default_file
        mysql_read_default_group
                These options can be used to read a config file like
                /etc/my.cnf or ~/.my.cnf. By default MySQL's C client
                library doesn't use any config files unlike the client
                programs (mysql, mysqladmin, ...) that do, but outside of
                the C client library. Thus you need to explicitly request
                reading a config file, as in

                    $dsn = "DBI:mysql:test;mysql_read_default_file=/home/joe/my.cnf";
                    $dbh = DBI->connect($dsn, $user, $password)

                The option mysql_read_default_group can be used to specify
                the default group in the config file: Usually this is the
                *client* group, but see the following example:

                    [perl]
                    host=perlhost

                    [client]
                    host=localhost

                If you read this config file, then you'll be typically
                connected to *localhost*. However, by using

                    $dsn = "DBI:mysql:test;mysql_read_default_group=perl;"
                        . "mysql_read_default_file=/home/joe/my.cnf";
                    $dbh = DBI->connect($dsn, $user, $password);

                you'll be connected to *perlhost*. Note that if you specify
                a default group and do not specify a file, then the default
                config files will all be read. See the (missing :-)
                documentation of the C function mysql_options() for details.

        mysql_socket
                As of MySQL 3.21.15, it is possible to choose the Unix
                socket that is used for connecting to the server. This is
                done, for example, with

                    mysql_socket=/dev/mysql

                Usually there's no need for this option, unless you are
                using another location for the socket than that built into
                the client.

  Private MetaData Methods

    ListDBs
            my $drh = DBI->install_driver("mysql");
            @dbs = $drh->func("$hostname:$port", '_ListDBs');
            @dbs = $drh->func($hostname, $port, '_ListDBs');
            @dbs = $dbh->func('_ListDBs');

        Returns a list of all databases managed by the mysql daemon or mSQL
        daemon running on `$hostname', port `$port'. This method is rarely
        needed for databases running on `localhost': You should use the
        portable method

            @dbs = DBI->data_sources("mysql");

                or

            @dbs = DBI->data_sources("mSQL");

        whenever possible. It is a design problem of this method, that
        there's no way of supplying a host name or port number to
        `data_sources', that's the only reason why we still support
        `ListDBs'. :-(

    ListTables
        *WARNING*: This method is obsolete due to DBI's $dbh->table_info().

            @tables = $dbh->func('_ListTables');

        Once connected to the desired database on the desired mysql or mSQL
        mSQL daemon with the `DBI-'connect()> method, we may extract a list
        of the tables that have been created within that database.

        `ListTables' returns an array containing the names of all the tables
        present within the selected database. If no tables have been
        created, an empty list is returned.

            @tables = $dbh->func( '_ListTables' );
            foreach $table ( @tables ) {
                print "Table: $table\n";
              }



( run in 1.046 second using v1.01-cache-2.11-cpan-acf6aa7dc9e )