SQLite user function
をテンプレートにして作成
[
Front page
] [
Page list
|
Search
|
Recent changes
|
RSS of recent changes
]
Start:
I built in some general sql functions to [[TkSQLite]] ver...
Here is the list of the functions. You can blild in these...
your database freely. NOTE: This is under developed, so t...
*** How to build in the functions to your db [#eaf68944]
package require sqlite3
source sqlitefunc.tcl
sqlite db :memory:
Sqlite::func::install db
then
% db eval {SELECT MD5('md5 test')}
2E5F9458BCD27E3C2B5908AF0B91551A
*** Download [#n5ef0eb9]
http://reddog.s35.xrea.com/software/sqlitefunc0.4.zip
http://reddog.s35.xrea.com/software/sqlitefunc0.5.zip
***String Format Functions [#fa4b0f08]
|ascii(char) |return ascii code ...
|char(code) |return char from ascii code...
|concat(arg ?, arg ...?) |join args ...
|concat_ws(sep, arg ?, arg?) |join args with sep ...
|convert(str, from, to) |encoding converter. from an...
|elt(n, arg ?, arg ...?) |MySQL's elt. ...
|hex(n) |return hex value. ...
|initcap(str) |Oracle's initcap. ...
|insert(s, pos, len, ns) | ...
|instr(str, sstr, ?st ?n??) |search sstr in str. ...
|length(str) |SQLite Built-in ...
|locate(sstr, str, pos) |return first sstr position ...
|lower(str) |SQLite Built-in ...
|lpad(str, len ?, pad?) | ...
|ltrim(str ?, chars?) |trimleft chars(or space) fr...
|mid(str, pos, len) | ...
|position(sstr, IN, str) |return first sstr position ...
|repeat(str, n) | ...
|replace(str, from, to) |replace from to to. ...
|reverse(str) |reverse string. ...
|rpad(str, n ?, pad?) | ...
|rtrim(str ?, chars?) |trimright chars(or space) f...
|space(n) |return space. ...
|to_char(num, fmt) |Support only B,FM,S,G,D,","...
|translate(str, from, to) |PostgreSQL's translate. ...
|trim(str ?, chars?) |This is not SQL99 trim. tri...
*** Math Functions [#o12e785e]
acos exp radians ...
asin floor rand ...
atan greatest random(SQLit...
atan2 least round(SQLite...
avg(SQLite Built-in) log sign ...
ceil log10 sin ...
cos mod sqrt ...
cot pi tan ...
degrees pow trunc ...
*** Date Time [#fe31d122]
|now() |return localtime. same as datetime('now', 'l...
|julianday |SQLite Built-in ...
|datetime |SQLite Built-in ...
|date |SQLite Built-in ...
|strftime |SQLite Built-in ...
*** Other Functions [#y6a88a8e]
|min |SQLite Built-in |
|max |SQLite Built-in |
|coalesce |SQLite Built-in |
|nullif |SQLite Built-in |
|ifnull |SQLite Built-in |
|last_insert_rowid |SQLite Built-in |
|quote |SQLite Built-in |
|regexp | |
|regsub | |
|user |return user name |
*** Crypt, Hash, etc [#ed5062cd]
NOTE: requires Tcllib and Trf
|md5(data ?, binary?) |MD5 ...
|md5_hmac(key, data ?, binary?) |HMAC-MD5 ...
|md5_crypt(pass, salt ?, binary?) |BSD compatible M...
|apr_crypt(pass, salt ?, binary?) |Apache compatibl...
|sha1(data ?, binary?) |SHA1 ...
|sha1_hmac(key, data ?, binary?) |HMAC-SHA1 ...
|aes_encrypt(key, data ?, binary?) |ASE encryption ...
|aes_decrypt(key, data ?, binary?) |ASE decryption ...
|blowfish_encrypt(key, data ?, binary?) |Blowfish encrypt...
|blowfish_decrypt(key, data ?, binary?) |Blowfish decrypt...
|des_encrypt(key, data ?, binary?) |DES encryption ...
|des_decrypt(key, data ?, binary?) |DES decryption ...
|base64_encode(data ?, binary?) |Base64 encode ...
|base64_decode(data ?, binary?) |Base64 decode ...
|compress(data ?, binary?) |compress data by...
|decompress(data ?, binary?) |decompress data ...
|uuid() |UUID ...
|exec(string) |execute command ...
the ''binary'' option must set 1 for the BLOB data. defau...
if ''binary'' is omitted (binary = 0), data is handled as...
''key'' is handled as text even if ''binary'' is 1.
*** File IO [#m7e679f6]
|write_file(path, data ?,binary?) |Base64 decode ...
|read_file(path ?,binary?) |Base64 encode ...
''path'' is file path.~
the ''binary'' option must set 1 for the BLOB data. defau...
if ''binary'' is omitted (binary = 0), data is handled as...
*** One Line Comment [#h4c6dd90]
-select MD5('ala') -- 2005-12-16 08:16:51
-broken link: http://reddog.s35.xrea.com/software/sqlitef...
-I fixed it. thanks. -- reddog 2006-03-17 01:23:19
#comment
----
[[CategoryTclTk]] [[TkSQLite]]
[[CategoryEnglish]]
End:
I built in some general sql functions to [[TkSQLite]] ver...
Here is the list of the functions. You can blild in these...
your database freely. NOTE: This is under developed, so t...
*** How to build in the functions to your db [#eaf68944]
package require sqlite3
source sqlitefunc.tcl
sqlite db :memory:
Sqlite::func::install db
then
% db eval {SELECT MD5('md5 test')}
2E5F9458BCD27E3C2B5908AF0B91551A
*** Download [#n5ef0eb9]
http://reddog.s35.xrea.com/software/sqlitefunc0.4.zip
http://reddog.s35.xrea.com/software/sqlitefunc0.5.zip
***String Format Functions [#fa4b0f08]
|ascii(char) |return ascii code ...
|char(code) |return char from ascii code...
|concat(arg ?, arg ...?) |join args ...
|concat_ws(sep, arg ?, arg?) |join args with sep ...
|convert(str, from, to) |encoding converter. from an...
|elt(n, arg ?, arg ...?) |MySQL's elt. ...
|hex(n) |return hex value. ...
|initcap(str) |Oracle's initcap. ...
|insert(s, pos, len, ns) | ...
|instr(str, sstr, ?st ?n??) |search sstr in str. ...
|length(str) |SQLite Built-in ...
|locate(sstr, str, pos) |return first sstr position ...
|lower(str) |SQLite Built-in ...
|lpad(str, len ?, pad?) | ...
|ltrim(str ?, chars?) |trimleft chars(or space) fr...
|mid(str, pos, len) | ...
|position(sstr, IN, str) |return first sstr position ...
|repeat(str, n) | ...
|replace(str, from, to) |replace from to to. ...
|reverse(str) |reverse string. ...
|rpad(str, n ?, pad?) | ...
|rtrim(str ?, chars?) |trimright chars(or space) f...
|space(n) |return space. ...
|to_char(num, fmt) |Support only B,FM,S,G,D,","...
|translate(str, from, to) |PostgreSQL's translate. ...
|trim(str ?, chars?) |This is not SQL99 trim. tri...
*** Math Functions [#o12e785e]
acos exp radians ...
asin floor rand ...
atan greatest random(SQLit...
atan2 least round(SQLite...
avg(SQLite Built-in) log sign ...
ceil log10 sin ...
cos mod sqrt ...
cot pi tan ...
degrees pow trunc ...
*** Date Time [#fe31d122]
|now() |return localtime. same as datetime('now', 'l...
|julianday |SQLite Built-in ...
|datetime |SQLite Built-in ...
|date |SQLite Built-in ...
|strftime |SQLite Built-in ...
*** Other Functions [#y6a88a8e]
|min |SQLite Built-in |
|max |SQLite Built-in |
|coalesce |SQLite Built-in |
|nullif |SQLite Built-in |
|ifnull |SQLite Built-in |
|last_insert_rowid |SQLite Built-in |
|quote |SQLite Built-in |
|regexp | |
|regsub | |
|user |return user name |
*** Crypt, Hash, etc [#ed5062cd]
NOTE: requires Tcllib and Trf
|md5(data ?, binary?) |MD5 ...
|md5_hmac(key, data ?, binary?) |HMAC-MD5 ...
|md5_crypt(pass, salt ?, binary?) |BSD compatible M...
|apr_crypt(pass, salt ?, binary?) |Apache compatibl...
|sha1(data ?, binary?) |SHA1 ...
|sha1_hmac(key, data ?, binary?) |HMAC-SHA1 ...
|aes_encrypt(key, data ?, binary?) |ASE encryption ...
|aes_decrypt(key, data ?, binary?) |ASE decryption ...
|blowfish_encrypt(key, data ?, binary?) |Blowfish encrypt...
|blowfish_decrypt(key, data ?, binary?) |Blowfish decrypt...
|des_encrypt(key, data ?, binary?) |DES encryption ...
|des_decrypt(key, data ?, binary?) |DES decryption ...
|base64_encode(data ?, binary?) |Base64 encode ...
|base64_decode(data ?, binary?) |Base64 decode ...
|compress(data ?, binary?) |compress data by...
|decompress(data ?, binary?) |decompress data ...
|uuid() |UUID ...
|exec(string) |execute command ...
the ''binary'' option must set 1 for the BLOB data. defau...
if ''binary'' is omitted (binary = 0), data is handled as...
''key'' is handled as text even if ''binary'' is 1.
*** File IO [#m7e679f6]
|write_file(path, data ?,binary?) |Base64 decode ...
|read_file(path ?,binary?) |Base64 encode ...
''path'' is file path.~
the ''binary'' option must set 1 for the BLOB data. defau...
if ''binary'' is omitted (binary = 0), data is handled as...
*** One Line Comment [#h4c6dd90]
-select MD5('ala') -- 2005-12-16 08:16:51
-broken link: http://reddog.s35.xrea.com/software/sqlitef...
-I fixed it. thanks. -- reddog 2006-03-17 01:23:19
#comment
----
[[CategoryTclTk]] [[TkSQLite]]
[[CategoryEnglish]]
Page:
HTML convert time: 0.002 sec.