Common component used by neeto-course-web and neeto-course-site for viewing sqlite databases and running queries on them. Powered by sql.js
Usage
<DatabaseViewer
dbBinaryContent={dbBinaryContent}
/>
[!NOTE] Please check and install the required peer dependencies
Prop | Type | Required | Description |
---|---|---|---|
dbBinaryContent | string | Yes | Base64 encoded database file content. |
shouldRunCode | boolean | No | Set to true to run the query (remember to set it back to false). |
query | string | No | Query to be ran. |
isExercise | boolean | No | Specify if evaluation is required. (Default : false) |
solutionQuery | string | No | The solution query used for evaluation |
focusTableBeforeRun | string | No | name of the table which should be focused |
focusTableAfterRun | string | No | name of the table which should be focused after running query |
checkForViews | comma separated string | No | Views that should be taken into account while evaluation |
setDbInstance | function | No | Callback function which provides the db instance created using sql.js .Can be used to export db |
onSqlRun | function | No | Callback function which runs after query and evaluation is complete. Provides evaluation result and error message as arguments |
showSchemaDataSwitcher | boolean | No | Specify if selector for schama and data needs to be shown |
showForeignKeys | boolean | No | If Foreign keys need to be shown |
Example app is created with vite. Simply run
yarn dev