|
||||||||||
|
| Home > Document > SQeeL Reference |
| A | B | C | D | E | F | G | H | I | J | L | M | N | O | P | R | S | T | U | X | Y | ||||
| count | : | Number of rows to be fetched |
| direction | : | Method of storing the return value |
| array | : | Fetched line |
| 0 | Success | |
| 1 | Argument error | |
| 100 | Oracle error |
| 文字列 | Database error number |
| 文字列 | Database message |
| 文字列 | Connected username to database |
//[result example]
//
// DEPT table has 5 data
//
require 'dboralib.slb'
run()
exit
function run()
local dept
connect scott/tiger
sql select DEPTNO, DNAME, LOC from DEPT;
if DBERR eq 0
dept = fetch(0)
print('DEPT table has '&count(dept)&' data', stdout)
else
print(DBERRMSG, stdout)
endif
logout
endfunction
| n | : |
| real number | : | Result | |
| 0 | : | Error or result |
| 0 | Success | |
| 1 | Argument error |
//[result example]
//
// input number:2.759
// floor(2.759) = 3
//
exit get_floor()
function get_floor()
local input = 0
input = getopt('input number: ')
print("floor("&input&") = "& floor(input) )
endfunction
| filehandle | : | File number |
| 0 | : | Error | |
| 1 | : | Success |
| 0 | Success | |
| 1 | Argument error | |
| 5 | File number error |
//[result example]
//
// 1 : hello world
// 2 : foge
// 3 : foo
// 4 : goo
// 5 : boo
//
get_fileline_to_flush()
exit
function get_fileline_to_flush()
local i
local lineString = ''
local fno
fno = open('foo.txt', read)
loop i=1; ; i++
lineString = readline(fno)
if ERROR != 0
break
endif
print('${i} : ${lineString}', STDOUT)
flush(STDOUT)
endloop
close(fno)
endfunction
| sec | : | Time elapsed from 0:00, January 1, 1970 (seconds) |
| format | : | Format |
| string | : | Conversion result | |
| NULL | : | Error or conversion result |
| 0 | Success | |
| 1 | Argument error |
//[result example]
//
// * 4 digit year number [%Y ] : 2004
// ・
// ・
// ・
// * date and time [%C ] : Fri Jan 23 16:56:15 JST 2004
// * date and time [%c ] : Fri Jan 23 16:56:15 2004
// * date (name base) [%#x] : %#x
// * date (number base) [%x ] : 01/23/04
// * time [%X ] : 16:56:15
// * AM/PM [%p ] : PM
// * time zone [%z ] : %z
// * same as %z [%Z ] : JST
// * persent sign [%% ] : %
//
exit getFormatTime()
function getFormatTime()
local b_time, f_time, msg, opt, i
local aFormat = { /* [0]: format, [1]: description */\
{ '%Y', '4 digit year number' } \
, { '%#Y', 'same as %Y' } \
, { '%y', 'last 2 digit year number (00-99)' } \
, { '%#y', 'last 2 digit year number ( 0-99)' } \
, { '%m', 'month number (01-12)' } \
, { '%#m', 'month number ( 1-12)' } \
, { '%B', 'complete month name' } \
, { '%b', '3 letter month name' } \
, { '%U', 'week of the year (Sunday is first (00-51)' } \
, { '%#U', 'week of the year (Sunday is first ( 0-51)' } \
, { '%W', 'week of the year (Monday is first (00-51)' } \
, { '%#W', 'week of the year (Monday is first ( 0-51)' } \
, { '%A', 'complete day of the week name' } \
, { '%a', '3 letter day of the week name' } \
, { '%w', 'day of the week number (0-6)' } \
, { '%#w', 'same as %w' } \
, { '%d', 'day number (01-31)' } \
, { '%#d', 'day number ( 1-31)' } \
, { '%H', 'hour (00-23)' } \
, { '%#H', 'hour ( 0-23)' } \
, { '%I', 'hour (01-12)' } \
, { '%#I', 'hour ( 1-12)' } \
, { '%M', 'minute (00-59)' } \
, { '%#M', 'minute ( 0-59)' } \
, { '%S', 'second (00-59)' } \
, { '%#S', 'second ( 0-59)' } \
, { '%j', 'day of the year (001-366)' } \
, { '%#j', 'day of the year ( 1-366)' } \
, { '%C', 'date and time' } \
, { '%c', 'date and time' } \
, { '%#x', 'date (name base)' } \
, { '%x', 'date (number base)' } \
, { '%X', 'time' } \
, { '%p', 'AM/PM' } \
, { '%z', 'time zone' } \
, { '%Z', 'same as %z' } \
, { '%%', 'persent sign' } \
}
b_time = curtime()
loop i=0; i<count(aFormat); i++
msg = rpad(aFormat[i][1], 40)
opt = rpad(aFormat[i][0], 3)
f_time = formattime(b_time, aFormat[i][0])
print('* ' & msg & ' [' & opt & '] : ' & f_time, stdout)
endloop
endfunction
| filename | : | File name for checking the last update time. |
| 1 or more | : | Last file update | |
| 0 | : | Fail |
| 0 | Success | |
| 1 | Argument error |
//[result example]
//
//modified time = 2003/11/20 15:21:07
//
run()
exit
function run()
local mod_time
mod_time = file_mod_time('sample_file_mod_time.eel')
print('modified time = ${formattime(mod_time, "%Y/%m/%d %H:%M:%S")}')
endfunction
| filename1 | : | source file name |
| filename2 | : | destination file name |
| 0 | : | Error | |
| 1 | : | Success |
| 0 | Success | |
| 1 | Argument error | |
| 13 | File copy error |
run()
exit
function run()
filecopy('sample_filecopy.eel', 'copy_file1')
endfunction
| filename | : | file name to be deleted |
| 0 | : | Error | |
| 1 | : | Success |
| 0 | Success | |
| 1 | Argument error | |
| 12 | File delete error |
run()
exit
function run()
filecopy('sample_filedelete.eel', 'copy_file4')
filedelete('copy_file4')
endfunction
| filename1 | : | source file name |
| filename2 | : | destination file name |
| 0 | : | Error | |
| 1 | : | Success |
| 0 | Success | |
| 1 | Argument error | |
| 16 | File copy error |
run()
exit
function run()
filecopy('sample_filemove.eel', 'copy_file2')
filemove('copy_file2', 'copy_file3')
endfunction
| start | : | Start line |
| end | : | End line |
| colname | : | Array name (character string) |
| len | : | Number of characters or delimiters |
| colname, len, { … } | : |
| 0 | : | Error | |
| 1 | : | Success |
| 0 | Success | |
| 1 | Argument error |
//[result example]
//
// 01/01/2004 Thursday is New Year's Day
// 02/14/2004 Saturday is St. Valentain's Day
// 04/01/2004 Thursday is April Fool's Day
// 10/31/2004 Sunday is Helloween
// 12/25/2004 Saturday is Christmas
//
run()
exit
function run()
local fileName = 'c:testdata01.txt'
local tab
local i
fileformat(0, 0, 'C1', ',', 'C2', ',', 'C3')
xsql select C1, C2, C3 from fileread('${fileName}');
tab = xfetch(0)
xclose()
loop i=0;i<count(tab); i++
print('${tab[i]["C1"]} ${tab[i]["C2"]} is ${tab[i]["C3"]}', stdout)
endloop
endfunction
/*
[testdata01.txt]
01/01/2004,Thursday,New Year's Day
02/14/2004,Saturday,St. Valentain's Day
04/01/2004,Thursday,April Fool's Day
10/31/2004,Sunday ,Helloween
12/25/2004,Saturday,Christmas
*/
| filename | : | |
| colname | : | |
| len | : | |
| colname1, len1, { … } | : |
| 0 | : | Success | |
| 11 | : | Argument error | |
| 12 | : | File open error |
| 0 | Success | |
| 11 | Argument error | |
| 12 | File open error |
//[result example]
//
// 01/01/2004 Thursday is New Year's Day
// 02/14/2004 Saturday is St. Valentain's Day
// 04/01/2004 Thursday is April Fool's Day
// 10/31/2004 Sunday is Helloween
// 12/25/2004 Saturday is Christmas
//
run()
exit
function run()
local fileName = 'c:testdata01.txt'
local tab
local i
xsql select C1, C2, C3 from fileread('${fileName}', 'C1', ',', 'C2', ',', 'C3');
tab = xfetch(0)
xclose()
loop i=0;i<count(tab); i++
print('${tab[i]["C1"]} ${tab[i]["C2"]} is ${tab[i]["C3"]}', stdout)
endloop
endfunction
/*
[testdata01.txt]
01/01/2004,Thursday,New Year's Day
02/14/2004,Saturday,St. Valentain's Day
04/01/2004,Thursday,April Fool's Day
10/31/2004,Sunday ,Helloween
12/25/2004,Saturday,Christmas
*/