惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

B
Blog RSS Feed
J
Java Code Geeks
C
Check Point Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Google DeepMind News
Google DeepMind News
阮一峰的网络日志
阮一峰的网络日志
Engineering at Meta
Engineering at Meta
Blog — PlanetScale
Blog — PlanetScale
D
Docker
H
Hackread – Cybersecurity News, Data Breaches, AI and More
月光博客
月光博客
I
InfoQ
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
A
About on SuperTechFans
L
LangChain Blog
腾讯CDC
Y
Y Combinator Blog
MongoDB | Blog
MongoDB | Blog
Vercel News
Vercel News
MyScale Blog
MyScale Blog
博客园 - Franky
IT之家
IT之家
博客园_首页

博客园 - 剑廿三

AirExcel -用于导出 Excel 2007 文件的 Flex AIR 组件 初版发布 Flex 遍历 ArrayCollection, Array Flex SQLite: 一次执行多个SQL,查询两个表的数据,导入datagrid Flex AIR SQLite Flex AIR: 使用透明 NativeWindow 窗体呈现 Line Chart 的一个 bug (Exception in CartesianChart/updateMultipleAxesStyles) Flex AIR:用 mx:Image 实现的动态图片按钮 Flex AIR:Line Chart 示例-从 XML 原始数据运算得出增长率图表 Flex AIR:Line Chart 示例-用 XML 画图表很简单 Flex: 抓取网页,通过 XML 获取部分内容 Flex: 通过 DataGrid 操作 XML 文件 PSP 使用 Web FTP (JSP, on EeeBox) 的两项设定 PS3 的 UserAgent PSP2000 的 UserAgent Windows Vista Ultimate 上基于 IE7 的 Maxthon 2.1.5 的 UserAgent OEM正版Windows Vista Home Premium上的 IE8 的 UserAgent EeeBox B202 上基于 Windows XP Pro SP2 的 IE7 的 UserAgent EeeBox B202上基于 Windows XP Pro SP2 IE7 的 Maxthon 2.1.5 的 UserAgent OEM正版Windows Vista Home Premium上的 Firefox 3.5.5 中文版的 UserAgent OEM正版Windows Vista Home Premium上基于IE8的 Maxthon 2.5.9 的 UserAgent
Flex SQLite Batch Insert Datas from Array
剑廿三 · 2010-07-27 · via 博客园 - 剑廿三

Posted on 2010-07-27 08:19  剑廿三  阅读(663)  评论()    收藏  举报

        [Bindable(event="message")]
        
private function dbSyncData():void 
        { 
            
            stmt.addEventListener(SQLEvent.RESULT, dbExecuteBatchSQL);
            
            var dataArray:Array 
= this.params.SyncDataArray as Array;
            
            
if(dataArray == null){
                dispatchEvent(
new MessagesEvent("同步到 SQLite","失败:数据源记录集是空的。"));
                
return;
            }
            
            var dataTable:String 
= this.params.SyncDataTable as String;
            
            
if(dataTable == null){
                dispatchEvent(
new MessagesEvent("同步到 SQLite","失败:数据表名称未定义。"));
                
return;
            }
            
            dispatchEvent(
new MessagesEvent("同步到 SQLite","准备将 "+ dataArray.length +" 条记录同步到 "+ dataTable +" 数据表"));
            
            
this._execSQLBatch = new Array();
            
            
if(dataTable == "stockdaily"){
                
for(var i:int=0;i<dataArray.length;i++){
                    var o:Object 
= dataArray[i];
                    var sql:String 
= "INSERT INTO stockdaily (StatDate,Symbol,FinalPrice,HighPrice,LowPrice,DealVolume,DealMoney,RunDate) "+
                        
" VALUES ('@StatDate','@Symbol',@FinalPrice,@HighPrice,@LowPrice,@DealVolume,@DealMoney,'@RunDate')"
                        .replace(
"@StatDate", o["StatDate"])
                        .replace(
"@Symbol", o["Symbol"])
                        .replace(
"@FinalPrice", o["FinalPrice"])
                        .replace(
"@HighPrice", o["HighPrice"])
                        .replace(
"@LowPrice", o["LowPrice"])
                        .replace(
"@DealVolume", o["DealVolume"])
                        .replace(
"@DealMoney", o["DealMoney"])
                        .replace(
"@RunDate", o["RunDate"])
                        ;
                    
this._execSQLBatch.push(sql);
                }
            }
else if(dataTable == "stockdailywatch"){
                
for(var i:int=0;i<dataArray.length;i++){
                    var o:Object 
= dataArray[i];
                    var sql:String 
= "INSERT INTO stockdailywatch (Symbol,Name) VALUES ('@Symbol','@Name')"
                        .replace(
"@StatDate", o["StatDate"])
                        .replace(
"@Name", o["Name"])
                        ;
                    
this._execSQLBatch.push(sql);
                }
            }
            
            
this._execSQLCallLatency = this.dbSyncDataResult;
            
            
this.dbExecuteBatchSQL(null);
            
        }
        
        
private function dbSyncData():void 
        { 
            dispatchEvent(
new MessagesEvent("同步到 SQLite","同步数据完毕。"));
        }