![]() |
|
#1
|
||||
|
||||
About mysql_connect()'s client_flagsPreviously I connected to the MySQL server via my PHP scripts like this:
PHP Code:
In my newer scripts, I want to try the somewhat newer client_flags parameter (available in PHP since ver. 4.3.0) but I am not sure what this paragraph means: Quote:
Is it MYSQL_CLIENT_COMPRESS + MYSQL_CLIENT_INTERACTIVE? Note the PLUS sign between the 2 constants, or is it a bit more complicated than that? About 2 hours ago I modified this copy of the forum script to connect to MySQL this way: PHP Code:
Anybody notice anything different...? __________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
|
#2
|
||||
|
||||
|
I think that you can split the tags with a comma (, )
never tried tho, but thats where testing systems come in place about the compress thing.. In my eyes compressing the MySQL data is not needed when MySQL is on the same server as your site. compressing always means a bit more processor usage so pages will slow down.. but whats the use of that when you MySQL on the same (fast) server. It's about the same with CVS. you can set compression, but setting it to high only slows down the server, which makes the compression useless [added] Just checked the mysql.c file it seems that PHP just passes the client_flags to mysql, so you will have to look at the MySQL manual for those flags i guess |
|
#3
|
||||
|
||||
|
Quote:
Quote:
![]() __________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
|
#4
|
||||
|
||||
|
i was a bit late adding what I found in the .c file (see post above)
I just took a look at the MySQL manual http://www.mysql.com/doc/en/mysql_real_connect.html also no help, they talk about a combination have you tried just adding a space between the flags? |
|
#5
|
||||
|
||||
|
I am embarrased to admit it but YES, I tried the commas, the spaces and finally ONLY the PLUS signed worked... well, it didn't complain when I added the plus sign!
... so that must be it! __________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
|
#6
|
|||
|
|||
|
Jay,
Try separating the flags with pipes: MYSQL_CLIENT_COMPRESS | MYSQL_CLIENT_INTERACTIVE This applies the binary OR operator to each value sending the result to the function. I'm not sure what the actual values of these two fields are, but say they are 8 and 16 just for kicks. 8 = 00001000 and 16 = 00010000, so 8|16 = 00011000. Notice how both flags are now turned on (the 1's)? Actually, you get the same result using + instead of | but if any of the client_flags span multiple bits then you will see some differences. |
|
#7
|
||||
|
||||
|
Thank you Scott, that was it! I've ALWAYS wondered what the php CONSTANT values meant or how I am supposed to use them - now your bit operator example puts a whole new perspective on things... finally!
__________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
Recent GIDBlog
Toyota - 2008 July Promotion by Nihal
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The