Author: johannes
Date: 2005-07-08 04:28:19 -0500 (Fri, 08 Jul 2005)
New Revision: 7714
Added:
trunk/gnue-common/src/datasources/drivers/sql/sqlite3/__init__.py
Modified:
trunk/gnue-common/src/datasources/drivers/sql/sqlite2/Behavior.py
trunk/gnue-common/src/datasources/drivers/sql/sqlite3/Behavior.py
Log:
Finished splitting of sqlite drivers
Modified: trunk/gnue-common/src/datasources/drivers/sql/sqlite2/Behavior.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/sql/sqlite2/Behavior.py
2005-07-08 09:17:33 UTC (rev 7713)
+++ trunk/gnue-common/src/datasources/drivers/sql/sqlite2/Behavior.py
2005-07-08 09:28:19 UTC (rev 7714)
@@ -74,7 +74,7 @@
class Behavior (DBSIG2.Behavior):
"""
- Behavior class for SQLite backens.
+ Behavior class for SQLite backends.
Limitations:
- Since SQLite is typeless we cannot derive a 'length' for columns
Modified: trunk/gnue-common/src/datasources/drivers/sql/sqlite3/Behavior.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/sql/sqlite3/Behavior.py
2005-07-08 09:17:33 UTC (rev 7713)
+++ trunk/gnue-common/src/datasources/drivers/sql/sqlite3/Behavior.py
2005-07-08 09:28:19 UTC (rev 7714)
@@ -19,20 +19,21 @@
# write to the Free Software Foundation, Inc., 59 Temple Place
# - Suite 330, Boston, MA 02111-1307, USA.
#
-# $Id: $
+# $Id$
"""
Schema support plugin for SQLite3.
"""
-from gnue.common.datasources.drivers.sql import sqlite2
+from gnue.common.datasources import GSchema
+from gnue.common.datasources.drivers.sql.sqlite2 import Behavior as Base
# =============================================================================
# Behavior class
# =============================================================================
-class Behavior (sqlite2.Behavior):
+class Behavior (Base.Behavior):
"""
Behavior class for SQLite3 backends.
@@ -51,7 +52,7 @@
def __init__ (self, connection):
- sqlite2.Behavior.__init__ (self, connection)
+ Base.Behavior.__init__ (self, connection)
self._type2native.update ({'boolean' : 'boolean',
'datetime': 'timestamp'})
@@ -71,18 +72,18 @@
code = code [code.find ('(') + 1:code.rfind (')')]
# Reduce multiple blanks to a single blank
- code = _BLANKS.sub (' ', code)
+ code = Base._BLANKS.sub (' ', code)
# Make sure to have numeric arugments like '( 5 , 2)' given as '(5;2)'
- code = _REPCOMMAS.sub (r'(\1;\2)', code)
+ code = Base._REPCOMMAS.sub (r'(\1;\2)', code)
# Realign arguments in parenthesis, i.e. from 'char( 7 )' to 'char (7)'
- code = _ALIGN.sub (r' (\1)', code)
+ code = Base._ALIGN.sub (r' (\1)', code)
# we currently skip all constraints (primary key, unique, check)
- cma = _CONSTRAINTS.match (code)
+ cma = Base._CONSTRAINTS.match (code)
while cma is not None:
constraint = cma.groups () [0]
code = code.replace (constraint, '')
- cma = _CONSTRAINTS.match (code)
+ cma = Base._CONSTRAINTS.match (code)
for item in [i.strip () for i in code.split (',')]:
if not len (item):
@@ -90,7 +91,7 @@
parts = item.split ()
- if _PKFIELD.match (item) is not None:
+ if Base._PKFIELD.match (item) is not None:
pk = table.findChildOfType ('GSPrimaryKey') or \
GSchema.GSPrimaryKey (table, name = 'pk_%s' % table.name)
GSchema.GSPKField (pk, name = parts [0])
@@ -100,7 +101,7 @@
datatype = ' '.join (parts [1:])
- lsmatch = _LEN_SCALE.match (datatype)
+ lsmatch = Base._LEN_SCALE.match (datatype)
if lsmatch is not None:
(typename, length, scale) = lsmatch.groups ()
else:
@@ -119,9 +120,9 @@
if scale:
attrs ['precision'] = int (scale)
- attrs ['nullable'] = _NOTNULL.match (item) is None
+ attrs ['nullable'] = Base._NOTNULL.match (item) is None
- if _TEXTTYPE.match (typename.upper ()):
+ if Base._TEXTTYPE.match (typename.upper ()):
attrs ['type'] = 'string'
elif typename.lower () == 'timestamp':
@@ -136,7 +137,7 @@
fields = table.findChildOfType ('GSFields') or GSchema.GSFields (table)
result [attrs ['id']] = GSchema.GSField (fields, **attrs)
- match = _DEFAULT.match (item)
+ match = Base._DEFAULT.match (item)
if match is not None:
text = match.groups () [0].strip ()
if text [0] in ["'", '"']:
Property changes on:
trunk/gnue-common/src/datasources/drivers/sql/sqlite3/Behavior.py
___________________________________________________________________
Name: svn:keywords
+ Id
Added: trunk/gnue-common/src/datasources/drivers/sql/sqlite3/__init__.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/sql/sqlite3/__init__.py
2005-07-08 09:17:33 UTC (rev 7713)
+++ trunk/gnue-common/src/datasources/drivers/sql/sqlite3/__init__.py
2005-07-08 09:28:19 UTC (rev 7714)
@@ -0,0 +1,48 @@
+# GNU Enterprise Common Library - SQLite3 database driver plugins
+#
+# Copyright 2000-2005 Free Software Foundation
+#
+# This file is part of GNU Enterprise.
+#
+# GNU Enterprise is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation; either
+# version 2, or (at your option) any later version.
+#
+# GNU Enterprise is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+# PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with program; see the file COPYING. If not,
+# write to the Free Software Foundation, Inc., 59 Temple Place
+# - Suite 330, Boston, MA 02111-1307, USA.
+#
+# $Id$
+
+"""
+Database driver plugins for SQLite backends.
+"""
+
+
+# =============================================================================
+# Driver info
+# =============================================================================
+
+class DriverInfo:
+
+ name = "SQLite3 Embedded Database"
+
+ url = "http://initd.org"
+
+ description = """
+SQLite is a C library that implements an embeddable SQL database engine.
+Programs that link with the SQLite library can have SQL database access
+without running a separate RDBMS process.
+
+SQLite is a great database to use with GNUe for single-user installations
+where a self-contained, distributable package is desired.
+"""
+
+ isfree = True
Property changes on:
trunk/gnue-common/src/datasources/drivers/sql/sqlite3/__init__.py
___________________________________________________________________
Name: svn:keywords
+ Id
_______________________________________________
Commit-gnue mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/commit-gnue