Isso Comments db - Adding Data

At the /comments-db page I had a look at the structure. Now have a look how to add old data.

SQLiteStudio

SQLiteStudio is great for looking at the data. I could look and add on my Windows 10 PC. Then move it back to the Ubuntu server. Not the most convenient way. I mostly did not word for me. This said, with my now knowledge it can work I guess.

The db will stall when isso sees errors. That means you either see….:

  • No comments in the admin, but a count
  • Comments in the admin, but not on the page

tid id parent created modified mode remote_addr text author email website likes dislikes voters notifications

tid	id	parent	created	modified	mode	remote_addr	text	author	email	website	likes	dislikes	voters	notifications

Now we can SSH to sqlite

INSERT INTO comments VALUES(255,2,NULL,1479277554,NULL,1,'88.23.75.21','comment text','Murphy','[email protected]','',0,0,0,0)

To avoid creating and editing many CSV entries, like changing it's to it''s I left the data as mySQL data and parsed them out in a WHILE loop.

echo  "INSERT INTO comments VALUES";
$sql = "SELECT * FROM comments WHERE id >= 0 ORDER BY id ASC LIMIT 10;";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
  while($row = $result->fetch_assoc()) {
	  	  	  $text = str_replace("'", "''", $row["text"]);
echo  "(".
	$row["tid"]. "," . 
	$row["id"].",". 
	$row["parent"].",".
	strtotime($row["created"]).",NULL,".
	$row["mode"].",'".
	$row["remote_addr"]."','".
	htmlspecialchars($text)."','".
	$row["author"]."','".
	$row["email"]."','".
	$row["website"]."',0,0,0,0),<br>";
  }
  

I eventually increases the LIMIT to 100 to get it done faster. After that I import them manually via putty ssh:

root@isso:/var/lib/isso# sqlite3 comments-xyz.db
sqlite>