適用於 Adobe® Flash® Platform 的 ActionScript® 3.0 參考
首頁  |  隱藏套件和類別清單 |  套件  |  類別  |  新增內容  |  索引  |  附錄  |  為什麼顯示英文?
篩選: AIR 30.0 和更早版本, Flash Player 30.0 和更早版本, Flash Lite 4
Flex 4.6 和更早版本, Flash Pro CS6 和更早版本
隱藏篩選
flash.data 

SQLConnection  - AS3

套件x

最上層
adobe.utils
air.desktop
air.net
air.update
air.update.events
coldfusion.air
coldfusion.air.errors
coldfusion.air.events
coldfusion.service
coldfusion.service.events
coldfusion.service.mxml
com.adobe.acm.solutions.authoring.domain.extensions
com.adobe.acm.solutions.ccr.domain.extensions
com.adobe.consulting.pst.vo
com.adobe.dct.component
com.adobe.dct.component.datadictionary
com.adobe.dct.component.datadictionaryElement
com.adobe.dct.component.dataElementsPanel
com.adobe.dct.component.toolbars
com.adobe.dct.event
com.adobe.dct.exp
com.adobe.dct.model
com.adobe.dct.service
com.adobe.dct.service.provider
com.adobe.dct.transfer
com.adobe.dct.util
com.adobe.dct.view
com.adobe.ep.taskmanagement.domain
com.adobe.ep.taskmanagement.event
com.adobe.ep.taskmanagement.filter
com.adobe.ep.taskmanagement.services
com.adobe.ep.taskmanagement.util
com.adobe.ep.ux.attachmentlist.component
com.adobe.ep.ux.attachmentlist.domain
com.adobe.ep.ux.attachmentlist.domain.events
com.adobe.ep.ux.attachmentlist.domain.renderers
com.adobe.ep.ux.attachmentlist.skin
com.adobe.ep.ux.attachmentlist.skin.renderers
com.adobe.ep.ux.content.event
com.adobe.ep.ux.content.factory
com.adobe.ep.ux.content.handlers
com.adobe.ep.ux.content.managers
com.adobe.ep.ux.content.model.asset
com.adobe.ep.ux.content.model.preview
com.adobe.ep.ux.content.model.relation
com.adobe.ep.ux.content.model.search
com.adobe.ep.ux.content.model.toolbar
com.adobe.ep.ux.content.search
com.adobe.ep.ux.content.services
com.adobe.ep.ux.content.services.load
com.adobe.ep.ux.content.services.permissions
com.adobe.ep.ux.content.services.preview
com.adobe.ep.ux.content.services.providers
com.adobe.ep.ux.content.services.query
com.adobe.ep.ux.content.services.relationships
com.adobe.ep.ux.content.services.search.lccontent
com.adobe.ep.ux.content.services.version
com.adobe.ep.ux.content.view
com.adobe.ep.ux.content.view.components.activate
com.adobe.ep.ux.content.view.components.grid
com.adobe.ep.ux.content.view.components.grid.hover
com.adobe.ep.ux.content.view.components.grid.hover.component
com.adobe.ep.ux.content.view.components.grid.renderers
com.adobe.ep.ux.content.view.components.relationships
com.adobe.ep.ux.content.view.components.review
com.adobe.ep.ux.content.view.components.search.renderers
com.adobe.ep.ux.content.view.components.searchpod
com.adobe.ep.ux.content.view.components.toolbar
com.adobe.ep.ux.content.view.components.toolbar.controlRenderers
com.adobe.ep.ux.content.view.components.version
com.adobe.ep.ux.documentsubmit.component
com.adobe.ep.ux.documentsubmit.domain
com.adobe.ep.ux.documentsubmit.skin
com.adobe.ep.ux.taskaction.component
com.adobe.ep.ux.taskaction.domain
com.adobe.ep.ux.taskaction.domain.events
com.adobe.ep.ux.taskaction.skin
com.adobe.ep.ux.taskdetails.component
com.adobe.ep.ux.taskdetails.domain
com.adobe.ep.ux.taskdetails.skin
com.adobe.ep.ux.tasklist.component
com.adobe.ep.ux.tasklist.domain
com.adobe.ep.ux.tasklist.skin
com.adobe.ep.ux.webdocumentviewer.domain
com.adobe.exm.expression
com.adobe.exm.expression.error
com.adobe.exm.expression.event
com.adobe.exm.expression.impl
com.adobe.fiber.runtime.lib
com.adobe.fiber.services
com.adobe.fiber.services.wrapper
com.adobe.fiber.styles
com.adobe.fiber.util
com.adobe.fiber.valueobjects
com.adobe.gravity.binding
com.adobe.gravity.context
com.adobe.gravity.flex.bundleloader
com.adobe.gravity.flex.progress
com.adobe.gravity.flex.serviceloader
com.adobe.gravity.framework
com.adobe.gravity.init
com.adobe.gravity.service.bundleloader
com.adobe.gravity.service.logging
com.adobe.gravity.service.manifest
com.adobe.gravity.service.progress
com.adobe.gravity.tracker
com.adobe.gravity.ui
com.adobe.gravity.utility
com.adobe.gravity.utility.async
com.adobe.gravity.utility.error
com.adobe.gravity.utility.events
com.adobe.gravity.utility.factory
com.adobe.gravity.utility.flex.async
com.adobe.gravity.utility.logging
com.adobe.gravity.utility.message
com.adobe.gravity.utility.sequence
com.adobe.gravity.utility.url
com.adobe.guides.control
com.adobe.guides.domain
com.adobe.guides.i18n
com.adobe.guides.spark.components.skins
com.adobe.guides.spark.components.skins.mx
com.adobe.guides.spark.headers.components
com.adobe.guides.spark.headers.skins
com.adobe.guides.spark.layouts.components
com.adobe.guides.spark.layouts.skins
com.adobe.guides.spark.navigators.components
com.adobe.guides.spark.navigators.renderers
com.adobe.guides.spark.navigators.skins
com.adobe.guides.spark.util
com.adobe.guides.spark.wrappers.components
com.adobe.guides.spark.wrappers.skins
com.adobe.guides.submit
com.adobe.icc.dc.domain
com.adobe.icc.dc.domain.factory
com.adobe.icc.editors.events
com.adobe.icc.editors.handlers
com.adobe.icc.editors.managers
com.adobe.icc.editors.model
com.adobe.icc.editors.model.config
com.adobe.icc.editors.model.el
com.adobe.icc.editors.model.el.operands
com.adobe.icc.editors.model.el.operators
com.adobe.icc.enum
com.adobe.icc.external.dc
com.adobe.icc.obj
com.adobe.icc.services
com.adobe.icc.services.category
com.adobe.icc.services.config
com.adobe.icc.services.download
com.adobe.icc.services.export
com.adobe.icc.services.external
com.adobe.icc.services.formbridge
com.adobe.icc.services.fragmentlayout
com.adobe.icc.services.layout
com.adobe.icc.services.letter
com.adobe.icc.services.locator
com.adobe.icc.services.module
com.adobe.icc.services.render
com.adobe.icc.services.submit
com.adobe.icc.services.user
com.adobe.icc.token
com.adobe.icc.vo
com.adobe.icc.vo.render
com.adobe.icomm.assetplacement.controller
com.adobe.icomm.assetplacement.controller.utils
com.adobe.icomm.assetplacement.data
com.adobe.icomm.assetplacement.model
com.adobe.livecycle.assetmanager.client
com.adobe.livecycle.assetmanager.client.event
com.adobe.livecycle.assetmanager.client.handler
com.adobe.livecycle.assetmanager.client.managers
com.adobe.livecycle.assetmanager.client.model
com.adobe.livecycle.assetmanager.client.model.cms
com.adobe.livecycle.assetmanager.client.service
com.adobe.livecycle.assetmanager.client.service.search
com.adobe.livecycle.assetmanager.client.service.search.cms
com.adobe.livecycle.assetmanager.client.utils
com.adobe.livecycle.content
com.adobe.livecycle.rca.model
com.adobe.livecycle.rca.model.constant
com.adobe.livecycle.rca.model.document
com.adobe.livecycle.rca.model.participant
com.adobe.livecycle.rca.model.reminder
com.adobe.livecycle.rca.model.stage
com.adobe.livecycle.rca.service
com.adobe.livecycle.rca.service.core
com.adobe.livecycle.rca.service.core.delegate
com.adobe.livecycle.rca.service.process
com.adobe.livecycle.rca.service.process.delegate
com.adobe.livecycle.rca.token
com.adobe.livecycle.ria.security.api
com.adobe.livecycle.ria.security.service
com.adobe.mosaic.layouts
com.adobe.mosaic.layouts.dragAndDrop
com.adobe.mosaic.layouts.interfaces
com.adobe.mosaic.mxml
com.adobe.mosaic.om.constants
com.adobe.mosaic.om.events
com.adobe.mosaic.om.impl
com.adobe.mosaic.om.interfaces
com.adobe.mosaic.skinning
com.adobe.mosaic.sparklib.editors
com.adobe.mosaic.sparklib.optionMenu
com.adobe.mosaic.sparklib.scrollableMenu
com.adobe.mosaic.sparklib.scrollableMenu.skins
com.adobe.mosaic.sparklib.tabLayout
com.adobe.mosaic.sparklib.tabLayout.events
com.adobe.mosaic.sparklib.tabLayout.layouts
com.adobe.mosaic.sparklib.tabLayout.skins
com.adobe.mosaic.sparklib.text
com.adobe.mosaic.sparklib.util
com.adobe.solutions.acm.authoring.presentation
com.adobe.solutions.acm.authoring.presentation.actionbar
com.adobe.solutions.acm.authoring.presentation.common
com.adobe.solutions.acm.authoring.presentation.events
com.adobe.solutions.acm.authoring.presentation.fragment
com.adobe.solutions.acm.authoring.presentation.letter
com.adobe.solutions.acm.authoring.presentation.letter.data
com.adobe.solutions.acm.authoring.presentation.preview
com.adobe.solutions.acm.authoring.presentation.rte
com.adobe.solutions.acm.ccr.presentation
com.adobe.solutions.acm.ccr.presentation.contentcapture
com.adobe.solutions.acm.ccr.presentation.contentcapture.events
com.adobe.solutions.acm.ccr.presentation.contentcapture.preview
com.adobe.solutions.acm.ccr.presentation.datacapture
com.adobe.solutions.acm.ccr.presentation.datacapture.renderers
com.adobe.solutions.acm.ccr.presentation.pdf
com.adobe.solutions.exm
com.adobe.solutions.exm.authoring
com.adobe.solutions.exm.authoring.components.controls
com.adobe.solutions.exm.authoring.components.toolbars
com.adobe.solutions.exm.authoring.domain
com.adobe.solutions.exm.authoring.domain.expression
com.adobe.solutions.exm.authoring.domain.impl
com.adobe.solutions.exm.authoring.domain.method
com.adobe.solutions.exm.authoring.domain.variable
com.adobe.solutions.exm.authoring.enum
com.adobe.solutions.exm.authoring.events
com.adobe.solutions.exm.authoring.model
com.adobe.solutions.exm.authoring.renderer
com.adobe.solutions.exm.authoring.view
com.adobe.solutions.exm.expression
com.adobe.solutions.exm.impl
com.adobe.solutions.exm.impl.method
com.adobe.solutions.exm.method
com.adobe.solutions.exm.mock
com.adobe.solutions.exm.mock.method
com.adobe.solutions.exm.runtime
com.adobe.solutions.exm.runtime.impl
com.adobe.solutions.exm.variable
com.adobe.solutions.prm.constant
com.adobe.solutions.prm.domain
com.adobe.solutions.prm.domain.factory
com.adobe.solutions.prm.domain.impl
com.adobe.solutions.prm.domain.manager
com.adobe.solutions.prm.presentation.asset
com.adobe.solutions.prm.presentation.constant
com.adobe.solutions.prm.presentation.document
com.adobe.solutions.prm.presentation.event
com.adobe.solutions.prm.presentation.file
com.adobe.solutions.prm.presentation.project
com.adobe.solutions.prm.presentation.team
com.adobe.solutions.prm.presentation.util
com.adobe.solutions.prm.service
com.adobe.solutions.prm.services.impl
com.adobe.solutions.prm.vo
com.adobe.solutions.rca.constant
com.adobe.solutions.rca.domain
com.adobe.solutions.rca.domain.common
com.adobe.solutions.rca.domain.factory
com.adobe.solutions.rca.domain.impl
com.adobe.solutions.rca.domain.impl.manager
com.adobe.solutions.rca.domain.manager
com.adobe.solutions.rca.presentation
com.adobe.solutions.rca.presentation.comment
com.adobe.solutions.rca.presentation.constant
com.adobe.solutions.rca.presentation.event
com.adobe.solutions.rca.presentation.gantt
com.adobe.solutions.rca.presentation.gantt.ruler
com.adobe.solutions.rca.presentation.template
com.adobe.solutions.rca.presentation.template.audit
com.adobe.solutions.rca.presentation.template.definition
com.adobe.solutions.rca.presentation.template.documents
com.adobe.solutions.rca.presentation.template.stages
com.adobe.solutions.rca.presentation.util
com.adobe.solutions.rca.service
com.adobe.solutions.rca.services.impl
com.adobe.solutions.rca.vo
com.adobe.solutions.rca.vo.um
com.adobe.viewsource
fl.accessibility
fl.containers
fl.controls
fl.controls.dataGridClasses
fl.controls.listClasses
fl.controls.progressBarClasses
fl.core
fl.data
fl.display
fl.events
fl.ik
fl.lang
fl.livepreview
fl.managers
fl.motion
fl.motion.easing
fl.rsl
fl.text
fl.transitions
fl.transitions.easing
fl.video
flash.accessibility
flash.concurrent
flash.crypto
flash.data
flash.desktop
flash.display
flash.display3D
flash.display3D.textures
flash.errors
flash.events
flash.external
flash.filesystem
flash.filters
flash.geom
flash.globalization
flash.html
flash.media
flash.net
flash.net.dns
flash.net.drm
flash.notifications
flash.permissions
flash.printing
flash.profiler
flash.sampler
flash.security
flash.sensors
flash.system
flash.text
flash.text.engine
flash.text.ime
flash.ui
flash.utils
flash.xml
flashx.textLayout
flashx.textLayout.compose
flashx.textLayout.container
flashx.textLayout.conversion
flashx.textLayout.edit
flashx.textLayout.elements
flashx.textLayout.events
flashx.textLayout.factory
flashx.textLayout.formats
flashx.textLayout.operations
flashx.textLayout.utils
flashx.undo
ga.controls
ga.layouts
ga.model
ga.uiComponents
ga.util
ga.views
ga.wrappers
lc.foundation
lc.foundation.domain
lc.foundation.events
lc.foundation.ui
lc.foundation.util
lc.preloader
lc.procmgmt
lc.procmgmt.commands
lc.procmgmt.domain
lc.procmgmt.events
lc.procmgmt.formbridge
lc.procmgmt.impl
lc.procmgmt.ui.attachments
lc.procmgmt.ui.controls
lc.procmgmt.ui.controls.card
lc.procmgmt.ui.controls.renderer
lc.procmgmt.ui.help
lc.procmgmt.ui.layout
lc.procmgmt.ui.presentationmodel
lc.procmgmt.ui.process
lc.procmgmt.ui.search
lc.procmgmt.ui.startpoint
lc.procmgmt.ui.task
lc.procmgmt.ui.task.form
lc.procmgmt.ui.task.form.commands
lc.procmgmt.ui.tracking
mx.accessibility
mx.automation
mx.automation.air
mx.automation.delegates
mx.automation.delegates.advancedDataGrid
mx.automation.delegates.charts
mx.automation.delegates.containers
mx.automation.delegates.controls
mx.automation.delegates.controls.dataGridClasses
mx.automation.delegates.controls.fileSystemClasses
mx.automation.delegates.core
mx.automation.delegates.flashflexkit
mx.automation.events
mx.binding
mx.binding.utils
mx.charts
mx.charts.chartClasses
mx.charts.effects
mx.charts.effects.effectClasses
mx.charts.events
mx.charts.renderers
mx.charts.series
mx.charts.series.items
mx.charts.series.renderData
mx.charts.styles
mx.collections
mx.collections.errors
mx.containers
mx.containers.accordionClasses
mx.containers.dividedBoxClasses
mx.containers.errors
mx.containers.utilityClasses
mx.controls
mx.controls.advancedDataGridClasses
mx.controls.dataGridClasses
mx.controls.listClasses
mx.controls.menuClasses
mx.controls.olapDataGridClasses
mx.controls.scrollClasses
mx.controls.sliderClasses
mx.controls.textClasses
mx.controls.treeClasses
mx.controls.videoClasses
mx.core
mx.core.windowClasses
mx.data
mx.data.crypto
mx.data.errors
mx.data.events
mx.data.messages
mx.data.mxml
mx.data.offline.errors
mx.data.utils
mx.effects
mx.effects.easing
mx.effects.effectClasses
mx.events
mx.filters
mx.flash
mx.formatters
mx.geom
mx.graphics
mx.graphics.codec
mx.graphics.shaderClasses
mx.logging
mx.logging.errors
mx.logging.targets
mx.managers
mx.messaging
mx.messaging.channels
mx.messaging.config
mx.messaging.errors
mx.messaging.events
mx.messaging.management
mx.messaging.messages
mx.modules
mx.netmon
mx.olap
mx.olap.aggregators
mx.preloaders
mx.printing
mx.resources
mx.rpc
mx.rpc.events
mx.rpc.http
mx.rpc.http.mxml
mx.rpc.livecycle
mx.rpc.mxml
mx.rpc.remoting
mx.rpc.remoting.mxml
mx.rpc.soap
mx.rpc.soap.mxml
mx.rpc.wsdl
mx.rpc.xml
mx.skins
mx.skins.halo
mx.skins.spark
mx.skins.wireframe
mx.skins.wireframe.windowChrome
mx.states
mx.styles
mx.utils
mx.validators
org.osmf.containers
org.osmf.display
org.osmf.elements
org.osmf.events
org.osmf.layout
org.osmf.logging
org.osmf.media
org.osmf.metadata
org.osmf.net
org.osmf.net.dvr
org.osmf.net.httpstreaming
org.osmf.net.metrics
org.osmf.net.qos
org.osmf.net.rtmpstreaming
org.osmf.net.rules
org.osmf.traits
org.osmf.utils
spark.accessibility
spark.automation.delegates
spark.automation.delegates.components
spark.automation.delegates.components.gridClasses
spark.automation.delegates.components.mediaClasses
spark.automation.delegates.components.supportClasses
spark.automation.delegates.skins.spark
spark.automation.events
spark.collections
spark.components
spark.components.calendarClasses
spark.components.gridClasses
spark.components.mediaClasses
spark.components.supportClasses
spark.components.windowClasses
spark.core
spark.effects
spark.effects.animation
spark.effects.easing
spark.effects.interpolation
spark.effects.supportClasses
spark.events
spark.filters
spark.formatters
spark.formatters.supportClasses
spark.globalization
spark.globalization.supportClasses
spark.layouts
spark.layouts.supportClasses
spark.managers
spark.modules
spark.preloaders
spark.primitives
spark.primitives.supportClasses
spark.skins
spark.skins.mobile
spark.skins.mobile.supportClasses
spark.skins.spark
spark.skins.spark.mediaClasses.fullScreen
spark.skins.spark.mediaClasses.normal
spark.skins.spark.windowChrome
spark.skins.wireframe
spark.skins.wireframe.mediaClasses
spark.skins.wireframe.mediaClasses.fullScreen
spark.transitions
spark.utils
spark.validators
spark.validators.supportClasses
xd.core.axm.enterprise.view.components
xd.core.axm.enterprise.view.skins
xd.core.axm.view.components
xd.core.axm.view.components.support

語言元素

全域常數
全域函數
運算子
陳述式、關鍵字和指令
特殊類型

附錄

新增內容
編譯器錯誤
編譯器警告
執行階段錯誤
移轉至 ActionScript 3
支援的字元集
僅限 MXML 標籤
移動 XML 元素
Timed Text 標籤
不建議元素清單
AccessibilityImplementation 常數
如何使用 ActionScript 範例
法律聲明
套件flash.data
類別public class SQLConnection
繼承SQLConnection Inheritance EventDispatcher Inheritance Object

語言版本: ActionScript 3.0
執行階段版本: AIR 1.0

SQLConnection 實體可用來管理本機 SQL 資料庫檔案 (本機資料庫) 的建立與連線。

SQLConnection 類別的功能可分成許多類:

  • 向 SQL 陳述式的 sqlConnection 屬性呼叫 open() 方法或 SQLConnection 實體,會建立或開啟本機 SQL 資料庫檔案。

  • SQLConnection 類別也可以提供 SQL 陳述式的狀態,其中包含在單一交易中執行多個陳述式的機制。交易是利用 begin()commit() 以及 rollback() 方法來加以管理的。此外,setSavepoint()releaseSavepoint() 以及 rollbackToSavepoint() 方法都允許程式碼來定義以及管理儲存點。這些都可用來將交易切成好幾組的作業。

  • SQLConnection 類別可讓您存取已連接資料庫的資料庫結構資訊。資料庫的結構說明了其表格、欄、索引和觸發器的定義。如需詳細資訊,請參閱 loadSchema() 方法。

  • SQLConnection 類別會提供使用 AES 搭配 CCM 來加密資料庫的功能。這個類別會同時提供資料的驗證和私用功能。若要加密資料庫,您必須在建立資料庫時指定 16 位元組金鑰 (使用 ByteArray 指定)。您之後可以使用 SQLConnection.reencrypt() 方法來變更這個金鑰。加密會降低資料庫寫入和讀取作業的效能。加密會套用至儲存在磁碟上的資料,而不會套用至記憶體中的暫存資料快取。記憶體內的資料庫「不」支援加密。

  • SQLConnection 實體可以用來接收資料庫層級的事件通知,並提供資料庫各方面的組態控制 (包含快取頁面大小、程序取消和陳述式執行選項)。

SQLConnection 實體可在同步或非同步執行模式下運作。若要使用同步執行,請針對 SQLConnection 實體使用 open() 方法,連接至主要資料庫。若要使用非同步執行,請針對該實體使用 openAsync() 方法,連接至主要資料庫。

使用非同步執行時,您可以使用事件偵聽程式或 Responder 實體來判斷作業何時完成或失敗。這些作業會在背景 (而非主應用程式執行緒) 中執行,因此即使在資料庫作業執行期間,應用程式仍會繼續執行並回應使用者的互動。每一個非同步 SQLConnection 實體會在自已執行緒中執行 SQL 陳述式。

在非同步執行模式下,您可以呼叫適當的方法開始特定作業,並且可以為適當的事件註冊偵聽程式,偵測作業為完成或失敗。每個作業都有相關聯的事件,會在作業成功完成時便會傳送。例如,當 openAsync() 方法呼叫成功完成 (資料庫連線已開啟) 時,便會傳送 open 事件。當作業失敗,便會傳送 error 事件。SQLErrorEvent 物件之 error 屬性中的 SQLError 實體包含特定錯誤的相關資訊,其中包括嘗試執行的作業和作業失敗的原因。

當您使用同步執行時,不需要註冊事件偵聽程式來判斷作業何時完成或失敗。若要識別錯誤,請在 try..catch 區塊中加入可以擲回錯誤的陳述式。由於同步作業是在主執行序中執行,因此在一個或多個資料庫作業執行期間,所有應用程式功能 (包含重新整理畫面以及允許滑鼠和鍵盤互動) 都會暫停。對於長時間執行的作業,這可能會造成應用程式明顯暫停的狀況。

詳細資訊

相關 API 元素



公用屬性
 屬性定義自
      autoCompact : Boolean
[唯讀] 指出當原本建立目前的資料庫時,是否啟用了自動壓縮功能 (建立資料庫時,於 open() 或 openAsync() 呼叫中指定的 autoCompact 參數值)。
SQLConnection
      cacheSize : uint
讓使用者存取此連線的快取大小,代表記憶體中每一次能夠保留的資料庫磁碟分頁數目上限。
SQLConnection
      columnNameStyle : String
指出 SELECT 陳述式結果中報告欄名稱的方式。
SQLConnection
      connected : Boolean
[唯讀] 指出 SQLConnection 實體是否開啟了對資料庫檔案的連線。
SQLConnection
 Inheritedconstructor : Object
類別物件的參照或是特定物件實體的建構函數。
Object
      inTransaction : Boolean
[唯讀] 指出此連線目前是否與交易有關。
SQLConnection
      isSupported : Boolean
[靜態] [唯讀] 指出目前平台是否支援 SQLConnection 類別。
SQLConnection
      lastInsertRowID : Number
[唯讀] SQL INSERT 陳述式最後產生的列識別名稱。
SQLConnection
      pageSize : uint
[唯讀] 指出當最初建立資料庫時 (建立資料庫時,於 open() 或 openAsync() 呼叫中指定的 pageSize 參數值),所指定的資料庫分頁大小 (以位元組為單位)。
SQLConnection
      totalChanges : Number
[唯讀] 包含自從開啟了資料庫的連線以來,所做的資料變更總數。
SQLConnection
公用方法
 方法定義自
  
    SQLConnection()
建立 SQLConnection 實體。
SQLConnection
  
    addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0.0, useWeakReference:Boolean = false):void
[覆寫] 會在 EventDispatcher 物件註冊事件偵聽程式,以便讓偵聽程式收到事件的通知。
SQLConnection
  
    analyze(resourceName:String = null, responder:Responder = null):void
收集資料庫索引的相關統計資料,並將其儲存在資料庫中。
SQLConnection
  
    attach(name:String, reference:Object = null, responder:Responder = null, encryptionKey:ByteArray = null):void
將另一個資料庫加入 SQLConnection 實體,為新資料庫提供指定名稱。
SQLConnection
  
    begin(option:String = null, responder:Responder = null):void
開始交易,其中所有針對連線資料庫執行的 SQL 陳述式將組成群組。
SQLConnection
  
    cancel(responder:Responder = null):void
中止目前針對連線至 SQLConnection 實體的資料庫執行之所有 SQL 陳述式。
SQLConnection
  
    close(responder:Responder = null):void
關閉目前的資料庫連線。
SQLConnection
  
    commit(responder:Responder = null):void
認可現有的交易,讓交易陳述式所執行的所有動作永久套用至資料庫。
SQLConnection
  
    compact(responder:Responder = null):void
回收資料庫中所有未使用的空間。
SQLConnection
  
    deanalyze(responder:Responder = null):void
移除所有因為呼叫 analyze() 方法而建立的所有統計資訊。
SQLConnection
  
    detach(name:String, responder:Responder = null):void
將先前使用 attach() 方法附加至 SQLConnection 實體的其他資料庫分離。
SQLConnection
 Inherited
會將事件傳送到事件流程。
EventDispatcher
  
讓使用者存取 loadSchema() 方法的呼叫結果。
SQLConnection
 Inherited
會檢查 EventDispatcher 物件是否有對特定的事件類型註冊偵聽程式。
EventDispatcher
 Inherited
指出物件是否有已定義的指定屬性。
Object
 Inherited
指出 Object 類別的實體是否位於指定為參數的物件原型鏈中。
Object
  
    loadSchema(type:Class = null, name:String = null, database:String = "main", includeColumnSchema:Boolean = true, responder:Responder = null):void
從連線的資料庫或任何附加的資料庫載入結構資訊。
SQLConnection
  
    open(reference:Object = null, openMode:String = "create", autoCompact:Boolean = false, pageSize:int = 1024, encryptionKey:ByteArray = null):void
在檔案系統的指定位置上開啟一個資料庫檔案的同步連線,或是在該位置上建立並開啟新的資料庫檔案,或者建立並開啟內存記憶體的資料庫。
SQLConnection
  
    openAsync(reference:Object = null, openMode:String = "create", responder:Responder = null, autoCompact:Boolean = false, pageSize:int = 1024, encryptionKey:ByteArray = null):void
在檔案系統的指定位置上開啟一個資料庫檔案的非同步連線,或是在該位置上建立並開啟新的資料庫檔案,或者建立並開啟內存記憶體的資料庫。
SQLConnection
 Inherited
