Commit 2c846b92 authored by Jim Fulton's avatar Jim Fulton

Split out Database Methods

parent 212b2a7f
#!/bin/env python
##############################################################################
#
# Copyright
#
# Copyright 1996 Digital Creations, L.C., 910 Princess Anne
# Street, Suite 300, Fredericksburg, Virginia 22401 U.S.A. All
# rights reserved.
#
##############################################################################
__doc__='''SQL Methods
$Id: SQL.py,v 1.1 1998/01/07 16:29:29 jim Exp $'''
__version__='$Revision: 1.1 $'[11:-2]
import AqueductDA.DA
from Globals import HTMLFile
def SQLConnectionIDs(self):
ids={}
have_id=ids.has_key
StringType=type('')
while self is not None:
if hasattr(self, 'objectValues'):
for o in self.objectValues():
if (hasattr(o,'_isAnSQLConnection') and o._isAnSQLConnection
and hasattr(o,'id')):
id=o.id
if type(id) is not StringType: id=id()
if not have_id(id):
if hasattr(o,'title_and_id'): o=o.title_and_id()
else: o=id
ids[id]=id
if hasattr(self, 'aq_parent'): self=self.aq_parent
else: self=None
ids=map(lambda item: (item[1], item[0]), ids.items())
ids.sort()
return ids
addForm=HTMLFile('add', globals())
def add(self, id, title, connection_id, arguments, template, REQUEST=None):
"""Add a SQL Method to a folder"""
self._setObject(id, SQL(id, title, connection_id, arguments, template))
if REQUEST is not None: return self.manage_main(self,REQUEST)
class SQL(AqueductDA.DA.DA):
meta_type='Aqueduct SQL Database Method'
icon='misc_/AqueductSQLMethods/icon'
manage_main=HTMLFile('edit', globals())
##############################################################################
#
# $Log: SQL.py,v $
# Revision 1.1 1998/01/07 16:29:29 jim
# Split out Database Methods
#
#
#!/bin/env python
##############################################################################
#
# Copyright
#
# Copyright 1996 Digital Creations, L.C., 910 Princess Anne
# Street, Suite 300, Fredericksburg, Virginia 22401 U.S.A. All
# rights reserved.
#
##############################################################################
__doc__='''SQL Method Product
$Id: __init__.py,v 1.1 1998/01/07 16:29:29 jim Exp $'''
__version__='$Revision: 1.1 $'[11:-2]
from ImageFile import ImageFile
import Aqueduct.Search, SQL
meta_types=(
{'name':'Aqueduct SQL Database Method',
'action':'manage_addAqueductSQLMethodForm',
},
{'name':'Aqueduct Search Interface',
'action':'manage_addAqueductSearchForm'
},
)
methods={
'manage_addAqueductSQLMethod': SQL.add,
'manage_addAqueductSQLMethodForm': SQL.addForm,
'SQLConnectionIDs': SQL.SQLConnectionIDs,
'manage_addAqueductSearchForm': Aqueduct.Search.addForm,
'manage_addAqueductSearch': Aqueduct.Search.add,
'aqueductQueryIds': Aqueduct.Search.aqueductQueryIds,
}
misc_={
'icon': ImageFile('AqueductDA/www/DBAdapter_icon.gif'),
}
##############################################################################
#
# $Log: __init__.py,v $
# Revision 1.1 1998/01/07 16:29:29 jim
# Split out Database Methods
#
#
<HTML><HEAD><TITLE>New SQL Method</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" LINK="#000099" VLINK="#555555">
<H2>New SQL Method</H2>
<!--#if SQLConnectionIDs-->
<form action="manage_addAqueductSQLMethod" method="post">
<table>
<tr> <th>Id</th>
<td><input name="id" size="40"></td></tr>
<tr> <th><em>Title<em></th>
<td><input name="title" size="40"></td></tr>
<tr> <th>Connection id</th>
<td><select name="connection_id">
<!--#in SQLConnectionIDs-->
<option value="<!--#var sequence-item-->">
<!--#var sequence-key--></option>
<!--#/in-->
</select></td></tr>
<tr> <th><em>Arguments<em></th>
<td><input name="arguments" size="40"></td></tr>
<tr> <td colspan=2><strong>Query template</strong><br>
<textarea name="template:text" rows=9 cols=50>
select *
from data
</textarea></td></tr>
<tr><td><input type="hidden" name="key" value=""></td><td>
<input type="SUBMIT" name="SUBMIT" value="Add">
</td></tr>
</table>
</form>
<!--#else-->
<em><strong>Warning:</strong>
There are no SQL database connections. You need
to add an Aqueduct SQL database connection
before you can use an Aqueduct SQL database adapter.
</em>
<!--#/if-->
</body></html>
<HTML><HEAD><TITLE>Edit <!--#var title_or_id--></TITLE></HEAD>
<BODY BGCOLOR="#FFFFFF" LINK="#000099" VLINK="#555555">
<!--#var manage_tabs-->
<H2>Edit <!--#var title_or_id--></H2>
<!--#if SQLConnectionIDs-->
<!--#if connectionIsValid-->
<!--#if connected--><!--#else-->
<strong>Warning:</strong>
The database connection used by this method is currently not
open.
<!--#/if-->
<!--#else-->
<strong>Warning:</strong>
The database connection for this method cannot be found!
<!--#/if-->
<form action="manage_edit" method="POST">
<table>
<tr> <th>ID</th>
<td><!--#var id--></td></tr>
<tr> <th><em>Title</em></th>
<td><input name="title" size="40"
value="<!--#var title-->"></td></tr>
<tr> <th>Connection id</th>
<td><select name="connection_id">
<!--#in SQLConnectionIDs-->
<option value="<!--#var sequence-item-->"
<!--#if expr="connection_id==_vars['sequence-item']"-->
SELECTED<!--#/if-->>
<!--#var sequence-key--></option>
<!--#/in-->
</select></td></tr>
<tr> <th><em>Arguments</em></th>
<td><input name="arguments" size="40"
value="<!--#var arguments_src-->"></td>
</tr>
<tr> <td colspan=2><strong>Query template</strong><br>
<textarea name="template:text" rows=10 cols=50>
<!--#var src fmt=html-quote-->
</textarea></td></tr>
<tr><td></td><td><input type="SUBMIT" name="SUBMIT" value="Change"></td></tr>
</table>
</form>
<!--#else-->
<em><strong>Warning:</strong>
There are no SQL database connections. You need
to add an Aqueduct SQL database connection
before you can use an Aqueduct SQL database adapter.
</em>
<!--#/if-->
</body></html>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment