• 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31

DBでDATETIME型で保存していたのですが、1.0で動かそうとしたらupdated_at(flash側ではDate)がInvalidDateと表示されてしまう。MYSQLクライアントでSELECTしたら特に問題なさそう。??と思ったのですが動いたのでメモ。

###修正したところ

  • DB側はDATETIMEではなくてDATE
    下にあるように親和性が高いカラムのほうが楽だと判断しDATE型にしました。DATEといっても日付と時間も格納してくれます。
  • parameterで渡すのはDateのインスタンス
    getTime()だとNumberが帰ってしまうので、INSERTはOKなんだけど、SELECTしてblog.updated_atとすると”Invalid Date”といわれてしまう。

java>>
stmt.parameter[":updated_at"] = new Date(); //OK
stmt.parameter[":updated_at"] = new Date().getTime(); //NG:beta3までは動いてた
<<--

###サポートされるSQLの仕様:local database
http://livedocs.adobe.com/air/1/jslr/localDatabaseSQLSupport.html

###サポートされる型で特に親和性が高いもの

The affinity of a column is the recommended type for data stored in that column. When a value is stored in a column (through an INSERT or UPDATE statement), the runtime attempts to convert that value from its data type to the specified affinity
http://livedocs.adobe.com/air/1/jslr/localDatabaseSQLSupport.html#columnAffinit

下記のカラムとは親和性があり、実行時にデータ型を変換してくれるそうです。

  • TEXT (or STRING)
  • NUMERIC
  • INTEGER
  • REAL (or NUMBER)
  • BOOLEAN
  • DATE
  • XML
  • XMLLIST
  • OBJECT
  • NONE

###DATEの親和性

A column with DATE affinity stores date and time values. A DATE column is designed to accept values that are ActionScript or JavaScript Date instances. If an attempt is made to store a String value in a DATE column, the runtime attempts to convert it to a Julian date. If the conversion fails an error occurs. If code attempts to store a Number, int, or uint value, no attempt is made to validate the data and it is assumed to be a valid Julian date value. A DATE value that's retrieved using a SELECT statement is automatically converted to a Date instance. DATE values are stored as Julian date values using the REAL storage class, so sorting and comparing operations work as you would expect them to.

NOTE:太字は私が強調をつけたところです。

posted by satoko satoko on Wed 26 Mar 2008 at 10:24 with 0 comments
Contents rssrss
NSAssertやNSLogを無効にする:-DNS_BLOCK_ASSERTIONS=1とNS_BLOCK_ASSERTIONS
GDBでview.frameを表示させる
Core Animationについてのリンク集
[iPhone] new BSDライセンスについてライセンス引用のメモ
Implementing a Container View Controller in UIViewController Class Reference
UITableView用のNSIndexPathの作り方
Xcodeのテンプレート、View-based ApplicationとWindow-based Applicationの違い
CopyOnSelectのLion対応
Xcode4のCode Snippetsを別のPCに移動する+gitで管理する
[iPhone] Singleton: iOS4以降はGCDのdispatch_onceを使う
Tags
AIR
Comments rssrss
https://proffseo.ru/prodvizhenie-sajtov-po-moskve https://proffseo.ru/prodvizhenie-sajtov-po-moskve: Цена: 48 800 ? Чаще всего, по статистике, у комп... 04/07 15:23
https://dez-spasatel.ru/articles/dezinfektsiya/osobennosti-obrabotki-borshchevika-vblizi-vodoemov-i-naselennykh-punktov/ https://dez-spasatel.ru/articles/dezinfektsiya/osobennosti-obrabotki-borshchevika-vblizi-vodoemov-i-naselennykh-punktov/: Подробнее о СЭС ЗАО https://dez-spasatel.ru/dezins... 04/07 11:58
https://socdental.ru/protezirovanie/koronki-na-zuby/metallicheskie/ https://socdental.ru/protezirovanie/koronki-na-zuby/metallicheskie/: В ее основе лежит технология компьютерного сканиро... 04/07 09:33
https://skyprofi.ru/stati/natyazhnoj-potolok-na-balkone/ https://skyprofi.ru/stati/natyazhnoj-potolok-na-balkone/: Эксклюзивный https://skyprofi.ru/tenevye-natyazhny... 04/06 19:38
https://stosastudio.ru/catalog/kuhni-lounge/ https://stosastudio.ru/catalog/kuhni-lounge/: Фабрика Tessarolo https://stosastudio.ru/vybiraem-... 04/06 08:14
KingofSmack KingofSmack: Here also good reads for this mobile application d... 05/10 18:02
satoko satoko: stackoverflowでも同じエラーを挙げている人がいたので、1.3でアップロードしたよってコメ... 12/13 03:36
ujihisa ujihisa: :%s/blog/glob/g 07/28 16:41