Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The issue is that you're using an instance variable for <code>sql</code>, setting it to the <code>SELECT</code> statement when you create <code>KejithEntryQueryDelegate</code>, changing it to an <code>INSERT</code> statement in the <code>importEntry:into:</code> method, but when you call <code>query:</code>, even though the code clearly assumes it should be <code>SELECT</code> statement, the <code>sql</code> is still the <code>INSERT</code> statement. </p> <p>By looking at the result code of <code>sqlite3_step</code> (point 3, below) one can quickly identify the issue. Since <code>sqlResult != DONE</code>, you want to log the issue and it reports "entry.entry_title may not be NULL" (which doesn't make sense in a <code>SELECT</code> statement, which made me realize that the old <code>INSERT</code> statement was still in the <code>sql</code> variable).</p> <p>My original answer, based upon a glance at the code is below. Point #3 is the critical observation.</p> <hr> <p>Just looking at the code, I don't see anything that would obviously cause the behavior you describe. If I follow you correctly, you're saying that if you do <em>not</em> import data, 50 records are found, but if you <em>do</em> attempt to import the data, not only do you not see new data, but suddenly nothing is found (including the records that were already there). Is that really what you're saying? That's curious behavior. If this is, in fact, the issue, that would lead me to suspect that the attempt to import is causing the subsequent attempt to read to fail.</p> <p>The only obvious SQLite issue here is that <code>importWithDelegate</code> should not be calling <code>sqlite3_finalize</code>. I don't even see why <code>KejithDatabaseAccess</code> has a <code>sqlite3_stmt</code>, as you don't prepare any statements in that class. Perhaps calling <code>sqlite3_finalize</code> with some invalid <code>sqlite3_stmt</code> causes problems?</p> <p>There are a few minor things here:</p> <ol> <li><p>The <code>importEntry:into:</code> should presumably check the result of <code>sqlite3_prepare_v2</code> statement. Elsewhere, you confirm that the prepare succeeded before proceeding, but not here.</p></li> <li><p>The <code>query</code> method is storing the email address into the web site property.</p></li> <li><p>I'd also save the result of <code>sqlite3_step</code> in the <code>query</code> method so that you could check for errors, e.g.:</p> <pre><code>while((sqlResult = sqlite3_step(statement)) == SQLITE_ROW) { // do all of your updating of entries here } if (sqlResult != SQLITE_DONE) { NSLog(@"Database: Problem Occured in KejithEntryQueryDelegate.m step"); NSLog(@"Database: Result Code: %d", sqlResult); NSLog(@"Database: SQL-Error: %s", sqlite3_errmsg(database)); } </code></pre> <p>Right now, if your <code>sqlite3_step</code> method failed, you'd never know.</p></li> </ol>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload