Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
dream
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
dream
Commits
dc716f84
Commit
dc716f84
authored
Jun 16, 2014
by
Ioannis Papagiannopoulos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new method for reading local data regarding the local DB
parent
fad26f8e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
0 deletions
+42
-0
dream/simulation/ConnectionData.py
dream/simulation/ConnectionData.py
+42
-0
No files found.
dream/simulation/ConnectionData.py
0 → 100644
View file @
dc716f84
# import os.path
from
readWip
import
findFile
''' choose the file where we have the info related to the database we are about to connect to'''
# insert the path to the file containing the data of the connection, for info see bellow within getConnectionInfo method#
# XXXX update the arguments with the server data stored on your computer, ADDED FOR TESTING
filename
=
findFile
(
'ServerData'
,
"c:/Users/papagiannis/workspace/DreamGit/dream/dream/simulation/"
,
'txt'
)
# choose a delimiter for the file to be read
seperator
=
'='
def
getConnectionInfo
():
''' open the file defined by the user (where the database info is stored) and read the info stored there
the data must be stored in this form:
driver='{<name of the driver>}' e.g. driver='{MySQL ODBC 3.5.1 Driver}', find out in system tools
server='<server address> e.g. driver='localhost' if the server is local
port='<the port of the server>' e.g. port='3306' the default for MySQL server
data_base='<the name of the database>'
user='<the name of the user>'
pass_word='<user password>'
'''
fileIN
=
open
(
filename
,
'r'
)
print
321
line
=
fileIN
.
readline
()
while
line
:
sout
=
line
.
split
(
seperator
)
name
=
sout
[
0
]
if
name
==
'driver'
:
driver
=
sout
[
1
].
rstrip
()
elif
name
==
'server'
:
server
=
sout
[
1
].
rstrip
()
elif
name
==
'port'
:
port
=
sout
[
1
].
rstrip
()
elif
name
==
'data_base'
:
data_base
=
sout
[
1
].
rstrip
()
elif
name
==
'user'
:
user
=
sout
[
1
].
rstrip
()
elif
name
==
'pass_word'
:
pass_word
=
sout
[
1
].
rstrip
()
line
=
fileIN
.
readline
()
return
driver
,
server
,
port
,
data_base
,
user
,
pass_word
\ No newline at end of file
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