lib/website/blog/database.rb
# Post Insert/Update/Delete statements
Post Insert/Update/Delete statements
Post Insert / Update / Delete statements
def insert(title, slug, desc, body, category)
        @mysql.connect do |client|
          stmt = client.prepare("INSERT INTO posts(post_title, post_slug, post_desc, post_body, post_category) VALUES(?, ?, ?, ?, ?)")
          stmt.execute(title, slug, desc, body, category)
          unless(categories.include?(category))
            stmt = client.prepare("INSERT INTO categories VALUES(?, '')")
            stmt.execute(category)
          end
          stmt.close
        end
      end
def insert ( title , slug , desc , body , category ) @mysql . connect do | client | stmt = client . prepare ( "INSERT INTO posts(post_title, post_slug, post_desc, post_body, post_category) VALUES(?, ?, ?, ?, ?)" ) stmt . execute ( title , slug , desc , body , category ) unless ( categories . include? ( category ) ) stmt = client . prepare ( "INSERT INTO categories VALUES(?, '')" ) stmt . execute ( category ) end stmt . close end end
Post Insert/Update/Delete statements
Post Insert / Update / Delete statements
title
<not_specific>
slug
<not_specific>
desc
<not_specific>
body
<not_specific>
category
<not_specific>