Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
3d7c113a
Commit
3d7c113a
authored
Aug 08, 1997
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improved connection status management and added database close method.
parent
d67041a7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
6 deletions
+25
-6
lib/python/Shared/DC/ZRDB/DA.py
lib/python/Shared/DC/ZRDB/DA.py
+25
-6
No files found.
lib/python/Shared/DC/ZRDB/DA.py
View file @
3d7c113a
...
@@ -11,8 +11,8 @@
...
@@ -11,8 +11,8 @@
__doc__
=
'''Generic Database adapter
__doc__
=
'''Generic Database adapter
$Id: DA.py,v 1.
4 1997/08/06 18:19:29
jim Exp $'''
$Id: DA.py,v 1.
5 1997/08/08 22:55:32
jim Exp $'''
__version__
=
'$Revision: 1.
4
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.
5
$'
[
11
:
-
2
]
import
string
,
OFS
.
Folder
,
Aqueduct
.
Aqueduct
,
Aqueduct
.
RDB
import
string
,
OFS
.
Folder
,
Aqueduct
.
Aqueduct
,
Aqueduct
.
RDB
import
DocumentTemplate
,
marshal
,
md5
,
zlib
,
base64
,
DateTime
,
Acquisition
import
DocumentTemplate
,
marshal
,
md5
,
zlib
,
base64
,
DateTime
,
Acquisition
...
@@ -38,19 +38,33 @@ class Folder(OFS.Folder.Folder):
...
@@ -38,19 +38,33 @@ class Folder(OFS.Folder.Folder):
manage_connectionForm
=
ManageHTMLFile
(
'AqueductDA/connection'
)
manage_connectionForm
=
ManageHTMLFile
(
'AqueductDA/connection'
)
manage_addDAForm
=
ManageHTMLFile
(
'AqueductDA/daAdd'
)
manage_addDAForm
=
ManageHTMLFile
(
'AqueductDA/daAdd'
)
start_time
=
DateTime
.
now
()
start_time
=
DateTime
.
now
()
bad_connection_string
=
(
"""<p><strong>Warning</strong>: The database is not connected.<p>
"""
)
def
manage_connection
(
self
,
value
=
None
,
check
=
None
,
REQUEST
=
None
):
def
manage_connection
(
self
,
value
=
None
,
check
=
None
,
REQUEST
=
None
):
'change database connection data'
'change database connection data'
if
value
is
None
:
return
self
.
database_connection_string
()
if
value
is
None
:
return
self
.
database_connection_string
()
if
check
:
self
.
database_connect
(
value
)
if
check
:
self
.
database_connect
(
value
)
else
:
self
.
manage_close_connection
(
REQUEST
)
self
.
database_connection_string
(
value
)
self
.
database_connection_string
(
value
)
return
self
.
manage_main
(
self
,
REQUEST
)
return
self
.
manage_main
(
self
,
REQUEST
)
def
manage_close_connection
(
self
,
REQUEST
):
" "
try
:
self
.
_v_database_connection
.
close
()
except
:
pass
self
.
bad_connection_string
=
(
"""<p><strong>Warning</strong>: The database is not connected.<p>
"""
)
return
self
.
manage_main
(
self
,
REQUEST
)
def
database_connect
(
self
,
s
=
''
):
def
database_connect
(
self
,
s
=
''
):
try
:
self
.
_v_database_connection
.
close
()
try
:
self
.
_v_database_connection
.
close
()
except
:
pass
except
:
pass
self
.
bad_connection_string
=
(
self
.
bad_connection_string
=
(
"""<
strong>Warning</strong>: The database is not connected.
"""<
p><strong>Warning</strong>: The database is not connected.<p>
"""
)
"""
)
if
not
s
:
s
=
self
.
folder_database_connection_string
()
if
not
s
:
s
=
self
.
folder_database_connection_string
()
if
not
s
:
return
if
not
s
:
return
...
@@ -155,10 +169,12 @@ class Query(Aqueduct.Aqueduct.BaseQuery,Persistent,Acquisition.Implicit):
...
@@ -155,10 +169,12 @@ class Query(Aqueduct.Aqueduct.BaseQuery,Persistent,Acquisition.Implicit):
)
)
def
query
(
self
,
DB__
,
REQUEST
,
RESPONSE
):
def
query
(
self
,
REQUEST
,
RESPONSE
):
' '
' '
if
DB__
is
None
:
raise
'Database Error'
,
(
try
:
DB__
=
self
.
database_connection
()
'No database connection defined'
)
except
:
raise
'Database Error'
,
(
'%s is not connected to a database'
%
self
.
id
)
try
:
try
:
argdata
=
REQUEST
.
form
.
value
argdata
=
REQUEST
.
form
.
value
argdata
=
decodestring
(
argdata
)
argdata
=
decodestring
(
argdata
)
...
@@ -197,6 +213,9 @@ class Query(Aqueduct.Aqueduct.BaseQuery,Persistent,Acquisition.Implicit):
...
@@ -197,6 +213,9 @@ class Query(Aqueduct.Aqueduct.BaseQuery,Persistent,Acquisition.Implicit):
##############################################################################
##############################################################################
#
#
# $Log: DA.py,v $
# $Log: DA.py,v $
# Revision 1.5 1997/08/08 22:55:32 jim
# Improved connection status management and added database close method.
#
# Revision 1.4 1997/08/06 18:19:29 jim
# Revision 1.4 1997/08/06 18:19:29 jim
# Renamed description->title and name->id and other changes
# Renamed description->title and name->id and other changes
#
#
...
...
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