U
Une Bévue
with this script :
require 'sqlite3'
db = SQLite3:atabase.new( "backpb.db" )
rows = db.execute( "select distinct UID, lastName, firstName,
fullLastName from devicephonebook" )
rows.each { | row |
db.execute( "UPDATE devicephonebook SET lastName =
'#{row[1].name_capitalize}', firstName = '#{row[2].name_capitalize}',
fullLastName = '#{row[1].name_capitalize}#{row[2].name_capitalize}'
WHERE UID = #{row[0]}")
}
i get the following error :
SQLite3::SQLException: no such function: get_zy_string
method check
in errors.rb at line 94
method initialize
in statement.rb at line 71
method new
in database.rb at line 184
method prepare
in database.rb at line 184
method execute
in database.rb at line 211
at top level
in test.rb at line 35
method each
in test.rb at line 34
at top level
in test.rb at line 34
line 35 being "db.execute( "UPDATE devicephonebook SET ..." )
I don't understand this error message...
For info, here is my String#name_capitalize :
PARTICULES = [ "de", "di", "von", "van" ]
class String
def name_capitalize
if self.include?("-")
l = self.split("-")
lo = []
l.each { |ll| lo << ll.capitalize }
return lo.join("-")
elsif self.include?(" ")
l = self.split(" ")
lo = []
l.each { |ll|
if PARTICULES.include? ll
lo << ll
else
lo << ll.capitalize
end
}
return lo.join(" ")
else
return self.capitalize
end
end
end
doing such capitalizations :
pavin de lafarge -o-> Pavin de Lafarge
marie-claude -o-> Marie-Claude
von beethoven -o-> von Beethoven
Smith -o-> Smith
require 'sqlite3'
db = SQLite3:atabase.new( "backpb.db" )
rows = db.execute( "select distinct UID, lastName, firstName,
fullLastName from devicephonebook" )
rows.each { | row |
db.execute( "UPDATE devicephonebook SET lastName =
'#{row[1].name_capitalize}', firstName = '#{row[2].name_capitalize}',
fullLastName = '#{row[1].name_capitalize}#{row[2].name_capitalize}'
WHERE UID = #{row[0]}")
}
i get the following error :
SQLite3::SQLException: no such function: get_zy_string
method check
in errors.rb at line 94
method initialize
in statement.rb at line 71
method new
in database.rb at line 184
method prepare
in database.rb at line 184
method execute
in database.rb at line 211
at top level
in test.rb at line 35
method each
in test.rb at line 34
at top level
in test.rb at line 34
line 35 being "db.execute( "UPDATE devicephonebook SET ..." )
I don't understand this error message...
For info, here is my String#name_capitalize :
PARTICULES = [ "de", "di", "von", "van" ]
class String
def name_capitalize
if self.include?("-")
l = self.split("-")
lo = []
l.each { |ll| lo << ll.capitalize }
return lo.join("-")
elsif self.include?(" ")
l = self.split(" ")
lo = []
l.each { |ll|
if PARTICULES.include? ll
lo << ll
else
lo << ll.capitalize
end
}
return lo.join(" ")
else
return self.capitalize
end
end
end
doing such capitalizations :
pavin de lafarge -o-> Pavin de Lafarge
marie-claude -o-> Marie-Claude
von beethoven -o-> von Beethoven
Smith -o-> Smith