指出指定的屬性是否存在,以及是否可列舉。
Object
  
    reencrypt(newEncryptionKey:ByteArray, responder:Responder = null):void
變更已加密資料庫的加密金鑰。
SQLConnection
  
    releaseSavepoint(name:String = null, responder:Responder = null):void
從最近儲存點或者在指定名稱時,從該指定名稱儲存點之後所做的 SQL 作業,這個方法都會予以認可。
SQLConnection
  
    removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
[覆寫] 會從 EventDispatcher 物件移除偵聽程式。
SQLConnection
  
    rollback(responder:Responder = null):void
復原使用 begin() 方法所建立的現有交易,代表將捨棄交易中由任何 SQL 陳述式所做的變更。
SQLConnection
  
    rollbackToSavepoint(name:String = null, responder:Responder = null):void
將最近儲存點或者在指定名稱時,從該指定名稱儲存點之後所做的 SQL 作業加以復原。
SQLConnection
 Inherited
為迴圈作業設定動態屬性的可用性。
Object
  
    setSavepoint(name:String = null, responder:Responder = null):void
建立一個儲存點,它就像是資料庫交易中的書籤。
SQLConnection
 Inherited
傳回代表此物件的字串,根據地區特定慣例進行格式化。
Object
 Inherited
會傳回指定之物件的字串形式。
Object
 Inherited
會傳回指定之物件的基本值。
Object
 Inherited
檢查此 EventDispatcher 物件是否已註冊事件偵聽程式,或者此物件的任何祖系已為特定事件類型註冊事件偵聽程式。
EventDispatcher
事件
 事件 摘要 定義自
 Inherited[廣播事件] 當 Flash Player 或 AIR 應用程式取得作業系統焦點並成為作用中時傳送。EventDispatcher
  
    analyze
當 analyze() 作業成功完成時傳送。SQLConnection
  
    attach
當 attach() 方法呼叫的作業成功完成時傳送。SQLConnection
  
    begin
當 begin() 方法呼叫的作業成功完成時傳送。SQLConnection
  
    cancel
當 cancel() 方法呼叫的作業成功完成時傳送。SQLConnection
  
    close
當 close() 方法呼叫的作業成功完成時傳送。SQLConnection
  
    commit
當 commit() 方法呼叫的作業成功完成時傳送。SQLConnection
  
    compact
當 compact() 方法呼叫的作業成功完成時傳送。SQLConnection
 Inherited[廣播事件] 當 Flash Player 或 AIR 應用程式失去作業系統焦點並成為非作用中時傳送。EventDispatcher
  
    deanalyze
當 deanalyze() 方法呼叫的作業成功完成時傳送。SQLConnection
  
    delete
當任何連線資料庫之任何表格內的資料因為執行 SQL DELETE 命令而變更時傳送。SQLConnection
  
    detach
當 detach() 方法呼叫的作業成功完成時傳送。SQLConnection
  
    error
當任何一個 SQLConnection 物件的非同步作業出現錯誤時傳送。SQLConnection
  
    insert
當任何連線資料庫之任何表格內的資料因為執行 SQL INSERT 命令而變更時傳送。SQLConnection
  
    open
當 openAsync() 方法呼叫的作業成功完成時傳送。SQLConnection
  
    reencrypt
當 reencrypt() 方法呼叫的作業成功完成時傳送。SQLConnection
  當 releaseSavepoint() 方法呼叫的作業成功完成時傳送。SQLConnection
  
    rollback
當 rollback() 方法呼叫的作業成功完成時傳送。SQLConnection
  當 rollbackToSavepoint() 方法呼叫的作業成功完成時傳送。SQLConnection
  
    schema
當 loadSchema() 方法呼叫的作業成功完成且結構結果就緒時傳送。SQLConnection
  
    setSavepoint
當 setSavepoint() 方法呼叫的作業成功完成時傳送。SQLConnection
  
    update
當任何連線資料庫之任何表格內的資料因為執行 SQL UPDATE 命令而變更時傳送。SQLConnection
屬性詳細資訊
    

autoCompact

屬性
autoCompact:Boolean  [唯讀]

語言版本: ActionScript 3.0
執行階段版本: AIR 1.0

指出當原本建立目前的資料庫時,是否啟用了自動壓縮功能 (建立資料庫時,於 open()openAsync() 呼叫中指定的 autoCompact 參數值)。如果此屬性為 true,則每次發生寫入作業之後,就會自動移除資料庫檔案中的未使用空間,以避免增加資料庫檔案大小。如果此屬性為 false,已移除之檔案先前所佔據的空間便會殘留在資料庫檔案中,並且視需要再次使用。即使在 autoCompactfalse 的情況下,您也可以呼叫 compact() 方法,強制資料庫對未使用空間進行回收。

如果 connected 屬性為 false,此屬性便會設定為 false



實作
    public function get autoCompact():Boolean

相關 API 元素

    

cacheSize

屬性 
cacheSize:uint

語言版本: ActionScript 3.0
執行階段版本: AIR 1.0

讓使用者存取此連線的快取大小,代表記憶體中每一次能夠保留的資料庫磁碟分頁數目上限。每個分頁都會使用大約 1.5 KB 的記憶體 (視您為 open()openAsync() 方法 (用來建立資料庫) 之 pageSize 參數指定的值而定)。預設的快取大小為 2000。如果應用程式要執行會變更資料庫內多列資料的 UPDATEDELETE 作業,增加快取大小可以增加記憶體的使用量,進而提高執行速度。



實作
    public function get cacheSize():uint
    public function set cacheSize(value:uint):void

擲回值
IllegalOperationError — 在 SQLConnection 實體並未連接至資料庫 (connected 屬性為 false) 時嘗試設定此屬性,或者目前交易正在進行中 (inTransaction 屬性為 true)。

相關 API 元素

    

columnNameStyle

屬性 
columnNameStyle:String

語言版本: ActionScript 3.0
執行階段版本: AIR 1.0

指出 SELECT 陳述式結果中報告欄名稱的方式。

在 SQLColumnNameStyle 類別中定義的常數代表此屬性可能使用的值:

  • SQLColumnNameStyle.LONG 表示欄名稱是以 [table-name]_[column-name] 的格式傳回。
  • SQLColumnNameStyle.SHORT 表示欄名稱的格式為 [column-name]。如果有多個同名欄,則只有一個具有該名稱的屬性會加入結果物件。
  • 預設值為 SQLColumnNameStyle.DEFAULT。使用此值時,結果欄名稱的格式便會根據 SELECT 陳述式中具有相似欄名稱之表格的數目來設定。如果 SELECT 陳述式只包含一份表格,便會使用短名稱格式 [column-name],而如果 SELECT 陳述式包含多份表格,則無論何時因為兩個欄名稱相同而出現命名衝突,長名稱格式 [table-name]_[column-name] 都會用來為這些具有相同名稱的欄解決衝突。



實作
    public function get columnNameStyle():String
    public function set columnNameStyle(value:String):void

擲回值
IllegalOperationError — 當 SQLConnection 實體並未連接至資料庫 (connected 屬性為 false) 時嘗試設定此屬性。

相關 API 元素

    

connected

屬性 
connected:Boolean  [唯讀]

語言版本: ActionScript 3.0
執行階段版本: AIR 1.0

指出 SQLConnection 實體是否開啟了對資料庫檔案的連線。



實作
    public function get connected():Boolean

相關 API 元素

    

inTransaction

屬性 
inTransaction:Boolean  [唯讀]

語言版本: ActionScript 3.0
執行階段版本: AIR 1.0

指出此連線目前是否與交易有關。



實作
    public function get inTransaction():Boolean

相關 API 元素

    

isSupported

屬性 
isSupported:Boolean  [唯讀]

語言版本: ActionScript 3.0
執行階段版本: AIR 3.4

指出目前平台是否支援 SQLConnection 類別。



實作
    public static function get isSupported():Boolean
    

lastInsertRowID

屬性 
lastInsertRowID:Number  [唯讀]

語言版本: ActionScript 3.0
執行階段版本: AIR 1.0

SQL INSERT 陳述式最後產生的列識別名稱。列識別名稱可用來唯一識別資料庫中表格內的列。資料庫會頻繁地產生這個值。

如果沒有連接至任何資料庫,或尚未執行任何 INSERT 陳述式,則此值為零。

單一 SQL INSERT 陳述式在執行時,其列識別名稱可以透過 SQLResult 物件 (由 SQLStatement 物件之 getResult() 方法 (當 SQLStatement 傳送其 result 事件之後呼叫) 傳回的 lastInsertRowID 屬性取得)。

如需有關主索引鍵和所產生列識別名稱的詳細資訊,請參閱附錄本機資料庫中的 SQL 支援內的 CREATE TABLE運算式一節。



實作
    public function get lastInsertRowID():Number

相關 API 元素

    

pageSize

屬性 
pageSize:uint  [唯讀]

語言版本: ActionScript 3.0
執行階段版本: AIR 1.0

指出當最初建立資料庫時 (建立資料庫時,於 open()openAsync() 呼叫中指定的 pageSize 參數值),所指定的資料庫分頁大小 (以位元組為單位)。

如果 connected 屬性為 false,此屬性的值便為 0。

直到在資料庫中建立第一份表格之前,資料庫的分頁大小都可以變更 (使用 open()openAsync() 方法)。



實作
    public function get pageSize():uint

相關 API 元素

    

totalChanges

屬性 
totalChanges:Number  [唯讀]

語言版本: ActionScript 3.0
執行階段版本: AIR 1.0

包含自從開啟了資料庫的連線以來,所做的資料變更總數。除了追蹤 INSERTDELETEUPDATE 陳述式所做的變更以外,此值還包括觸發器所做的變更。

關閉資料庫連線時,此值會重設為 0。當 SQLConnection 實體並未連接至資料庫時,此值為 0。



實作
    public function get totalChanges():Number

相關 API 元素

建構函式詳細資料
    

SQLConnection

()建構函式
public function SQLConnection()

語言版本: ActionScript 3.0
執行階段版本: AIR 1.0

建立 SQLConnection 實體。


擲回值
SecurityError — 如果建構函式是由主應用程式安全執行程序以外的安全執行程序呼叫。
方法詳細資訊

    addEventListener

()方法
override public function addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0.0, useWeakReference:Boolean = false):void

語言版本: ActionScript 3.0
執行階段版本: AIR 1.0

會在 EventDispatcher 物件註冊事件偵聽程式,以便讓偵聽程式收到事件的通知。您可以在顯示清單上的所有節點,為特定類型的事件、階段與優先順序註冊事件偵聽程式。

當您成功註冊事件偵聽程式後,就不可以透過對 addEventListener() 的額外呼叫來變更其優先順序。 若要變更偵聽程式的優先順序,您必須先呼叫 removeListener()。 然後,您就可以使用新的優先順序等級來重新註冊偵聽程式。

請記住,一旦您註冊了偵聽程式,對 addEventListener() 進行後續呼叫,若使用不同的 typeuseCapture 值,將會導致建立個別的偵聽程式註冊程序。 例如,如果您先將 useCapture 設為 true 來註冊偵聽程式,則只會在捕捉階段進行偵聽。 如果您使用相同的偵聽程式物件,再次呼叫 addEventListener() (但將 useCapture 設為 false) 會得到兩個不同的偵聽程式: 一個會在捕捉階段進行偵聽,另一個則會在目標與反昇階段進行偵聽。

您無法單獨針對目標階段或反昇階段註冊事件偵聽程式。 由於反昇階段只適用於目標節點的祖系,因此這兩種階段必須一起進行註冊。

如果您不再需要事件偵聽程式,可以呼叫 removeEventListener() 來移除它,否則可能產生記憶體問題。 事件偵聽程式不會自動從記憶體中移除,因為只要傳送的物件存在,垃圾回收器就不會移除偵聽程式 (除非 useWeakReference 參數設定為 true)。

複製 EventDispatcher 實體並不會將附加在該實體上的事件偵聽程式一併複製 (如果新建立的節點需要事件偵聽程式,則您必須在建立節點後再附加偵聽程式)。 然而,如果您移動了 EventDispatcher 實體,則附加的事件偵聽程式也會跟著移動。

若於此節點正在處理事件的同時將事件偵聽程式註冊到某個節點上,則事件偵聽程式不會在目前階段觸發,但會在事件流程的後續階段 (例如反昇階段) 中觸發。

如果您在節點正在處理事件的同時將事件偵聽程式從節點中移除,則事件偵聽程式還是會被目前的動作觸發。 一旦移除了事件偵聽程式,就無法再叫用它 (除非您為了日後的處理而再次註冊它)。

參數

type:String — 事件類型。
 
listener:Function — 處理事件的偵聽程式函數。此函數必須接受 Event 物件並當做唯一的參數,而且必須傳回空值,如下列範例所示:
function(evt:Event):void

函數可以具有任何名稱。

 
useCapture:Boolean (default = false)判斷偵聽程式是否可在捕捉階段或目標與反昇階段運作。如果 useCapture 設為 true,則偵聽程式只會在捕捉階段 (而不是在目標或反昇階段) 處理事件。如果 useCapturefalse,則偵聽程式只會在目標或反昇階段處理事件。若要在全部三個階段中偵聽事件,請呼叫 addEventListener 兩次,先將 useCapture 設為 true 進行第一次呼叫,再將 useCapture 設為 false 進行第二次呼叫。
 
priority:int (default = 0.0) — 事件偵聽程式的優先順序等級。優先順序是由一個具有正負號的 32 位元整數所指定。 數字越大,代表優先順序越高。所有優先順序為 n 的偵聽程式都會比優先順序為 n -1 的偵聽程式優先處理。 如果有兩個以上的偵聽程式共用同一個優先順序,則會依據加入的先後次序來處理。預設的優先順序為 0。
 
useWeakReference:Boolean (default = false) — 判斷偵聽程式的參照為強或弱。強參照 (預設) 會避免偵聽程式被垃圾回收器從記憶體中移除, 弱參照則無法避免這個情況發生。

類別層級的成員函數不受記憶體回收限制,因此您可以將類別層級成員函數的 useWeakReference 設定為 true,而且不會受到記憶體回收的限制。如果您將屬於巢狀內部函數的偵聽程式其 useWeakReference 設定為 true,該函數將會進行記憶體回收,而不再具備永續性。如果您建立內部函數的參考 (將它儲存在其他變數中),函數就不會進行記憶體回收,並保有永續性。

    analyze

()方法 
public function analyze(resourceName:String = null, responder:Responder = null):void

語言版本: ActionScript 3.0
執行階段版本: AIR 1.0

收集資料庫索引的相關統計資料,並將其儲存在資料庫中。接著,這些統計資料便可供查詢最佳化工具 (資料庫引擎的一部分,可判斷執行每個陳述式的最有效方式) 使用。執行特定查詢時,這些統計資料可協助查詢最佳化工具更精準地判斷出要使用的索引。

如果已定義資料庫的索引,但是尚未呼叫 analyze() 方法,執行階段仍會使用這些索引來執行陳述式。但是,由於並未使用 analyze() 方法產生其他統計資訊,執行階段可能不會針對特定查詢選擇最有效的索引。

當表格的資料變更時 (執行 INSERTUPDATEDELETE 陳述式的結果),與該表格相關聯的索引也隨之變更。analyze() 產生的統計資料不會自動更新。因此,在經過大量資料變更之後,建議再次呼叫 analyze() 方法。不過,再次呼叫 analyze() 的好處需視幾項因素而定,其中包括針對表格所定義的索引數、表格中已變更的列數和總列數的關係、表格中索引資料的變化程度,以及變更的資料與百分比資料的差異。

resourceName 參數表示作業應該針對所有已附加資料庫、特定資料庫還是特定表格的索引來執行。

每次呼叫此方法時,先前建立的統計資料都會遭到清除,然後再針對 resourceName 參數中指定的資料庫或表格 (如果 resourceNamenull,則為所有已連接資料庫中的全部表格) 重新建立統計資料。只要已開啟資料庫連線,便可以隨時呼叫此方法。analyze() 作業和其統計資料並不屬於交易的一部分。不過,當資料庫正在進行交易 (inTransaction 屬性為 true) 時,最好不要呼叫 analyze()。這是因為 analyze() 呼叫並不會將交易中已執行但尚未認可的所有資料、表格結構或索引變更包含在內的緣故,而且一旦交易經過認可,analyze() 資料就會過時。

若要移除 analyze() 方法所建立的統計資料,請使用 deanalyze() 方法。

參數

resourceName:String (default = null) — 要分析其索引之資料庫或表格的名稱。如果指定的資源為表格,並且此表格的名稱在所有附加的資料庫中獨一無二,則只需指定此表格名稱。不過,您可以使用 [database-name].[table-name] 格式來指定表格名稱,以避免當表格名稱並非唯一時造成混淆。如果 resourceName 參數為 null (預設值),則會分析所有已附加資料庫中的全部索引。
 
responder:Responder (default = null) — 物件,指定當作業成功或失敗時要呼叫的方法。在非同步執行模式下,如果 responder 引數為 null,則執行作業完成時會傳送 analyzeerror 事件。


事件
analyze:SQLEvent — 當作業成功完成時傳送。
 
error:SQLErrorEvent — 當作業在非同步執行模式下失敗時傳送。

擲回值
IllegalOperationError — 當 SQLConnection 實體並未連接至資料庫 (connected 屬性為 false) 就呼叫此方法時。
 
SQLError — 如果作業在同步執行模式下失敗。

相關 API 元素

    attach

()方法 
public function attach(name:String, reference:Object = null, responder:Responder = null, encryptionKey:ByteArray = null):void

語言版本: ActionScript 3.0
執行階段版本: AIR 1.0

將另一個資料庫加入 SQLConnection 實體,為新資料庫提供指定名稱。附加資料庫可讓該資料庫在針對此 SQLConnection 實體執行的 SQL 陳述式中使用。

如果已經使用指定的名稱附加資料庫,則呼叫 attach() 將造成錯誤。不過,只要使用不同的名稱,您便可以多次附加相同的資料庫。最多只能將十個資料庫附加至 SQLConnection 實體。

任何可以針對使用 attach() 連接的資料庫來執行的 SQL 陳述式,都可以針對主要資料庫 (使用 open()openAsync() 連接的資料庫) 來執行。SQL 陳述式可以存取附加至與該陳述式相關聯 SQLConnection 實體之所有資料庫中的表格,其中包含在單一陳述式中存取多個資料庫內的表格。當執行階段要解析陳述式內的表格名稱時,它會從使用 open()openAsync() 方法連接的資料庫開始,在 SQLConnection 實體的資料庫中 (依照資料庫的附加順序) 進行搜尋。請在陳述式中使用 (在 attach() 方法的 name 參數中指定之) 資料庫名稱,以確認表格名稱是否有效。

若要移除使用 attach() 方法附加的資料庫,請使用 detach() 方法。關閉 SQLConnection 實體 (呼叫 close() 方法) 時,所有已附加的資料庫都會分離。

無論主要資料庫是使用 open() 方法或 openAsync() 方法來連接 (同步或非同步),已附加的資料庫都將使用與主要資料庫相同的執行模式。

參數

name:String — 用來識別新附加之資料庫的名稱。您可以在 SQL 陳述式中使用此名稱,以明確指出某個表格屬於該指定的資料庫,格式為 [database-name].[table-name]。「main」和「temp」為保留名稱,無法使用。
 
reference:Object (default = null) — 要附加之資料庫檔案的參考 (flash.filesystem.File 實體)。如果該參考所指的實體不存在,則會根據為已連接主要資料庫之 open()openAsync() 呼叫中 openMode 參數指定的值,建立新的資料庫檔案或擲回錯誤。

如果參數的值為 null,則會在記憶體內部建立資料庫,並附加此資料庫。

 
responder:Responder (default = null) — 物件,指定當作業成功或失敗時要呼叫的方法。在非同步執行模式下,如果 responder 引數為 null,則執行作業完成時會傳送 attacherror 事件。
 
encryptionKey:ByteArray (default = null) — 資料庫檔案的加密金鑰。如果 attach() 呼叫建立了資料庫,此資料庫就會加密,而且指定的金鑰會當做此資料庫的加密金鑰使用。如果呼叫附加了現有的加密資料庫,此值就必須符合資料庫的加密金鑰,否則會發生錯誤。如果所附加的資料庫並未加密,或者您要建立未加密的資料庫,此值就必須是 null (預設值)。

有效加密金鑰的長度是 16 個位元組。記憶體內的資料庫無法加密,因此當 reference 參數的值為 null 時,這個參數就必須是 null

附加已加密的資料庫時,如果所提供的加密金鑰不符合資料庫的加密金鑰,就會發生例外狀況。在同步執行模式中,系統會擲出 SQLError 例外狀況。在非同步執行模式中,系統會傳送 SQLErrorEvent,而且事件物件的 error 屬性會包含 SQLError 實體。不論是哪一種情況,SQLError 物件的 errorID 屬性都是 3138 (「已開啟的檔案不是資料庫檔案」)。

從 AIR 1.5 開始就已經提供 encryptionKey 參數。


事件
attach:SQLEvent — 當作業成功完成時傳送。
 
error:SQLErrorEvent — 當作業在非同步執行模式下失敗時傳送。

擲回值
ArgumentError — 當 name 參數是空字串 ("") 或 null
 
ArgumentError — 針對 reference 參數指定的值不是 flash.filesystem.File 實體時
 
ArgumentError — 當 encryptionKey 引數不是 null 而且其長度不是 16 個位元組時
 
ArgumentError — 當 reference 參數是 null 而且 encryptionKey 引數不是 null
 
IllegalOperationError — 當 SQLConnection 實體並未連接至資料庫 (connected 屬性為 false),或者目前已開啟交易 (inTransaction 屬性為 true) 時。
 
SQLError — 如果作業在同步執行模式下失敗。

相關 API 元素

    begin

()方法 
public function begin(option:String = null, responder:Responder = null):void

語言版本: ActionScript 3.0
執行階段版本: AIR 1.0

開始交易,其中所有針對連線資料庫執行的 SQL 陳述式將組成群組。

根據預設,每個 SQL 陳述式都是在自己擁有的交易中執行,而且當陳述式執行成功或失敗時,交易也會結束。如果使用 begin() 方法建立新交易,則會建立新的手動交易。從此刻開始,所有針對 SQLConnection 實體執行的 SQL 陳述式都會在交易中發生,而且這些陳述式執行的所有動作和修改都會被當做群組進行認可 (永遠有效) 或復原 (還原)。

若要結束交易,請視這些交易之陳述式所做的變更為永久有效還是必須捨棄,呼叫 commit()rollback() 方法。

會略過巢狀呼叫 begin()。您可以使用 setSavepoint() 方法來建立儲存體,它就像交易中的書籤一樣。然後您可以呼叫 releaseSavepoint()rollbackToSavepoint() 方法,部分認可或復原 SQL 陳述式。不過,如果是呼叫 begin() 來開始交易,在呼叫 commit() 方法後,才會永久認可對資料庫所做的變更。

如果目前已開啟交易時關閉資料庫連線,AIR 就會自動回復交易。(注意:若為 AIR 1.1 和先前的版本,已開啟的交易會在連線關閉時自動認可)。

交易不僅限於在單一資料庫中執行的陳述式,它可以包含針對已附加的不同資料庫執行的陳述式。

參數

option:String (default = null) — 表示交易使用的鎖定策略。此值可以是在 SQLTransactionLockType 類別中定義的其中一個常數:
  • SQLTransactionLockType.DEFERRED 表示直到發生首次讀取或寫入作業時,才會鎖定資料庫。
  • SQLTransactionLockType.EXCLUSIVE 表示儘快鎖定資料庫,而且其他 SQLConnection 實體都不能對資料庫執行讀取或寫入作業。
  • SQLTransactionLockType.IMMEDIATE 表示儘快鎖定資料庫,而且其他 SQLConnection 實體可以對資料庫執行讀取作業,但是無法執行寫入作業。

預設值 (null) 等同於 SQLTransactionLockType.DEFERRED

 
responder:Responder (default = null) — 物件,指定當作業成功或失敗時要呼叫的方法。在非同步執行模式下,如果 responder 引數為 null,則執行作業完成時會傳送 beginerror 事件。


事件
begin:SQLEvent — 當作業完成時傳送。
 
error:SQLErrorEvent — 當作業在非同步執行模式下失敗時傳送。

擲回值
IllegalOperationError — 當 SQLConnection 實體並未連接至資料庫 (connected 屬性為 false) 就呼叫此方法時。
 
ArgumentError — 如果指定的選項並非其中一個 SQLTransactionLockType 常數。
 
SQLError — 如果作業在同步執行模式下失敗。

相關 API 元素


範例  ( 如何使用本範例 )

以下範例會示範如何在一筆交易中執行多個 SQL INSERT 陳述式。首先在 "employees" 表格中加上一列。接下來擷取新插入的那一列的主索引鍵,然後用於將另一列加到相關的 "phoneNumbers" 表格。
package
{
    import flash.data.SQLConnection;
    import flash.data.SQLResult;
    import flash.data.SQLStatement;
    import flash.display.Sprite;
    import flash.events.SQLErrorEvent;
    import flash.events.SQLEvent;
    import flash.filesystem.File;
    
    public class MultiInsertTransactionExample extends Sprite
    {
        private var conn:SQLConnection;
        private var insertEmployee:SQLStatement;
        private var insertPhoneNumber:SQLStatement;
        
        public function MultiInsertTransactionExample():void
        {
            // define where to find the database file
            var appStorage:File = File.applicationStorageDirectory;
            var dbFile:File = appStorage.resolvePath("ExampleDatabase.db");
            
            // open the database connection
            conn = new SQLConnection();
            conn.addEventListener(SQLErrorEvent.ERROR, errorHandler);
            conn.addEventListener(SQLEvent.OPEN, openHandler);
            conn.openAsync(dbFile);
        }
        
        // Called when the database is connected
        private function openHandler(event:SQLEvent):void
        {
            conn.removeEventListener(SQLEvent.OPEN, openHandler);
            
            // start a transaction
            conn.addEventListener(SQLEvent.BEGIN, beginHandler);
            conn.begin();
        }
        
        // Called when the transaction begins
        private function beginHandler(event:SQLEvent):void
        {
            conn.removeEventListener(SQLEvent.BEGIN, beginHandler);
            
            // create and execute the first SQL statement:
            // insert an employee record
            insertEmployee = new SQLStatement();
            insertEmployee.sqlConnection = conn;
            insertEmployee.text = 
                "INSERT INTO employees (lastName, firstName, email) " + 
                "VALUES (:lastName, :firstName, :email, :birthday)";
            insertEmployee.parameters[":lastName"] = "Smith";
            insertEmployee.parameters[":firstName"] = "Bob";
            insertEmployee.parameters[":email"] = "bsmith@example.com";
            insertEmployee.parameters[":birthday"] = new Date(1971, 8, 12);
            
            insertEmployee.addEventListener(SQLEvent.RESULT, insertEmployeeHandler);
            insertEmployee.addEventListener(SQLErrorEvent.ERROR, errorHandler);
            
            insertEmployee.execute();
        }
        
        // Called after the employee record is inserted
        private function insertEmployeeHandler(event:SQLEvent):void
        {
            insertEmployee.removeEventListener(SQLEvent.RESULT, insertEmployeeHandler);
            insertEmployee.removeEventListener(SQLErrorEvent.ERROR, errorHandler);
            
            // Get the employee id of the newly created employee row
            var result:SQLResult = insertEmployee.getResult();
            var employeeId:Number = result.lastInsertRowID;
            
            // Add a phone number to the related phoneNumbers table
            insertPhoneNumber = new SQLStatement();
            insertPhoneNumber.sqlConnection = conn;
            insertPhoneNumber.text =
                "INSERT INTO phoneNumbers (employeeId, type, number) " +
                "VALUES (:employeeId, :type, :number)";
            insertPhoneNumber.parameters[":employeeId"] = employeeId;
            insertPhoneNumber.parameters[":type"] = "Home";
            insertPhoneNumber.parameters[":number"] = "(555) 555-1234";
            
            insertPhoneNumber.addEventListener(SQLEvent.RESULT, insertPhoneNumberHandler);
            insertPhoneNumber.addEventListener(SQLErrorEvent.ERROR, errorHandler);
            
            insertPhoneNumber.execute();
        }
        
        // Called after the phone number record is inserted
        private function insertPhoneNumberHandler(event:SQLEvent):void
        {
            insertPhoneNumber.removeEventListener(SQLEvent.RESULT, insertPhoneNumberHandler);
            insertPhoneNumber.removeEventListener(SQLErrorEvent.ERROR, errorHandler);
            
            // No errors so far, so commit the transaction
            conn.addEventListener(SQLEvent.COMMIT, commitHandler);
            conn.commit();
        }
        
        // Called after the transaction is committed
        private function commitHandler(event:SQLEvent):void
        {
            conn.removeEventListener(SQLEvent.COMMIT, commitHandler);
            
            trace("Transaction complete");
        }
        
        // Called whenever an error occurs
        private function errorHandler(event:SQLErrorEvent):void
        {
            // If a transaction is happening, roll it back
            if (conn.inTransaction)
            {
                conn.addEventListener(SQLEvent.ROLLBACK, rollbackHandler);
                conn.rollback();
            }
            
            trace(event.error.message);
            trace(event.error.details);
        }
        
        // Called when the transaction is rolled back
        private function rollbackHandler(event:SQLEvent):void
        {
            conn.removeEventListener(SQLEvent.ROLLBACK, rollbackHandler);
            
            // add additional error handling, close the database, etc.
        }
    }
}

以下範例會示範如何在一筆交易中執行多個 SQL DELETE 陳述式。這項交易用於刪除員工記錄。首先,刪除 "phoneNumbers" 表格中相關的列。接下來從 "employees" 表格刪除員工記錄列。
package
{
    import flash.data.SQLConnection;
    import flash.data.SQLResult;
    import flash.data.SQLStatement;
    import flash.display.Sprite;
    import flash.events.SQLErrorEvent;
    import flash.events.SQLEvent;
    import flash.filesystem.File;
    
    public class MultiDeleteTransactionExample extends Sprite
    {
        private var conn:SQLConnection;
        private var deleteEmployee:SQLStatement;
        private var deletePhoneNumbers:SQLStatement;
        
        private var employeeIdToDelete:Number = 25;
        
        public function MultiDeleteTransactionExample():void
        {
            // define where to find the database file
            var appStorage:File = File.applicationStorageDirectory;
            var dbFile:File = appStorage.resolvePath("ExampleDatabase.db");
            
            // open the database connection
            conn = new SQLConnection();
            conn.addEventListener(SQLErrorEvent.ERROR, errorHandler);
            conn.addEventListener(SQLEvent.OPEN, openHandler);
            conn.openAsync(dbFile);
        }
        
        // Called when the database is connected
        private function openHandler(event:SQLEvent):void
        {
            conn.removeEventListener(SQLEvent.OPEN, openHandler);
            
            // start a transaction
            conn.addEventListener(SQLEvent.BEGIN, beginHandler);
            conn.begin();
        }
        
        // Called when the transaction begins
        private function beginHandler(event:SQLEvent):void
        {
            conn.removeEventListener(SQLEvent.BEGIN, beginHandler);
            
            // Create and execute the first SQL statement:
            // Delete an employee's phone number records
            deletePhoneNumbers = new SQLStatement();
            deletePhoneNumbers.sqlConnection = conn;
            deletePhoneNumbers.text =
                "DELETE FROM phoneNumbers " +
                "WHERE employeeId = :employeeId";
            deletePhoneNumbers.parameters[":employeeId"] = employeeIdToDelete;
            
            deletePhoneNumbers.addEventListener(SQLEvent.RESULT, deletePhoneNumbersHandler);
            deletePhoneNumbers.addEventListener(SQLErrorEvent.ERROR, errorHandler);
            
            deletePhoneNumbers.execute();
        }
        
        // Called after the phone number records are deleted
        private function deletePhoneNumbersHandler(event:SQLEvent):void
        {
            deletePhoneNumbers.removeEventListener(SQLEvent.RESULT, deletePhoneNumbersHandler);
            deletePhoneNumbers.removeEventListener(SQLErrorEvent.ERROR, errorHandler);
            
            deleteEmployee = new SQLStatement();
            deleteEmployee.sqlConnection = conn;
            deleteEmployee.text = 
                "DELETE FROM employees " + 
                "WHERE employeeId = :employeeId";
            deleteEmployee.parameters[":employeeId"] = employeeIdToDelete;
            
            deleteEmployee.addEventListener(SQLEvent.RESULT, deleteEmployeeHandler);
            deleteEmployee.addEventListener(SQLErrorEvent.ERROR, errorHandler);
            
            deleteEmployee.execute();
        }
        
        // Called after the employee record is deleted
        private function deleteEmployeeHandler(event:SQLEvent):void
        {
            deleteEmployee.removeEventListener(SQLEvent.RESULT, deleteEmployeeHandler);
            deleteEmployee.removeEventListener(SQLErrorEvent.ERROR, errorHandler);
            
            // No errors so far, so commit the transaction
            conn.addEventListener(SQLEvent.COMMIT, commitHandler);
            conn.commit();
        }
        
        // Called after the transaction is committed
        private function commitHandler(event:SQLEvent):void
        {
            conn.removeEventListener(SQLEvent.COMMIT, commitHandler);
            
            trace("Transaction complete");
        }
        
        // Called whenever an error occurs
        private function errorHandler(event:SQLErrorEvent):void
        {
            // If a transaction is happening, roll it back
            if (conn.inTransaction)
            {
                conn.addEventListener(SQLEvent.ROLLBACK, rollbackHandler);
                conn.rollback();
            }
            
            trace(event.error.message);
            trace(event.error.details);
        }
        
        // Called when the transaction is rolled back
        private function rollbackHandler(event:SQLEvent):void
        {
            conn.removeEventListener(SQLEvent.ROLLBACK, rollbackHandler);
            
            // add additional error handling, close the database, etc.
        }
    }
}

    cancel

()方法 
public function cancel(responder:Responder = null):void

語言版本: ActionScript 3.0
執行階段版本: AIR 1.0

中止目前針對連線至 SQLConnection 實體的資料庫執行之所有 SQL 陳述式。此方法可以用來停止長時間執行或已失控的查詢。

如果呼叫 cancel() 方法時有陳述式正在執行,此方法會中止這些陳述式的作業,而且復原所有未完成的更新或交易。如果沒有任何陳述式正在執行,呼叫此方法會將開啟的交易復原,但是不會有其他動作。

參數

responder:Responder (default = null) — 物件,指定當作業成功或失敗時要呼叫的方法。在非同步執行模式下,如果 responder 引數為 null,則執行作業完成時會傳送 cancelerror 事件。


事件
cancel:SQLEvent — 當作業成功完成時傳送。
 
error:SQLErrorEvent — 當作業在非同步執行模式下失敗時傳送。

擲回值
IllegalOperationError — 當 SQLConnection 實體並未連接至資料庫 (connected 屬性為 false) 就呼叫此方法時。
 
SQLError — 如果作業在同步執行模式下失敗。

相關 API 元素

    close

()方法 
public function close(responder:Responder = null):void

語言版本: ActionScript 3.0
執行階段版本: AIR 1.0

關閉目前的資料庫連線。所有已附加的資料庫也都會分離。

如果在呼叫 close() 時已開啟某項交易,則會復原該交易。當 SQLConnection 實體已進行記憶體回收時,執行階段便會自動呼叫 close(),即使 AIR 應用程式在 SQLConnection 仍與資料庫連接時為關閉狀態也是一樣。

參數

responder:Responder (default = null) — 物件,指定當作業成功或失敗時要呼叫的方法。在非同步執行模式下,如果 responder 引數為 null,則執行作業完成時會傳送 closeerror 事件。


事件
close:SQLEvent — 當作業成功完成時傳送。
 
error:SQLErrorEvent — 當作業在非同步執行模式下失敗時傳送。

擲回值
SQLError — 如果作業在同步執行模式下失敗。

    commit

()方法 
public function commit(responder:Responder = null):void

語言版本: ActionScript 3.0
執行階段版本: AIR 1.0

認可現有的交易,讓交易陳述式所執行的所有動作永久套用至資料庫。

呼叫 setSavepoint() 方法可以建立中間儲存點,它就像交易中的書籤一樣。利用儲存點,您就可以呼叫 releaseSavepoint() 方法來認可交易的某些部分,或者呼叫 rollbackToSavepoint() 方法來復原交易中的某些部分。不過,如果是呼叫 begin() 來開始交易,則在呼叫 commit() 方法來認可整項交易之後,才會將所做的變更永久儲存至資料庫。

至於使用儲存點的交易,認可整項交易之後,任何使用 rollbackToSavepoint() 方法來復原的陳述式,都不予以認可。使用 releaseSavepoint() 認可的陳述式,或者其儲存點尚未釋放或復原的陳述式,會在資料庫予以認可。

參數

responder:Responder (default = null) — 物件,指定當作業成功或失敗時要呼叫的方法。在非同步執行模式下,如果 responder 引數為 null,則執行作業完成時會傳送 commiterror 事件。


事件
commit:SQLEvent — 當作業成功完成時傳送。
 
error:SQLErrorEvent — 當作業於失敗情況下完成時傳送。

擲回值
IllegalOperationError — 如果 SQLConnection 實體並未連接至資料庫 (connected 屬性為 false) 而呼叫此方法,或是沒有開啟任何交易的情況下 (inTransaction 屬性為 false)。

相關 API 元素

    compact

()方法 
public function compact(responder:Responder = null):void

語言版本: ActionScript 3.0
執行階段版本: AIR 1.0

回收資料庫中所有未使用的空間。自資料庫中丟棄某個物件 (表格、索引或觸發器) 時,該物件會留下空白空間。這會讓資料庫檔案變得比應有的大小還大,卻也可以加速 INSERT 作業。時間一久,INSERTDELETE 作業都會讓資料庫檔案結構呈現片段化,降低磁碟中資料庫內容的存取速度。此方法會刪除空白分頁、將表格資料相鄰排列,以及清理資料庫檔案結構,以便壓縮資料庫檔案。

您無法對已附加的資料庫檔案執行 compact() 作業,只能對 SQLConnection 實體所開啟的主要 (原始) 資料庫檔案執行。如果有交易正在進行,此作業將會失敗,而不會對內存記憶體的資料庫造成影響。

參數

responder:Responder (default = null) — 物件,指定當作業成功或失敗時要呼叫的方法。在非同步執行模式下,如果 responder 引數為 null,則執行作業完成時會傳送 compacterror 事件。


事件
compact:SQLEvent — 當作業成功完成時傳送。
 
error:SQLErrorEvent — 當作業在非同步執行模式下失敗時傳送。

擲回值
IllegalOperationError — 如果 SQLConnection 實體並未連接至資料庫 (connected 屬性為 false) 而呼叫此方法,或是交易目前正在進行中的情況下 (inTransaction 屬性為 true)。
 
SQLError — 如果作業在同步執行模式下失敗。

    deanalyze

()方法 
public function deanalyze(responder:Responder = null):void

語言版本: ActionScript 3.0
執行階段版本: AIR 1.0

移除所有因為呼叫 analyze() 方法而建立的所有統計資訊。

因為 analyze() 方法產生的統計資料會佔據資料庫中的空間,呼叫 deanalyze() 可讓您回收該空間佔據的記憶體 (例如,丟棄數個索引或表格之後)。

正在進行的交易不包含此作業。

參數

responder:Responder (default = null) — 物件,指定當作業成功或失敗時要呼叫的方法。在非同步執行模式下,如果 responder 引數為 null,則執行作業完成時會傳送 deanalyzeerror 事件。


事件
deanalyze:SQLEvent — 當作業成功完成時傳送。
 
error:SQLErrorEvent — 當作業在非同步執行模式下失敗時傳送。

擲回值
IllegalOperationError — 當 SQLConnection 實體並未連接至資料庫 (connected 屬性為 false) 就呼叫此方法時。
 
SQLError — 如果作業在同步執行模式下失敗。

相關 API 元素

    detach

()方法 
public function detach(name:String, responder:Responder = null):void

語言版本: ActionScript 3.0
執行階段版本: AIR 1.0

將先前使用 attach() 方法附加至 SQLConnection 實體的其他資料庫分離。您可以使用不同的名稱,將相同的資料庫附加多次,而且分離其中一個連線並不會影響其他連線。如果連線包含已開啟的交易 (inTransaction 屬性為 true),則無法將該資料庫分離。

參數

name:String — 要分離之資料庫的指定名稱。
 
responder:Responder (default = null) — 物件,指定當作業成功或失敗時要呼叫的方法。在非同步執行模式下,如果 responder 引數為 null,則執行作業完成時會傳送 detacherror 事件。


事件
detach:SQLEvent — 當作業成功完成時傳送。
 
error:SQLErrorEvent — 當作業在非同步執行模式下失敗時傳送。

擲回值
ArgumentError — 如果 name 引數為 null 或包含空字串 ("")。
 
IllegalOperationError — 如果 SQLConnection 實體並未連接至資料庫 (connected 屬性為 false) 而呼叫此方法,或是 SQLConnection 實體包含已開啟的交易 (inTransaction 屬性為 true)。
 
SQLError — 如果作業在同步執行模式下失敗。

相關 API 元素

    getSchemaResult

()方法 
public function getSchemaResult():SQLSchemaResult

語言版本: ActionScript 3.0
執行階段版本: AIR 1.0

讓使用者存取 loadSchema() 方法的呼叫結果。getSchemaResult() 方法的作用與結果的先入先出佇列相同。每次 loadSchema() 方法呼叫完成 (每次在非同步執行模式下傳送 schema 事件) 時,佇列中就會加入新的 SQLSchemaResult 物件。每次呼叫 getSchemaResult() 方法時,就會傳回最舊的結果 (最先加入佇列的結果) 並從佇列移除該結果。佇列中沒有任何物件時,getSchemaResult() 會傳回 null

資料庫連線已關閉時,此方法會傳回 null

傳回值
SQLSchemaResult

相關 API 元素

    loadSchema

()方法 
public function loadSchema(type:Class = null, name:String = null, database:String = "main", includeColumnSchema:Boolean = true, responder:Responder = null):void

語言版本: ActionScript 3.0
執行階段版本: AIR 1.0

從連線的資料庫或任何附加的資料庫載入結構資訊。此結構 (Schema) 會指出資料庫之各個表格、欄、索引和觸發器的結構 (Structure)。

若要存取已載入的結構,請使用 SQLConnection.getSchemaResult() 方法。

在非同步執行模式下,如果作業成功便會傳回 schema 事件;如果作業失敗便會傳回 error 事件。

typename 參數值的組合會決定 loadSchema() 方法所產生的結構資料類型,以及之後所產生 SQLSchemaResult 實體的屬性值。下表列出有效的 typename 組合,以及最後產生的結構資料:

type 引數name 引數擷取下列項目的結構資料:
nullnull資料庫中的所有物件 (所有表格、檢視、觸發器和索引)
SQLIndexSchemanull資料庫中的所有索引
SQLIndexSchema有效的表格名稱針對指定之表格定義的所有索引
SQLIndexSchema有效的索引名稱指定的索引
SQLTableSchemanull資料庫中的所有表格
SQLTableSchema有效的表格名稱指定的表格
SQLTriggerSchemanull資料庫中的所有觸發器
SQLTriggerSchema有效的表格名稱與指定之表格相關聯的所有觸發器
SQLTriggerSchema有效的檢視名稱與指定之檢視相關聯的所有觸發器
SQLTriggerSchema有效的觸發器名稱指定的觸發器
SQLViewSchemanull資料庫中的所有檢視
SQLViewSchema有效的檢視名稱指定的檢視

如果 typename 引數的組合並非對應至上述其中一種指定的組合,則在非同步執行模式下便會傳回 error 事件,在同步執行模式下便會擲回例外。例如,type 引數為 SQLViewSchemaname 引數為表格名稱 (而非檢視名稱),則會發生錯誤,指出該資料庫不含具有指定之名稱和指定之類型的物件。

如果資料庫是空的 (不包含任何資料表、檢視、觸發程序或索引),呼叫 loadSchema() 方法就會產生錯誤。

參數

type:Class (default = null) — 表示要載入的結構類型。null 值 (預設值) 表示要載入所有結構資訊。為此參數指定 null 以外的值會縮小產生的結構範圍,如此可以從結果移除不需要的資訊,讓作業更有效率。此值必須為下列其中一個類別的類別名稱:
  • SQLIndexSchema
  • SQLTableSchema
  • SQLTriggerSchema
  • SQLViewSchema
 
name:String (default = null) — 指出應該載入的資源結構。此值的使用方式視指定的 type 引數而定。一般而言,這會是資料庫物件的名稱,例如表格名稱以及索引或檢視名稱等等。如果已經指定值,則結果中只會包含具有該指定名稱之資料庫物件的結構資訊。

如果指定的值無效,則會傳送 error 事件 (或在同步執行模式下擲回錯誤)。如方法的說明所述,type 參數值必須對應至如上述命名之物件的類型才有效。

如果 name 引數為 null,則指定之類型的所有結構都會包含在內。如果指定的值無效,則會傳送 error 事件。

 
database:String (default = "main") — 已載入其結構的資料庫名稱。如果指定的值無效,則會傳送 error 事件。
 
includeColumnSchema:Boolean (default = true) — 指出結果是否包含表格和檢視的欄結構資訊。
 
responder:Responder (default = null) — 物件,指定當作業成功或失敗時要呼叫的方法。在非同步執行模式下,如果 responder 引數為 null,則執行作業完成時會傳送 schemaerror 事件。


事件
schema:SQLEvent — 當作業成功完成時傳送。
 
error:SQLErrorEvent — 當作業於失敗情況下完成時傳送。

擲回值
IllegalOperationError — 當 SQLConnection 實體並未連接至資料庫 (connected 屬性為 false) 就呼叫此方法時。
 
ArgumentError — 當指定的 type 引數值不屬於任何一種允許的類型時。
 
SQLError — 當使用同步執行模式,如果為 name 或 database 參數提供的值無效時。

相關 API 元素

    open

()方法 
public function open(reference:Object = null, openMode:String = "create", autoCompact:Boolean = false, pageSize:int = 1024, encryptionKey:ByteArray = null):void

語言版本: ActionScript 3.0
執行階段版本: AIR 1.0

在檔案系統的指定位置上開啟一個資料庫檔案的同步連線,或是在該位置上建立並開啟新的資料庫檔案,或者建立並開啟內存記憶體的資料庫。以此方法開啟資料庫時,使用此 SQLConnection 實體建立和開啟資料庫以及執行的其他所有作業 (包含與此 SQLConnection 實體相關聯之 SQLStatement 實體執行陳述式和其他作業) 都是以「同步」方式執行。若要以非同步方式執行這些作業,請改用 openAsync() 方法開啟資料庫連線。

連接資料庫之後,可以使用 SQLStatement 實體來執行 SQL 命令。資料庫等級作業,例如開始或結束交易、載入資料結構資訊,以及其他使用 SQLConnection 實體來執行的作業。

使用 open() 方法連接的資料庫會自動被指派「main」這個名稱。您可以搭配 [database-name].[table-name] 格式來使用此名稱,明確地確認 SQL 陳述式中的表格名稱是否有效。

參數

reference:Object (default = null) — 開啟的資料庫檔案位置。此值必須為 flash.filesystem.File 實體。如果參數的值為 null,則會在記憶體內部建立資料庫,並開啟此資料庫。
 
openMode:String (default = "create") — 指出資料庫以什麼方式開啟。此值可以是在 SQLMode 類別中定義的任何常數。預設值為 SQLMode.CREATE,表示如果在指定的位置找不到資料庫檔案,就建立新檔案。如果 openModeSQLMode.READ 且指定的檔案不存在,則會發生錯誤。當 reference 參數為 null 時,此參數便會遭忽略。
 
autoCompact:Boolean (default = false) — 指出是否應該自動對資料庫中未使用的空間進行回收。只有在建立新資料庫檔案或開啟其中尚未建立任何表格的資料庫檔案時,此參數才有效。根據預設,已移除之檔案所佔據的空間會殘留在資料庫檔案中,並且視需要再次使用。將此參數設定為 true 可讓資料庫自動對未使用的空間進行記憶體回收。由於每當資料寫入資料庫時,都需要額外進行處理,所以這項作業會降低系統效能,而且時間一久,還會造成資料庫檔案片段化。任何時候您都可以強制資料庫回收資料庫檔案中未使用的空間,然後使用 compact() 方法來重組資料庫檔案。

openMode 參數為 SQLMode.READ 時,此參數便會遭忽略。

 
pageSize:int (default = 1024) — 表示資料庫的分頁大小 (以位元組為單位)。只有在建立新資料庫檔案或開啟其中尚未建立任何表格的資料庫檔案時,此參數才有效。此值必須為 2 的倍數,而且下限為 512,上限為 32768。預設值為 1024 位元組。此值只能在建立任何表格之前設定。一旦建立表格,嘗試變更此值會產生錯誤。
 
encryptionKey:ByteArray (default = null) — 資料庫檔案的加密金鑰。如果 open() 呼叫建立了資料庫,此資料庫就會加密,而且指定的金鑰會當做此資料庫的加密金鑰使用。如果呼叫開啟了已加密的資料庫,此值就必須符合資料庫的加密金鑰,否則會發生錯誤。如果所開啟的資料庫並未加密,或者您要建立未加密的資料庫,此值就必須是 null (預設值),否則會發生錯誤。

有效加密金鑰的長度是 16 個位元組。記憶體內的資料庫無法加密,因此當 reference 參數的值為 null 時,這個參數就必須是 null

開啟已加密的資料庫時,如果所提供的加密金鑰不符合資料庫的加密金鑰,就會擲出 SQLError 例外狀況。在該情況下,SQLError 物件的 errorID 屬性是 3138 (「已開啟的檔案不是資料庫檔案」)。

從 AIR 1.5 開始就已經提供 encryptionKey 參數。


事件
open:SQLEvent — 當作業成功完成時傳送。

擲回值
IllegalOperationError — 當 SQLConnection 實體已連接至資料庫 (connected 屬性為 true) 時。
 
SQLError — 如果作業失敗。作業失敗之後,連線就一定會關閉。
 
ArgumentError — 針對 reference 參數指定的值不是 flash.filesystem.File 實體時
 
ArgumentError — 當 encryptionKey 引數不是 null 而且其長度不是 16 個位元組時
 
ArgumentError — 當 reference 參數是 null 而且 encryptionKey 引數不是 null
 
ArgumentError — 如果指定了無效的 pageSize 參數。當模式為 SQLMode.READ 時,這包含了傳遞分頁大小的動作。

相關 API 元素

    openAsync

()方法 
public function openAsync(reference:Object = null, openMode:String = "create", responder:Responder = null, autoCompact:Boolean = false, pageSize:int = 1024, encryptionKey:ByteArray = null):void

語言版本: ActionScript 3.0
執行階段版本: AIR 1.0

在檔案系統的指定位置上開啟一個資料庫檔案的非同步連線,或是在該位置上建立並開啟新的資料庫檔案,或者建立並開啟內存記憶體的資料庫。以此方法開啟資料庫時,使用此 SQLConnection 實體建立和開啟資料庫以及執行的其他所有作業 (包含與此 SQLConnection 實體相關聯之 SQLStatement 實體執行陳述式和其他作業) 都是以「非同步」方式執行。若要以同步方式執行這些作業,請改用 open() 方法開啟資料庫連線。

連接資料庫之後,可以使用 SQLStatement 實體來執行 SQL 命令。資料庫等級作業,例如開始或結束交易、載入資料結構資訊,以及其他使用 SQLConnection 實體來執行的作業。

使用 openAsync() 方法連接的資料庫會自動被指派「main」這個名稱。您可以搭配 [database-name].[table-name] 格式來使用此名稱,明確地確認 SQL 陳述式中的表格名稱是否有效。

參數

reference:Object (default = null) — 開啟的資料庫檔案位置。此值必須為 flash.filesystem.File 實體。如果參數的值為 null,則會在記憶體內部建立資料庫,並開啟此資料庫。
 
openMode:String (default = "create") — 指出資料庫以什麼方式開啟。此值可以是在 SQLMode 類別中定義的任何常數。預設值為 SQLMode.CREATE,表示如果在指定的位置找不到資料庫檔案,就建立新檔案。如果 openModeSQLMode.READ 且指定的檔案不存在,則會傳送錯誤事件。reference 參數為 null 時,此參數便會遭忽略。
 
responder:Responder (default = null) — 物件,指定當作業成功或失敗時要呼叫的方法。如果 responder 引數為 null,則執行作業完成時會傳送 openerror 事件。
 
autoCompact:Boolean (default = false) — 指出是否應該自動對資料庫中未使用的空間進行回收。只有在建立新資料庫檔案或開啟其中尚未建立任何表格的資料庫檔案時,此參數才有效。根據預設,已移除之檔案所佔據的空間會殘留在資料庫檔案中,並且視需要再次使用。將此參數設定為 true 可讓資料庫自動對未使用的空間進行記憶體回收。由於每當資料寫入資料庫時,都需要額外進行處理,所以這項作業會降低系統效能,而且時間一久,還會造成資料庫檔案片段化。若要隨時強制資料庫對資料庫檔案中未使用的空間進行記憶體回收並重組資料庫檔案,請使用 compact() 方法。

openMode 參數為 SQLMode.READ 時,此參數便會遭忽略。

 
pageSize:int (default = 1024) — 表示資料庫的分頁大小 (以位元組為單位)。只有在建立新資料庫檔案或開啟其中尚未建立任何表格的資料庫檔案時,此參數才有效。此值必須為 2 的倍數,而且下限為 512,上限為 32768。預設值為 1024 位元組。此值只能在建立任何表格之前設定。一旦建立表格,嘗試變更此值會產生錯誤。
 
encryptionKey:ByteArray (default = null) — 資料庫檔案的加密金鑰。如果 openAsync() 呼叫建立了資料庫,此資料庫就會加密,而且指定的金鑰會當做此資料庫的加密金鑰使用。如果呼叫開啟了已加密的資料庫,此值就必須符合資料庫的加密金鑰,否則會發生錯誤。如果所開啟的資料庫並未加密,此值就必須是 null (預設值),否則會發生錯誤。

有效加密金鑰的長度是 16 個位元組。記憶體內的資料庫無法加密,因此當 reference 參數的值為 null 時,這個參數就必須是 null

開啟已加密的資料庫時,如果所提供的加密金鑰不符合資料庫的加密金鑰,就會傳送 SQLErrorEvent。事件物件的 error 屬性包含 SQLError 實體。該 SQLError 物件的 errorID 屬性是 3138 (「已開啟的檔案不是資料庫檔案」)。

從 AIR 1.5 開始就已經提供 encryptionKey 參數。


事件
open:SQLEvent — 當作業成功完成時傳送。
 
error:SQLErrorEvent — 當作業失敗時傳送。作業失敗之後,連線就一定會關閉。

擲回值
IllegalOperationError — 當 SQLConnection 實體已連接至資料庫 (connected 屬性為 true) 時。
 
ArgumentError — 針對 reference 參數指定的值不是 flash.filesystem.File 實體時
 
ArgumentError — 當 encryptionKey 引數不是 null 而且其長度不是 16 個位元組時
 
ArgumentError — 當 reference 參數是 null 而且 encryptionKey 引數不是 null
 
ArgumentError — 如果指定了無效的 pageSize 參數。當模式為 SQLMode.READ 時,這包含了傳遞分頁大小的動作。

相關 API 元素

    reencrypt

()方法 
public function reencrypt(newEncryptionKey:ByteArray, responder:Responder = null):void

語言版本: ActionScript 3.0
執行階段版本: AIR 1.5

變更已加密資料庫的加密金鑰。這個方法只會影響主要資料庫 (使用 open()openAsync() 方法所連接的資料庫) 的加密金鑰。您只能針對建立時已加密的資料庫呼叫 reencrypt()。一旦資料庫已經建立成加密資料庫,您就無法取消加密。同樣地,建立時未加密的資料庫無法之後進行加密。

重新加密作業會在自己的交易中執行。如果重新加密程序中斷,資料庫就會回復交易而且不會變更加密金鑰。

參數

newEncryptionKey:ByteArray — ByteArray,其中包含資料庫的新加密金鑰。有效加密金鑰的長度是 16 個位元組。
 
responder:Responder (default = null) — 物件,指定當作業成功或失敗時要呼叫的方法。如果 responder 引數為 null,則執行作業完成時會傳送 reencrypterror 事件。


事件
reencrypt:SQLEvent — 當作業成功完成時傳送。
 
error:SQLErrorEvent — 當作業失敗時傳送。

擲回值
ArgumentError — 當 newEncryptionKey 值是 null 或者其長度不是 16 個位元組時。
 
IllegalOperationError — 當連線並未開啟,或者存在已開啟的交易時。
 
SQLError — 如果作業在同步執行模式下失敗。

相關 API 元素

    releaseSavepoint

()方法 
public function releaseSavepoint(name:String = null, responder:Responder = null):void

語言版本: ActionScript 3.0
執行階段版本: AIR 2

從最近儲存點或者在指定名稱時,從該指定名稱儲存點之後所做的 SQL 作業,這個方法都會予以認可。

注意:在認可整項交易之後,所做的任何變更才會永久儲存至資料庫。若交易是使用 begin() 方法開始的,您就必須呼叫 commit() 方法來認可整項交易。若交易是呼叫 setSavepoint() 來開始的,而 inTransactionfalse,您可以呼 commit() 方法,或者為交易的第一個儲存點來呼叫 releaseSavepoint()rollbackToSavepoint(),便可以完成整項交易。

若程式碼呼叫 rollback() 方法,它會永久捨棄交易中所有的變更,無論是否在復原交易之前呼叫 releaseSavepoint()

若呼叫此方法時未加上參數 (或者 name 參數使用 null),則最近未命名的儲存點 (呼叫 setSavepoint() 但未加上 name 參數所建立的最新儲存點) 之後所做的資料庫變更,都會予以認可。例如,若呼叫 setSavepoint() 方法三次,就會設定三個儲存點。此時呼叫 releaseSavepoint() 會認可第三個 (最新的) 儲存點之後所執行的 SQL 作業。

若為 name 參數提供值,此方法會認可指定名稱儲存點之後所執行的所有 SQL 作業。若在指定的儲存點之後,又建立了其他的儲存點,則在這些儲存點之後所執行的作業也會予以認可。

儲存點一旦釋放或撤回之後,儲存點以及任何最新的儲存點都會加以移除。若程式碼在 releaseSavepoint() 之後執行其他 SQL 作業,或 rollbackToSavepoint() 呼叫移除某一個儲存點,則這些作業屬於其他剩餘的最近儲存點。(換言之,它們屬於在移除儲存點之前最近建立的儲存點)。若沒有剩餘任何儲存點,則作業屬於主交易。

參數

name:String (default = null) — 字串 - 儲存點的名稱,該儲存點的所有 SQL 作業都會被認可。若未提供任何值,或者它的參數是 null (預設值),則會使用最近未命名的儲存點 (呼叫 setSavepoint() 而且不加上 name 值時所建立的)。name 值不可以是空字串 ("")。
 
responder:Responder (default = null) — Responder - 一個物件,指定當作業成功或失敗時要呼叫的方法。在非同步執行模式下,如果 responder 引數為 null,則執行作業完成時會傳送 releaseSavepointerror 事件。


事件
releaseSavepoint:SQLEvent — 當作業成功完成時傳送。
 
error:SQLErrorEvent — 當作業在非同步執行模式下失敗時傳送。

擲回值
ArgumentError — 當 name 參數值是空字串 ("")。
 
IllegalOperationError — 如果 SQLConnection 實體並未連接至資料庫 (connected 屬性為 false) 而呼叫此方法,或是沒有開啟任何交易的情況下 (inTransaction 屬性為 false)。
 
SQLError — 如果作業在同步執行模式下失敗。

相關 API 元素

    removeEventListener

()方法 
override public function removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void

語言版本: ActionScript 3.0
執行階段版本: AIR 1.0

會從 EventDispatcher 物件移除偵聽程式。 如果沒有相符的偵聽程式以 EventDispatcher 物件來註冊,則呼叫此方法不會產生任何作用。

參數

type:String — 事件類型。
 
listener:Function — 要移除的偵聽程式物件。
 
useCapture:Boolean (default = false)指定偵聽程式是否針對捕捉階段或目標與反昇階段而註冊。如果偵聽程式同時針對捕捉階段和目標與反昇階段而註冊,則必須移除對 removeEventListener() 的兩次呼叫 (一次呼叫的 useCapture() 是設為 true,另一次呼叫的 useCapture() 則是設定為 false),才能移除這兩個階段。

    rollback

()方法 
public function rollback(responder:Responder = null):void

語言版本: ActionScript 3.0
執行階段版本: AIR 1.0

復原使用 begin() 方法所建立的現有交易,代表將捨棄交易中由任何 SQL 陳述式所做的變更。

您可以呼叫 setSavepoint() 方法,在交易中標記一個中間儲存點。利用儲存體,您就可以呼叫 releaseSavepoint() 方法來認可交易的某些部分,或者呼叫 rollbackToSavepoint()來復原交易中的某些部分。不過,呼叫 rollback() 方法會永久捨棄交易中所有的變更,無論個別儲存點是否在復原交易之前已經釋放 (認可)。

參數

responder:Responder (default = null) — 物件,指定當作業成功或失敗時要呼叫的方法。在非同步執行模式下,如果 responder 引數為 null,則執行作業完成時會傳送 rollbackerror 事件。


事件
rollback:SQLEvent — 當作業成功完成時傳送。
 
error:SQLErrorEvent — 當作業在非同步執行模式下失敗時傳送。

擲回值
IllegalOperationError — 如果 SQLConnection 實體並未連接至資料庫 (connected 屬性為 false) 而呼叫此方法,或是沒有開啟任何交易的情況下 (inTransaction 屬性為 false)。
 
SQLError — 如果作業在同步執行模式下失敗。

相關 API 元素

    rollbackToSavepoint

()方法 
public function rollbackToSavepoint(name:String = null, responder:Responder = null):void

語言版本: ActionScript 3.0
執行階段版本: AIR 2

將最近儲存點或者在指定名稱時,從該指定名稱儲存點之後所做的 SQL 作業加以復原。

注意:若呼叫 commit() 方法來認可整項交易,則尚未使用 rollbackToSavepoint() 方法復原的交易變更,會永久儲存至資料庫。此外,呼叫 rollback() 方法會永久捨棄所有的變更,無論個別儲存點是否在復原交易之前已經釋放 (認可) 或復原

若呼叫此方法時未加上參數 (或者 name 參數使用 null),則最近未命名的儲存點 (呼叫 setSavepoint() 但未加上 name 參數建立的最新儲存點) 之後所做的資料庫變更,都會被復原。

若為 name 參數提供值,此方法會復原指定名稱儲存點之後所執行的所有 SQL 作業。若在指定的儲存點之後,又建立了其他的儲存點,則在這些儲存點之後所執行的作業也會予以復原。

儲存點一旦釋放或撤回之後,儲存點以及任何最新的儲存點都會加以移除。若程式碼在 releaseSavepoint() 之後執行其他 SQL 作業,或 rollbackToSavepoint() 呼叫移除某一個儲存點,則這些作業屬於其他剩餘的最近儲存點。(換言之,它們屬於在移除儲存點之前最近建立的儲存點)。若沒有剩餘任何儲存點,則作業屬於主交易。

參數

name:String (default = null) — 字串 - 儲存點的名稱,資料庫狀態應復原至該儲存點。若未提供任何值,或者它的參數是 null (預設值) ,則會使用最近未命名的儲存點 (呼叫 setSavepoint() 而且不加上 name 值)。name 值不可以是空字串 ("")。
 
responder:Responder (default = null) — Responder - 一個物件,指定當作業成功或失敗時要呼叫的方法。在非同步執行模式下,如果 responder 引數為 null,則執行作業完成時會傳送 rollbackToSavepointerror 事件。


事件
rollbackToSavepoint:SQLEvent — 當作業成功完成時傳送。
 
error:SQLErrorEvent — 當作業在非同步執行模式下失敗時傳送。

擲回值
ArgumentError — 當 name 參數值是空字串 ("")。
 
IllegalOperationError — 如果 SQLConnection 實體並未連接至資料庫 (connected 屬性為 false) 而呼叫此方法,或是沒有開啟任何交易的情況下 (inTransaction 屬性為 false)。
 
SQLError — 如果作業在同步執行模式下失敗。

相關 API 元素

    setSavepoint

()方法 
public function setSavepoint(name:String = null, responder:Responder = null):void

語言版本: ActionScript 3.0
執行階段版本: AIR 2

建立一個儲存點,它就像是資料庫交易中的書籤。儲存點代表交易中的某一點。在儲存點之間執行的一組 SQL 作業可以使用 releaseSavepoint()rollbackToSavepoint() 方法,從其他作業中個別認可或復原。在這種方式下,使用儲存點可以讓您將一組 SQL 作業當做是巢狀交易。

呼叫 setSavepoint() 方法時,若交易尚未 (透過呼叫 begin() 方法) 開啟,則呼叫此方法會開始交易,並在交易開始時建立儲存點。若交易已經開始,呼叫 setSavepoint() 會在交易中建立一個儲存點。

注意:在認可整項交易之後,所做的任何變更才會永久儲存至資料庫。若交易是使用 begin() 方法開始的,您就必須呼叫 commit() 方法來認可整項交易。若交易是呼叫 setSavepoint() 來開始的,而 inTransactionfalse,您可以呼 commit() 方法,完成整項交易。當您為開始交易的儲存點來呼叫 releaseSavepoint()rollbackToSavepoint() 時,也會自動完成交易。

您可以為 name 參數提供一個值,就可以指定儲存點的名稱。這樣可以讓您復原或認可指定儲存點之後所做的變更。若未指定名稱 (預設值),則會建立未命名的儲存點。

儲存點一旦釋放或撤回之後,儲存點以及任何最新的儲存點都會加以移除。若程式碼在 releaseSavepoint() 之後執行其他 SQL 作業,或 rollbackToSavepoint() 呼叫移除某一個儲存點,則這些作業屬於其他剩餘的最近儲存點。(換言之,它們屬於在移除儲存點之前最近建立的儲存點)。若沒有剩餘任何儲存點,則作業屬於主交易。

參數

name:String (default = null) — 字串 - 儲存點的名稱。若未提供任何值或者此參數為 null (預設值),則下一次呼叫 releaseSavepoint()rollbackToSavepoint() 而且未指定 name 參數,就會認可或復原自未命名儲存點之後所執行的 SQL 作業。

若提供的名稱與先前命名的儲存點重複,則下次呼叫 SQLConnection.releaseSavepoint()SQLConnection.rollbackToSavepoint() 時會認可或復原自最近該名稱的儲存點之後所做的變更。

name 值不可以是空字串 ("")。

 
responder:Responder (default = null) — Responder - 一個物件,指定當作業成功或失敗時要呼叫的方法。在非同步執行模式下,如果 responder 引數為 null,則執行作業完成時會傳送 setSavepointerror 事件。


事件
setSavepoint:SQLEvent — 當作業成功完成時傳送。
 
error:SQLErrorEvent — 當作業在非同步執行模式下失敗時傳送。

擲回值
ArgumentError — 當 name 參數值是空字串 ("")。
 
IllegalOperationError — 當 SQLConnection 實體並未連接至資料庫 (connected 屬性為 false) 就呼叫此方法時。
 
SQLError — 如果作業在同步執行模式下失敗。

相關 API 元素

事件詳細資訊
    

analyze

事件
事件物件類型: flash.events.SQLEvent
屬性 SQLEvent.type = flash.events.SQLEvent.ANALYZE

語言版本: ActionScript 3.0
執行階段版本: AIR 1.0

analyze() 作業成功完成時傳送。

SQLEvent.ANALYZE 常數會定義 analyze 事件物件的 type 屬性值。當 SQLConnection.analyze() 方法呼叫成功完成時,便會傳送此類型的事件。analyze 事件具有下列屬性:
屬性
bubblesfalse
cancelablefalse;沒有要取消的預設行為指令。
currentTarget正主動使用事件偵聽程式處理 Event 物件的物件。
target執行此作業的 SQLConnection 物件。

相關 API 元素

    

attach

事件  
事件物件類型: flash.events.SQLEvent
屬性 SQLEvent.type = flash.events.SQLEvent.ATTACH

語言版本: ActionScript 3.0
執行階段版本: AIR 1.0

attach() 方法呼叫的作業成功完成時傳送。

SQLEvent.ATTACH 常數會定義 attach 事件物件的 type 屬性值。當 SQLConnection.attach() 方法呼叫成功完成時,便會傳送此類型的事件。attach 事件具有下列屬性:
屬性
bubblesfalse
cancelablefalse;沒有要取消的預設行為指令。
currentTarget正主動使用事件偵聽程式處理 Event 物件的物件。
target執行此作業的 SQLConnection 物件。

相關 API 元素

    

begin

事件  
事件物件類型: flash.events.SQLEvent
屬性 SQLEvent.type = flash.events.SQLEvent.BEGIN

語言版本: ActionScript 3.0
執行階段版本: AIR 1.0

begin() 方法呼叫的作業成功完成時傳送。

SQLEvent.BEGIN 常數會定義 begin 事件物件的 type 屬性值。當 SQLConnection.begin() 方法呼叫成功完成時,便會傳送此類型的事件。begin 事件具有下列屬性:
屬性
bubblesfalse
cancelablefalse;沒有要取消的預設行為指令。
currentTarget正主動使用事件偵聽程式處理 Event 物件的物件。
target執行此作業的 SQLConnection 物件。

相關 API 元素

    

cancel

事件  
事件物件類型: flash.events.SQLEvent
屬性 SQLEvent.type = flash.events.SQLEvent.CANCEL

語言版本: ActionScript 3.0
執行階段版本: AIR 1.0

cancel() 方法呼叫的作業成功完成時傳送。

SQLEvent.CANCEL 常數會定義 cancel 事件物件的 type 屬性值。當 SQLConnection.cancel() 方法呼叫成功完成時,便會傳送此類型的事件。cancel 事件具有下列屬性:
屬性
bubblesfalse
cancelablefalse;沒有要取消的預設行為指令。
currentTarget正主動使用事件偵聽程式處理 Event 物件的物件。
target執行此作業的 SQLConnection 或 SQLStatement 物件。

相關 API 元素

    

close

事件  
事件物件類型: flash.events.SQLEvent
屬性 SQLEvent.type = flash.events.SQLEvent.CLOSE

語言版本: ActionScript 3.0
執行階段版本: AIR 1.0

close() 方法呼叫的作業成功完成時傳送。

SQLEvent.CLOSE 常數會定義 close 事件物件的 type 屬性值。當 SQLConnection.close() 方法呼叫成功完成時,便會傳送此類型的事件。close 事件具有下列屬性:
屬性
bubblesfalse
cancelablefalse;沒有要取消的預設行為指令。
currentTarget正主動使用事件偵聽程式處理 Event 物件的物件。
target執行此作業的 SQLConnection 物件。

相關 API 元素

    

commit

事件  
事件物件類型: flash.events.SQLEvent
屬性 SQLEvent.type = flash.events.SQLEvent.COMMIT

語言版本: ActionScript 3.0
執行階段版本: AIR 1.0

commit() 方法呼叫的作業成功完成時傳送。

SQLEvent.COMMIT 常數會定義 commit 事件物件的 type 屬性值。當 SQLConnection.commit() 方法呼叫成功完成時,便會傳送此類型的事件。commit 事件具有下列屬性:
屬性
bubblesfalse
cancelablefalse;沒有要取消的預設行為指令。
currentTarget正主動使用事件偵聽程式處理 Event 物件的物件。
target執行此作業的 SQLConnection 物件。

相關 API 元素

    

compact

事件  
事件物件類型: flash.events.SQLEvent
屬性 SQLEvent.type = flash.events.SQLEvent.COMPACT

語言版本: ActionScript 3.0
執行階段版本: AIR 1.0

compact() 方法呼叫的作業成功完成時傳送。

SQLEvent.COMPACT 常數會定義 compact 事件物件的 type 屬性值。當 SQLConnection.compact() 方法呼叫成功完成時,便會傳送此類型的事件。compact 事件具有下列屬性:
屬性
bubblesfalse
cancelablefalse;沒有要取消的預設行為指令。
currentTarget正主動使用事件偵聽程式處理 Event 物件的物件。
target執行此作業的 SQLConnection 物件。

相關 API 元素

    

deanalyze

事件  
事件物件類型: flash.events.SQLEvent
屬性 SQLEvent.type = flash.events.SQLEvent.DEANALYZE

語言版本: ActionScript 3.0
執行階段版本: AIR 1.0

deanalyze() 方法呼叫的作業成功完成時傳送。

SQLEvent.DEANALYZE 常數會定義 deanalyze 事件物件的 type 屬性值。當 SQLConnection.deanalyze() 方法呼叫成功完成時,便會傳送此類型的事件。deanalyze 事件具有下列屬性:
屬性
bubblesfalse
cancelablefalse;沒有要取消的預設行為指令。
currentTarget正主動使用事件偵聽程式處理 Event 物件的物件。
target執行此作業的 SQLConnection 物件。

相關 API 元素

    

delete

事件  
事件物件類型: flash.events.SQLUpdateEvent
屬性 SQLUpdateEvent.type = flash.events.SQLUpdateEvent.DELETE

語言版本: ActionScript 3.0
執行階段版本: AIR 1.0

當任何連線資料庫之任何表格內的資料因為執行 SQL DELETE 命令而變更時傳送。資料變更可能是透過 SQLStatement 實體執行 DELETE 陳述式直接造成的結果,或是觸發器為回應陳述式的執行而觸發間接造成的結果。

SQLUpdateEvent.DELETE 常數會定義 SQLConnection delete 事件的 type 屬性值。delete 事件具有下列屬性:
屬性
bubblesfalse
cancelablefalse;沒有要取消的預設行為指令。
currentTarget正主動使用事件偵聽程式處理 Event 物件的物件。
rowID已插入、刪除,或更新之列的唯一列識別名稱。
target針對其執行作業的 SQLConnection 物件。
table內容發生變更的表格名稱。

相關 API 元素

    

detach

事件  
事件物件類型: flash.events.SQLEvent
屬性 SQLEvent.type = flash.events.SQLEvent.DETACH

語言版本: ActionScript 3.0
執行階段版本: AIR 1.0

detach() 方法呼叫的作業成功完成時傳送。

SQLEvent.DETACH 常數會定義 detach 事件物件的 type 屬性值。當 SQLConnection.detach() 方法呼叫成功完成時,便會傳送此類型的事件。
屬性
bubblesfalse
cancelablefalse;沒有要取消的預設行為指令。
currentTarget正主動使用事件偵聽程式處理 Event 物件的物件。
target執行此作業的 SQLConnection 物件。

相關 API 元素

    

error

事件  
事件物件類型: flash.events.SQLErrorEvent
屬性 SQLErrorEvent.type = flash.events.SQLErrorEvent.ERROR

語言版本: ActionScript 3.0
執行階段版本: AIR 1.0

當任何一個 SQLConnection 物件的非同步作業出現錯誤時傳送。當做事件物件傳遞的 SQLErrorEvent 實體具有 error 屬性,其中包含嘗試執行之作業和失敗原因的相關資訊。

SQLErrorEvent.ERROR 常數會定義 error 事件的 type 屬性值,當對 SQLConnection 或 SQLStatement 實體的呼叫發生錯誤而結束時,便會傳送此事件。error 事件具有下列屬性:
屬性
bubblesfalse
cancelablefalse;沒有要取消的預設行為指令。
errorSQLError 物件,其中包含發生的錯誤類型和造成錯誤的作業相關資訊。
currentTarget正主動使用事件偵聽程式處理 Event 物件的物件。
target報告錯誤的 SQLConnection 或 SQLStatement 物件。
    

insert

事件  
事件物件類型: flash.events.SQLUpdateEvent
屬性 SQLUpdateEvent.type = flash.events.SQLUpdateEvent.INSERT

語言版本: ActionScript 3.0
執行階段版本: AIR 1.0

當任何連線資料庫之任何表格內的資料因為執行 SQL INSERT 命令而變更時傳送。資料變更可能是透過 SQLStatement 實體執行 INSERT 陳述式直接造成的結果,或是觸發器為回應陳述式的執行而觸發間接造成的結果。

SQLUpdateEvent.INSERT 常數會定義 SQLConnection insert 事件的 type 屬性值。insert 事件具有下列屬性:
屬性
bubblesfalse
cancelablefalse;沒有要取消的預設行為指令。
currentTarget正主動使用事件偵聽程式處理 Event 物件的物件。
rowID已插入、刪除,或更新之列的唯一列識別名稱。
target針對其執行作業的 SQLConnection 物件。
table內容發生變更的表格名稱。

相關 API 元素

    

open

事件  
事件物件類型: flash.events.SQLEvent
屬性 SQLEvent.type = flash.events.SQLEvent.OPEN

語言版本: ActionScript 3.0
執行階段版本: AIR 1.0

openAsync() 方法呼叫的作業成功完成時傳送。

SQLEvent.OPEN 常數會定義 open 事件物件的 type 屬性值。當 SQLConnection.open()SQLConnection.openAsync() 方法呼叫成功完成時,便會傳送此類型的事件。open 事件具有下列屬性:
屬性
bubblesfalse
cancelablefalse;沒有要取消的預設行為指令。
currentTarget正主動使用事件偵聽程式處理 Event 物件的物件。
target執行此作業的 SQLConnection 物件。

相關 API 元素

    

reencrypt

事件  
事件物件類型: flash.events.SQLEvent
屬性 SQLEvent.type = flash.events.SQLEvent.REENCRYPT

語言版本: ActionScript 3.0
執行階段版本: AIR 1.5

reencrypt() 方法呼叫的作業成功完成時傳送。

SQLEvent.REENCRYPT 常數會定義 reencrypt 事件物件的 type 屬性值。當 SQLConnection.reencrypt() 方法呼叫成功完成時,便會傳送此類型的事件。reencrypt 事件具有下列屬性:
屬性
bubblesfalse
cancelablefalse;沒有要取消的預設行為指令。
currentTarget正主動使用事件偵聽程式處理 Event 物件的物件。
target執行此作業的 SQLConnection 物件。

相關 API 元素

    

releaseSavepoint

事件  
事件物件類型: flash.events.SQLEvent
屬性 SQLEvent.type = flash.events.SQLEvent.RELEASE_SAVEPOINT

語言版本: ActionScript 3.0
執行階段版本: AIR 2

releaseSavepoint() 方法呼叫的作業成功完成時傳送。

SQLEvent.RELEASE_SAVEPOINT 常數定義 releaseSavepoint 事件物件的 type 屬性值。當 SQLConnection.releaseSavepoint() 方法呼叫成功完成時,便會傳送此類型的事件。releaseSavepoint 事件具有下列屬性:
屬性
bubblesfalse
cancelablefalse;沒有要取消的預設行為指令。
currentTarget正主動使用事件偵聽程式處理 Event 物件的物件。
target執行此作業的 SQLConnection 物件。

相關 API 元素

    

rollback

事件  
事件物件類型: flash.events.SQLEvent
屬性 SQLEvent.type = flash.events.SQLEvent.ROLLBACK

語言版本: ActionScript 3.0
執行階段版本: AIR 1.0

rollback() 方法呼叫的作業成功完成時傳送。

SQLEvent.ROLLBACK 常數會定義 rollback 事件物件的 type 屬性值。當 SQLConnection.rollback() 方法呼叫成功完成時,便會傳送此類型的事件。rollback 事件具有下列屬性:
屬性
bubblesfalse
cancelablefalse;沒有要取消的預設行為指令。
currentTarget正主動使用事件偵聽程式處理 Event 物件的物件。
target執行此作業的 SQLConnection 物件。

相關 API 元素

    

rollbackToSavepoint

事件  
事件物件類型: flash.events.SQLEvent
屬性 SQLEvent.type = flash.events.SQLEvent.ROLLBACK_TO_SAVEPOINT

語言版本: ActionScript 3.0
執行階段版本: AIR 2

rollbackToSavepoint() 方法呼叫的作業成功完成時傳送。

SQLEvent.ROLLBACK_TO_SAVEPOINT 常數定義 rollbackToSavepoint 事件物件的 type 屬性值。當 SQLConnection.rollbackToSavepoint() 方法呼叫成功完成時,便會傳送此類型的事件。rollbackToSavepoint 事件具有下列屬性:
屬性
bubblesfalse
cancelablefalse;沒有要取消的預設行為指令。
currentTarget正主動使用事件偵聽程式處理 Event 物件的物件。
target執行此作業的 SQLConnection 物件。

相關 API 元素

    

schema

事件  
事件物件類型: flash.events.SQLEvent
屬性 SQLEvent.type = flash.events.SQLEvent.SCHEMA

語言版本: ActionScript 3.0
執行階段版本: AIR 1.0

loadSchema() 方法呼叫的作業成功完成且結構結果就緒時傳送。

SQLEvent.SCHEMA 常數會定義 schema 事件物件的 type 屬性值。當 SQLConnection.loadSchema() 方法成功完成時傳送。一旦傳送 SQLEvent.SCHEMA 事件,就可以使用 SQLConnection.getSchemaResult() 方法來取得結構資訊。schema 事件具有下列屬性:
屬性
bubblesfalse
cancelablefalse;沒有要取消的預設行為指令。
currentTarget正主動使用事件偵聽程式處理 Event 物件的物件。
target執行此作業的 SQLConnection 物件。

相關 API 元素

    

setSavepoint

事件  
事件物件類型: flash.events.SQLEvent
屬性 SQLEvent.type = flash.events.SQLEvent.SET_SAVEPOINT

語言版本: ActionScript 3.0
執行階段版本: AIR 2

setSavepoint() 方法呼叫的作業成功完成時傳送。

SQLEvent.SET_SAVEPOINT 常數定義 setSavepoint 事件物件的 type 屬性值。當 SQLConnection.setSavepoint() 方法呼叫成功完成時,便會傳送此類型的事件。setSavepoint 事件具有下列屬性:
屬性
bubblesfalse
cancelablefalse;沒有要取消的預設行為指令。
currentTarget正主動使用事件偵聽程式處理 Event 物件的物件。
target執行此作業的 SQLConnection 物件。

相關 API 元素

    

update

事件  
事件物件類型: flash.events.SQLUpdateEvent
屬性 SQLUpdateEvent.type = flash.events.SQLUpdateEvent.UPDATE

語言版本: ActionScript 3.0
執行階段版本: AIR 1.0

當任何連線資料庫之任何表格內的資料因為執行 SQL UPDATE 命令而變更時傳送。資料變更可能是透過 SQLStatement 實體執行 UPDATE 陳述式直接造成的結果,或是觸發器為回應陳述式的執行而觸發間接造成的結果。

SQLUpdateEvent.UPDATE 常數會定義 SQLConnection update 事件的 type 屬性值。

update 事件具有下列屬性:

屬性
bubblesfalse
cancelablefalse;沒有要取消的預設行為指令。
currentTarget正主動使用事件偵聽程式處理 Event 物件的物件。
rowID已插入、刪除,或更新之列的唯一列識別名稱。
target針對其執行作業的 SQLConnection 物件。
table內容發生變更的表格名稱。

相關 API 元素





[ X ]為什麼顯示英文?
「ActionScript 3.0 參考」的內容是以英文顯示

並非所有「ActionScript 3.0 參考」的內容都翻譯為所有語言。當語言元素未翻譯時,就會以英文顯示。例如,ga.controls.HelpBox 類別並沒有翻譯為任何語言。因此在參考的繁體中文版本中,ga.controls.HelpBox 類別就會以英文顯示。