title: Primary Key issues when inserting value with SQLite using Node.js
body: <p>I am currently trying to have a server that is using SQLite Data bases. In one of my table, I need to INSERT a new value. The PRIMARY KEY will be writen by a user of my application. The problem is that I am trying to figure out how to make sure the guy does not insert an existing value.</p>
  <p>I am trying not to use a SELECT to look if the PRIMARY KEY exists, but I don't know how to do that with Node.js. I am trying to make a function that just return <code>true</code> or <code>false</code> depending on if the thing exist or not.</p>
  <p>There is what I got after all my attempts:</p>
  <pre><code>  function Validation(DataBase){
        console.log('Validation...')
        var sqlCode = &quot;SELECT My_PRIMARY_KEY UserEntry FROM UsersTable WHERE My_PRIMARY_KEY = ?&quot;
  
        DataBase.get(sqlCode, [UserEntry], (err, row) =&gt; {
          if(err){
            return console.error(err.message);
          }
  
          return false // This is where I tried to return true or false
        });
  
   }
  
  </code></pre>
  <p>I will also try in the future to return What I selected and all informations I found confused me. If someone can help me on that as well.</p>