daily pastebin goal
82%
SHARE
TWEET

Untitled

a guest Sep 19th, 2011 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. bool addDirectors(const Movie &theMovie)
  2. {
  3.     QStringListIterator it(theMovie.directors_);
  4.  
  5.     while(it.hasNext())
  6.     {
  7.         QSqlQuery query("SELECT NAME FROM DIRECTOR WHERE NAME = :name;");
  8.         query.bindValue(":name", it.);
  9.  
  10.         if(query.isNull())
  11.         {
  12.             query("INSERT INTO DIRECTOR(NAME) VALUES (:name);");
  13.             query.bindValue(":name", *it);
  14.         }
  15.  
  16.         query("INSERT INTO DIRECT(ID, NAME, USERNAME) VALUES (:id, :name, :username);");
  17.         query.bindValue(":id", theMovie.id_);
  18.         query.bindValue(":name", *it);
  19.         query.bindValue(":username", theMovie.username_);
  20.  
  21.         query.clear();
  22.     }
  23. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top