/[gnue]/gnue-common/src/datasources/drivers/sybase/sybase/Connection.py
ViewVC logotype

Diff of /gnue-common/src/datasources/drivers/sybase/sybase/Connection.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by jcater, Fri Oct 10 01:21:35 2003 UTC revision 1.2 by jcater, Tue Nov 25 17:01:47 2003 UTC
# Line 0  Line 1 
1    #
2    # This file is part of GNU Enterprise.
3    #
4    # GNU Enterprise is free software; you can redistribute it
5    # and/or modify it under the terms of the GNU General Public
6    # License as published by the Free Software Foundation; either
7    # version 2, or (at your option) any later version.
8    #
9    # GNU Enterprise is distributed in the hope that it will be
10    # useful, but WITHOUT ANY WARRANTY; without even the implied
11    # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12    # PURPOSE. See the GNU General Public License for more details.
13    #
14    # You should have received a copy of the GNU General Public
15    # License along with program; see the file COPYING. If not,
16    # write to the Free Software Foundation, Inc., 59 Temple Place
17    # - Suite 330, Boston, MA 02111-1307, USA.
18    #
19    # Copyright 2000-2003 Free Software Foundation
20    #
21    # FILE:
22    # sybase/DBdriver.py
23    #
24    # DESCRIPTION:
25    # Driver to provide access to data via Dave Cole's Sybase ASE/Python Driver
26    # Requires Sybase.py (http://www.object-craft.com.au/projects/sybase/)
27    #
28    # NOTES:
29    #
30    #   Supported attributes (via connections.conf or <database> tag)
31    #
32    #     service=    This is the Sybase DSN for your connection  (required)
33    #     dbame=      This is the Sybase database to use (optional)
34    #
35    
36    #### THIS IS AN UNTESTED DRIVER ####
37    ####      Any volunteers?       ####
38    
39    __all__ = ['Connection']
40    
41    from string import lower
42    import sys
43    from gnue.common.datasources import GDataObjects, GConditions, GConnections
44    from gnue.common.apps import GDebug
45    from gnue.common.datasources.drivers import DBSIG2
46    from DataObjects import *
47    
48    try:
49      import Sybase as SIG2api
50    except ImportError, message:
51      tmsg = _("Driver not installed: Sybase.py for Sybase ASE 11.0/11.9 [%s]") % message
52      raise GConnections.AdapterNotInstalled, tmsg
53    
54    
55    class Connection(DBSIG2.Connection)
56      _DatabaseError = SIG2api.DatabaseError
57      supportedDataObjects = {
58        'object': DataObject_Object,
59        'sql':    DataObject_SQL
60      }
61    
62      def connect(self, connectData):
63        GDebug.printMesg(1,"Sybase database driver initializing")
64        try:
65          if connectData.has_key('dbname'):
66            self.native = SIG2api.connect( \
67                      service=connectData['service'],  \
68                      user=connectData['_username'], \
69                      passwd=connectData['_password'], \
70                      datbase=connectData['dbname'])
71          else:
72            self.native = SIG2api.connect( \
73                      service=connectData['service'],  \
74                      user=connectData['_username'], \
75                      passwd=connectData['_password'])
76        except self._DatabaseError, value:
77          raise GDataObjects.LoginError, value
78    

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26