diff options
author | LukenShiro <lukenshiro@ngi.it> | 2010-05-13 00:25:19 +0200 |
---|---|---|
committer | Robby Workman <rworkman@slackbuilds.org> | 2010-05-13 00:25:19 +0200 |
commit | 1cc45bd25a8e1b4f37d4fc8c146147ea96d4f376 (patch) | |
tree | e3c4a9f7d63a7ea3d147b8fabdffc2caed8bdf70 /development/pydblite | |
parent | 38e627528498a2613b9def07d646d94a4b00b624 (diff) |
development/pydblite: Updated for version 2.4
Diffstat (limited to 'development/pydblite')
-rw-r--r-- | development/pydblite/README | 11 | ||||
-rw-r--r-- | development/pydblite/index.html | 207 | ||||
-rw-r--r-- | development/pydblite/index_fr.html | 148 | ||||
-rw-r--r-- | development/pydblite/pydblite.SlackBuild | 10 | ||||
-rw-r--r-- | development/pydblite/pydblite.info | 10 | ||||
-rw-r--r-- | development/pydblite/slack-desc | 10 |
6 files changed, 21 insertions, 375 deletions
diff --git a/development/pydblite/README b/development/pydblite/README index 1038a7032a03d..3224e2de38000 100644 --- a/development/pydblite/README +++ b/development/pydblite/README @@ -1,9 +1,8 @@ PyDbLite (small footprint untyped database engine in python) -PyDbLite is a pure-Python in-memory database engine, using -Python list comprehensions as query language instead of SQL, -which stores data in a cPickled file. +PyDbLite is a pure-Python in-memory database engine, using Python list +comprehensions as query language instead of SQL, which stores data in a +cPickled file. -You can also use PyDbLite with MySQL and SQLite, as backends. -In order to use MySQL's adapter you will need MySQL-python -(available on SlackBuilds.org). +You can also use PyDbLite with MySQL and SQLite, as backends. In order to +use MySQL's adapter you will need MySQL-python (available on SlackBuilds.org). diff --git a/development/pydblite/index.html b/development/pydblite/index.html deleted file mode 100644 index a7a7ccc6ca7c1..0000000000000 --- a/development/pydblite/index.html +++ /dev/null @@ -1,207 +0,0 @@ -<html>
-
-<head>
-<title>PyDbLite</title>
-</head>
-
-<body>
-
-<style type="text/css">
-body, td {
- color: #000000;
- background-color: #ffffff;
- font-family: sans-serif;
- font-size: 13;
- }
-
-pre {
- font-family: arial }
-
-li { padding-bottom:10;
- }
-
-.python {
- color:330099;
- font-family: "Courier New";
- }
-
-.console {
- color:white;
- background-color:black;
- font-family: "Courier New";
- padding : 3;
- }
-
-td.navigation
-{ background-color: #99ccff;
- font-weight: bold;
- font-family: avantgarde, sans-serif;
- font-size: 110%;
- width: 90%}
-
-td.lnk { background-color: #99ccff;
- font-size: 70%;
- }
-
-ol { margin-left : 20px;
- }
-
-</style>
-
-<table width="100%" cellspacing="0"><tr><td class="navigation" align="center">PyDbLite</td>
-<td class="lnk" align="right"></td>
-</tr></table>
-<p>PyDbLite is a pure-Python in-memory database engine, using Python list
-comprehensions as query language, instead of SQL
-
-<p>It consists of one small module, <code>PyDbLite.py</code>. The package also provides two modules,
-<code>SQLite.py</code> and <code>MySQL.py</code>. They use SQLite and MySQL backends with the
-same Pythonic syntax as the pure-Python PyDbLite engine
-
-<p>To install the package, just <a href="http://sourceforge.net/project/platformdownload.php?group_id=210258">download
-it</a> and install it by running <span class="console">>python setup.py install</span>
-
-<p><h2>Pure-Python engine</h2>
-
-<ul>
-<li> import class <CODE>Base</CODE> from module PyDbLite : <span class="python">from PyDbLite import Base</span>
-
-<li> create a database instance, passing it a path in the file system : <span class="python">db = Base('dummy')</span>
-
-<li>for a new database, define the field names : <span class="python">db.create('name','age','size')</span>
-
-<br>You don't have to define the field types. PyDbLite will accept any value that
-can be serialized by the <CODE>cPickle</CODE> module : strings, Unicode strings, integers,
-floats, dates and datetimes (instances of the <CODE>date</CODE> and <CODE>datetime</CODE> classes in the <CODE>datetime</CODE> module), user-defined classes, etc
-
-<li> if the base exists, open it : <span class="python">db.open()</span>
-
-<li> you can pass a parameter "mode" to the <CODE>create()</CODE> method, to specify what
-you want to do if the base already exists in the file system
-<ul>
-<li>mode = "open" : <span class="python">db.create('name','age','size',mode="open")</span>
-
- opens the database and ignores the field definition
-
-<li> mode = "override" : <span class="python">db.create('name','age','size',mode="override")</span>
-
- erases the existing base and creates a new one with the field definition
-
-<li> if mode is not specified and the base already exists, an <CODE>IOError</CODE> is raised
-</ul>
-
-<li> insert a new record
-<ul>
-<li> by keywords : <span class="python">db.insert(name='homer',age=23,size=1.84)</span>
-
-<br>If some fields are missing, they are initialized with the value <CODE>None</CODE>
-
-<li> by positional arguments : <span class="python">db.insert('homer',23,1.84)</span>
-
-<br>The arguments must be provided in the same order as in the <CODE>create()</CODE> method
-</ul>
-
-<li>save the changes on disk : <span class="python">db.commit()</span>
-<br>If you don't commit the changes, the insertion, deletion and update operations
-will not be saved on disk. To return to the previous version, just <span class="python">
-open()</span> it again (this is equivalent to rollback in transactional
-databases)
-
-<li> besides the fields passed to the <CODE>create()</CODE> method, an internal field called <CODE>__id__</CODE> is added. It is a integer which is guaranteed to be unique and unchanged for each record in the base, so that it can be used as the record identifier
-
-<li> another internal field called <CODE>__version__</CODE> is also managed by the database engine. It is a integer which is set to 0 when the record is created, then incremented by 1 each time the record is updated. This is used to detect concurrency control, for instance in a web application where 2 users select the same record and want to update it at the same time
-
-<li>the selection of records uses Python list comprehension syntax :
-<br><span class="python">recs = [ r for r in db if 30 > r['age'] >= 18 and r['size'] < 2 ]</span>
-
-<br>returns the records in the base where the age is between 18 and 30, and size is below 2 meters. The record is a dictionary, where the key is the field name and value is the field value
-
-<li> Python generator expression syntax can also be used :
-<br><span class="python">for r in (r for r in db if r['name'] in ('homer','marge') ):<br>
- do_something_with(r)</span>
-
-<br>iterates on the records where the name is one of 'homer' or 'marge'
-
-<li> to iterate on all the records :
-<br><span class="python">for r in db:<br>
- do_something_with(r)</span>
-
-<li> a record can be accessed by its identifier : <span class="python">record = db[rec_id]</span>
-
-returns the record such that record['__id__'] == rec_id
-
-<li> finally, a shortcut can be used for simple selections :
-<span class="python">db(key1=val1,key2=val2)</span> returns the list of records where the keys take the given value. It is equivalent to <span class="python">[ r for r in db if r["key1"]==val1 and r["key2"]==val2]</span>, but much more concise
-
-<li>to speed up selections, an index can be created on a field : <span class="python">db.create_index('age')</span>
-
-<br>When an index is created, the database instance has an attribute (here <CODE>_age</CODE> : note the heading underscore, to avoid name conflicts with internal names). This attribute is a dictionary-like object, where keys are the values taken by the field, and values are the records whose field values are egal to the key :
-<br><span class="python">records = db._age[23]</span> returns the list of records with age == 23
-
-<br>If no record has this value, lookup by this value returns an empty list
-
-<br>The index supports iteration on the field values, and the <CODE>keys()</CODE> method
-returns all existing values for the field
-
-<li>number of records in the base : <span class="python">len(db)</span>
-
-<li>to delete a record : <span class="python">db.delete(record)</span> or, if you know the record identifier : <span class="python">del db[rec_id]</span>
-
-<li>to delete a list of records : <span class="python">db.delete(list_of_records)</span>
-
-<br><CODE>list_of_records</CODE> can be any iterable (list, tuple, set, etc) yielding records
-
-<li>to update a record : <span class="python">db.update(record,age=24)</span>
-
-<li>to add a new field to an existing base and specify a default value : <span class="python">db.add_field('new_field'[,default=v])</span>. If no default is provided, the field value is <CODE>None</CODE>
-
-<li>to drop an existing field : <span class="python">db.drop_field('name')</span>
-
-<li>to get the list of fields : <span class="python">db.fields</span>
-
-</ul>
-
-<a name="sqlite"><p><h2>SQLite adapter</h2>
-<p>The only difference with the pure-Python module is the syntax to identify a <code>Base</code> and the need to specify field types on base creation
-<ul>
-<li>import the class <code>Base</code> :
-<span class="python">from PyDbLite.SQLite import Base</span>
-<li>connect to the SQLite database :
-<span class="python">connection = sqlite.connect("test")</span>
-<li>to create a <code>Base</code> instance (a table in the SQLite database) you pass the connection as argument : <span class="python">db = Base('dummy',connection)</code>
-<li>to create the base you must specify an SQLite field type : NULL, INTEGER, REAL, TEXT
-or BLOB : <span class="python">db.create(('name','TEXT'),('age',"INTEGER'),('size','REAL'))</span>
-<p>For convenience, you can also use the types DATE and DATETIME (or TIMESTAMP), the package will
-transparently manage the conversions between the <code>datetime.date</code> and
-<code>datetime.datetime</code> and the TEXT type
-</ul>
-<p>For record insertion, selection, update and deletion, the syntax is the same as above. The only difference is that you can't use the <code>drop_field()</code> method, since dropping fields is not supported by SQLite
-<p>The <code>Base</code> instance has an attribute <code>cursor</code>, so you can also execute
-SQL expressions by <span class="python">db.cursor.execute(some_sql)</span> and get the result
-by <span class="python">results = db.cursor.fetchall()</span>
-
-<p><a name="mysql"><h2>MySQL adapter</h2>
-<p>The only difference with the pure-Python module is the syntax to identify a <code>Base</code> and the need to specify field types on base creation
-<ul>
-<li>import the class <code>Base</code> :
-<span class="python">from PyDbLite.MySQL import Base</span>
-<li>connect to the SQLite database :
-<p><span class="python">import MySQLdb<br>
- connection = MySQLdb.connect("localhost","root","admin")<br>
- connection.cursor().execute("USE test")
- </span> - -<li>pass the connection as argument to Base creation : <span class="python">db = Base('dummy',connection)</code>
-<li>to create a new base (a table in the MySQL database),specify a valid MySQL field type :
-<span class="python">db.create(('name','INTEGER'),('age',"INTEGER'),('size','REAL'))</span>
-</ul>
-
-<p>For record insertion, selection, update and deletion, adding or dropping fields,
-the syntax is the same as above
-<p>The <code>Base</code> instance has an attribute <code>cursor</code>, so you can also execute
-SQL expressions by <span class="python">db.cursor.execute(some_sql)</span> and get the result
-by <span class="python">results = db.cursor.fetchall()</span>
-
-
-</body>
-</html>
\ No newline at end of file diff --git a/development/pydblite/index_fr.html b/development/pydblite/index_fr.html deleted file mode 100644 index 112dabc8ff31e..0000000000000 --- a/development/pydblite/index_fr.html +++ /dev/null @@ -1,148 +0,0 @@ -<html>
-
-<head>
-<title>PyDbLite</title>
-</head>
-
-<body>
-
-<style type="text/css">
-body, td {
- color: #000000;
- background-color: #ffffff;
- font-family: sans-serif;
- font-size: 13;
- }
-
-pre {
- font-family: arial }
-
-li { padding-bottom:10;
- }
-
-.python {
- color:330099;
- font-family: "Courier New";
- }
-
-td.navigation
-{ background-color: #99ccff;
- font-weight: bold;
- font-family: avantgarde, sans-serif;
- font-size: 110%;
- width: 90%}
-
-td.lnk { background-color: #99ccff;
- font-size: 70%;
- }
-
-td.tablename { vertical-align: top;
- text-align: center;
- font-weight: bold;
- }
-
-ol { margin-left : 20px;
- }
-
-</style>
-
-<table width="100%" cellspacing="0"><tr><td class="navigation" align="center">PyDbLite</td>
-<td class="lnk" align="right"><a href="index.html">English</a></td>
-</tr></table>
-<p>PyDbLite est un moteur de base de données en mémoire, en pur Python, qui utilise les "list comprehensions" de Python comme langage de requêtes au lieu de SQL
-
-<p>Il consiste en un seul petit module, PyDbLite.py. Pour l'installer, il suffit de le <a href="http://sourceforge.net/project/platformdownload.php?group_id=210258">télécharger</a> et de le mettre dans le répertoire <code>Lib/site-packages</code> de votre distribution Python
-
-<p>Utilisation :
-
-<ul>
-<li>importer la classe <CODE>Base</CODE> du module PyDbLite : <span class="python">from PyDbLite import Base</span>
-
-<li>créer une instance de base de données,en passant un nom de fichier : <span class="python">db = Base('test')</span>
-
-<li>pour une nouvelle base, définissez les noms des champs : <span class="python">db.create('nom','age','taille')</span>
-
-<br>Vous n'avez pas à définir le type des champs. PyDbLite accepte toute valeur qui peut être sérialisée par le module <CODE>cPickle</CODE> : des chaînes de caractères, des chaînes Unicode, des entiers, réels, dates et dates-heures (instances des classes <CODE>date</CODE> et <CODE>datetime</CODE> dans le module <CODE>datetime</CODE>), des instances de classes définies par l'utilisateur, etc
-
-<li>si la base existe déjà, pour l'ouvrir : <span class="python">db.open()</span>
-
-<li>on peut passer un paramètre "mode" à la méthode <CODE>create()</CODE>, pour indiquer ce qu'il faut faire si la base existe déjà sur le disque
-<ul>
-<li>mode = "open" : <span class="python">db.create('nom','age','taille',mode="open")</span>
-
-ouvre la base en ignorant la définition des champs
-
-<li> mode = "override" : <span class="python">db.create('nom','age','taille',mode="override")</span>
-
-efface la base existante et en crée une nouvelle avec les définitions de champs
-<li>si le mode n'est pas précisé et que la base existe déjà, une exception <CODE>IOError</CODE> est déclenchée</ul>
-
-<li>insertion d'un nouvel enregistrement
-<ul>
-<li>par mots-clés : <span class="python">db.insert(nom='homer',age=23,taille=1.84)</span>
-
-<br>Si certains champs manquent, ils sont initialisés à la valeur <CODE>None</CODE>
-
-<li>par arguments positionnels : <span class="python">db.insert('homer',23,1.84)</span>
-
-<br>Les arguments doivent être fournis dans le même ordre que dans la méthode <CODE>create()</CODE>
-</ul>
-
-<li>pour sauvegarder les changements sur le disque : <span class="python">db.commit()</span>
-<br>Si vous ne confirmez pas les changements, les opérations d'insertion, de suppression et de mise à jour ne seront pas sauvegardés sur le disque
-
-<li>En plus des champs passés à la méthode <CODE>create()</CODE>, un champ interne appelé <CODE>__id__</CODE> est ajouté. C'est un entier, unique et inchangé pour chaque enregistrement, il peut donc être utilisé comme identifiant pour l'enregistrement
-
-<li> un autre champ interne appelé <CODE>__version__</CODE> est également géré par le moteur de base de données. Il s'agit d'un entier qui est initialisé à 0 quand l'enregistrement est créé, et incrémenté de 1 à chaque fois que l'enregistrement est mis à jour. Ceci sert pour la détection des accès concurrents, par exemple dans une application web dans laquelle deux utilisateurs veulent mettre à jour le même enregistrement en même temps
-
-<li>la sélection d'enregistrements utilise la syntaxe des "list comprehensions" de Python :
-<br><span class="python">recs = [ r for r in db if 30 > r['age'] >= 18 and r['taille'] < 2 ]</span>
-
-<br>retourne les enregistrements de la base pour lesquels l'âge est compris entre 18 et 30 ans, et la taille est inférieure à 2 mètres. L'enregistrement est un dictionnaire, où la clé est le nom de champ et la valeur est la valeur de ce champ
-
-<li>la syntaxe des générateurs d'expression Python peut aussi être utilisée :
-<br><span class="python">for r in (r for r in db if r['nom'] in ('homer','marge') ):<br>
- faire_qqch_avec(r)</span>
-
-<br>itère sur les enregistrements dont le nom est 'homer' ou 'marge'
-
-<li>pour itérer sur tous les enregistrements :
-<br><span class="python">for r in db:<br>
- fais_qqch_avec(r)</span>
-
-<li>on peut accéder directement à un enregistrement par son identifiant : <span class="python">record = db[rec_id]</span>
-
-retourne l'enregistrement tel que record['__id__'] == rec_id
-
-<li> finalement, un raccourci peut être utilisé pour les sélections simples :
-<span class="python">db(cle1=val1,cle2=val2)</span> renvoie la liste des enregistrements dont les clés prennent les valeurs données. C'est équivalent à <span class="python">[ r for r in db if r["cle1"]==val1 and r["cle2"]==val2]</span>, mais en beaucoup plus concis
-
-<li>pour accélérer les sélections, un index peut être créé sur un champ : <span class="python">db.create_index('age')</span>
-
-<br>Quand un index est créé, l'instance de la base de données a un attribut (ici <CODE>_age</CODE> : noter le signe de soulignement initial, pour éviter les conflits de noms avec des noms internes). Cet attribut est un objet de type dictionnaire, où les clés sont les valeurs prises par le champ, et les valeurs sont les enregistrements dont le champ a la même valeur que la clé :
-<br><span class="python">records = db._age[23]</span> retourne la liste des enregistrements avec age == 23
-
-<br>Si aucun enregistrement n'a cette valeur, la recherche par cette valeur retourne une liste vide
-
-<br>L'index supporte l'itération sur les valeurs du champ, et la méthode <CODE>keys()</CODE> retourne toutes les valeurs existantes pour le champ
-
-<li>nombre d'enregistrements dans la base : <span class="python">len(db)</span>
-
-<li>pour supprimer un enregistrement : <span class="python">db.delete(record)</span> ou, si vous connaissez l'identifiant : <span class="python">del db[rec_id]</span>
-
-<li>pour supprimer une liste d'enregistrements : <span class="python">db.delete(liste_d_enregistrements)</span>
-
-<br><CODE>liste_d_enregistrements</CODE> peut être n'importe quel itérable (liste, tuple, set, etc) qui produit des enregistrements
-
-<li>pour mettre à jour un enregistrement : <span class="python">db.update(record,age=24)</span>
-
-<li>pour ajouter un nouveau champ à une base existante et spécifier une valeur par défaut : <span class="python">db.add_field('nouveau_champ'[,default=v])</span>. Si le défaut n'est pas fourni, la valeur du champ est <CODE>None</CODE>
-
-<li>pour supprimer un champ existant : <span class="python">db.drop_field('nom')</span>
-
-<li>pour connaître la liste des champs : <span class="python">db.fields</span>
-
-</ul>
-
-</body>
-</html>
\ No newline at end of file diff --git a/development/pydblite/pydblite.SlackBuild b/development/pydblite/pydblite.SlackBuild index b8acc776d42ad..052ebf3c840e1 100644 --- a/development/pydblite/pydblite.SlackBuild +++ b/development/pydblite/pydblite.SlackBuild @@ -2,7 +2,7 @@ # Slackware build script for pydblite -# Copyright 2007-8-9 LukenShiro <lukenshiro@ngi.it> +# Copyright 2007-2009 LukenShiro <lukenshiro@ngi.it> # All rights reserved. # # Redistribution and use of this script, with or without modification, is @@ -23,8 +23,8 @@ # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. PRGNAM=pydblite -VERSION=${VERSION:-2.3} -ARCH=noarch +VERSION=${VERSION:-2.4} +ARCH=${ARCH:-i486} BUILD=${BUILD:-1} TAG=${TAG:-_SBo} @@ -34,7 +34,7 @@ PKG=$TMP/package-$PRGNAM OUTPUT=${OUTPUT:-/tmp} SRC_PRGNAM=PyDbLite -DOCFILES="PKG-INFO $CWD/index.html $CWD/index_fr.html" +DOCFILES="PKG-INFO README.txt PyDbLite/doc/*.html" # SLKCFLAGS are not used @@ -61,4 +61,4 @@ mkdir -p $PKG/install cat $CWD/slack-desc > $PKG/install/slack-desc cd $PKG -/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.tgz +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} diff --git a/development/pydblite/pydblite.info b/development/pydblite/pydblite.info index 9957500047d97..5259b58c80b44 100644 --- a/development/pydblite/pydblite.info +++ b/development/pydblite/pydblite.info @@ -1,8 +1,10 @@ PRGNAM="pydblite" -VERSION="2.3" +VERSION="2.4" HOMEPAGE="http://pydblite.sourceforge.net" -DOWNLOAD="http://downloads.sourceforge.net/pydblite/PyDbLite-2.3.zip" -MD5SUM="b0bd2216f3667dced29f71dc879e18cb" +DOWNLOAD="http://downloads.sourceforge.net/pydblite/PyDbLite-2.4.zip" +MD5SUM="deb3af4fdb682a6e923365f7d7496d13" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" MAINTAINER="LukenShiro" EMAIL="lukenshiro@ngi.it" -APPROVED="dsomero" +APPROVED="rworkman" diff --git a/development/pydblite/slack-desc b/development/pydblite/slack-desc index f67cc73aa87ca..5a2e5392aeedd 100644 --- a/development/pydblite/slack-desc +++ b/development/pydblite/slack-desc @@ -7,13 +7,13 @@ |-----handy-ruler------------------------------------------------------| pydblite: PyDbLite (small footprint untyped database engine in python) -pydblite: +pydblite: pydblite: PyDbLite is a pure-Python in-memory database engine, using pydblite: Python list comprehensions as query language instead of SQL, pydblite: which stores data in a cPickled file. -pydblite: +pydblite: pydblite: It is written by Pierre Quentel and released under BSD license. -pydblite: -pydblite: +pydblite: pydblite: Homepage: http://pydblite.sourceforge.net -pydblite: +pydblite: +pydblite: |