My favorites | Sign in
Project Home Downloads Wiki Issues Source
Checkout   Browse   Changes    
 
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
// GNU GPL License - 2008
//----------------------------------------------
// Villagrán & Quiroz
// http://www.villagranquiroz.cl
package FlexMediaPlayer
{
import flash.errors.SQLError;

public class SQLiteConnector {
import flash.data.SQLConnection;
import flash.data.SQLMode;
import flash.data.SQLStatement;
import flash.data.SQLResult;
import flash.events.SQLErrorEvent;
import flash.events.SQLEvent;
import flash.filesystem.File;
import mx.utils.ObjectUtil;

private var conn:SQLConnection;
private var dbFile:File;
public function SQLiteConnector() {
conn = new SQLConnection;
}
// Get & Set
public function get sqlConnector():SQLConnection { return conn; }
public function set DbFile(setValue:String):void {
if(!File.documentsDirectory.resolvePath(setValue).exists) {
File.applicationDirectory.resolvePath(setValue).copyTo(File.documentsDirectory.resolvePath(setValue), true);
}
dbFile = File.documentsDirectory.resolvePath(setValue);
}
// Functions
public function Connect():void {
try {
conn.open(dbFile, SQLMode.UPDATE);
} catch(error:SQLError) {
trace("Error message:", error.message);
trace("Details:", error.details);
}
}
public function Disconnect():void {
try {
conn.close();
} catch(error:SQLError) {
trace("Error message:", error.message);
trace("Details:", error.details);
}

}
public function DoSQL(sql:String, param1:String = ""):SQLResult {
Connect();

var statement:SQLStatement = new SQLStatement();

statement.sqlConnection = conn;
statement.text = sql;

try {
if(param1 != "")
statement.parameters[":param1"] = param1;
statement.execute();
var result:SQLResult = statement.getResult()

} catch(error:SQLError) {
trace("Error message:", error.message);
trace("Details:", error.details);
}
Disconnect();
if(result != null)
return result;

return null;
}
public function FetchOne(sql:String, param1:String = ""):String {
var result:SQLResult = DoSQL(sql, param1);

for (var i:int = 0; i < result.data.length; i++) {
for (var columnName:String in result.data[i]) {
return result.data[i][columnName];
}

}

return null;
}
public function FetchArray(sql:String, param1:String = ""):Array {
var result:SQLResult = DoSQL(sql, param1);
return result.data;
}
}
}

Change log

r5 by and...@villagranquiroz.cl on May 26, 2008   Diff
Added:
- Find Media Status
- Changed Algorithms for reading Media
(First insert paths, Second read ID3 Tags)
- CoverBox Resize Effect
- Volume Bar
- Played time and Total time
Go to: 
Project members, sign in to write a code review

Older revisions

r4 by and...@villagranquiroz.cl on May 26, 2008   Diff
[No log message]
r2 by and...@villagranquiroz.cl on May 11, 2008   Diff
First Alpha Commit, only plays audio
files.
All revisions of this file

File info

Size: 2549 bytes, 91 lines

File properties

svn:executable
*
Powered by Google Project Hosting