Creating UDF?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Creating UDF?

Dr. Mucibirahman İLBUĞA
Hi,

Is there a very simple example how to create UDF in SQLite?!

I found some example with C and PHP but not enaugh to understand and
apply for me unfortunatelly... :(

--
Regards,
Mucip:)

_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Creating UDF?

Clemens Ladisch
Dr. Mucibirahman İLBUĞA wrote:
> Is there a very simple example how to create UDF in SQLite?!

From the Python documentation:

  import sqlite3
  import md5

  def md5sum(t):
      return md5.md5(t).hexdigest()

  con = sqlite3.connect(":memory:")
  con.create_function("md5", 1, md5sum)
  cur = con.cursor()
  cur.execute("select md5(?)", ("foo",))
  print cur.fetchone()[0]


Which language do you want to use?


Regards,
Clemens
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users