A deno.js javascript client implementing the ADODB protocol on windows.
- This project is in the early stages of its development. So many things can still change.
- To use deno-adodb you must manually save the contents of the repository on your PC. I don't know if it will be possible to avoid this in the future.
- The library need system support Microsoft.Jet.OLEDB.4.0 or Microsoft.ACE.OLEDB.12.0, Windows XP SP2 above support Microsoft.Jet.OLEDB.4.0 by default, Others need to install support! Recommended use Microsoft.ACE.OLEDB.12.0, download: Microsoft.ACE.OLEDB.12.0
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" }
]
}
- cscript and cscriptSync: identifies the location of "cscript.exe" on the PC where deno-adodb is launched.
- execute: performs operations on the database and return the result in the form of JSON (or CVS).
- command: a set of predefined commands to pass as an argument to execute
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.