Manipulations de base sur une DB

avec le fameux module DBI :

require "dbi"
# Connexion 
dbh = DBI.connect("DBI:Mysql:MABASE:SERVER", "USERNAME", "PASSWORD")
# Faire une insertion 
dbh.do("INSERT INTO matable VALUES .....;")
# Faire une selection
dbh.select_all("SELECT bla FROM ....").each do |row|
  puts row['bla']
end

FIXME : ajouter activerecord

ruby/manipulation_db_base.txt · Last modified: 2010/01/12 13:29 (external edit)
www.chimeric.de Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0