Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
elp
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
崔为之
elp
Commits
48201a87
Commit
48201a87
authored
Nov 12, 2023
by
崔为之
💪🏽
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update project
parent
5aaf4c5b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
3 deletions
+11
-3
application/config/config.yaml
application/config/config.yaml
+8
-0
application/libs/helper/mysql.py
application/libs/helper/mysql.py
+3
-3
No files found.
application/config/config.yaml
View file @
48201a87
...
@@ -36,3 +36,11 @@ Scheduler:
...
@@ -36,3 +36,11 @@ Scheduler:
Start
:
2023-11-12 10:04:00
Start
:
2023-11-12 10:04:00
End
:
2099-11-11 16:00:00
End
:
2099-11-11 16:00:00
Timezone
:
Asia/Shanghai
Timezone
:
Asia/Shanghai
ExtraDB
:
Host
:
localhost
Port
:
3306
User
:
root
Password
:
localhost123
DB
:
elp
Sql
:
select * from users;
application/libs/helper/mysql.py
View file @
48201a87
...
@@ -40,14 +40,14 @@ class MySQLHelper:
...
@@ -40,14 +40,14 @@ class MySQLHelper:
if
self
.
conn
:
if
self
.
conn
:
self
.
conn
.
close
()
self
.
conn
.
close
()
if
exc_type
:
if
exc_type
:
print
(
f
"Error occurred:
{
exc_val
}
"
)
print
(
f
'Error occurred:
{
exc_val
}
'
)
def
execute
(
self
,
sql
:
str
)
->
Optional
[
tuple
]:
def
execute
(
self
,
sql
:
str
)
->
Optional
[
tuple
]:
"""
"""
Execute the SQL statement and retrieve the results
Execute the SQL statement and retrieve the results
"""
"""
if
not
self
.
conn
:
if
not
self
.
conn
:
print
(
"No connection available."
)
print
(
'No connection available.'
)
return
None
return
None
try
:
try
:
...
@@ -58,5 +58,5 @@ class MySQLHelper:
...
@@ -58,5 +58,5 @@ class MySQLHelper:
return
result
return
result
except
Exception
as
e
:
except
Exception
as
e
:
print
(
f
"Error executing SQL:
{
e
}
"
)
print
(
f
'Error executing SQL:
{
e
}
'
)
return
None
return
None
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