Odkazy
Příklad 38.4. Příklad použití Ruby-SQLite
require 'sqlite'
def getDAD(str)
str + ' sardina'
end
sq = SQLite.new('test.db')
print(getDAD('dddd'),"\n")
sq.setFunc('getDAD',1,self,'getDAD')
print(sq.exec("select getDAD('robertp') as duo;"),"\n")
# should print : roberto sardina
sq.close()Příklad 38.5. Druhý příklad použití Ruby-SQLite
require 'sqlite'
def my_func(str)
'[[' + str + ']]'
end
sq = SQLite.new('my_db_file.db')
sq.setFunc('wrap_str',1,self,'my_func')
print sq.exec("select wrap_str(name) from users;")
# should print : [[Paul]]
sq.close()