Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
antSword
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
HuangJunbo
antSword
Commits
05c1bdc7
Commit
05c1bdc7
authored
Nov 25, 2018
by
Medicean
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
db(php mysql): 表结构和建表sql语句
parent
b4870101
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
1 deletion
+50
-1
en.js
source/language/en.js
+2
-0
zh.js
source/language/zh.js
+2
-0
index.js
source/modules/database/php/index.js
+46
-1
No files found.
source/language/en.js
View file @
05c1bdc7
...
...
@@ -375,6 +375,8 @@ module.exports = {
deldb
:
'Del Database'
,
addtable
:
'New Table'
,
edittable
:
'Edit TableName'
,
desctable
:
'Desc Table'
,
showcreatetable
:
'Create Table SQL'
,
deltable
:
'Del Table'
,
addcolumn
:
'New Column'
,
editcolumn
:
'Edit Column'
,
...
...
source/language/zh.js
View file @
05c1bdc7
...
...
@@ -377,6 +377,8 @@ module.exports = {
addtable
:
'新建表'
,
edittable
:
'编辑表名'
,
deltable
:
'删除表'
,
showcreatetable
:
'建表语句'
,
desctable
:
'查看表结构'
,
addcolumn
:
'添加列'
,
editcolumn
:
'编辑列'
,
delcolumn
:
'删除列'
,
...
...
source/modules/database/php/index.js
View file @
05c1bdc7
...
...
@@ -144,6 +144,14 @@ class PHP {
action
:
this
.
addTable
.
bind
(
this
)
},
{
divider
:
true
},
{
text
:
LANG
[
'list'
][
'menu'
][
'desctable'
],
icon
:
'fa fa-table'
,
action
:
this
.
descTable
.
bind
(
this
)
},
{
text
:
LANG
[
'list'
][
'menu'
][
'showcreatetable'
],
icon
:
'fa fa-info'
,
action
:
this
.
showcreateTable
.
bind
(
this
)
},
{
text
:
LANG
[
'list'
][
'menu'
][
'edittable'
],
icon
:
'fa fa-edit'
,
...
...
@@ -1085,6 +1093,43 @@ class PHP {
}
});
}
// 显示表结构
descTable
()
{
const
treeselect
=
this
.
tree
.
getSelected
();
const
id
=
treeselect
.
split
(
'::'
)[
1
].
split
(
":"
)[
0
];
let
dbname
=
new
Buffer
(
treeselect
.
split
(
'::'
)[
1
].
split
(
":"
)[
1
],
"base64"
).
toString
();
let
tablename
=
new
Buffer
(
treeselect
.
split
(
'::'
)[
1
].
split
(
":"
)[
2
],
"base64"
).
toString
();
switch
(
this
.
dbconf
[
'type'
]){
case
"mysqli"
:
case
"mysql"
:
let
sql
=
`DESC \`
${
dbname
}
\`.\`
${
tablename
}
\`;`
;
this
.
manager
.
query
.
editor
.
session
.
setValue
(
sql
);
this
.
execSQL
(
sql
);
break
;
default
:
toastr
.
warning
(
LANG
[
'notsupport'
],
LANG_T
[
'warning'
]);
break
;
}
}
showcreateTable
()
{
const
treeselect
=
this
.
tree
.
getSelected
();
const
id
=
treeselect
.
split
(
'::'
)[
1
].
split
(
":"
)[
0
];
let
dbname
=
new
Buffer
(
treeselect
.
split
(
'::'
)[
1
].
split
(
":"
)[
1
],
"base64"
).
toString
();
let
tablename
=
new
Buffer
(
treeselect
.
split
(
'::'
)[
1
].
split
(
":"
)[
2
],
"base64"
).
toString
();
switch
(
this
.
dbconf
[
'type'
]){
case
"mysqli"
:
case
"mysql"
:
let
sql
=
`SHOW CREATE TABLE \`
${
dbname
}
\`.\`
${
tablename
}
\`;`
;
this
.
manager
.
query
.
editor
.
session
.
setValue
(
sql
);
this
.
execSQL
(
sql
);
break
;
default
:
toastr
.
warning
(
LANG
[
'notsupport'
],
LANG_T
[
'warning'
]);
break
;
}
}
// TODO: 新增列
addColumn
()
{
// 获取配置
...
...
@@ -1370,7 +1415,7 @@ class PHP {
arr
.
map
((
_
)
=>
{
let
_data
=
_
.
split
(
'
\
t|
\
t'
);
for
(
let
i
=
0
;
i
<
_data
.
length
;
i
++
)
{
_data
[
i
]
=
antSword
.
noxss
(
new
Buffer
(
_data
[
i
],
"base64"
).
toString
());
_data
[
i
]
=
antSword
.
noxss
(
new
Buffer
(
_data
[
i
],
"base64"
).
toString
()
,
false
);
}
data_arr
.
push
(
_data
);
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment