Hi Christian,
For the time being, I ended up with this:
sql:init("org.mariadb.jdbc.Driver"),
let $MariaBase := 'Relational' let $db := 'Innovate' let $user := '<user>' let $pass := '<pass'
let $con := sql:connect('jdbc:mariadb://localhost:3306/' || $db, $user, $pass) let $tables := sql:execute($con, 'show tables')/sql:column/text()
let $doc := element { $db } { for $table in $tables return element { $table } { let $rows := sql:execute($con, 'select * from ' || $table) for $row in $rows return element row { for $col in $row/sql:column return element { $col/@name } { $col/data() } } } }
(: return db:add($MariaBase, $doc, $db). :) return $doc gives
------------
return $doc gives:
<Innovate> <Dienst> <row> <Dienst_ID>1</Dienst_ID> <Dienst>CIO Office</Dienst> </row>
But return db:add($MariaBase, $doc, $db) results in my database in Relational -> Innovate/1 -> Innovate/1 -> Dienst/1 -> row/n (1 and n indicate parity)
I expected that return db:add($MariaBase, $doc) would add $doc at the top-level, resulting in Relational -> Innovate/1 -> Dienst/1 -> row/n but this results in an error (path is missing)
According to the documentation ommitting the third parameter in db:add should be allowed, or did I misinterpret something?
Cheers, Ben
Op 21-12-2021 om 13:20 schreef Christian Grün:
Thanks. Does the query do what you are looking for?
On Tue, Dec 21, 2021 at 12:47 PM benengbers@dds.nl wrote:
Christian Grün schreef op 21-12-2021 10:18:
Hi Ben,
return db:add($db, $doc, $table || '.xml')
Could you give us little examples for <DB-name>, <DB-schema> and <table-name> ?
Best, Christian
To the best of my knowledge in MySQL and/or MariaDB DB-name and DB-schema are identical? The schema-name I use is 'Innovate'. Table-names are +--------------------+ | Tables_in_Innovate | +--------------------+ | Dienst | | Mdw_Probleem | | Mdw_Wens | | Medewerker | | Medewerker_dienst | | Probleem | | Wens | +--------------------+
Ben PS.I hope you'll see this reply. Since a few days all mail from basex-talk is refused by Thunderbird. At least I don't see them anymore ....