Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
LinuxSuRen
zendata
提交
84a29ac3
Z
zendata
项目概览
LinuxSuRen
/
zendata
与 Fork 源项目一致
Fork自
易企天创 / zendata
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Z
zendata
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
84a29ac3
编写于
8月 06, 2020
作者:
aaronchen2k2k
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
create output dir if needed
上级
ab1051c3
变更
48
隐藏空白更改
内联
并排
Showing
48 changed file
with
579 addition
and
15 deletion
+579
-15
demo/default.yaml
demo/default.yaml
+1
-1
demo/test.yaml
demo/test.yaml
+13
-1
test/ztf/data/.cache/.data.db
test/ztf/data/.cache/.data.db
+0
-0
test/ztf/script/basic/field_buildin_instances.exp
test/ztf/script/basic/field_buildin_instances.exp
+2
-0
test/ztf/script/basic/field_buildin_instances.php
test/ztf/script/basic/field_buildin_instances.php
+24
-0
test/ztf/script/basic/field_buildin_ranges.exp
test/ztf/script/basic/field_buildin_ranges.exp
+2
-0
test/ztf/script/basic/field_buildin_ranges.php
test/ztf/script/basic/field_buildin_ranges.php
+24
-0
test/ztf/script/basic/field_children.exp
test/ztf/script/basic/field_children.exp
+2
-0
test/ztf/script/basic/field_children.php
test/ztf/script/basic/field_children.php
+24
-0
test/ztf/script/basic/field_common.exp
test/ztf/script/basic/field_common.exp
+2
-2
test/ztf/script/basic/field_common.php
test/ztf/script/basic/field_common.php
+2
-2
test/ztf/script/basic/field_default_config.exp
test/ztf/script/basic/field_default_config.exp
+2
-0
test/ztf/script/basic/field_default_config.php
test/ztf/script/basic/field_default_config.php
+24
-0
test/ztf/script/basic/field_file.exp
test/ztf/script/basic/field_file.exp
+2
-0
test/ztf/script/basic/field_file.php
test/ztf/script/basic/field_file.php
+30
-0
test/ztf/script/basic/field_format.exp
test/ztf/script/basic/field_format.exp
+2
-0
test/ztf/script/basic/field_format.php
test/ztf/script/basic/field_format.php
+24
-0
test/ztf/script/basic/field_loop.exp
test/ztf/script/basic/field_loop.exp
+2
-0
test/ztf/script/basic/field_loop.php
test/ztf/script/basic/field_loop.php
+24
-0
test/ztf/script/basic/field_loop_range.exp
test/ztf/script/basic/field_loop_range.exp
+2
-0
test/ztf/script/basic/field_loop_range.php
test/ztf/script/basic/field_loop_range.php
+24
-0
test/ztf/script/basic/field_overwrite.exp
test/ztf/script/basic/field_overwrite.exp
+2
-0
test/ztf/script/basic/field_overwrite.php
test/ztf/script/basic/field_overwrite.php
+24
-0
test/ztf/script/basic/field_random.exp
test/ztf/script/basic/field_random.exp
+2
-0
test/ztf/script/basic/field_random.php
test/ztf/script/basic/field_random.php
+29
-0
test/ztf/script/basic/field_repeat.exp
test/ztf/script/basic/field_repeat.exp
+2
-0
test/ztf/script/basic/field_repeat.php
test/ztf/script/basic/field_repeat.php
+24
-0
test/ztf/script/basic/field_step.exp
test/ztf/script/basic/field_step.exp
+2
-0
test/ztf/script/basic/field_step.php
test/ztf/script/basic/field_step.php
+23
-0
test/ztf/script/basic/field_use_config.exp
test/ztf/script/basic/field_use_config.exp
+2
-0
test/ztf/script/basic/field_use_config.php
test/ztf/script/basic/field_use_config.php
+24
-0
test/ztf/script/basic/field_use_excel.exp
test/ztf/script/basic/field_use_excel.exp
+2
-0
test/ztf/script/basic/field_use_excel.php
test/ztf/script/basic/field_use_excel.php
+24
-0
test/ztf/script/basic/field_use_instances.exp
test/ztf/script/basic/field_use_instances.exp
+2
-0
test/ztf/script/basic/field_use_instances.php
test/ztf/script/basic/field_use_instances.php
+24
-0
test/ztf/script/basic/field_use_ranges.exp
test/ztf/script/basic/field_use_ranges.exp
+2
-0
test/ztf/script/basic/field_use_ranges.php
test/ztf/script/basic/field_use_ranges.php
+24
-0
test/ztf/script/cmd/cmd_decode.exp
test/ztf/script/cmd/cmd_decode.exp
+2
-2
test/ztf/script/cmd/cmd_decode.php
test/ztf/script/cmd/cmd_decode.php
+8
-3
test/ztf/script/lib/zd.php
test/ztf/script/lib/zd.php
+24
-4
test/ztf/script/output/out_json.exp
test/ztf/script/output/out_json.exp
+1
-0
test/ztf/script/output/out_json.php
test/ztf/script/output/out_json.php
+23
-0
test/ztf/script/output/out_sql.exp
test/ztf/script/output/out_sql.exp
+1
-0
test/ztf/script/output/out_sql.php
test/ztf/script/output/out_sql.php
+24
-0
test/ztf/script/output/out_txt.exp
test/ztf/script/output/out_txt.exp
+2
-0
test/ztf/script/output/out_txt.php
test/ztf/script/output/out_txt.php
+26
-0
test/ztf/script/output/out_xml.exp
test/ztf/script/output/out_xml.exp
+1
-0
test/ztf/script/output/out_xml.php
test/ztf/script/output/out_xml.php
+23
-0
未找到文件。
demo/default.yaml
浏览文件 @
84a29ac3
...
...
@@ -109,7 +109,7 @@ fields:
from
:
custom.ip.private.yaml
# 引用data/custom/ip/private.yaml
use
:
all
# 使用该文件中的所有实例。
prefix
:
"
{"
postfix
:
"
}"
postfix
:
"
}
\t
"
-
field
:
field_use_excel
# 从excel数据源里面取数据。
from
:
system.address.v1.china
# 从data/system/address/v1.xlsx文件中读取名为china的工作簿。
...
...
demo/test.yaml
浏览文件 @
84a29ac3
...
...
@@ -20,12 +20,24 @@ fields:
prefix
:
"
["
postfix
:
"
]"
-
field
:
field_loop_range
range
:
1-3{3}
loop
:
2-3
loopfix
:
"
|"
prefix
:
"
["
postfix
:
"
]
\t
"
-
field
:
field_nested_range
from
:
custom.test.number.v1.yaml
use
:
all
use
:
medium
prefix
:
"
["
postfix
:
"
]"
-
field
:
field_nested_instant
from
:
custom.ip.private.yaml
use
:
all
prefix
:
"
["
-
field
:
field_nested_instant
from
:
custom.ip.private.yaml
use
:
all
...
...
test/ztf/data/.cache/.data.db
浏览文件 @
84a29ac3
无法预览此类型文件
test/ztf/script/basic/field_buildin_instances.exp
0 → 100644
浏览文件 @
84a29ac3
>> 10
>> [10.2.2.3/'24'
\ No newline at end of file
test/ztf/script/basic/field_buildin_instances.php
0 → 100755
浏览文件 @
84a29ac3
#!/usr/bin/env php
<?php
/**
[case]
title=
cid=0
pid=0
[group]
>>
>>
[esac]
*/
include_once
__DIR__
.
DIRECTORY_SEPARATOR
.
'../lib/zd.php'
;
$zd
=
new
zendata
();
$output
=
$zd
->
create
(
""
,
"test.yaml"
,
10
,
""
,
array
(
"fields"
=>
"field_nested_instant"
));
$count
=
sprintf
(
"%d"
,
count
(
$output
));
print
(
">>
$count
\n
"
);
print
(
">>
$output[2]
\n
"
);
\ No newline at end of file
test/ztf/script/basic/field_buildin_ranges.exp
0 → 100644
浏览文件 @
84a29ac3
>> 10
>> ['103']
\ No newline at end of file
test/ztf/script/basic/field_buildin_ranges.php
0 → 100755
浏览文件 @
84a29ac3
#!/usr/bin/env php
<?php
/**
[case]
title=
cid=0
pid=0
[group]
>>
>>
[esac]
*/
include_once
__DIR__
.
DIRECTORY_SEPARATOR
.
'../lib/zd.php'
;
$zd
=
new
zendata
();
$output
=
$zd
->
create
(
""
,
"test.yaml"
,
10
,
""
,
array
(
"fields"
=>
"field_nested_range"
));
$count
=
sprintf
(
"%d"
,
count
(
$output
));
print
(
">>
$count
\n
"
);
print
(
">>
$output[2]
\n
"
);
\ No newline at end of file
test/ztf/script/basic/field_children.exp
0 → 100644
浏览文件 @
84a29ac3
>> 10
>> part1_c|part2_C|part3_int_12
\ No newline at end of file
test/ztf/script/basic/field_children.php
0 → 100755
浏览文件 @
84a29ac3
#!/usr/bin/env php
<?php
/**
[case]
title=
cid=0
pid=0
[group]
>>
>>
[esac]
*/
include_once
__DIR__
.
DIRECTORY_SEPARATOR
.
'../lib/zd.php'
;
$zd
=
new
zendata
();
$output
=
$zd
->
create
(
""
,
"default.yaml"
,
10
,
""
,
array
(
"fields"
=>
"field_with_children"
));
$count
=
sprintf
(
"%d"
,
count
(
$output
));
print
(
">>
$count
\n
"
);
print
(
">>
$output[2]
\n
"
);
\ No newline at end of file
test/ztf/script/basic/field_common.exp
浏览文件 @
84a29ac3
>> 3
>> int_1
\ No newline at end of file
>> 30
>> int_22
\ No newline at end of file
test/ztf/script/basic/field_common.php
浏览文件 @
84a29ac3
...
...
@@ -16,8 +16,8 @@ pid=0
include_once
__DIR__
.
DIRECTORY_SEPARATOR
.
'../lib/zd.php'
;
$zd
=
new
zendata
();
$output
=
$zd
->
create
(
""
,
"default.yaml"
,
3
,
""
,
array
(
"fields"
=>
"field_common"
));
$output
=
$zd
->
create
(
""
,
"default.yaml"
,
3
0
,
""
,
array
(
"fields"
=>
"field_common"
));
$count
=
sprintf
(
"%d"
,
count
(
$output
));
print
(
">>
$count
\n
"
);
print
(
">>
$output[0]
\n
"
);
\ No newline at end of file
print
(
">>
$output[12]
\n
"
);
\ No newline at end of file
test/ztf/script/basic/field_default_config.exp
0 → 100644
浏览文件 @
84a29ac3
>> 10
>> part1_c|part2_C|part3_int_12
\ No newline at end of file
test/ztf/script/basic/field_default_config.php
0 → 100755
浏览文件 @
84a29ac3
#!/usr/bin/env php
<?php
/**
[case]
title=
cid=0
pid=0
[group]
>>
>>
[esac]
*/
include_once
__DIR__
.
DIRECTORY_SEPARATOR
.
'../lib/zd.php'
;
$zd
=
new
zendata
();
$output
=
$zd
->
create
(
"default.yaml"
,
"test.yaml"
,
10
,
""
);
$count
=
sprintf
(
"%d"
,
count
(
$output
));
print
(
">>
$count
\n
"
);
print
(
">>
$output[2]
\n
"
);
\ No newline at end of file
test/ztf/script/basic/field_file.exp
0 → 100644
浏览文件 @
84a29ac3
>> 10
>> is in array
\ No newline at end of file
test/ztf/script/basic/field_file.php
0 → 100755
浏览文件 @
84a29ac3
#!/usr/bin/env php
<?php
/**
[case]
title=
cid=0
pid=0
[group]
>>
>>
[esac]
*/
include_once
__DIR__
.
DIRECTORY_SEPARATOR
.
'../lib/zd.php'
;
$zd
=
new
zendata
();
$output
=
$zd
->
create
(
""
,
"default.yaml"
,
10
,
""
,
array
(
"fields"
=>
"field_file"
));
$count
=
sprintf
(
"%d"
,
count
(
$output
));
print
(
">>
$count
\n
"
);
$str
=
join
(
$output
,
","
);
print
(
"
$str
\n
"
);
$array
=
array
(
"aaron"
,
"ben"
,
"carl"
);
if
(
in_array
(
$output
[
0
],
$array
))
{
print
(
">>
$output[0]
is in array
\n
"
);
}
\ No newline at end of file
test/ztf/script/basic/field_format.exp
0 → 100644
浏览文件 @
84a29ac3
>> 10
>> passwd03
\ No newline at end of file
test/ztf/script/basic/field_format.php
0 → 100755
浏览文件 @
84a29ac3
#!/usr/bin/env php
<?php
/**
[case]
title=
cid=0
pid=0
[group]
>>
>>
[esac]
*/
include_once
__DIR__
.
DIRECTORY_SEPARATOR
.
'../lib/zd.php'
;
$zd
=
new
zendata
();
$output
=
$zd
->
create
(
""
,
"default.yaml"
,
10
,
""
,
array
(
"fields"
=>
"field_format"
));
$count
=
sprintf
(
"%d"
,
count
(
$output
));
print
(
">>
$count
\n
"
);
print
(
">>
$output[2]
\n
"
);
\ No newline at end of file
test/ztf/script/basic/field_loop.exp
0 → 100644
浏览文件 @
84a29ac3
>> 10
>> g_h_i
\ No newline at end of file
test/ztf/script/basic/field_loop.php
0 → 100755
浏览文件 @
84a29ac3
#!/usr/bin/env php
<?php
/**
[case]
title=
cid=0
pid=0
[group]
>>
>>
[esac]
*/
include_once
__DIR__
.
DIRECTORY_SEPARATOR
.
'../lib/zd.php'
;
$zd
=
new
zendata
();
$output
=
$zd
->
create
(
""
,
"default.yaml"
,
10
,
""
,
array
(
"fields"
=>
"field_loop"
));
$count
=
sprintf
(
"%d"
,
count
(
$output
));
print
(
">>
$count
\n
"
);
print
(
">>
$output[2]
\n
"
);
\ No newline at end of file
test/ztf/script/basic/field_loop_range.exp
0 → 100644
浏览文件 @
84a29ac3
>> 10
>> [2|3]
\ No newline at end of file
test/ztf/script/basic/field_loop_range.php
0 → 100755
浏览文件 @
84a29ac3
#!/usr/bin/env php
<?php
/**
[case]
title=
cid=0
pid=0
[group]
>>
>>
[esac]
*/
include_once
__DIR__
.
DIRECTORY_SEPARATOR
.
'../lib/zd.php'
;
$zd
=
new
zendata
();
$output
=
$zd
->
create
(
""
,
"test.yaml"
,
10
,
""
,
array
(
"fields"
=>
"field_loop_range"
));
$count
=
sprintf
(
"%d"
,
count
(
$output
));
print
(
">>
$count
\n
"
);
print
(
">>
$output[2]
\n
"
);
\ No newline at end of file
test/ztf/script/basic/field_overwrite.exp
0 → 100644
浏览文件 @
84a29ac3
>> 10
>> [10.2.2.3/'24'}
\ No newline at end of file
test/ztf/script/basic/field_overwrite.php
0 → 100755
浏览文件 @
84a29ac3
#!/usr/bin/env php
<?php
/**
[case]
title=
cid=0
pid=0
[group]
>>
>>
[esac]
*/
include_once
__DIR__
.
DIRECTORY_SEPARATOR
.
'../lib/zd.php'
;
$zd
=
new
zendata
();
$output
=
$zd
->
create
(
"default.yaml"
,
"test.yaml"
,
10
,
""
,
array
(
"fields"
=>
"field_nested_instant"
));
$count
=
sprintf
(
"%d"
,
count
(
$output
));
print
(
">>
$count
\n
"
);
print
(
">>
$output[2]
\n
"
);
\ No newline at end of file
test/ztf/script/basic/field_random.exp
0 → 100644
浏览文件 @
84a29ac3
>> 10
>> not 1,2,3
\ No newline at end of file
test/ztf/script/basic/field_random.php
0 → 100755
浏览文件 @
84a29ac3
#!/usr/bin/env php
<?php
/**
[case]
title=
cid=0
pid=0
[group]
>>
>>
[esac]
*/
include_once
__DIR__
.
DIRECTORY_SEPARATOR
.
'../lib/zd.php'
;
$zd
=
new
zendata
();
$output
=
$zd
->
create
(
""
,
"default.yaml"
,
10
,
""
,
array
(
"fields"
=>
"field_random"
));
$count
=
sprintf
(
"%d"
,
count
(
$output
));
print
(
">>
$count
\n
"
);
$str
=
join
(
$output
,
","
);
print
(
"
$str
\n
"
);
if
(
$output
[
0
]
!=
1
||
$output
[
1
]
!=
2
||
$output
[
2
]
!=
3
)
{
print
(
">> not 1,2,3
\n
"
);
}
\ No newline at end of file
test/ztf/script/basic/field_repeat.exp
0 → 100644
浏览文件 @
84a29ac3
>> 10
>> user2
\ No newline at end of file
test/ztf/script/basic/field_repeat.php
0 → 100755
浏览文件 @
84a29ac3
#!/usr/bin/env php
<?php
/**
[case]
title=
cid=0
pid=0
[group]
>>
>>
[esac]
*/
include_once
__DIR__
.
DIRECTORY_SEPARATOR
.
'../lib/zd.php'
;
$zd
=
new
zendata
();
$output
=
$zd
->
create
(
""
,
"default.yaml"
,
10
,
""
,
array
(
"fields"
=>
"field_repeat"
));
$count
=
sprintf
(
"%d"
,
count
(
$output
));
print
(
">>
$count
\n
"
);
print
(
">>
$output[3]
\n
"
);
\ No newline at end of file
test/ztf/script/basic/field_step.exp
0 → 100644
浏览文件 @
84a29ac3
>> 10
>> 5
\ No newline at end of file
test/ztf/script/basic/field_step.php
0 → 100755
浏览文件 @
84a29ac3
#!/usr/bin/env php
<?php
/**
[case]
title=
cid=0
pid=0
[group]
>>
>>
[esac]
*/
include_once
__DIR__
.
DIRECTORY_SEPARATOR
.
'../lib/zd.php'
;
$zd
=
new
zendata
();
$output
=
$zd
->
create
(
""
,
"default.yaml"
,
10
,
""
,
array
(
"fields"
=>
"field_step"
));
$count
=
sprintf
(
"%d"
,
count
(
$output
));
print
(
">>
$count
\n
"
);
print
(
">>
$output[2]
\n
"
);
\ No newline at end of file
test/ztf/script/basic/field_use_config.exp
0 → 100644
浏览文件 @
84a29ac3
>> 10
>> '104,105'
\ No newline at end of file
test/ztf/script/basic/field_use_config.php
0 → 100755
浏览文件 @
84a29ac3
#!/usr/bin/env php
<?php
/**
[case]
title=
cid=0
pid=0
[group]
>>
>>
[esac]
*/
include_once
__DIR__
.
DIRECTORY_SEPARATOR
.
'../lib/zd.php'
;
$zd
=
new
zendata
();
$output
=
$zd
->
create
(
""
,
"default.yaml"
,
10
,
""
,
array
(
"fields"
=>
"field_use_another_file"
));
$count
=
sprintf
(
"%d"
,
count
(
$output
));
print
(
">>
$count
\n
"
);
print
(
">>
$output[2]
\n
"
);
\ No newline at end of file
test/ztf/script/basic/field_use_excel.exp
0 → 100644
浏览文件 @
84a29ac3
>> 10
>> 淄博市
\ No newline at end of file
test/ztf/script/basic/field_use_excel.php
0 → 100755
浏览文件 @
84a29ac3
#!/usr/bin/env php
<?php
/**
[case]
title=
cid=0
pid=0
[group]
>>
>>
[esac]
*/
include_once
__DIR__
.
DIRECTORY_SEPARATOR
.
'../lib/zd.php'
;
$zd
=
new
zendata
();
$output
=
$zd
->
create
(
""
,
"default.yaml"
,
10
,
""
,
array
(
"fields"
=>
"field_use_excel"
));
$count
=
sprintf
(
"%d"
,
count
(
$output
));
print
(
">>
$count
\n
"
);
print
(
">>
$output[2]
\n
"
);
\ No newline at end of file
test/ztf/script/basic/field_use_instances.exp
0 → 100644
浏览文件 @
84a29ac3
>> 10
>> 192.168.2.3
\ No newline at end of file
test/ztf/script/basic/field_use_instances.php
0 → 100755
浏览文件 @
84a29ac3
#!/usr/bin/env php
<?php
/**
[case]
title=
cid=0
pid=0
[group]
>>
>>
[esac]
*/
include_once
__DIR__
.
DIRECTORY_SEPARATOR
.
'../lib/zd.php'
;
$zd
=
new
zendata
();
$output
=
$zd
->
create
(
""
,
"default.yaml"
,
10
,
""
,
array
(
"fields"
=>
"field_use_instance"
));
$count
=
sprintf
(
"%d"
,
count
(
$output
));
print
(
">>
$count
\n
"
);
print
(
">>
$output[2]
\n
"
);
\ No newline at end of file
test/ztf/script/basic/field_use_ranges.exp
0 → 100644
浏览文件 @
84a29ac3
>> 10
>> '103'
\ No newline at end of file
test/ztf/script/basic/field_use_ranges.php
0 → 100755
浏览文件 @
84a29ac3
#!/usr/bin/env php
<?php
/**
[case]
title=
cid=0
pid=0
[group]
>>
>>
[esac]
*/
include_once
__DIR__
.
DIRECTORY_SEPARATOR
.
'../lib/zd.php'
;
$zd
=
new
zendata
();
$output
=
$zd
->
create
(
""
,
"default.yaml"
,
10
,
""
,
array
(
"fields"
=>
"field_use_ranges"
));
$count
=
sprintf
(
"%d"
,
count
(
$output
));
print
(
">>
$count
\n
"
);
print
(
">>
$output[2]
\n
"
);
\ No newline at end of file
test/ztf/script/cmd/cmd_decode.exp
浏览文件 @
84a29ac3
>> 3
>> int_1
\ No newline at end of file
>> found part1_a
>> found part3_int_10
\ No newline at end of file
test/ztf/script/cmd/cmd_decode.php
浏览文件 @
84a29ac3
...
...
@@ -20,6 +20,11 @@ $output = $zd->create("", "test2.yaml", 3, "output/test2.txt");
$zd
->
decode
(
"test2.yaml"
,
"output/test2.txt"
,
"output/test2.json"
);
$lineArr
=
$zd
->
readOutput
(
"output/zt_action.yaml"
,
array
(
6
));
$lines
=
join
(
"
\n
"
,
$lineArr
);
print
(
">>
$lines
\n
"
);
\ No newline at end of file
$arr
=
$zd
->
readOutput
(
"output/test2.json"
);
$content
=
join
(
$arr
,
""
);
if
(
strpos
(
$content
,
'part1_a'
)
>
0
)
{
print
(
">> found part1_a
\n
"
);
}
if
(
strpos
(
$content
,
'part3_int_10'
)
>
0
)
{
print
(
">> found part3_int_10
\n
"
);
}
test/ztf/script/lib/zd.php
浏览文件 @
84a29ac3
...
...
@@ -19,12 +19,25 @@ class zendata
{
$cmdStr
=
sprintf
(
"%s -c %s/%s -n %d"
,
$this
->
cmdPath
,
$this
->
workDir
,
$conf
,
$lines
);
if
(
count
(
$options
)
>
0
&&
$options
[
"fields"
])
{
if
(
$default
)
{
$cmdStr
=
str_replace
(
" -c "
,
" -d "
.
$this
->
workDir
.
"/"
.
$default
.
" -c "
,
$cmdStr
);
}
if
(
array_key_exists
(
"fields"
,
$options
))
{
$cmdStr
.
=
" -F "
.
$options
[
"fields"
];
}
if
(
array_key_exists
(
"table"
,
$options
))
{
$cmdStr
.
=
" -table "
.
$options
[
"table"
];
}
if
(
array_key_exists
(
"trim"
,
$options
))
{
$cmdStr
.
=
" -T "
;
}
if
(
$output
)
{
$cmdStr
.
=
" -o "
.
$this
->
workDir
.
"/"
.
$output
;
}
print
(
"
$cmdStr
\n
"
);
$output
=
[];
...
...
@@ -48,12 +61,19 @@ class zendata
print
(
"
$filePath
\n
"
);
$content
=
file_get_contents
(
$filePath
);
$arr
=
explode
(
"
\n
"
,
$content
);
if
(
count
(
$lines
)
==
0
)
{
return
$content
;
$ret
=
array
();
foreach
(
$arr
as
$item
)
{
$item
=
trim
(
$item
);
if
(
$item
)
{
array_push
(
$ret
,
$item
);
}
}
return
$ret
;
}
$ret
=
array
();
$arr
=
explode
(
"
\n
"
,
$content
);
foreach
(
$lines
as
$num
)
{
array_push
(
$ret
,
$arr
[
$num
-
1
]);
}
...
...
@@ -63,7 +83,7 @@ class zendata
public
function
decode
(
$config
,
$input
,
$out
)
{
$cmdStr
=
sprintf
(
"-D -c %s/%s -i %s/%s -o %s/%s"
,
$cmdStr
=
sprintf
(
"
%s
-D -c %s/%s -i %s/%s -o %s/%s"
,
$this
->
cmdPath
,
$this
->
workDir
,
$config
,
$this
->
workDir
,
$input
,
$this
->
workDir
,
$out
);
print
(
"
$cmdStr
\n
"
);
...
...
test/ztf/script/output/out_json.exp
0 → 100644
浏览文件 @
84a29ac3
>> {"field_common":"int_2\t"},
\ No newline at end of file
test/ztf/script/output/out_json.php
0 → 100755
浏览文件 @
84a29ac3
#!/usr/bin/env php
<?php
/**
[case]
title=
cid=0
pid=0
[group]
>>
>>
[esac]
*/
include_once
__DIR__
.
DIRECTORY_SEPARATOR
.
'../lib/zd.php'
;
$zd
=
new
zendata
();
$output
=
$zd
->
create
(
""
,
"default.yaml"
,
10
,
"output/default.json"
,
array
(
"fields"
=>
"field_common"
));
$lineArr
=
$zd
->
readOutput
(
"output/default.json"
);
print
(
">>
$lineArr[2]
\n
"
);
\ No newline at end of file
test/ztf/script/output/out_sql.exp
0 → 100644
浏览文件 @
84a29ac3
>> ('1|2|2')
\ No newline at end of file
test/ztf/script/output/out_sql.php
0 → 100755
浏览文件 @
84a29ac3
#!/usr/bin/env php
<?php
/**
[case]
title=
cid=0
pid=0
[group]
>>
>>
[esac]
*/
include_once
__DIR__
.
DIRECTORY_SEPARATOR
.
'../lib/zd.php'
;
$zd
=
new
zendata
();
$output
=
$zd
->
create
(
""
,
"test2.yaml"
,
10
,
"output/test2.sql"
,
array
(
"fields"
=>
"test0"
,
"table"
=>
"tlb_table"
,
"trim"
=>
"true"
));
$lineArr
=
$zd
->
readOutput
(
"output/test2.sql"
);
print
(
">>
$lineArr[2]
\n
"
);
\ No newline at end of file
test/ztf/script/output/out_txt.exp
0 → 100644
浏览文件 @
84a29ac3
>> 10
>> int_3
\ No newline at end of file
test/ztf/script/output/out_txt.php
0 → 100755
浏览文件 @
84a29ac3
#!/usr/bin/env php
<?php
/**
[case]
title=
cid=0
pid=0
[group]
>>
>>
[esac]
*/
include_once
__DIR__
.
DIRECTORY_SEPARATOR
.
'../lib/zd.php'
;
$zd
=
new
zendata
();
$output
=
$zd
->
create
(
""
,
"default.yaml"
,
10
,
"output/default.txt"
,
array
(
"fields"
=>
"field_common"
));
$lineArr
=
$zd
->
readOutput
(
"output/default.txt"
);
$count
=
sprintf
(
"%d"
,
count
(
$lineArr
));
print
(
">>
$count
\n
"
);
print
(
">>
$lineArr[2]
\n
"
);
\ No newline at end of file
test/ztf/script/output/out_xml.exp
0 → 100644
浏览文件 @
84a29ac3
>> <row><col>int_1	</col></row>
\ No newline at end of file
test/ztf/script/output/out_xml.php
0 → 100755
浏览文件 @
84a29ac3
#!/usr/bin/env php
<?php
/**
[case]
title=
cid=0
pid=0
[group]
>>
>>
[esac]
*/
include_once
__DIR__
.
DIRECTORY_SEPARATOR
.
'../lib/zd.php'
;
$zd
=
new
zendata
();
$output
=
$zd
->
create
(
""
,
"default.yaml"
,
10
,
"output/default.xml"
,
array
(
"fields"
=>
"field_common"
));
$lineArr
=
$zd
->
readOutput
(
"output/default.xml"
);
print
(
">>
$lineArr[3]
\n
"
);
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录