if (feed == null) throw new IllegalStateException(MSG_NO_FEED);
if (feed.getID() == -1L) throw new IllegalStateException(MSG_TRANSIENT_FEED);
if (!(article instanceof StandardArticle))
throw new IllegalArgumentException(MSG_UNSUPPORTED_TYPE);
StandardArticle standardArticle = (StandardArticle)article;
PreparedStatement stmt = context.getPreparedStatement(
"INSERT INTO ARTICLES (AUTHOR, TEXT, PLAINTEXT, SIMPLEMATCHKEY, PUBLICATIONDATE, TITLE, " +
"SUBJECT, READ, PINNED, LINK, FEEDID) " +
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
try
{
stmt.setString(1, standardArticle.getAuthor());
stmt.setString(2, standardArticle.getText());
stmt.setString(3, standardArticle.getPlainText());
stmt.setString(4, standardArticle.getSimpleMatchKey());
Date publicationDate = standardArticle.getPublicationDate();
stmt.setLong(5, publicationDate == null ? -1L : publicationDate.getTime());
stmt.setString(6, standardArticle.getTitle());
stmt.setString(7, standardArticle.getSubject());
stmt.setBoolean(8, standardArticle.isRead());
stmt.setBoolean(9, standardArticle.isPinned());
URL link = standardArticle.getLink();
stmt.setString(10, link == null ? null : link.toString());
stmt.setLong(11, feed.getID());
stmt.executeUpdate();
// Get ID