Table model etc

master
E. Almqvist 3 years ago
parent c4a3be6f73
commit c4c30f1f86
  1. 14
      src/db_models.rb

@ -1,6 +1,18 @@
class TableModel class TableModel # Base model
attr_reader :table_name attr_reader :table_name
def initialize(table_name) def initialize(table_name)
@table_name = table_name @table_name = table_name
end end
private def get(entity, filter="")
db = db_handle # get the db handle
query = "SELECT #{entity} FROM #{@table_name} " # create the query string
if filter != "" then query += "WHERE #{filter}" end
db.execute query
end
end
class User < TableModel
end end

Loading…
Cancel
Save