Created
November 1, 2011 15:48
-
-
Save davidrenne/1330885 to your computer and use it in GitHub Desktop.
The most amazing mysql flags ever - multiple queries in one mysql_query
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
define('CLIENT_LONG_PASSWORD',1); /* new more secure passwords */ | |
define('CLIENT_FOUND_ROWS',2); /* Found instead of affected rows */ | |
define('CLIENT_LONG_FLAG',4); /* Get all column flags */ | |
define('CLIENT_CONNECT_WITH_DB',8); /* One can specify db on connect */ | |
define('CLIENT_NO_SCHEMA',16); /* Don't allow database.table.column */ | |
define('CLIENT_COMPRESS',32); /* Can use compression protocol */ | |
define('CLIENT_ODBC',64); /* Odbc client */ | |
define('CLIENT_LOCAL_FILES',128); /* Can use LOAD DATA LOCAL */ | |
define('CLIENT_IGNORE_SPACE',256); /* Ignore spaces before '(' */ | |
define('CLIENT_PROTOCOL_41',512); /* New 4.1 protocol */ | |
define('CLIENT_INTERACTIVE',1024); /* This is an interactive client */ | |
define('CLIENT_SSL',2048); /* Switch to SSL after handshake */ | |
define('CLIENT_IGNORE_SIGPIPE',4096); /* IGNORE sigpipes */ | |
define('CLIENT_TRANSACTIONS',8192); /* Client knows about transactions */ | |
define('CLIENT_RESERVED',16384); /* Old flag for 4.1 protocol */ | |
define('CLIENT_SECURE_CONNECTION',32768); /* New 4.1 authentication */ | |
define('CLIENT_MULTI_STATEMENTS',65536); /* Enable/disable multi-stmt support */ | |
define('CLIENT_MULTI_RESULTS',131072); /* Enable/disable multi-results */ | |
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password',true,CLIENT_FOUND_ROWS + CLIENT_MULTI_STATEMENTS + CLIENT_MULTI_RESULTS); | |
mysql_query("insert into blah values (1);update foo set bar = 1; delete from poop where toilet = 1;insert into asdf; set @x=LAST_INSERT_ID(); insert into 1234 (@x);"); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment