@cyklang/cli 0.8.0 → 0.8.3

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.
@@ -0,0 +1,4 @@
1
+ import { Command } from "commander";
2
+ export declare class CronCommand extends Command {
3
+ constructor(name: string);
4
+ }
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.CronCommand = void 0;
7
+ const commander_1 = require("commander");
8
+ const loglevel_1 = __importDefault(require("loglevel"));
9
+ const Cmd_1 = require("./Cmd");
10
+ const logger = loglevel_1.default.getLogger('CronCommand.ts');
11
+ logger.setLevel('debug');
12
+ class CronCommand extends commander_1.Command {
13
+ constructor(name) {
14
+ super(name);
15
+ this.description('batch scheduling with cron')
16
+ .addCommand(new CronList('list'))
17
+ .addCommand(new CronList('l'))
18
+ .addCommand(new CronAddCmd('add'))
19
+ .addCommand(new CronAddCmd('a'));
20
+ }
21
+ }
22
+ exports.CronCommand = CronCommand;
23
+ class CronList extends Cmd_1.Cmd {
24
+ constructor(name) {
25
+ super(name);
26
+ this.description('List scheduled batches')
27
+ .action(async (options) => {
28
+ });
29
+ }
30
+ }
31
+ class CronAddCmd extends Cmd_1.Cmd {
32
+ constructor(name) {
33
+ super(name);
34
+ this.description('add a batch scheduling with cron')
35
+ .option('-s --schedule <schedule>', 'schedule in crontab format')
36
+ .option('-m --module <module_name>', 'module name')
37
+ .option('-f --function <function>', 'function called in the module')
38
+ .option('-p --param <parameter_name_value>', 'name and value separated by = character')
39
+ .action(async (options) => {
40
+ console.log('options', options);
41
+ });
42
+ }
43
+ }
@@ -9,6 +9,7 @@ const loglevel_1 = __importDefault(require("loglevel"));
9
9
  const Cmd_1 = require("./Cmd");
10
10
  const commander_1 = require("commander");
11
11
  const DBClient_1 = require("./DBClient");
12
+ const inquirer_1 = __importDefault(require("inquirer"));
12
13
  const logger = loglevel_1.default.getLogger("QueryCommand.ts");
13
14
  logger.setLevel("debug");
14
15
  class QueryCommand extends commander_1.Command {
@@ -17,6 +18,7 @@ class QueryCommand extends commander_1.Command {
17
18
  this.description('query management');
18
19
  this.addCommand(new QueryList('list', 'list queries'));
19
20
  this.addCommand(new QueryList('l', 'list queries'));
21
+ this.addCommand(new QueryDelete('delete'));
20
22
  }
21
23
  }
22
24
  exports.QueryCommand = QueryCommand;
@@ -40,6 +42,46 @@ class QueryList extends Cmd_1.Cmd {
40
42
  dbClient.selectFromTable('List of Queries', 'cyk_query', { fields: 'query_id,query_name,query_auth,query_access,query_description', sort: options.sort || '1' });
41
43
  }
42
44
  }
45
+ /**
46
+ * class QueryDelete
47
+ */
48
+ class QueryDelete extends Cmd_1.Cmd {
49
+ constructor(name) {
50
+ super(name);
51
+ this.description('delete query from cyk_query table')
52
+ .option('-y --yes', 'confirmation is not required')
53
+ .argument('<query>', 'query name')
54
+ .action(async (query, options) => {
55
+ await this.commandDelete(query, options);
56
+ });
57
+ }
58
+ async commandDelete(query, options) {
59
+ try {
60
+ await this.prologue(options);
61
+ if (!this.dbManager)
62
+ throw 'dbManager undefined';
63
+ const dbQuery = await this.dbManager.dbQueryExist(query);
64
+ if (!dbQuery) {
65
+ console.log('query ' + query + ' does not exist ');
66
+ return;
67
+ }
68
+ let deleteConfirmed = (options.yes !== undefined);
69
+ if (deleteConfirmed === false) {
70
+ const reply = await inquirer_1.default.prompt({ type: 'confirm', name: 'confirm', message: 'Delete query ' + query + '?' });
71
+ if (reply.confirm) {
72
+ deleteConfirmed = true;
73
+ }
74
+ }
75
+ if (deleteConfirmed) {
76
+ await this.dbManager.dbQueryDelete(dbQuery);
77
+ console.log('Query ' + query + ' has been deleted');
78
+ }
79
+ }
80
+ catch (err) {
81
+ logger.error(err);
82
+ }
83
+ }
84
+ }
43
85
  //--------------------------------------------------------------------------------------------------------------------
44
86
  // class queryData
45
87
  //--------------------------------------------------------------------------------------------------------------------
@@ -112,7 +112,8 @@ async function testfile(filename) {
112
112
  let xmlError = err;
113
113
  (0, console_1.errorconsole)(xmlError);
114
114
  }
115
- console.log(err);
115
+ else
116
+ console.log(err);
116
117
  }
117
118
  let log = fs.readFileSync(logfilename);
118
119
  if (fs.existsSync(outfilename) === true) {
package/build/console.js CHANGED
@@ -41,6 +41,7 @@ function errorconsole(xmlError) {
41
41
  msg += ":" + (xmlError.tag.column + 1);
42
42
  }
43
43
  msg += ") ===============\n";
44
+ msg += xmlError.message;
44
45
  console.log(msg);
45
46
  }
46
47
  }
package/build/index.js CHANGED
@@ -43,6 +43,7 @@ const TableDataCommand_1 = require("./TableDataCommand");
43
43
  const TestCommand_1 = require("./TestCommand");
44
44
  const UninstallCommand_1 = require("./UninstallCommand");
45
45
  const UserCommand_1 = require("./UserCommand");
46
+ const CronCommand_1 = require("./CronCommand");
46
47
  const logger = loglevel_1.default.getLogger("index.ts");
47
48
  logger.setLevel("debug");
48
49
  /**
@@ -181,7 +182,7 @@ class StopCommand extends commander_1.Command {
181
182
  */
182
183
  const program = new commander_1.Command();
183
184
  program.name('cyk').description('cyklang CLI')
184
- .version('0.7.5');
185
+ .version('0.8.3');
185
186
  program.addCommand(new StartCommand('start'));
186
187
  program.addCommand(new StopCommand('stop'));
187
188
  program.addCommand(new InstallCommand_1.InstallCommand('install'));
@@ -204,4 +205,6 @@ program.addCommand(new RunCommand_1.RunCommand('run'));
204
205
  program.addCommand(new RunCommand_1.RunCommand('r'));
205
206
  program.addCommand(new OpenCommand_1.OpenCommand('open'));
206
207
  program.addCommand(new OpenCommand_1.OpenCommand('o'));
208
+ program.addCommand(new CronCommand_1.CronCommand('cron'));
209
+ program.addCommand(new CronCommand_1.CronCommand('c'));
207
210
  program.parse();
package/clean_test.sh ADDED
@@ -0,0 +1,20 @@
1
+ #!/bin/sh
2
+
3
+ cyk table drop -y t_film_actor
4
+ cyk table drop -y t_film
5
+ cyk table drop -y t_actor
6
+
7
+
8
+ psql -c "
9
+ do \$\$
10
+ declare next_id int;
11
+ begin
12
+ select max(table_id)+1 from cyk_table into next_id;
13
+ execute 'alter sequence cyk_table_table_id_seq restart with ' || next_id ;
14
+ end \$\$
15
+ "
16
+
17
+
18
+
19
+
20
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cyklang/cli",
3
- "version": "0.8.0",
3
+ "version": "0.8.3",
4
4
  "description": "cyklang CLI",
5
5
  "main": "build/index.js",
6
6
  "scripts": {
@@ -11,13 +11,13 @@
11
11
  "npm:upgrade": "npx npm-check-updates -iu",
12
12
  "refresh": "rm -rf ./node_modules ./package-lock.json && npm install",
13
13
  "dev": "nodemon -e ts --ignore build --exec \"npm run global\" ",
14
- "test": "cyk test test/t*.xml"
14
+ "test": "./run_test.sh"
15
15
  },
16
16
  "keywords": [],
17
17
  "author": "",
18
18
  "license": "ISC",
19
19
  "dependencies": {
20
- "@cyklang/core": "^0.5.4",
20
+ "@cyklang/core": "^0.6.2",
21
21
  "commander": "^9.4.0",
22
22
  "dotenv": "^16.0.1",
23
23
  "form-data": "^4.0.0",
package/run_test.sh CHANGED
@@ -1,11 +1,11 @@
1
1
  #!/bin/sh
2
2
 
3
- cyk table drop -y t_film_actor
4
- cyk table drop -y t_film
5
- cyk table drop -y t_actor
3
+ ./clean_test.sh
6
4
 
7
5
  cyk module upload test/db/t20.xml
8
6
  cyk module upload test/db/t22.xml
9
7
 
10
8
  cyk test test/db/t*.xml
11
9
 
10
+ cyk test test/t*.xml
11
+
@@ -0,0 +1,40 @@
1
+ import { Command } from "commander";
2
+ import loglevel from 'loglevel'
3
+ import { Cmd } from "./Cmd";
4
+ const logger = loglevel.getLogger('CronCommand.ts')
5
+ logger.setLevel('debug')
6
+
7
+ export class CronCommand extends Command {
8
+ constructor(name: string) {
9
+ super(name)
10
+ this.description('batch scheduling with cron')
11
+ .addCommand(new CronList('list'))
12
+ .addCommand(new CronList('l'))
13
+ .addCommand(new CronAddCmd('add'))
14
+ .addCommand(new CronAddCmd('a'))
15
+ }
16
+ }
17
+
18
+ class CronList extends Cmd {
19
+ constructor(name: string) {
20
+ super(name)
21
+ this.description('List scheduled batches')
22
+ .action(async (options: any) => {
23
+
24
+ })
25
+ }
26
+ }
27
+
28
+ class CronAddCmd extends Cmd {
29
+ constructor(name: string) {
30
+ super(name)
31
+ this.description('add a batch scheduling with cron')
32
+ .option('-s --schedule <schedule>', 'schedule in crontab format')
33
+ .option('-m --module <module_name>', 'module name')
34
+ .option('-f --function <function>', 'function called in the module')
35
+ .option('-p --param <parameter_name_value>', 'name and value separated by = character')
36
+ .action(async (options: any) => {
37
+ console.log('options', options)
38
+ })
39
+ }
40
+ }
@@ -5,6 +5,7 @@ import loglevel from 'loglevel'
5
5
  import { Cmd } from './Cmd'
6
6
  import { Command } from 'commander'
7
7
  import { DBClient } from "./DBClient"
8
+ import inquirer from 'inquirer'
8
9
  const logger = loglevel.getLogger("QueryCommand.ts")
9
10
  logger.setLevel("debug")
10
11
 
@@ -14,6 +15,7 @@ export class QueryCommand extends Command {
14
15
  this.description('query management')
15
16
  this.addCommand(new QueryList('list', 'list queries'))
16
17
  this.addCommand(new QueryList('l', 'list queries'))
18
+ this.addCommand(new QueryDelete('delete'))
17
19
  }
18
20
  }
19
21
 
@@ -42,7 +44,47 @@ class QueryList extends Cmd {
42
44
  }
43
45
  }
44
46
 
47
+ /**
48
+ * class QueryDelete
49
+ */
50
+ class QueryDelete extends Cmd {
51
+ constructor(name: string) {
52
+ super(name)
53
+ this.description('delete query from cyk_query table')
54
+ .option('-y --yes', 'confirmation is not required')
55
+ .argument('<query>', 'query name')
56
+ .action(async (query, options) => {
57
+ await this.commandDelete(query, options)
58
+ })
59
+ }
45
60
 
61
+ async commandDelete(query: string, options: any) {
62
+ try {
63
+ await this.prologue(options)
64
+ if (! this.dbManager) throw 'dbManager undefined'
65
+
66
+ const dbQuery = await this.dbManager.dbQueryExist(query)
67
+ if (! dbQuery ) {
68
+ console.log('query ' + query + ' does not exist ')
69
+ return
70
+ }
71
+ let deleteConfirmed = (options.yes !== undefined)
72
+ if (deleteConfirmed === false) {
73
+ const reply = await inquirer.prompt({ type: 'confirm', name: 'confirm', message: 'Delete query ' + query + '?' })
74
+ if (reply.confirm) {
75
+ deleteConfirmed = true
76
+ }
77
+ }
78
+ if (deleteConfirmed) {
79
+ await this.dbManager.dbQueryDelete(dbQuery)
80
+ console.log('Query ' + query + ' has been deleted')
81
+ }
82
+ }
83
+ catch (err) {
84
+ logger.error(err)
85
+ }
86
+ }
87
+ }
46
88
 
47
89
  //--------------------------------------------------------------------------------------------------------------------
48
90
  // class queryData
