A deno.js javascript client implementing the ADODB protocol on windows.
Create a demo.ts file containing this code:
import { execute, cscriptSync, command } from "./mod.ts";
const nameDatabase = Deno.args[0];
const cscriptString: string = cscriptSync();
const cmd = command.schema.getAllTables(cscriptString, nameDatabase);
const result = await execute(cmd);
console.log("CAPTURED:" , result.captured);
console.log("CMD:", result.cmd);
console.log("STATUS ADODB:" , result.statusAdodb);
console.log(JSON.parse(result.result));
From the terminal use this code:
deno run --unstable --allow-run --allow-read --allow-env demo.ts "./demo/adodb.mdb"
parse.result
will contain an object similar to this:
{
schema: [
{ TABLE_NAME: "MSysAccessObjects", TABLE_TYPE: "ACCESS TABLE" },
{ TABLE_NAME: "MSysACEs", TABLE_TYPE: "SYSTEM TABLE" },
{ TABLE_NAME: "MSysNavPaneGroupCategories", TABLE_TYPE: "ACCESS TABLE" },
{ TABLE_NAME: "MSysNavPaneGroups", TABLE_TYPE: "ACCESS TABLE" },
{ TABLE_NAME: "MSysNavPaneGroupToObjects", TABLE_TYPE: "ACCESS TABLE" },
{ TABLE_NAME: "MSysNavPaneObjectIDs", TABLE_TYPE: "ACCESS TABLE" },
{ TABLE_NAME: "MSysObjects", TABLE_TYPE: "SYSTEM TABLE" },
{ TABLE_NAME: "MSysQueries", TABLE_TYPE: "SYSTEM TABLE" },
{ TABLE_NAME: "MSysRelationships", TABLE_TYPE: "SYSTEM TABLE" },
{ TABLE_NAME: "Users", TABLE_TYPE: "TABLE" }
]
}
Query database schema information (see SchemaEnum).
schema.getAllTables(cscriptString, nameDatabase);
: Returns the tables (including views) defined in the catalog that are accessible to a given user.Query tables:
query.getAllValue(cscriptString, nameDatabase, nomeTable);
: Returns all of the fields and records for the table (or view).query.sql(cscriptString, nameDatabase, sqlString);
: Execute a SQL statement.schema.getAllTables(cscriptString, nameDatabase);
: Returns the tables (including views) defined in the catalog that are accessible to a given user.schema.getTablesByType(cscriptString, nameDatabase, tableType);
: Returns the tables (including views) defined in the catalog that are accessible to a given user.query.sql(cscriptString, nameDatabase, sqlString);
: Execute a SQL statement.Author: el3um4s
Source Code: https://github.com/el3um4s/deno-adodb
#deno #nodejs #javascript