Created
February 5, 2021 07:23
-
-
Save FatihDurmus/7f1fdffb4cfbe93348fc89125e3c5a46 to your computer and use it in GitHub Desktop.
database example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'sqlite3' | |
require 'thread' | |
def emailSave(email) | |
#db = SQLite3::Database.open 'data.db' | |
#db.results_as_hash = true | |
#query = db.prepare" select * from datas" | |
#result = query.execute | |
#result.each do |row| | |
#puts row['email'] | |
db = SQLite3::Database.open 'data.db' | |
db.results_as_hash = true | |
query = db.prepare" INSERT INTO datas (email) | |
VALUES ('#{email}');" | |
result = query.execute | |
#end | |
end | |
def passwordSave(password) | |
#db = SQLite3::Database.open 'data.db' | |
#db.results_as_hash = true | |
#query = db.prepare" select * from datas" | |
#result = query.execute | |
#result.each do |row| | |
#puts row['email'] | |
db = SQLite3::Database.open 'data.db' | |
db.results_as_hash = true | |
query = db.prepare" INSERT INTO datas (password) | |
VALUES ('#{password}');" | |
result = query.execute | |
#end | |
end | |
def divided_data | |
File.open("email.txt", "r") do |f| | |
f.each_line do |line| | |
email = Array(line.split(/: */)) | |
#puts $email[0] | |
t1 = Thread.new{emailSave(email.first(1))} | |
File.open("passowrd.txt", "r") do |g| | |
g.each_line do |pass| | |
password = Array.new | |
password = Array(pass.split(/: */)) | |
t2 = Thread.new{passwordSave(password[1])} | |
end | |
end | |
#data = line.split(":", 3).to_s | |
#result = data.split(/: */).to_s | |
#puts line | |
t1.join | |
t2.join | |
#puts $email.first | |
#puts $password.first() | |
#dbTest($email.first,$password) | |
#File.open("full_data.txt", 'a') { |file| file.write(email.first+":"+" \n ") } | |
#File.open("md5_compare.txt",'a'){ |file| file.write(data[0]+"\n")} | |
end | |
end | |
end | |
divided_data |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment