Esempio n. 1
0
 def prepare_clean_database(cls):
   """
   :rtype Database
   """
   Database.close()
   Database.open(":memory:")
Esempio n. 2
0
# This program 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.
#
# Copyright (c) 2015 Reishin  <*****@*****.**>
#                    crashtua <*****@*****.**> and Contributors

from orm.Entities import Person, Notes
from dao.Person import PersonDAO
from cube.database import Database


# uncomment to write database to disk
Database.open("D:\\test.db")

# normal test case
pdao = PersonDAO()

p = Person(name="My Person", description="human")


p.name = "NewName"
if Database.has_created():
  for i in range(1, 10):
    p.name = "Person %s" % i
    pdao.insert(p)

results = pdao.findall()

for item in results: