Changes between Version 1 and Version 2 of support-team/mysql-mysqli-conversion


Ignore:
Timestamp:
Apr 16, 2014, 9:07:11 PM (7 years ago)
Author:
Ross
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • support-team/mysql-mysqli-conversion

    v1 v2  
    88
    99=== mysql_connect ===
     10mysql_connect takes only the parameters (host, user, password) and returns the connection resource.
     11==== mysqli_connect ===
     12For this function requires a few more parameters.  Our currently functional implementation looks like this:
     13{{{
     14$flags = 0;
     15$flags = MYSQL_CLIENT_SSL;
     16$sql = mysqli_init();
     17if (!($sql->options(MYSQLI_READ_DEFAULT_FILE, '/root/horror/my.cnf')))
     18  printf("failed to set the default file (MYSQLI_READ_DEFAULT_FILE: %d)\n", MYSQLI_READ_DEFAULT_FILE);
     19if (!($sql->options(MYSQLI_READ_DEFAULT_GROUP, 'red')))
     20  printf("failed to set the group for the default file (MYSQLI_READ_DEFAULT_GROUP: %d)\n", MYSQLI_READ_DEFAULT_GROUP);
     21if (!($sql->real_connect($db_host,$db_user,$db_pass, $db_name))) {
     22  printf("failed to really connect\n");
     23}
     24}}}
     25===== Notable changes =====
     26 * $flags = MYSQL_CLIENT_SSL;
     27  * This flag ensures the client is connection via ssl.
     28 * $sql->options(MYSQLI_READ_DEFAULT_FILE, '/root/horror/my.cnf')
     29  * Here we add a new set of options in a custom my.cnf file, probably stored in /user/local/etc/red/my.cnf.  The configured options are:
     30{{{
     31[red]
     32ssl=true
     33ssl-ca=/etc/mysql/red-cert.pem
     34ssl-verify-server-cert=true
     35}}}
     36   * where `red-cert.pem` is the mysql ca certificate, which will need to be stored on all MOSHes and on hay.
     37 * $sql->options(MYSQLI_READ_DEFAULT_GROUP, 'red')
     38  * This simply says, "Read from the my.cnf group `red`.
     39 * $sql->real_connect($db_host,$db_user,$db_pass, $db_name)
     40  * This makes the mysql connection.
    1041=== mysql_data_seek ===
    1142=== mysql_error ===