From 6bce0d501fe33419f6a73f0fd84f0de597f1eab0 Mon Sep 17 00:00:00 2001 From: Vladimir Enchev Date: Thu, 13 Mar 2014 14:41:07 +0200 Subject: [PATCH] database removed because of missing iOS implementation --- BCL.csproj | 13 ----- Database/Readme.md | 28 ---------- Database/database.android.ts | 92 ------------------------------- Database/database.d.ts | 16 ------ Database/database.ios.ts | 53 ------------------ Database/database_query_result.ts | 21 ------- 6 files changed, 223 deletions(-) delete mode 100644 Database/Readme.md delete mode 100644 Database/database.android.ts delete mode 100644 Database/database.d.ts delete mode 100644 Database/database.ios.ts delete mode 100644 Database/database_query_result.ts diff --git a/BCL.csproj b/BCL.csproj index fdb309b36..2f1466d17 100644 --- a/BCL.csproj +++ b/BCL.csproj @@ -63,13 +63,6 @@ application.d.ts - - database.d.ts - - - - database.d.ts - declarations.d.ts @@ -81,9 +74,6 @@ camera.d.ts - - database.d.ts - declarations.d.ts @@ -132,9 +122,6 @@ - - - diff --git a/Database/Readme.md b/Database/Readme.md deleted file mode 100644 index ece3a25d1..000000000 --- a/Database/Readme.md +++ /dev/null @@ -1,28 +0,0 @@ -Sample code: -``` -// TODO: Update with the module architecture (require) -var folder = TK.IO.KnownFolders.Documents(); - -var path = folder.path + "/MyDB.db"; - -var db = TK.Data.Database.openDatabase(path); - -db.executeSql('DROP TABLE IF EXISTS DEMO;'); -db.executeSql('CREATE TABLE DEMO (id unique, data);'); -db.executeSql('INSERT INTO DEMO (id, data) VALUES (1, "First row")'); -db.executeSql('INSERT INTO DEMO (id, data) VALUES (2, "Second row")'); - -db.query("SELECT * FROM DEMO", function(result){ - Log("result count:" + result.count); - - for(var item in result.items) - { - for(var name in item) - { - Log(name + ":" + item[name]); - } - } - }, function(e){ Log("Error:" + e.message ); } -); - -``` \ No newline at end of file diff --git a/Database/database.android.ts b/Database/database.android.ts deleted file mode 100644 index 48c82dc0a..000000000 --- a/Database/database.android.ts +++ /dev/null @@ -1,92 +0,0 @@ -import query_module = require("Database/database_query_result"); - -export module tk { - export module data { - /** - * Android specific Database implementation. - */ - export class Database { - public android: android.database.sqlite.SQLiteDatabase; - - public static openDatabase(path: string): Database { - return new Database(path); - } - - /** - * Open or creates SQLiteDatabase using the specified path. - */ - constructor(path: string) { - this.android = android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(path, null); - } - - /** - * Executes non-select SQL statements using execSQL method of android.database.sqlite.SQLiteDatabase. - */ - public executeSql(sqlStatement: string, successCallback?: Function, errorCallback?: (e: Error) => void) { - try { - if (sqlStatement.toLowerCase().indexOf("select") > -1) { - throw new Error("Please use 'query' method for select SQL statements!"); - } - - this.android.execSQL(sqlStatement); - - if (successCallback) { - successCallback(); - } - } catch (ex) { - - if (errorCallback) { - errorCallback(ex); - } - - } - } - - /** - * Executes select SQL statements using rawQuery method of android.database.sqlite.SQLiteDatabase and returns QueryResult. - */ - public query(sqlSelectStatement: string, successCallback: (results: query_module.tk.data.QueryResult) => void, errorCallback?: (e: Error) => void) { - try { - - if (sqlSelectStatement.toLowerCase().indexOf("select") == -1) { - throw new Error("Please use 'executeSql' method for non-select SQL statements!"); - } - - if (successCallback) { - var cursor = this.android.rawQuery(sqlSelectStatement, null); - - var qr = new query_module.tk.data.QueryResult(); - qr.items = []; - qr.count = cursor.getCount(); - - if (qr.count > 0) { - cursor.moveToFirst(); - - var names = cursor.getColumnNames(); - - do { - var item = {}; - - for (var name in names) { - item[name] = cursor.getString(cursor.getColumnIndex(name)); - } - - qr.items.push(item); - } while (cursor.moveToNext()); - - cursor.close(); - } - - successCallback(qr); - } - } catch (ex) { - - if (errorCallback) { - errorCallback(ex); - } - - } - } - } - } -} \ No newline at end of file diff --git a/Database/database.d.ts b/Database/database.d.ts deleted file mode 100644 index 8f204c5f4..000000000 --- a/Database/database.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -import qr = require("Database/database_query_result"); - -/** - * Data (Database) module. - */ -export declare module tk { - export module data { - /** - * The Database interface. - */ - export class Database { - executeSql(sqlStatement: string, successCallback?: Function, errorCallback?: (e: Error) => void) - query(sqlSelectStatement: string, successCallback: (results: qr.tk.data.QueryResult) => void, errorCallback?: (e: Error) => void) - } - } -} \ No newline at end of file diff --git a/Database/database.ios.ts b/Database/database.ios.ts deleted file mode 100644 index 1eae9083c..000000000 --- a/Database/database.ios.ts +++ /dev/null @@ -1,53 +0,0 @@ -import query_module = require("Database/database_query_result"); - -export module tk { - export module data { - export class Database { - - public static openDatabase(path: string): Database { - return new Database(path); - } - - constructor(path: string) { - - } - - public executeSql(sqlStatement: string, successCallback?: Function, errorCallback?: (e: Error) => void) { - try { - - // native code goes here - - if (successCallback) { - successCallback(); - } - } catch (ex) { - - if (errorCallback) { - errorCallback(ex); - } - - } - } - - public query(sqlSelectStatement: string, successCallback: (results: query_module.tk.data.QueryResult) => void, errorCallback?: (e: Error) => void) { - try { - - // native code goes here - - if (successCallback) { - - var qr = new query_module.tk.data.QueryResult(); - - successCallback(qr); - } - } catch (ex) { - - if (errorCallback) { - errorCallback(ex); - } - - } - } - } - } -} \ No newline at end of file diff --git a/Database/database_query_result.ts b/Database/database_query_result.ts deleted file mode 100644 index a1558732c..000000000 --- a/Database/database_query_result.ts +++ /dev/null @@ -1,21 +0,0 @@ -export module tk { - export module data { - export class QueryResult { - constructor() { - - } - - /** - * Total number of query result items. - */ - get count(): number { - return 0; - } - - /** - * The query result items. - */ - public items: Array; - } - } -} \ No newline at end of file