@cyklang/cli 0.7.4 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/Cmd.js +13 -7
- package/build/OpenCommand.d.ts +1 -1
- package/build/OpenCommand.js +11 -5
- package/build/TableCommand.js +12 -3
- package/build/index.js +1 -1
- package/package.json +1 -1
- package/run_test.sh +11 -0
- package/src/Cmd.ts +10 -5
- package/src/OpenCommand.ts +11 -5
- package/src/TableCommand.ts +16 -6
- package/src/index.ts +1 -1
- package/test/db/t10.output +23 -0
- package/test/{t10.xml → db/t10.xml} +44 -22
- package/test/db/t13.output +2 -0
- package/test/{t13.xml → db/t13.xml} +3 -3
- package/test/{t14.output → db/t14.output} +2 -0
- package/test/{t14.xml → db/t14.xml} +2 -2
- package/test/db/t15.output +4 -0
- package/test/{t15.xml → db/t15.xml} +8 -10
- package/test/db/t16.output +16 -0
- package/test/{t16.xml → db/t16.xml} +6 -6
- package/test/{t20.xml → db/t20.xml} +1 -1
- package/test/{t22.xml → db/t22.xml} +7 -7
- package/test/{t23.xml → db/t23.xml} +4 -4
- package/test/t09.output +1 -1
- package/test/t09.xml +1 -1
- package/test/cyklang.xsd +0 -1090
- package/test/t16.output +0 -49
- package/test/t19.xml +0 -234
- /package/test/{t14.xsd → db/t14.xsd} +0 -0
- /package/test/{t20.output → db/t20.output} +0 -0
- /package/test/{t21.output → db/t21.output} +0 -0
- /package/test/{t21.xml → db/t21.xml} +0 -0
- /package/test/{t22.output → db/t22.output} +0 -0
- /package/test/{t23.output → db/t23.output} +0 -0
package/build/Cmd.js
CHANGED
|
@@ -44,12 +44,18 @@ class Cmd extends commander_1.Command {
|
|
|
44
44
|
this.option('--env <env>', 'path to the environment variables file');
|
|
45
45
|
}
|
|
46
46
|
async prologue(options) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
if (options.env || fs.existsSync('.env')) {
|
|
48
|
+
const dotenvOutput = dotenv_1.default.config({ path: options.env });
|
|
49
|
+
if (dotenvOutput.error !== undefined)
|
|
50
|
+
throw dotenvOutput.error;
|
|
51
|
+
}
|
|
50
52
|
const structure = new core_1.Structure();
|
|
51
|
-
if (process.env.DBREMOTE_URL
|
|
52
|
-
throw 'DBREMOTE_URL undefined';
|
|
53
|
+
if (!process.env.DBREMOTE_URL)
|
|
54
|
+
throw 'DBREMOTE_URL environment variable undefined';
|
|
55
|
+
if (!process.env.USER_NAME)
|
|
56
|
+
throw 'USER_NAME environment variable undefined';
|
|
57
|
+
if (!process.env.USER_PASSWORD)
|
|
58
|
+
throw 'USER_PASSWORD environment variable undefined';
|
|
53
59
|
logger.info('Cyk server: ' + process.env.DBREMOTE_URL);
|
|
54
60
|
const nodeCrypto = new NodeCrypto_1.NodeCrypto();
|
|
55
61
|
this.dbRemote = new core_1.DBRemote(structure.scope, process.env.DBREMOTE_URL, nodeCrypto);
|
|
@@ -154,7 +160,7 @@ exports.runShellCommand = runShellCommand;
|
|
|
154
160
|
function spawnCommand(command, args) {
|
|
155
161
|
console.log();
|
|
156
162
|
console.log([command, ...args, '...'].join(' '));
|
|
157
|
-
const child_process = (0, child_process_1.spawn)(command, args, { stdio: 'inherit' });
|
|
163
|
+
const child_process = (0, child_process_1.spawn)(command, args, { stdio: 'inherit', shell: process.platform === 'win32' });
|
|
158
164
|
return new Promise((resolve, reject) => {
|
|
159
165
|
child_process.on('close', (code) => {
|
|
160
166
|
if (code === 0) {
|
|
@@ -176,7 +182,7 @@ exports.spawnCommand = spawnCommand;
|
|
|
176
182
|
*/
|
|
177
183
|
function spawnCommandData(command, args) {
|
|
178
184
|
let result = '';
|
|
179
|
-
const child_process = (0, child_process_1.spawn)(command, args);
|
|
185
|
+
const child_process = (0, child_process_1.spawn)(command, args, { shell: process.platform === 'win32' });
|
|
180
186
|
return new Promise((resolve, reject) => {
|
|
181
187
|
child_process.stdout.on('data', (data) => {
|
|
182
188
|
result += String(data);
|
package/build/OpenCommand.d.ts
CHANGED
package/build/OpenCommand.js
CHANGED
|
@@ -12,17 +12,23 @@ class OpenCommand extends Cmd_1.Cmd {
|
|
|
12
12
|
constructor(name) {
|
|
13
13
|
super(name);
|
|
14
14
|
this.description('open browser').version('0.1')
|
|
15
|
-
.argument('<
|
|
16
|
-
.action(async (
|
|
17
|
-
await this.openBrowser(
|
|
15
|
+
.argument('<module_path>', 'module to execute or pathname')
|
|
16
|
+
.action(async (module_path, options) => {
|
|
17
|
+
await this.openBrowser(module_path, options);
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
|
-
async openBrowser(
|
|
20
|
+
async openBrowser(module_path, options) {
|
|
21
21
|
try {
|
|
22
22
|
await this.prologue(options);
|
|
23
23
|
if (process.env.DBREMOTE_URL === undefined)
|
|
24
24
|
throw 'DBREMOTE_URL undefined';
|
|
25
|
-
|
|
25
|
+
let url = process.env.DBREMOTE_URL;
|
|
26
|
+
if (module_path.startsWith('/')) {
|
|
27
|
+
url += module_path;
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
url += '/cyk/#/run/' + module_path;
|
|
31
|
+
}
|
|
26
32
|
const open = await import('open');
|
|
27
33
|
open.default(url);
|
|
28
34
|
}
|
package/build/TableCommand.js
CHANGED
|
@@ -320,6 +320,7 @@ class TableDropCommand extends Cmd_1.Cmd {
|
|
|
320
320
|
constructor(name, description) {
|
|
321
321
|
super(name);
|
|
322
322
|
this.description(description)
|
|
323
|
+
.option('-y --yes', 'confirmation is not required')
|
|
323
324
|
.argument('<table>', 'table name')
|
|
324
325
|
.action(async (table, options) => {
|
|
325
326
|
await this.commandDrop(table, options);
|
|
@@ -335,8 +336,14 @@ class TableDropCommand extends Cmd_1.Cmd {
|
|
|
335
336
|
console.log('table ' + table + ' does not exist');
|
|
336
337
|
return;
|
|
337
338
|
}
|
|
338
|
-
|
|
339
|
-
if (
|
|
339
|
+
let dropConfirmed = (options.yes !== undefined);
|
|
340
|
+
if (dropConfirmed === false) {
|
|
341
|
+
const reply = await inquirer_1.default.prompt({ type: 'confirm', name: 'confirm', message: 'Drop table ' + table + '?' });
|
|
342
|
+
if (reply.confirm) {
|
|
343
|
+
dropConfirmed = true;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
if (dropConfirmed) {
|
|
340
347
|
await dropTable(table, this.dbManager);
|
|
341
348
|
}
|
|
342
349
|
}
|
|
@@ -352,7 +359,9 @@ class TableDropCommand extends Cmd_1.Cmd {
|
|
|
352
359
|
*/
|
|
353
360
|
async function dropTable(table, dbManager) {
|
|
354
361
|
const dbTable = await dbManager.dbTableExist(table);
|
|
355
|
-
if (dbTable)
|
|
362
|
+
if (dbTable) {
|
|
356
363
|
await dbManager.dbTableDelete(dbTable);
|
|
364
|
+
console.log('table ' + dbTable.name + ' dropped');
|
|
365
|
+
}
|
|
357
366
|
}
|
|
358
367
|
exports.dropTable = dropTable;
|
package/build/index.js
CHANGED
|
@@ -181,7 +181,7 @@ class StopCommand extends commander_1.Command {
|
|
|
181
181
|
*/
|
|
182
182
|
const program = new commander_1.Command();
|
|
183
183
|
program.name('cyk').description('cyklang CLI')
|
|
184
|
-
.version('0.7.
|
|
184
|
+
.version('0.7.5');
|
|
185
185
|
program.addCommand(new StartCommand('start'));
|
|
186
186
|
program.addCommand(new StopCommand('stop'));
|
|
187
187
|
program.addCommand(new InstallCommand_1.InstallCommand('install'));
|
package/package.json
CHANGED
package/run_test.sh
ADDED
package/src/Cmd.ts
CHANGED
|
@@ -22,11 +22,16 @@ export class Cmd extends Command {
|
|
|
22
22
|
|
|
23
23
|
async prologue(options: any): Promise<SigninResponse> {
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
if (options.env || fs.existsSync('.env')) {
|
|
26
|
+
const dotenvOutput = dotenv.config({ path: options.env })
|
|
27
|
+
if (dotenvOutput.error !== undefined) throw dotenvOutput.error
|
|
28
|
+
}
|
|
27
29
|
|
|
28
30
|
const structure = new Structure()
|
|
29
|
-
if (process.env.DBREMOTE_URL
|
|
31
|
+
if (! process.env.DBREMOTE_URL) throw 'DBREMOTE_URL environment variable undefined'
|
|
32
|
+
if (! process.env.USER_NAME) throw 'USER_NAME environment variable undefined'
|
|
33
|
+
if (! process.env.USER_PASSWORD) throw 'USER_PASSWORD environment variable undefined'
|
|
34
|
+
|
|
30
35
|
logger.info('Cyk server: ' + process.env.DBREMOTE_URL)
|
|
31
36
|
const nodeCrypto = new NodeCrypto()
|
|
32
37
|
this.dbRemote = new DBRemote(structure.scope, process.env.DBREMOTE_URL, nodeCrypto)
|
|
@@ -145,7 +150,7 @@ export async function runShellCommand(command: string, args: string[]) {
|
|
|
145
150
|
export function spawnCommand(command: string, args: string[]): Promise<void> {
|
|
146
151
|
console.log()
|
|
147
152
|
console.log([command, ...args, '...'].join(' '))
|
|
148
|
-
const child_process = spawn(command, args, { stdio: 'inherit' })
|
|
153
|
+
const child_process = spawn(command, args, { stdio: 'inherit', shell: process.platform === 'win32' })
|
|
149
154
|
return new Promise((resolve, reject) => {
|
|
150
155
|
child_process.on('close', (code) => {
|
|
151
156
|
if (code === 0) {
|
|
@@ -167,7 +172,7 @@ export function spawnCommand(command: string, args: string[]): Promise<void> {
|
|
|
167
172
|
*/
|
|
168
173
|
export function spawnCommandData(command: string, args: string[]): Promise<string> {
|
|
169
174
|
let result = ''
|
|
170
|
-
const child_process = spawn(command, args)
|
|
175
|
+
const child_process = spawn(command, args, { shell: process.platform === 'win32' })
|
|
171
176
|
return new Promise((resolve, reject) => {
|
|
172
177
|
child_process.stdout.on('data', (data) => {
|
|
173
178
|
result += String(data)
|
package/src/OpenCommand.ts
CHANGED
|
@@ -8,18 +8,24 @@ export class OpenCommand extends Cmd {
|
|
|
8
8
|
constructor(name: string) {
|
|
9
9
|
super(name)
|
|
10
10
|
this.description('open browser').version('0.1')
|
|
11
|
-
.argument('<
|
|
12
|
-
.action(async (
|
|
13
|
-
await this.openBrowser(
|
|
11
|
+
.argument('<module_path>', 'module to execute or pathname')
|
|
12
|
+
.action(async (module_path: any, options: any) => {
|
|
13
|
+
await this.openBrowser(module_path, options)
|
|
14
14
|
})
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
async openBrowser(
|
|
17
|
+
async openBrowser(module_path: string, options: any) {
|
|
18
18
|
try {
|
|
19
19
|
await this.prologue(options)
|
|
20
20
|
|
|
21
21
|
if (process.env.DBREMOTE_URL === undefined) throw 'DBREMOTE_URL undefined'
|
|
22
|
-
|
|
22
|
+
let url = process.env.DBREMOTE_URL
|
|
23
|
+
if (module_path.startsWith('/')) {
|
|
24
|
+
url += module_path
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
url += '/cyk/#/run/' + module_path
|
|
28
|
+
}
|
|
23
29
|
const open = await import('open');
|
|
24
30
|
open.default(url)
|
|
25
31
|
}
|
package/src/TableCommand.ts
CHANGED
|
@@ -324,6 +324,7 @@ class TableDropCommand extends Cmd {
|
|
|
324
324
|
constructor(name: string, description: string) {
|
|
325
325
|
super(name)
|
|
326
326
|
this.description(description)
|
|
327
|
+
.option('-y --yes', 'confirmation is not required')
|
|
327
328
|
.argument('<table>', 'table name')
|
|
328
329
|
.action(async (table, options) => {
|
|
329
330
|
await this.commandDrop(table, options)
|
|
@@ -334,18 +335,25 @@ class TableDropCommand extends Cmd {
|
|
|
334
335
|
try {
|
|
335
336
|
await this.prologue(options)
|
|
336
337
|
if (!this.dbManager) throw 'dbManager undefined'
|
|
337
|
-
|
|
338
|
+
|
|
338
339
|
const dbTable = await this.dbManager.dbTableExist(table)
|
|
339
340
|
if (!dbTable) {
|
|
340
341
|
console.log('table ' + table + ' does not exist')
|
|
341
342
|
return
|
|
342
343
|
}
|
|
343
|
-
|
|
344
|
-
if (
|
|
344
|
+
let dropConfirmed = (options.yes !== undefined)
|
|
345
|
+
if (dropConfirmed === false) {
|
|
346
|
+
const reply = await inquirer.prompt({ type: 'confirm', name: 'confirm', message: 'Drop table ' + table + '?' })
|
|
347
|
+
if (reply.confirm) {
|
|
348
|
+
dropConfirmed = true
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
if (dropConfirmed) {
|
|
345
353
|
await dropTable(table, this.dbManager)
|
|
346
354
|
}
|
|
347
355
|
}
|
|
348
|
-
catch(err) {
|
|
356
|
+
catch (err) {
|
|
349
357
|
logger.error(err)
|
|
350
358
|
}
|
|
351
359
|
}
|
|
@@ -358,8 +366,10 @@ class TableDropCommand extends Cmd {
|
|
|
358
366
|
*/
|
|
359
367
|
export async function dropTable(table: string, dbManager: DBManager) {
|
|
360
368
|
const dbTable = await dbManager.dbTableExist(table)
|
|
361
|
-
if (dbTable)
|
|
362
|
-
await dbManager.dbTableDelete(dbTable)
|
|
369
|
+
if (dbTable) {
|
|
370
|
+
await dbManager.dbTableDelete(dbTable)
|
|
371
|
+
console.log('table ' + dbTable.name + ' dropped')
|
|
372
|
+
}
|
|
363
373
|
}
|
|
364
374
|
|
|
365
375
|
|
package/src/index.ts
CHANGED
|
@@ -175,7 +175,7 @@ class StopCommand extends Command {
|
|
|
175
175
|
*/
|
|
176
176
|
const program = new Command()
|
|
177
177
|
program.name('cyk').description('cyklang CLI')
|
|
178
|
-
.version('0.7.
|
|
178
|
+
.version('0.7.5')
|
|
179
179
|
program.addCommand(new StartCommand('start'))
|
|
180
180
|
program.addCommand(new StopCommand('stop'))
|
|
181
181
|
program.addCommand(new InstallCommand('install'))
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
New film ID 1
|
|
2
|
+
films_actors.resultset.at(0).t_actor.last_name CHANE YOU KAYE
|
|
3
|
+
actor 1 Maria CHANE YOU KAYE, film 1 La mélodie du bonheur
|
|
4
|
+
string(films_actors.resultset) : <object>
|
|
5
|
+
<object name="t_actor">
|
|
6
|
+
<number name="actor_id">1</number>
|
|
7
|
+
<string name="first_name" literal="">Maria</string>
|
|
8
|
+
<string name="last_name" literal="">CHANE YOU KAYE</string>
|
|
9
|
+
<datetime name="last_update">
|
|
10
|
+
</datetime>
|
|
11
|
+
<string name="cyk_remark" literal="">remarque</string>
|
|
12
|
+
<boolean name="cyk_disable">
|
|
13
|
+
</boolean>
|
|
14
|
+
</object>
|
|
15
|
+
<object name="t_film">
|
|
16
|
+
<number name="film_id">1</number>
|
|
17
|
+
<string name="title" literal="">La mélodie du bonheur</string>
|
|
18
|
+
<string name="description" literal="">Le film préféré de Mao</string>
|
|
19
|
+
<number name="release_year">1965</number>
|
|
20
|
+
<number name="length">60</number>
|
|
21
|
+
<number name="language_id">1</number>
|
|
22
|
+
</object>
|
|
23
|
+
</object>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
<?xml-model href="cyklang.xsd" ?>
|
|
1
|
+
<?xml-model href="https://www.cyklang.net/schema/cyklang.xsd" ?>
|
|
2
2
|
<module>
|
|
3
3
|
|
|
4
|
-
<db.table name="
|
|
4
|
+
<db.table name="t_actor">
|
|
5
5
|
<number name="actor_id" type="int" primary="" generated='by default'/>
|
|
6
6
|
<string name="first_name" type="varchar(50)"/>
|
|
7
7
|
<string name="last_name" type="text" />
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<boolean name="cyk_disable" type="boolean"/>
|
|
11
11
|
</db.table>
|
|
12
12
|
|
|
13
|
-
<db.table name="
|
|
13
|
+
<db.table name="t_film">
|
|
14
14
|
<number name="film_id" type="int" primary="" generated='by default'/>
|
|
15
15
|
<string name="title" type="varchar(255)" />
|
|
16
16
|
<string name="description" type="text" />
|
|
@@ -19,23 +19,45 @@
|
|
|
19
19
|
<number name="language_id" type="int"/>
|
|
20
20
|
</db.table>
|
|
21
21
|
|
|
22
|
-
<db.table name="
|
|
23
|
-
<number name="
|
|
24
|
-
<number name="
|
|
22
|
+
<db.table name="t_film_actor">
|
|
23
|
+
<number name="id" type="int" primary="" generated="by default"/>
|
|
24
|
+
<number name="actor_id" type="int"/>
|
|
25
|
+
<number name="film_id" type="int"/>
|
|
25
26
|
<number name="length" type="int"/>
|
|
26
27
|
</db.table>
|
|
27
28
|
|
|
28
|
-
<
|
|
29
|
+
<!-- <object name="result"/>
|
|
30
|
+
|
|
31
|
+
<db.query name="t_film_actor_truncate">
|
|
32
|
+
<string name="__fields__" literal="">*</string>
|
|
33
|
+
<string name="__sql__" literal="">truncate table t_film_actor</string>
|
|
34
|
+
</db.query>
|
|
35
|
+
<db.runquery name="t_film_actor_truncate" result="result"></db.runquery>
|
|
36
|
+
|
|
37
|
+
<db.query name="t_film_truncate">
|
|
38
|
+
<string name="__fields__" literal="">*</string>
|
|
39
|
+
<string name="__sql__" literal="">truncate table t_film</string>
|
|
40
|
+
</db.query>
|
|
41
|
+
<db.runquery name="t_film_truncate" result="result"></db.runquery>
|
|
42
|
+
|
|
43
|
+
<db.query name="t_actor_truncate">
|
|
44
|
+
<string name="__fields__" literal="">*</string>
|
|
45
|
+
<string name="__sql__" literal="">truncate table t_actor</string>
|
|
46
|
+
</db.query>
|
|
47
|
+
<db.runquery name="t_actor_truncate" result="result"></db.runquery> -->
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
<db.query name="t_films_actors">
|
|
29
51
|
<number name="length_from">0</number>
|
|
30
52
|
<number name="length_to">999</number>
|
|
31
|
-
<string name="__entities__">"
|
|
53
|
+
<string name="__entities__">"t_actor t_film"</string>
|
|
32
54
|
<string name="__sql__" literal="">
|
|
33
|
-
SELECT * FROM public.
|
|
34
|
-
join
|
|
35
|
-
join
|
|
36
|
-
where
|
|
55
|
+
SELECT * FROM public.t_actor
|
|
56
|
+
join t_film_actor on t_film_actor.actor_id = t_actor.actor_id
|
|
57
|
+
join t_film on t_film_actor.film_id = t_film.film_id
|
|
58
|
+
where t_film.length between {{ length_from }} and {{ length_to }}
|
|
37
59
|
-- and actor.actor_id = 2
|
|
38
|
-
ORDER BY
|
|
60
|
+
ORDER BY t_actor.actor_id ASC ;
|
|
39
61
|
</string>
|
|
40
62
|
</db.query>
|
|
41
63
|
|
|
@@ -49,7 +71,7 @@
|
|
|
49
71
|
<object name="actor">actor_maria</object>
|
|
50
72
|
</db.execute> -->
|
|
51
73
|
|
|
52
|
-
<db.insert table="
|
|
74
|
+
<db.insert table="t_actor" returning_into="actor_maria">
|
|
53
75
|
<object name="actor">actor_maria</object>
|
|
54
76
|
</db.insert>
|
|
55
77
|
|
|
@@ -65,7 +87,7 @@
|
|
|
65
87
|
<object> new_film </object>
|
|
66
88
|
</db.execute> -->
|
|
67
89
|
|
|
68
|
-
<db.insert table="
|
|
90
|
+
<db.insert table="t_film" returning_into="new_film">
|
|
69
91
|
<object>new_film</object>
|
|
70
92
|
</db.insert>
|
|
71
93
|
|
|
@@ -77,7 +99,7 @@
|
|
|
77
99
|
<object name="film"> new_film </object>
|
|
78
100
|
</db.execute> -->
|
|
79
101
|
|
|
80
|
-
<db.update table="
|
|
102
|
+
<db.update table="t_film">
|
|
81
103
|
<object name="film"> new_film </object>
|
|
82
104
|
</db.update>
|
|
83
105
|
|
|
@@ -88,7 +110,7 @@
|
|
|
88
110
|
</object>
|
|
89
111
|
</db.execute> -->
|
|
90
112
|
|
|
91
|
-
<db.insert table="
|
|
113
|
+
<db.insert table="t_film_actor">
|
|
92
114
|
<object>
|
|
93
115
|
<number name="actor_id">actor_maria.actor_id</number>
|
|
94
116
|
<number name="film_id">new_film.film_id</number>
|
|
@@ -102,24 +124,24 @@
|
|
|
102
124
|
<number name="length_to">60</number>
|
|
103
125
|
</db.execute> -->
|
|
104
126
|
|
|
105
|
-
<db.runquery name="
|
|
127
|
+
<db.runquery name="t_films_actors" result="films_actors">
|
|
106
128
|
<number name="length_from">60</number>
|
|
107
129
|
<number name="length_to">60</number>
|
|
108
130
|
</db.runquery>
|
|
109
131
|
|
|
110
|
-
<print>"films_actors.resultset.at(0).
|
|
132
|
+
<print>"films_actors.resultset.at(0).t_actor.last_name " + films_actors.resultset.at(0).t_actor.last_name</print>
|
|
111
133
|
<call object="films_actors.resultset" method="foreach">
|
|
112
134
|
<function>
|
|
113
135
|
<object name="result" />
|
|
114
136
|
<block>
|
|
115
|
-
<print>"actor " + result.
|
|
116
|
-
+ ", film " + result.
|
|
137
|
+
<print>"actor " + result.t_actor.actor_id + " " + result.t_actor.first_name + " " + result.t_actor.last_name
|
|
138
|
+
+ ", film " + result.t_film.film_id + " " + result.t_film.title
|
|
117
139
|
</print>
|
|
118
140
|
</block>
|
|
119
141
|
</function>
|
|
120
142
|
</call>
|
|
121
143
|
|
|
122
|
-
<print>"string(films_actors) : "+string(films_actors)</print>
|
|
144
|
+
<print>"string(films_actors.resultset) : "+string(films_actors.resultset)</print>
|
|
123
145
|
|
|
124
146
|
|
|
125
147
|
</module>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<?xml-model href="cyklang.xsd" ?>
|
|
1
|
+
<?xml-model href="https://www.cyklang.net/schema/cyklang.xsd" ?>
|
|
2
2
|
<module>
|
|
3
3
|
<object name="films_actors" />
|
|
4
4
|
<number name="index">2</number>
|
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
<number name="length_from">60</number>
|
|
11
11
|
<number name="length_to">60</number>
|
|
12
12
|
</db.execute> -->
|
|
13
|
-
<db.runquery name="
|
|
13
|
+
<db.runquery name="t_films_actors" result="films_actors">
|
|
14
14
|
<number name="length_from">60</number>
|
|
15
15
|
<number name="length_to">60</number>
|
|
16
16
|
</db.runquery>
|
|
17
17
|
<print>"index = "+index</print>
|
|
18
|
-
<sleep>
|
|
18
|
+
<sleep>500</sleep>
|
|
19
19
|
|
|
20
20
|
</then>
|
|
21
21
|
</while>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<?xml-model href="cyklang.xsd" ?>
|
|
1
|
+
<?xml-model href="https://www.cyklang.net/schema/cyklang.xsd" ?>
|
|
2
2
|
<module>
|
|
3
3
|
<object name="obj1">
|
|
4
4
|
<string name="name">"obj1_name"</string>
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
|
|
74
74
|
<print>"========= TEST OF newDBRow ======="</print>
|
|
75
75
|
|
|
76
|
-
<object name="actress">newDBRow("
|
|
76
|
+
<object name="actress">newDBRow("t_actor")</object>
|
|
77
77
|
<print>"actress "+string(actress)</print>
|
|
78
78
|
|
|
79
79
|
<object name="user1">newDBRow("cyk_user")</object>
|
|
@@ -1,26 +1,24 @@
|
|
|
1
|
-
<?xml-model href="cyklang.xsd" ?>
|
|
1
|
+
<?xml-model href="https://www.cyklang.net/schema/cyklang.xsd" ?>
|
|
2
2
|
<module>
|
|
3
3
|
<print>"test de if()"</print>
|
|
4
4
|
<print>if(2+2 == 4, "2+2==4", "2+2!==4")</print>
|
|
5
5
|
|
|
6
|
-
<db.query name="
|
|
6
|
+
<db.query name="t_actors_by_film">
|
|
7
7
|
<number name="film_id"/>
|
|
8
8
|
<string name="__fields__">"
|
|
9
9
|
film_id: number;
|
|
10
10
|
actor_id: number: key;
|
|
11
11
|
title: string;
|
|
12
|
-
image_uri: string;
|
|
13
12
|
first_name: string;
|
|
14
13
|
last_name: string
|
|
15
14
|
"
|
|
16
15
|
</string>
|
|
17
16
|
<string name="__sql__" literal="">
|
|
18
|
-
select
|
|
19
|
-
actor.image_uri,
|
|
17
|
+
select t_film.film_id, title, t_actor.actor_id actor_id,
|
|
20
18
|
first_name, last_name
|
|
21
|
-
from
|
|
22
|
-
join
|
|
23
|
-
where
|
|
19
|
+
from t_film_actor join t_film on t_film.film_id = t_film_actor.film_id
|
|
20
|
+
join t_actor on t_actor.actor_id = t_film_actor.actor_id
|
|
21
|
+
where t_film_actor.film_id = {{ film_id }}
|
|
24
22
|
</string>
|
|
25
23
|
</db.query>
|
|
26
24
|
|
|
@@ -30,11 +28,11 @@ where film_actor.film_id = {{ film_id }}
|
|
|
30
28
|
<number name="film_id">103</number>
|
|
31
29
|
</db.execute> -->
|
|
32
30
|
|
|
33
|
-
<db.runquery name="
|
|
31
|
+
<db.runquery name="t_actors_by_film" result="actors_by_film">
|
|
34
32
|
<number name="film_id">103</number>
|
|
35
33
|
</db.runquery>
|
|
36
34
|
|
|
37
|
-
<print>string(actors_by_film)</print>
|
|
35
|
+
<print>string(actors_by_film.resultset)</print>
|
|
38
36
|
<print>actors_by_film.resultset.length()</print>
|
|
39
37
|
<!-- <object name="films_actors"/>
|
|
40
38
|
<db.execute query="films_actors" result="films_actors">
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
OK Février
|
|
2
|
+
test IF before
|
|
3
|
+
monthlabel Mars
|
|
4
|
+
test IF after
|
|
5
|
+
month 1 Janvier 2021 2021-01-01 -> 2021-01-31
|
|
6
|
+
month 2 Février 2021 2021-02-01 -> 2021-02-28
|
|
7
|
+
month 3 Mars 2021 2021-03-01 -> 2021-03-31
|
|
8
|
+
month 4 Avril 2021 2021-04-01 -> 2021-04-30
|
|
9
|
+
month 5 Mai 2021 2021-05-01 -> 2021-05-31
|
|
10
|
+
month 6 Juin 2021 2021-06-01 -> 2021-06-30
|
|
11
|
+
month 7 Juillet 2021 2021-07-01 -> 2021-07-31
|
|
12
|
+
month 8 Août 2021 2021-08-01 -> 2021-08-31
|
|
13
|
+
month 9 Septembre 2021 2021-09-01 -> 2021-09-30
|
|
14
|
+
month 10 Octobre 2021 2021-10-01 -> 2021-10-31
|
|
15
|
+
month 11 Novembre 2021 2021-11-01 -> 2021-11-30
|
|
16
|
+
month 12 Décembre 2021 2021-12-01 -> 2021-12-31
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
<?xml-model href="cyklang.xsd" ?>
|
|
1
|
+
<?xml-model href="https://www.cyklang.net/schema/cyklang.xsd" ?>
|
|
2
2
|
<module>
|
|
3
|
-
<object name="dbresult"/>
|
|
4
|
-
<!-- <db.execute select_from_table="year" result="dbresult">
|
|
5
|
-
<string name="where">"year_num = 2021"</string>
|
|
6
|
-
</db.execute> -->
|
|
3
|
+
<!-- <object name="dbresult"/>
|
|
7
4
|
<db.select table="year" result="dbresult">
|
|
8
5
|
<string name="where">"year_num = 2021"</string>
|
|
9
6
|
</db.select>
|
|
@@ -25,7 +22,10 @@
|
|
|
25
22
|
<else>
|
|
26
23
|
<print>"TEST KO"</print>
|
|
27
24
|
</else>
|
|
28
|
-
</if>
|
|
25
|
+
</if> -->
|
|
26
|
+
|
|
27
|
+
<string name="year_begin_date">"2021-01-01"</string>
|
|
28
|
+
<string name="year_end_date">"2021-12-31"</string>
|
|
29
29
|
|
|
30
30
|
<object name="monthlabel">
|
|
31
31
|
<string name="_01">"Janvier"</string>
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
<?xml-model href="cyklang.xsd" ?>
|
|
2
|
-
<module
|
|
1
|
+
<?xml-model href="https://www.cyklang.net/schema/cyklang.xsd" ?>
|
|
2
|
+
<module>
|
|
3
3
|
<function name="get_tables" returns="result: object">
|
|
4
4
|
<block>
|
|
5
5
|
|
|
6
|
-
<object name="
|
|
7
|
-
<db.select table="
|
|
8
|
-
<!-- <db.execute select_from_table="
|
|
6
|
+
<object name="result_t_actor"/>
|
|
7
|
+
<db.select table="t_actor" result="result_t_actor"/>
|
|
8
|
+
<!-- <db.execute select_from_table="t_actor" result="result_t_actor"/> -->
|
|
9
9
|
|
|
10
10
|
<object name="result_">
|
|
11
11
|
<string name="name">"CYK"</string>
|
|
12
12
|
<string name="surname">"Philippe"</string>
|
|
13
|
-
<object name="
|
|
13
|
+
<object name="t_actor">result_t_actor.t_actor</object>
|
|
14
14
|
<object name="meta">
|
|
15
|
-
<string name="
|
|
15
|
+
<string name="t_actor">result_t_actor.meta.t_actor</string>
|
|
16
16
|
</object>
|
|
17
17
|
</object>
|
|
18
18
|
<set name="result">result_</set>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
<?xml-model href="cyklang.xsd" ?>
|
|
2
|
-
<module
|
|
1
|
+
<?xml-model href="https://www.cyklang.net/schema/cyklang.xsd" ?>
|
|
2
|
+
<module>
|
|
3
3
|
<function name="call_get_tables">
|
|
4
4
|
<block>
|
|
5
|
-
<object name="
|
|
6
|
-
<db.call module="t22" method="get_tables" returns="
|
|
5
|
+
<object name="t_actor"/>
|
|
6
|
+
<db.call module="t22" method="get_tables" returns="t_actor"/>
|
|
7
7
|
|
|
8
8
|
<!-- <db.execute module="t22" method="get_tables" returns="settings">
|
|
9
9
|
</db.execute> -->
|
package/test/t09.output
CHANGED