コード例 #1
0
ファイル: test_utils.py プロジェクト: hapylestat/cube
 def prepare_clean_database(cls):
   """
   :rtype Database
   """
   Database.close()
   Database.open(":memory:")
コード例 #2
0
ファイル: helloworld.py プロジェクト: hapylestat/cube
# 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: