<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
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
tech_docs-linux常用命令大全 (2000个子文件)
katex.css 25KB
katex.min.css 23KB
katex.min.css 22KB
dark.css 17KB
dolphin.css 17KB
vue.css 17KB
buble.css 16KB
pure.css 12KB
dark.css 12KB
vue.css 12KB
dolphin.css 12KB
vue.css 12KB
buble.css 11KB
pure.css 8KB
style.css 6KB
mermaid.min.css 5KB
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
light.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
copy-tex.css 462B
prism-show-invisibles.css 456B
prism-unescaped-markup.css 359B
prism-wpd.css 235B
copy-tex.min.css 104B
prism-autolinker.css 29B
.editorconfig 209B
.gitattributes 110B
prism-qore.html 28KB
prism-bro.html 18KB
index.html 17KB
index.html 16KB
extending.html 12KB
prism-elixir.html 11KB
prism-clojure.html 11KB
test-suite.html 9KB
prism-rest.html 9KB
prism-inform7.html 9KB
index.html 8KB
faq.html 7KB
prism-makefile.html 7KB
index.html 7KB
prism-d.html 7KB
test.html 6KB
index.html 6KB
index.html 6KB
index.html 6KB
index.html 5KB
prism-javastacktrace.html 5KB
prism-processing.html 5KB
index.html 5KB
index.html 5KB
prism-actionscript.html 5KB
index.html 5KB
prism-nim.html 5KB
prism-icon.html 4KB
prism-sas.html 4KB
prism-keyman.html 4KB
download.html 4KB
prism-puppet.html 4KB
prism-verilog.html 4KB
prism-opencl.html 3KB
prism-textile.html 3KB
prism-mel.html 3KB
index.html 3KB
prism-xeora.html 3KB
prism-wiki.html 3KB
prism-jolie.html 3KB
prism-vhdl.html 3KB
prism-kotlin.html 3KB
index.html 3KB
index.html 3KB
prism-renpy.html 3KB
prism-n4js.html 3KB
examples.html 3KB
prism-autohotkey.html 3KB
prism-q.html 3KB
prism-scala.html 2KB
prism-pure.html 2KB
index.html 2KB
prism-nasm.html 2KB
prism-asciidoc.html 2KB
prism-javascript.html 2KB
prism-groovy.html 2KB
index.html 2KB
prism-haskell.html 2KB
index.html 2KB
prism-gherkin.html 2KB
prism-bison.html 2KB
prism-parser.html 2KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
lsx202406
- 粉丝: 2551
- 资源: 5604
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 基于Kotlin语言的Android开发工具类集合源码
- 零延迟 DirectX 11 扩展实用程序.zip
- 基于Java的语音识别系统设计源码
- 基于Java和HTML的yang_home766个人主页设计源码
- 基于Java与前端技术的全国实时疫情信息网站设计源码
- 基于鸿蒙系统的HarmonyHttpClient设计源码,纯Java实现类似OkHttp的HttpNet框架与优雅的Retrofit注解解析
- 基于HTML和JavaScript的廖振宇图书馆前端设计源码
- 基于Java的Android开发工具集合源码
- 通过 DirectX 12 Hook (kiero) 实现通用 ImGui.zip
- 基于Java开发的YY网盘个人网盘设计源码
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功