I'm writing some code using PDO:
$str_insert_sql = 'INSERT INTO some_table (vid, container_cdn_uri, container_name, root_filename, filename_extension, is_default, time_added, original_width, original_height, remote_url_hash) VALUES (:vid, :container_cdn_uri, :container_name, :root_filename, :filename_extension, :is_default, :time_added, :original_width, :original_height, :remote_url_hash)';
$arr_insert = array(
':vid' => 999999,
':container_cdn_uri' => 'http://foo.com/bar',
':container_name' => 'foo_bar',
':root_filename' => 'root_filename',
':filename_extension' => ".jpg",
':is_default' => 1,
':time_added' => date('Y-m-d H:i:s'),
':original_width' => 1600,
':original_height' => 1200,
':remote_url_hash' => md5('http://domain.com/blah');
);
$stmt = $db->prepare($str_insert_sql); // should throw an exception if it fails?? TODO: test if it does
I'm hoping that the prepare statement will throw an exception if the prepare statement fails but I can't seem to make this happen. Can anyone offer a prepare statement that will fail? the docs don't describe what circumstances will cause this failure and I can't seem to make it happen.