@@ -11,15 +11,15 @@ export class TestCommand extends Cmd {
11
11
  constructor() {
12
12
  super('test')
13
13
  this.description('test script').version('0.1')
14
- .argument('<files...>', 'local module file(s) to test run')
15
- .action(async(files: any, options: any) => {
16
- await this.testRun(files, options)
17
- })
14
+ .argument('<files...>', 'local module file(s) to test run')
15
+ .action(async (files: any, options: any) => {
16
+ await this.testRun(files, options)
17
+ })
18
18
  }
19
19
  async testRun(files: string[], options: any) {
20
20
  try {
21
21
  const signinResponse = await this.prologue(options)
22
- for (let ind=0; ind < files.length; ind++) {
22
+ for (let ind = 0; ind < files.length; ind++) {
23
23
  const result = await testfile(files[ind])
24
24
  if (result === false) {
25
25
  logger.debug('*********** FAILURE ' + files[ind] + ' ***************')
@@ -50,12 +50,12 @@ async function testfile(filename: string): Promise<boolean> {
50
50
 
51
51
  let xml = fs.readFileSync(xmlfilename)
52
52
 
53
-
53
+
54
54
  fs.writeFileSync(logfilename, "")
55
55
  //console.log(xml.toString())
56
56
  try {
57
57
  if (process.env.DBREMOTE_URL === undefined) throw 'DBREMOTE_URL undefined'
58
- logger.trace('DBREMOTE_URL '+process.env.DBREMOTE_URL)
58
+ logger.trace('DBREMOTE_URL ' + process.env.DBREMOTE_URL)
59
59
  const structure = new Structure()
60
60
  const nodeCrypto = new NodeCrypto()
61
61
  const dbRemote = new DBRemote(structure.scope, process.env.DBREMOTE_URL, nodeCrypto)
@@ -67,7 +67,7 @@ async function testfile(filename: string): Promise<boolean> {
67
67
  let script = new Script(structure.scope, xmlfilename, xml.toString())
68
68
  const user_lang = login.content.user_lang
69
69
  if (user_lang && user_lang.trim() !== '') {
70
-
70
+
71
71
  const langfilename = filename + "__" + user_lang + ".xml"
72
72
 
73
73
  if (fs.existsSync(langfilename)) {
@@ -97,11 +97,12 @@ async function testfile(filename: string): Promise<boolean> {
97
97
  let xmlError = <XmlError>err
98
98
  errorconsole(xmlError)
99
99
  }
100
- console.log(err)
100
+ else
101
+ console.log(err)
101
102
  }
102
103
 
103
104
  let log = fs.readFileSync(logfilename)
104
- if (fs.existsSync(outfilename) === true ) {
105
+ if (fs.existsSync(outfilename) === true) {
105
106
  let out = fs.readFileSync(outfilename)
106
107
 
107
108
  if (log.toString() === out.toString()) {
package/src/console.ts CHANGED
@@ -17,6 +17,7 @@ export function errorconsole(xmlError: XmlError) {
17
17
  msg += ":" + (xmlError.tag.column + 1)
18
18
  }
19
19
  msg += ") ===============\n"
20
+ msg += xmlError.message
20
21
  console.log(msg)
21
22
  }
22
23
  }
package/src/index.ts CHANGED
@@ -15,6 +15,7 @@ import { TableDataCommand } from './TableDataCommand'
15
15
  import { TestCommand } from './TestCommand'
16
16
  import { UninstallCommand } from './UninstallCommand'
17
17
  import { UserCommand } from './UserCommand'
18
+ import { CronCommand } from './CronCommand'
18
19
 
19
20
  const logger = loglevel.getLogger("index.ts")
20
21
  logger.setLevel("debug")
@@ -175,7 +176,7 @@ class StopCommand extends Command {
175
176
  */
176
177
  const program = new Command()
177
178
  program.name('cyk').description('cyklang CLI')
178
- .version('0.7.5')
179
+ .version('0.8.3')
179
180
  program.addCommand(new StartCommand('start'))
180
181
  program.addCommand(new StopCommand('stop'))
181
182
  program.addCommand(new InstallCommand('install'))
@@ -198,5 +199,7 @@ program.addCommand(new RunCommand('run'))
198
199
  program.addCommand(new RunCommand('r'))
199
200
  program.addCommand(new OpenCommand('open'))
200
201
  program.addCommand(new OpenCommand('o'))
202
+ program.addCommand(new CronCommand('cron'))
203
+ program.addCommand(new CronCommand('c'))
201
204
 
202
205
  program.parse()
@@ -0,0 +1,74 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
3
+
4
+ <xs:element name="query" type="queryType"/>
5
+ <xs:element name="object" type="declareObject"/>
6
+
7
+ <xs:complexType name="declareObject" mixed="true">
8
+ <xs:group ref="declareVariable" minOccurs="0" maxOccurs="unbounded"/>
9
+ <xs:attribute name="name" type="xs:string"/>
10
+ <xs:attribute name="type" type="xs:string"/>
11
+ </xs:complexType>
12
+
13
+ <xs:complexType name="queryType" mixed="true">
14
+ <xs:group ref="queryTypeChild" minOccurs="1" maxOccurs="unbounded"/>
15
+ <xs:attribute name="name" type="xs:string"/>
16
+ </xs:complexType>
17
+
18
+ <xs:group name="queryTypeChild">
19
+ <xs:choice>
20
+ <xs:element name="string" type="queryStringChild"/>
21
+ <xs:element name="object" type="queryObjectChild"/>
22
+ </xs:choice>
23
+ </xs:group>
24
+
25
+ <xs:complexType name="queryStringChild">
26
+ <xs:simpleContent>
27
+ <xs:restriction base="stringType">
28
+ <xs:attribute name="name" use="required">
29
+ <xs:simpleType>
30
+ <xs:restriction base="xs:string">
31
+ <xs:enumeration value="sql"></xs:enumeration>
32
+ <xs:enumeration value="fields"></xs:enumeration>
33
+ <xs:enumeration value="entities"></xs:enumeration>
34
+ </xs:restriction>
35
+ </xs:simpleType>
36
+ </xs:attribute>
37
+ </xs:restriction>
38
+ </xs:simpleContent>
39
+ </xs:complexType>
40
+
41
+ <xs:complexType name="queryObjectChild" mixed="true">
42
+ <xs:group ref="declareVariable" minOccurs="0" maxOccurs="unbounded"/>
43
+ <xs:attribute name="name" type="xs:string" fixed="params"/>
44
+ </xs:complexType>
45
+
46
+ <xs:group name="declareVariable">
47
+ <xs:choice>
48
+ <xs:element name="number" type="numberType"/>
49
+ <xs:element name="string" type="stringType"/>
50
+ <xs:element name="query" type="queryType"/>
51
+ <xs:element name="object" type="declareObject"/>
52
+ </xs:choice>
53
+ </xs:group>
54
+
55
+ <xs:complexType name="numberType">
56
+ <xs:simpleContent>
57
+ <xs:extension base="xs:string">
58
+ <xs:attribute name="name" type="xs:string"/>
59
+ </xs:extension>
60
+ </xs:simpleContent>
61
+
62
+ </xs:complexType>
63
+
64
+ <xs:complexType name="stringType">
65
+ <xs:simpleContent>
66
+ <xs:extension base="xs:string">
67
+ <xs:attribute name="name" type="xs:string"/>
68
+ <xs:attribute name="literal" type="xs:string" fixed=""/>
69
+ </xs:extension>
70
+ </xs:simpleContent>
71
+
72
+ </xs:complexType>
73
+
74
+ </xs:schema>
package/test/db/t10.xml CHANGED
@@ -26,28 +26,7 @@
26
26
  <number name="length" type="int"/>
27
27
  </db.table>
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
+ <query name="t_films_actors">
51
30
  <number name="length_from">0</number>
52
31
  <number name="length_to">999</number>
53
32
  <string name="__entities__">"t_actor t_film"</string>
@@ -59,7 +38,7 @@
59
38
  -- and actor.actor_id = 2
60
39
  ORDER BY t_actor.actor_id ASC ;
61
40
  </string>
62
- </db.query>
41
+ </query>
63
42
 
64
43
  <object name="actor_maria">
65
44
  <string name="first_name">"Maria" </string>
@@ -124,10 +103,10 @@
124
103
  <number name="length_to">60</number>
125
104
  </db.execute> -->
126
105
 
127
- <db.runquery name="t_films_actors" result="films_actors">
106
+ <runquery name="t_films_actors" result="films_actors">
128
107
  <number name="length_from">60</number>
129
108
  <number name="length_to">60</number>
130
- </db.runquery>
109
+ </runquery>
131
110
 
132
111
  <print>"films_actors.resultset.at(0).t_actor.last_name " + films_actors.resultset.at(0).t_actor.last_name</print>
133
112
  <call object="films_actors.resultset" method="foreach">
package/test/db/t13.xml CHANGED
@@ -10,10 +10,23 @@
10
10
  <number name="length_from">60</number>
11
11
  <number name="length_to">60</number>
12
12
  </db.execute> -->
13
- <db.runquery name="t_films_actors" result="films_actors">
13
+ <query name="t_films_actors">
14
+ <number name="length_from">0</number>
15
+ <number name="length_to">999</number>
16
+ <string name="__entities__">"t_actor t_film"</string>
17
+ <string name="__sql__" literal="">
18
+ SELECT * FROM public.t_actor
19
+ join t_film_actor on t_film_actor.actor_id = t_actor.actor_id
20
+ join t_film on t_film_actor.film_id = t_film.film_id
21
+ where t_film.length between {{ length_from }} and {{ length_to }}
22
+ -- and actor.actor_id = 2
23
+ ORDER BY t_actor.actor_id ASC ;
24
+ </string>
25
+ </query>
26
+ <runquery name="t_films_actors" result="films_actors">
14
27
  <number name="length_from">60</number>
15
28
  <number name="length_to">60</number>
16
- </db.runquery>
29
+ </runquery>
17
30
  <print>"index = "+index</print>
18
31
  <sleep>500</sleep>
19
32
 
package/test/db/t14.xml CHANGED
@@ -1,4 +1,4 @@
1
- <?xml-model href="https://www.cyklang.net/schema/cyklang.xsd" ?>
1
+ <?xml-model href="../../../../../VueProjects/docs-vuepress/docs/.vuepress/public/cyklang.xsd" ?>
2
2
  <module>
3
3
  <object name="obj1">
4
4
  <string name="name">"obj1_name"</string>
@@ -1,4 +1,10 @@
1
1
  test de if()
2
2
  2+2==4
3
-
4
- 0
3
+ <object>
4
+ <number name="film_id">1</number>
5
+ <number name="actor_id">1</number>
6
+ <string name="title" literal="">La mélodie du bonheur</string>
7
+ <string name="first_name" literal="">Maria</string>
8
+ <string name="last_name" literal="">CHANE YOU KAYE</string>
9
+ </object>
10
+ actors_by_film.resultset.length(): 1
package/test/db/t15.xml CHANGED
@@ -3,9 +3,11 @@
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="t_actors_by_film">
7
- <number name="film_id"/>
8
- <string name="__fields__">"
6
+ <query name="t_actors_by_film">
7
+ <object name="params">
8
+ <number name="film_id">150</number>
9
+ </object>
10
+ <string name="fields">"
9
11
  film_id: number;
10
12
  actor_id: number: key;
11
13
  title: string;
@@ -13,14 +15,14 @@
13
15
  last_name: string
14
16
  "
15
17
  </string>
16
- <string name="__sql__" literal="">
18
+ <string name="sql" literal="">
17
19
  select t_film.film_id, title, t_actor.actor_id actor_id,
18
- first_name, last_name
20
+ first_name, last_name
19
21
  from t_film_actor join t_film on t_film.film_id = t_film_actor.film_id
20
22
  join t_actor on t_actor.actor_id = t_film_actor.actor_id
21
23
  where t_film_actor.film_id = {{ film_id }}
22
24
  </string>
23
- </db.query>
25
+ </query>
24
26
 
25
27
  <object name="actors_by_film"/>
26
28
 
@@ -28,12 +30,12 @@ where t_film_actor.film_id = {{ film_id }}
28
30
  <number name="film_id">103</number>
29
31
  </db.execute> -->
30
32
 
31
- <db.runquery name="t_actors_by_film" result="actors_by_film">
32
- <number name="film_id">103</number>
33
- </db.runquery>
33
+ <runquery name="t_actors_by_film" result="actors_by_film">
34
+ <number name="film_id">1</number>
35
+ </runquery>
34
36
 
35
37
  <print>string(actors_by_film.resultset)</print>
36
- <print>actors_by_film.resultset.length()</print>
38
+ <print>"actors_by_film.resultset.length(): " + actors_by_film.resultset.length()</print>
37
39
  <!-- <object name="films_actors"/>
38
40
  <db.execute query="films_actors" result="films_actors">
39
41
  <number name="length_from">60</number>
@@ -0,0 +1,15 @@
1
+ <?xml-model href="./schema.xsd"?>
2
+ <object>
3
+ <query name="q1">
4
+ <object name="params">
5
+ <number name="n"/>
6
+
7
+ </object>
8
+ <string name="sql" literal="">select * from table</string>
9
+ </query>
10
+ <number name="n1"/>
11
+ <string name="s1"/>
12
+ <object name="o1">
13
+ <number name="n2"/>
14
+ </object>
15
+ </object>