rubyCode/GenSQL.rb
#Function for inverted Index sql file generation
#Takes row data and file path as parameters
Function for inverted Index sql file generation
Takes row data and file path as parameters
Function for inverted Index sql file generation Takes row data and file path as parameters
def generateInverted(rows, filepath)
      file = File.open(filepath, 'a+')
      file.write("INSERT IGNORE INTO invertedIndex VALUES(0,0,0,0,0)")
      rows.each do |row|
        file.write(",(#{row.wordID}, #{row.nDocs}, #{row.docID}, #{row.nHits}, #{row.hit})")
      end
      file.write(";")
      file.write("\n")
      file.close
    end
def generateInverted ( rows , filepath ) file = File . open ( filepath , 'a+' ) file . write ( "INSERT IGNORE INTO invertedIndex VALUES(0,0,0,0,0)" ) rows . each do | row | file . write ( ",(#{row.wordID}, #{row.nDocs}, #{row.docID}, #{row.nHits}, #{row.hit})" ) end file . write ( ";" ) file . write ( "\n" ) file . close end
Function for inverted Index sql file generation
Takes row data and file path as parameters
Function for inverted Index sql file generation Takes row data and file path as parameters
#Database should already exist at this point
rows
<not_specific>
filepath
<not_specific>