How can I do the below code faster? I want to insert a new record if it does not exist. Then I want to get the ID.

function _get_author_id($name){
$sql = "INSERT IGNORE INTO {ezc_author}(name) " .
" VALUES ('%s');" ;

$result = db_query($sql,$name);

$sql = "SELECT ID from {ezc_author} WHERE name='%s'";

$result = db_query($sql,$name);

return db_result($result);

}