Diffusion Kexi 4adbe1bd36a4

WIP enable scripting in Kexi.

Authored by piggz on Jul 24 2017, 8:55 PM.

Description

WIP enable scripting in Kexi.

Summary:
No Kexi wrappers are built yet, but module and global scripts are
available to reports

Test Plan:
generate report with scripts

run 'executable' scripts within kexi. Scripts such as Kexi.openItem("report", "report_name"); works as expected

Example working script (providing database exists):

var db = new KDb();
console.log(db.driverNames());

var driver = db.driver("org.kde.kdb.sqlite");
console.log(driver.fileDBDriverMimeTypes());

var conn_data = db.createConnectionData();
conn_data.setDatabaseName("/home/piggz/Documents/Database/POI.kexi")

var conn = driver.createConnection(conn_data);

if (!conn.connect()) {
    console.log("Error connecting to database", conn.lastError());
}

if (!conn.useDatabase("")) {
    console.log("Error using database", conn.lastError());
}

console.log(conn.currentDatabase(), conn.isConnected());
console.log(conn.tableNames());

var cursor = conn.executeQueryString("select * from " + conn.tableNames()[0]);

cursor.open();
var fieldcount = cursor.fieldCount();
while (!cursor.eof()) {
    for (var i = 0; i < fieldcount; ++i) {
        console.log(cursor.value(i));
    }
    cursor.moveNext();
}

Reviewers: staniek

Reviewed By: staniek

Tags: KEXI

Maniphest Tasks: T4649

Differential Revision: https://phabricator.kde.org/D6037

Details

Committed
piggzJul 24 2017, 8:55 PM
Reviewer
staniek
Differential Revision
D6037: WIP enable scripting in Kexi.
Parents
R71:17ec51e5e52d: GIT_SILENT Update developer docs about Kexi settings based on current…
Branches
Unknown
Tags
Unknown