<h2>Full example</h2>
<pre><code>#!/usr/bin/env qore
# database test script
# databases users must be able to create and destroy tables and procedures, etc
# in order to execute all tests
%require-our
%enable-all-warnings
our ($o, $errors, $test_count);
const opts =
( "help" : "h,help",
"host" : "H,host=s",
"pass" : "p,pass=s",
"db" : "d,db=s",
"user" : "u,user=s",
"type" : "t,type=s",
"enc" : "e,encoding=s",
"verbose" : "v,verbose:i+",
"leave" : "l,leave"
);
sub usage()
{
printf("usage: %s [options]
-h,--help this help text
-u,--user=ARG set username
-p,--pass=ARG set password
-d,--db=ARG set database name
-e,--encoding=ARG set database character set encoding (i.e. \"utf8\")
-H,--host=ARG set hostname (for MySQL and PostgreSQL connections)
-t,--type set database driver (default mysql)
-v,--verbose more v's = more information
-l,--leave leave test tables in schema at end\n",
basename($ENV."_"));
exit();
}
const object_map =
( "oracle" :
( "tables" : ora_tables ),
"mysql" :
( "tables" : mysql_tables ),
"pgsql" :
( "tables" : pgsql_tables ),
"sybase" :
( "tables" : syb_tables,
"procs" : sybase_procs ),
"freetds" :
( "tables" : freetds_sybase_tables,
"procs" : sybase_procs ) );
const ora_tables = (
"family" : "create table family (
family_id int not null,
name varchar2(80) not null
)",
"people" : "create table people (
person_id int not null,
family_id int not null,
name varchar2(250) not null,
dob date not null
)",
"attributes" : "create table attributes (
person_id int not null,
attribute varchar2(80) not null,
value varchar2(160) not null
)" );
const mysql_tables = (
"family" : "create table family (
family_id int not null,
name varchar(80) not null
) type = innodb",
"people" : "create table people (
person_id int not null,
family_id int not null,
name varchar(250) not null,
dob date not null
) type = innodb",
"attributes" : "create table attributes (
person_id int not null,
attribute varchar(80) not null,
value varchar(160) not null
) type = innodb" );
const pgsql_tables = (
"family" : "create table family (
family_id int not null,
name varchar(80) not null )",
"people" : "create table people (
person_id int not null,
family_id int not null,
name varchar(250) not null,
dob date not null )",
"attributes" : "create table attributes (
person_id int not null,
attribute varchar(80) not null,
value varchar(160) not null)",
"data_test" : "create table data_test (
int2_f smallint not null,
int4_f integer not null,
int8_f int8 not null,
bool_f boolean not null,
float4_f real not null,
float8_f double precision not null,
number_f numeric(16,3) not null,
money_f money not null,
text_f text not null,
varchar_f varchar(40) not null,
char_f char(40) not null,
name_f name not null,
date_f date not null,
abstime_f abstime not null,
reltime_f reltime not null,
interval_f interval not null,
time_f time not null,
timetz_f time with time zone not null,
timestamp_f timestamp not null,
timestamptz_f timestamp with time zone not null,
tinterval_f tinterval not null,
bytea_f bytea not null
--bit_f bit(11) not null,
--varbit_f bit varying(11) not null
)" );
const syb_tables = (
"family" : "create table family (
family_id int not null,
name varchar(80) not null
)",
"people" : "create table people (
person_id int not null,
family_id int not null,
name varchar(250) not null,
dob date not null
)",
"attributes" : "create table attributes (
person_id int not null,
attribute varchar(80) not null,
value varchar(160) not null
)",
"data_test" : "create table data_test (
null_f char(1) null,
varchar_f varchar(40) not null,
char_f char(40) not null,
unichar_f unichar(40) not null,
univarchar_f univarchar(40) not null,
text_f text not null,
unitext_f unitext not null, -- note that unitext is stored as 'image'
bit_f bit not null,
tinyint_f tinyint not null,
smallint_f smallint not null,
int_f int not null,
int_f2 int not null,
decimal_f decimal(10,4) not null,
float_f float not null, -- 8-bytes
real_f real not null, -- 4-bytes
money_f money not null,
smallmoney_f smallmoney not null,
date_f date not null,
time_f time not null,
datetime_f datetime not null,
smalldatetime_f smalldatetime not null,
binary_f binary(4) not null,
varbinary_f varbinary(4) not null,
image_f image not null
)" );
const sybase_procs = (
"find_family" :
"create procedure find_family @name varchar(80)
as
select * from family where name = @name
commit -- to maintain transaction count
",
"get_values" :
"create procedure get_values @string varchar(80) output, @int int output
as
select @string = 'hello there'
select @int = 150
commit -- to maintain transaction count
",
"get_values_and_select" :
"create procedure get_values_and_select @string varchar(80) output, @int int output
as
select @string = 'hello there'
select @int = 150
select * from family where family_id = 1
commit -- to maintain transaction count
",
"get_values_and_multiple_select" :
"create procedure get_values_and_multiple_select @string varchar(80) output, @int int output
as
select @string = 'hello there'
select @int = 150
select * from family where family_id = 1
select * from people where person_id = 1
commit -- to maintain transaction count
",
"just_select" :
"create procedure just_select
as
select * from family where family_id = 1
commit -- to maintain transaction count
",
"multiple_select" :
"create procedure multiple_select
as
select * from family where family_id = 1
select * from people where person_id = 1
commit -- to maintain transaction count
"
);
const freetds_sybase_tables = (
"family" : "create table family (
family_id int not null,
name varchar(80) not null
)",
"people" : "create table people (
person_id int not null,
family_id int not null,
name varchar(250) not null,
dob date not null
)",
"attributes" : "create table attributes (
person_id int not null,
attribute varchar(80) not null,
value varchar(160) not null
)",
"data_test" : "create table data_test (
null_f char(1) null,
varchar_f varchar(40) not null,
char_f char(40) not null,
text_f text not null,
unitext_f unitext not null, -- note that unitext is stored as 'image'
bit_f bit not null,
tinyint_f tinyint not null,
smallint_f smallint not null,
int_f int not null,
int_f2 int not null,
decimal_f decimal(10,4) not null,
float_f float not null, -- 8-bytes
real_f real not null, -- 4-bytes
money_f money not null,
smallmoney_f smallmoney not null,
date_f date not null,
time_f time not null,
datetime_f datetime not null,
smalldatetime_f smalldatetime not null,
binary_f binary(4) not null,
varbinary_f varbinary(4) not null,
image_f image not null
)" );
const freetds_mssql_tables = (
"family" : "create table family (
family_id int not null,
name varchar(80) not null
)",
"people" : "create table people (
person_id int not null,
family_id int not null,
name varchar(250) not null,
dob datetime not null
)",
"attributes" : "create table attributes (
person_id int not null,
attribute varchar(80) not null,
value varchar(160) not null
)",
"data_test" : "create table data_test (
null_f char(1) null,
varchar_f varchar(40) not null,
char_f char(40) not null,
text_f text not null,
bit_f bit not null,
tinyint_f tinyint not null,
smallint_f smallint not null,
int_f int not null,
int_f2 int not null,
decimal_f decimal(10,4) not null,
float_f float not null, -- 8-bytes
real_f real not null, -- 4-bytes
money_f money not null,
smallmoney_f smallmoney not null,
datetime_f datetime not null,
smalldatetime_f smalldatetime not null,
binary_f binary(4) not null,
varbinary_f varbinary(4) not nul
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
技术面试必备基础知识、Leetcode、计算机操作系统、计算机网络、系统设计 (2559个子文件)
CNAME 11B
style.css 6KB
prism-previewers.css 5KB
prism-coy.css 4KB
prism-twilight.css 4KB
prism-solarizedlight.css 3KB
prism.css 2KB
prism-dark.css 2KB
prism-funky.css 2KB
prism-okaidia.css 2KB
prism-tomorrow.css 2KB
prism-toolbar.css 1KB
prism-line-highlight.css 989B
prism-line-numbers.css 806B
prism-command-line.css 683B
prism-show-invisibles.css 456B
prism-unescaped-markup.css 359B
prism-wpd.css 235B
prism-autolinker.css 29B
.editorconfig 209B
111521119368714.gif 214KB
111521119203347.gif 185KB
111521118640738.gif 146KB
6fb7cf89-71b3-48c1-bc6a-5110e1f1fc15.gif 89KB
111521118015898.gif 84KB
e69537d2-a016-4676-b169-9ea17eeb9037.gif 78KB
60c4a44c-7829-4242-b3a1-26c3b513aaf0.gif 63KB
d156bcda-ac8d-4324-95e0-0c8df41567c9.gif 44KB
c269e362-1128-4212-9cf3-d4c12b363b2f.gif 40KB
643b6f18-f933-4ac5-aa7a-e304dbd7fe49.gif 39KB
643b6f18-f933-4ac5-aa7a-e304dbd7fe49-1572675454173.gif 39KB
0ad9f7ba-f408-4999-a77a-9b73562c9088.gif 38KB
49d2adc1-b28a-44bf-babb-d44993f4a2e3.gif 37KB
b0f0107a-e35b-4ace-b25e-cacb22b1556035029196.gif 36KB
35a8c711-0dc0-4613-95f3-be96c6c6e104.gif 35KB
111521118445538.gif 34KB
ad5cc8fc-d59b-45ce-8899-63a18320d97e.gif 32KB
ef25ff7c-0f63-420d-8b30-eafbeea35d11.gif 31KB
network-of-networks.gif 31KB
111550414182638.gif 30KB
399b459d-db9e-4e77-b879-e6492c7d382b.gif 30KB
101550414151983.gif 29KB
71550414107576.gif 27KB
111521118483039.gif 24KB
_u91CD_u5EFA_u4E8C_u53C9_u6811-21548502782193.gif 23KB
91550414131331.gif 22KB
f7c1fea2-c1e7-4d31-94b5-0d9df85e093c-1572687601927.gif 21KB
f7c1fea2-c1e7-4d31-94b5-0d9df85e093c.gif 21KB
c9714e03-eb43-48e8-b1b0-1fb620a036c8.gif 21KB
3ea280b5-be7d-471b-ac76-ff020384357c.gif 21KB
c4859290-e27d-4f12-becf-e2a5c1f3a275.gif 20KB
c2ca8dd2-8d00-4a3e-bece-db7849ac9cfd.gif 20KB
_u4ECE_u5C3E_u5230_u5934_u6253_1548296249372.gif 20KB
_u7528_u4E24_u4E2A_u6808_u5B9E_.gif 20KB
0f8d178b-52d8-491b-9dfd-41e05a952578.gif 20KB
db5f30a7-8bfa-4ecc-ab5d-747c77818964.gif 19KB
35253fa4-f60a-4e3b-aaec-8fc835aabdac.gif 18KB
_u4E8C_u7EF4_u6570_u7EC4_u4E2D_.gif 18KB
094e3ac8-e080-4e94-9f0a-64c25abc695e.gif 18KB
bc6be2d0-ed5e-4def-89e5-3ada9afa811a.gif 18KB
_u4ECE_u5C3E_u5230_u5934_u6253_1548295232667.gif 16KB
0dae7e93-cfd1-4bd3-97e8-325b032b716f-1572687622947.gif 16KB
95080fae-de40-463d-a76e-783a0c677fec.gif 15KB
_u4ECE_u5C3E_u5230_u5934_u6253_1548503461113.gif 15KB
6980aef0-debe-4b4b-8da5-8b1befbc1408.gif 15KB
7008dc2b-6f13-4174-a516-28b2d75b0152.gif 14KB
b903fda8-07d0-46a7-91a7-e803892895cf.gif 13KB
d1ed87eb-da5a-4728-b0dc-e3705aa028ea.gif 12KB
_u6590_u6CE2_u90A3_u5951_u6570_u5217.gif 12KB
b0611f89-1e5f-4494-a795-3544bf65042a.gif 12KB
_u4E8C_u53C9_u6811_u7684_u4E0B_1548504426508.gif 12KB
0dbc4f7d-05c9-4aae-8065-7b7ea7e9709e.gif 11KB
437cb54c-5970-4ba9-b2ef-2541f7d6c81e.gif 11KB
_u4E8C_u53C9_u6811_u7684_u4E0B_.gif 11KB
_u66FF_u6362_u7A7A_u683C.gif 11KB
fcc941ec-134b-4dcd-bc86-1702fd305300.gif 10KB
9d1deeba-4ae1-41dc-98f4-47d85b9831bc.gif 10KB
0dae7e93-cfd1-4bd3-97e8-325b032b716f.gif 10KB
dceea2c3-78ba-4bc5-9836-9dd5df2381a2.gif 8KB
58c8e370-3bec-4c2b-bf17-c8d34345dd17.gif 8KB
99d5e84e-fc2a-49a3-8259-8de274617756.gif 8KB
4bf5e3fb-a285-4138-b3b6-780956eb1df1.gif 8KB
_u4ECE_u5C3E_u5230_u5934_u6253_1548293972480.gif 6KB
_u91CD_u5EFA_u4E8C_u53C9_u6811-1.gif 6KB
.gitattributes 110B
.gitattributes 29B
.gitignore 63B
.gitignore 40B
prism-qore.html 28KB
prism-bro.html 18KB
index.html 16KB
extending.html 12KB
prism-elixir.html 11KB
prism-clojure.html 11KB
index.html 11KB
prism-rest.html 9KB
test-suite.html 9KB
prism-inform7.html 9KB
index.html 8KB
faq.html 7KB
共 2559 条
- 1
- 2
- 3
- 4
- 5
- 6
- 26
资源评论
Java程序员-张凯
- 粉丝: 1w+
- 资源: 6656
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- foldcraftlauncher_262944.apk
- 珍藏多年的基于matlab实现潮流计算程序源代码集合,包含多个潮流计算程序.rar
- 使用FPGA实现串-并型乘法器
- 基于matlab实现针对基于双曲线定位的DV-Hop算法中误差误差出一种基于加权双曲线定位的DV-Hop改进算法.rar
- 基于matlab实现由遗传算法开发的整数规划,车辆调度问题.rar
- 电视家7.0(对电视配置要求高).apk
- 免费计算机毕业设计-基于JavaEE的医院病历管理系统设计与实现(包含论文+源码)
- 手机端 我的世界融合植物大战僵尸版.apk
- 植物大战僵尸 · 戴夫的老年生活 手机版.apk
- Runcraft · 我的世界跑酷游戏 手机端.apk
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功