I built in some general sql functions to [[TkSQLite]] ver0.4.~
Here is the list of the functions. You can blild in these functions to 
your database freely. NOTE: This is under developed, so these may be changed. 


*** 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 and to must be tcl's encoding name.       |
|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 in str. start from pos.                 |
|lower(str)                  |SQLite Built-in                                                    |
|lpad(str, len ?, pad?)      |                                                                   |
|ltrim(str ?, chars?)        |trimleft chars(or space) from str.                                 |
|mid(str, pos, len)          |                                                                   |
|position(sstr, IN, str)     |return first sstr position in str.                                 |
|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) from str.                                |
|space(n)                    |return space.                                                      |
|to_char(num, fmt)           |Support only B,FM,S,G,D,",",9,0. Only number format. If you want to format datetime, use some sqlite built-in functions like strftime or datetime. |
|translate(str, from, to)    |PostgreSQL's translate.                                            |
|trim(str ?, chars?)         |This is not SQL99 trim. trim chars(or space) from str.             |


*** Math Functions [#o12e785e]
 acos                    exp                 radians                    
 asin                    floor               rand                       
 atan                    greatest            random(SQLite Built-in)    
 atan2                   least               round(SQLite Built-in)     
 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', 'localtime') |
|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 MD5 crypt    |
|apr_crypt(pass, salt ?, binary?)       |Apache compatible MD5 crypt |
|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 encryption         |
|blowfish_decrypt(key, data ?, binary?) |Blowfish decryption         |
|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 zip        |
|decompress(data ?, binary?)            |decompress data by zip      |
|uuid()                                 |UUID                        |
|exec(string)                           |execute command and return result |
the ''binary'' option must set 1 for the BLOB data. default is 0.
if ''binary'' is omitted (binary = 0), data is handled as text.
''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. default is 0.
if ''binary'' is omitted (binary = 0), data is handled as text.


*** One Line Comment [#h4c6dd90]
-select MD5('ala') --  2005-12-16 08:16:51
-broken link: http://reddog.s35.xrea.com/software/sqlitefunc.zip -- Giorgio 2006-03-16 22:29:29
-I fixed it. thanks. -- reddog 2006-03-17 01:23:19
- I'm on holiday http://graceibc.org/revatio-how-supplied/ generic revatio for ed  Campbell’s Soup Company is recalling 1,920 cans of SpaghettiOs with Meatballs because the product contains wheat, soy, and milk, which are three of the major food allergens, that are not declared on the label.  -- Salvatore &new{2015-05-09 (Sat) 22:28:06};
- Free medical insurance http://www.drijendesigns.co.uk/avanafil-scheda-tecnica/ estimation of avanafil by uv  BEIJING/HONG KONG - China reiterated its opposition on Thursday to a European Union plan to limit airline carbon dioxide emissions and called for talks to resolve the issue a day after its major airlines refused to pay any carbon costs under the new law.  -- Roger &new{2015-05-09 (Sat) 22:28:14};
- Sorry, I'm busy at the moment https://ummgc.org/vicerex-mercadolibre vicerex dove si compra  “The last thing that we want is him getting hurt, and we don’t need people coming here and trying to watch the bear – because he’s a big bear,” he said. “I bet he’s 400 pounds. I’m sure he could definitely hurt someone.”  -- Amber &new{2015-05-09 (Sat) 22:28:18};
- I'm training to be an engineer http://www.pizzaamorewoodfire.com/cheap-filagra-100-mg-pink.html filagra 100 dp  “To be absolutely clear, the Senate will reject both the one-year delay of the Affordable Care Act and the repeal of the medical device tax," Reid said. "After weeks of futile political games from Republicans, we are still at square one."  -- Richie &new{2015-05-09 (Sat) 22:28:20};
- I'm originally from Dublin but now live in Edinburgh http://anestasiavodka.com/blog/vegah-extra-cobra-cost/ vegah extra cobra 120 nedir  "We are far too soft, our bodies would not be able to cope with the cold winters, no central heating, the growing of food, health and the lack of hygiene, the feudal system - you and I would be near the bottom - wars, crime and on and on.  -- Brandon &new{2015-05-09 (Sat) 22:28:22};
- Your account's overdrawn http://www.sniderscyclery.com/?vitaros-phase-iv.pdf vitaros cream online  These sound like trumped up charges, and if the ship had medical supplies as one would think they would, one might find drugs. When one is injured that is what is given to get rid of pain. AND I do believe that Green peace was trying to get more press for their cause. This is one of the forms they raise funds, via controversy. If things where so bad that Green Peace had to run up there, why is the U.S. government so quite.  -- Danial &new{2015-05-09 (Sat) 22:28:25};
- I'm retired http://www.townofcaroline.org/tadalista-informacion/ cheapest tadalista  Davis hit .165 in the first half, a stretch that included a monthlong demotion to Triple-A Las Vegas. Since returning to the majors, he owns a .192 average (5 for 26). With Josh Satin producing and Lucas Duda eventually coming off the disabled list, Davis needs to start hitting.  -- Collin &new{2015-05-09 (Sat) 22:28:28};
- What sort of music do you like? http://graceibc.org/revatio-how-supplied/ revatio generic drug  The house at 807 Barrow Street was demolished Thursday as previously planned. It was owned by Covenant House Alaska and used by a contractor overseeing the construction of its new shelter nearby. Police say they signed off on the demolition. Covenant House plans to build a parking lot for staff on the lot.  -- Jacques &new{2015-05-09 (Sat) 22:28:30};
- I'm a member of a gym http://graceibc.org/revatio-how-supplied/ pvl revatio  According to Medicare.gov, the government's official website, Medicare Part A generally covers most of the bills associated with that type of a hospital stay, including a semi-private room and medical procedures. But it doesn't cover incidentals like hospital-room TV or phone service, which can run as high as $50 per day.  -- Geraldo &new{2015-05-09 (Sat) 22:28:33};
- I work for myself http://www.sniderscyclery.com/?vitaros-phase-iv.pdf vitaros directions  He added that improvements in more forward-looking data, such as new buyer inquiries in the Royal Institution of Chartered Surveyors housing market survey or the main measures of consumer confidence, suggest that further rises in approvals "probably lie ahead".  -- Shaun &new{2015-05-09 (Sat) 22:28:39};

#commente

----
[[CategoryTclTk]] [[TkSQLite]]
[[CategoryEnglish]]


HTML convert time: 0.010 sec.