Skip to content

Commit c8fe3ce

Browse files
authored
Merge pull request #300 from codefori/feature/editable_columns
Editable cells
2 parents 5e4bd83 + 1cb9f9a commit c8fe3ce

File tree

8 files changed

+466
-42
lines changed

8 files changed

+466
-42
lines changed

package-lock.json

Lines changed: 7 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "vscode-db2i",
33
"displayName": "Db2 for IBM i",
44
"description": "Db2 for IBM i tools in VS Code",
5-
"version": "1.6.3",
5+
"version": "1.6.3-scott12",
66
"engines": {
77
"vscode": "^1.95.0"
88
},

src/database/table.ts

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11

2-
import vscode from "vscode"
32
import { JobManager } from "../config";
43
import { getInstance } from "../base";
5-
import Statement from "./statement";
64

75
export default class Table {
86
/**
@@ -32,11 +30,46 @@ export default class Table {
3230
` column.table_schema = key.table_schema and`,
3331
` column.table_name = key.table_name and`,
3432
` column.column_name = key.column_name`,
35-
`WHERE column.TABLE_SCHEMA = '${schema}' AND column.TABLE_NAME = '${name}'`,
33+
`WHERE column.TABLE_SCHEMA = ? AND column.TABLE_NAME = ?`,
3634
`ORDER BY column.ORDINAL_POSITION`,
3735
].join(` `);
3836

39-
return JobManager.runSQL(sql);
37+
return JobManager.runSQL(sql, {parameters: [schema, name]});
38+
}
39+
40+
/**
41+
* This is to be used instead of getItems when the table is in session/QTEMP
42+
*/
43+
static async getSessionItems(name: string): Promise<TableColumn[]> {
44+
const sql = [
45+
`SELECT `,
46+
` column.TABLE_SCHEMA,`,
47+
` column.TABLE_NAME,`,
48+
` column.COLUMN_NAME,`,
49+
` '' as CONSTRAINT_NAME,`,
50+
` column.DATA_TYPE, `,
51+
` column.CHARACTER_MAXIMUM_LENGTH,`,
52+
` column.NUMERIC_SCALE, `,
53+
` column.NUMERIC_PRECISION,`,
54+
` column.IS_NULLABLE, `,
55+
` column.HAS_DEFAULT, `,
56+
` column.COLUMN_DEFAULT, `,
57+
` column.COLUMN_TEXT, `,
58+
` column.IS_IDENTITY`,
59+
`FROM QSYS2.SYSCOLUMNS2_SESSION as column`,
60+
`WHERE column.TABLE_NAME = ?`,
61+
`ORDER BY column.ORDINAL_POSITION`,
62+
].join(` `);
63+
64+
return JobManager.runSQL(sql, {parameters: [name]});
65+
}
66+
67+
static async isPartitioned(schema: string, name: string): Promise<boolean> {
68+
const sql = `select table_name, partitioned_table from qsys2.sysfiles where table_schema = ? and table_name = ? and partitioned_table is not null and partitioned_table = 'YES'`;
69+
const parameters = [schema, name];
70+
71+
const result = await JobManager.runSQL(sql, {parameters});
72+
return result.length > 0;
4073
}
4174

4275
static async clearFile(library: string, objectName: string): Promise<void> {

src/language/sql/statement.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export default class Statement {
2020
first = this.tokens[2];
2121
}
2222

23-
if (tokenIs(first, `word`) && tokenIs(this.tokens[1], `colon`)) {
23+
if (first.value !== undefined && tokenIs(this.tokens[1], `colon`)) {
2424
// Possible label?
2525
this.label = first.value;
2626
first = this.tokens[2];

src/views/html.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export function getHeader(options: {withCollapsed?: boolean} = {}): string {
99
border-collapse: collapse;
1010
font-size: 0.9em;
1111
font-family: sans-serif;
12-
min-width: 400px;
12+
min-width: 100%;
1313
}
1414
1515
thead tr {
@@ -20,11 +20,14 @@ export function getHeader(options: {withCollapsed?: boolean} = {}): string {
2020
top: 0; /* Don't forget this, required for the stickiness */
2121
}
2222
23+
tfoot {
24+
position: sticky;
25+
bottom: 0;
26+
}
27+
2328
tfoot tr {
2429
background-color: var(--vscode-multiDiffEditor-headerBackground);
2530
text-align: left;
26-
position: sticky; /* Lock the footer row to the bottom so it's always visible as rows are scrolled */
27-
bottom: 0; /* Don't forget this, required for the stickiness */
2831
}
2932
3033
#resultset th,

0 commit comments

Comments
 (0)