src/mysql.php
private static function merge($sql, $binds) {
	if (is_array($binds) == false) {
		$binds = (array)$binds;
	}
	if (is_null(self::$connection)) {
		$exception = bootstrap::get_library('exception');
		$response  = bootstrap::get_library('response');
		throw new $exception('no db connection', $response::STATUS_SERVICE_UNAVAILABLE);
	}
	
	foreach ($binds as &$argument) {
		$argument = self::$connection->real_escape_string($argument);
	}
	
	return vsprintf($sql, $binds);
}
private static function merge($sql, $binds) {
	if (is_array($binds) == false) {
		$binds = (array)$binds;
	}
	if (is_null(self::$connection)) {
		$exception = bootstrap::get_library('exception');
		$response  = bootstrap::get_library('response');
		throw new $exception('no db connection', $response::STATUS_SERVICE_UNAVAILABLE);
	}
	
	foreach ($binds as &$argument) {
		$argument = self::$connection->real_escape_string($argument);
	}
	
	return vsprintf($sql, $binds);
}
private static function merge ( $ sql , $ binds ) { if ( is_array ( $ binds ) == false ) { $ binds = ( array ) $ binds ; } if ( is_null ( self :: $ connection ) ) { $ exception = bootstrap :: get_library ( 'exception' ) ; $ response = bootstrap :: get_library ( 'response' ) ; throw new $ exception ( 'no db connection' , $ response :: STATUS_SERVICE_UNAVAILABLE ) ; } foreach ( $ binds as & $ argument ) { $ argument = self :: $ connection -> real_escape_string ( $ argument ) ; } return vsprintf ( $ sql , $ binds ) ; }
merges bind values while escaping them

$sql can contain printf conversion specifications, i.e.:
- SELECT * WHERE `foo` = '%s';
- SELECT * WHERE `foo` > %d;

@param  string $sql   the base sql statement
@param  array  $binds bind values for the given sql
@return string        input sql merged with bind values
merges bind values while escaping them