2008年6月14日土曜日

None による条件検索

まず
 select * from Kawase where entry_date = None 
はエラーとなる。
必ず、バインド変数のように指定しなければならない。

entity = db.GqlQuery("select * from Kawase where stock = :1", None)
for e in entity:
print e.entry_date, e.stock
 
しかし、これで Kawase の stock = None の値がすべて検索できるわけではない。
以下の検索で None となって、検索結果が返ってきているが、上の検索のリストにな該当レコードがない。

entity = db.GqlQuery("select * from Kawase where entry_date = :1 ", e1 )
for e in entity:
print e.entry_date, e.stock
 
原因:
 後から Property を追加したような場合、この Property を None で更新した場合、
「"select * from Kawase where stock = :1", None 」に該当するが、そうでないレコード(entities)は値が未登録であっても、この検索には該当しないようである。( SDK 1.1.0)

google/appengine/ext/admin/__init__.py
からしても、Google の Datastore は実際のデータを get して、解析してみなければ、そのデータの構造がわからない。 RDBでいうところの dictionary テーブルのようなものは存在しない。存在しないものを検索することはできない。
つまり、ある db.Model はどんな、 Property から構成されているかは、事前にはわからない。検索してはじめてわかる。

Docs > Datastore API > Entities and Models の以下の意味がようやく少し解ってきた。
Unlike relational databases, the App Engine datastore does not require that all entities of a given kind have the same properties. The application can specify and enforce its data models using the model API.

Unityでドアの開閉はAnimatorそれともiTween?

Mac Mini M2 の Unity で Sketchup のデータを復元したつづき。 以前、苦労して作成したドアの開閉が動作しないので修復する。 どうやって動かしていたのか、また忘れそうなので記録しておく。             Animator 左右のドア PlaneL,...