1

This is the situation, I have a simple table:

> DB.execute("CREATE TABLE IF NOT EXISTS webserver(id INTEGER PRIMARY
> KEY AUTOINCREMENT, url varchar(1000), server_name varchar(1000));")

I have just one record in the table:

SELECT * FROM webserver; 1 https://onlinetvs.inbulgaria.info/   cloudflare-nginx

When I am selecting the the server_name column I am getting nothing back: SELECT * FROM webserver WHERE server_name LIKE 'c%';

Before any update, I am checking the type as well, I know I am missing something small and stupid, but after my verification with the sqlite3 documentation, not sure which way to go.

hrefs.each do |link|
    result = get_server_from_headers(link)
    if result != nil && result.respond_to?(:to_str) && link.respond_to?(:to_str)
        DB.execute("INSERT INTO webserver(url, server_name) VALUES(?, ?)", link, result)
        puts "Adding to DB " + link + " " + result
        abort
    end
end

enter image description here

Recoba20
  • 314
  • 1
  • 13
  • Are you sure that `server_name` is exactly what you think it is? What does `select '-' || server_name || '-' from webserver` say? – mu is too short Nov 30 '16 at 21:48
  • Well, I even uploaded the picture, it's a varchar column, the weirdest is that I am able to fetch any urls with the same pattern. – Recoba20 Nov 30 '16 at 22:00
  • There's something funny going on. Can you reproduce the problem in a self-contained script? – mu is too short Nov 30 '16 at 22:31
  • "Self contained" as in "doesn't depend on any external resources". A script that opens the database, INSERTs some data (that is contained in the script itself), and then queries it is what I meant. – mu is too short Dec 01 '16 at 05:18
  • Try to create an [SQL Fiddle](http://www.sqlfiddle.com/#!5). – CL. Dec 01 '16 at 09:17

0 Answers0