Search
 
SCRIPT & CODE EXAMPLE
 

SQL

how to define a save method in ruby for sqlite3 databases

def save
    sql = <<-SQL
      INSERT INTO songs (name, album) 
      VALUES (?, ?)
    SQL
 
    DB[:conn].execute(sql, self.name, self.album)
 
    @id = DB[:conn].execute("SELECT last_insert_rowid() FROM songs")[0][0]
 
  end
Comment

PREVIOUS NEXT
Code Example
Sql :: smallint sql 
Sql :: mysql GROUP BY clause; this is incompatible with sql_mode=only_full_group_by 
Sql :: postgres parent and child tables 
Sql :: insert query mysql workbench 
Sql :: oracle error line 
Sql :: sql restore database from backup 
Sql :: sql inner join 
Sql :: import mysql database command line 
Sql :: sql if null then string 
Sql :: influxdb delete measurement based on date 
Sql :: postgres find missing indexes 
Sql :: php get closest location by latitude longitude 
Sql :: php delete database 
Sql :: sql pivot rows to columns 
Sql :: top 3 salary in sql 
Sql :: mysql get only the field names in a table 
Sql :: See Foreign Key 
Sql :: python get backup of sql 
Sql :: Oracle filter date column by year 
Sql :: fk in insert mysql 
Sql :: sql distinct vs unique 
Sql :: between date in sql server 
Sql :: sql if else 
Sql :: mysql error 1114 (hy000) the table is full 
Sql :: changing column names in sql query results 
Sql :: mysqldump devilbox 
Sql :: fetlife 
Sql :: stored procedure data to table 
Sql :: tsql generate rows 
Sql :: Inserting data into different tables at once in oracle sql 
ADD CONTENT
Topic
Content
Source link
Name
8+3 =