Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Safar <marek.safar@gmail.com>2017-01-03 18:01:24 +0300
committerMarek Safar <marek.safar@gmail.com>2017-01-03 18:01:24 +0300
commit09774416fd9032d1beef725f68856adc23d51ab8 (patch)
tree7eb2868781ee85697b1c20bca58578901ccd374d /mcs/class/Mono.Data.Sqlite
parent208dd1e9568b584851ebbd1a6987eb89087fa09a (diff)
[System] Keep single MonoPInvokeCallbackAttribute implementation
Diffstat (limited to 'mcs/class/Mono.Data.Sqlite')
-rw-r--r--mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite.dll.sources4
-rw-r--r--mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/MonoPInvokeCallbackAttribute.cs36
-rw-r--r--mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLite3.cs14
-rw-r--r--mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLiteDataReader.cs62
-rw-r--r--mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLiteFunction.cs4
5 files changed, 42 insertions, 78 deletions
diff --git a/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite.dll.sources b/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite.dll.sources
index 206efb2edd3..e17c152506a 100644
--- a/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite.dll.sources
+++ b/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite.dll.sources
@@ -1,8 +1,6 @@
Assembly/AssemblyInfo.cs
../../build/common/Consts.cs
-../../build/common/Locale.cs
-../../build/common/MonoTODOAttribute.cs
-Mono.Data.Sqlite_2.0/MonoPInvokeCallbackAttribute.cs
+../System/Mono.Util/MonoPInvokeCallbackAttribute.cs
Mono.Data.Sqlite_2.0/SQLite3.cs
Mono.Data.Sqlite_2.0/SQLite3_UTF16.cs
Mono.Data.Sqlite_2.0/SQLiteBase.cs
diff --git a/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/MonoPInvokeCallbackAttribute.cs b/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/MonoPInvokeCallbackAttribute.cs
deleted file mode 100644
index 1546be907f6..00000000000
--- a/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/MonoPInvokeCallbackAttribute.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-//
-// MonoPInvokeCallbackAttribute.cs: necessary for AOT ports of Mono
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-#if MONOTOUCH
-
-using System;
-
-namespace MonoTouch {
-
- [AttributeUsage (AttributeTargets.Method)]
- sealed class MonoPInvokeCallbackAttribute : Attribute {
- public MonoPInvokeCallbackAttribute (Type t) {}
- }
-}
-
-#endif
diff --git a/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLite3.cs b/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLite3.cs
index 34556edb930..6b2ee13e03a 100644
--- a/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLite3.cs
+++ b/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLite3.cs
@@ -706,7 +706,7 @@ namespace Mono.Data.Sqlite
}
#if MONOTOUCH
- [MonoTouch.MonoPInvokeCallback(typeof(SQLiteCallback))]
+ [Mono.Util.MonoPInvokeCallback(typeof(SQLiteCallback))]
internal static void scalar_callback(IntPtr context, int nArgs, IntPtr argsptr)
{
var handle = GCHandle.FromIntPtr (UnsafeNativeMethods.sqlite3_user_data(context));
@@ -714,7 +714,7 @@ namespace Mono.Data.Sqlite
func.Func(context, nArgs, argsptr);
}
- [MonoTouch.MonoPInvokeCallback(typeof(SQLiteCallback))]
+ [Mono.Util.MonoPInvokeCallback(typeof(SQLiteCallback))]
internal static void step_callback(IntPtr context, int nArgs, IntPtr argsptr)
{
var handle = GCHandle.FromIntPtr(UnsafeNativeMethods.sqlite3_user_data(context));
@@ -722,7 +722,7 @@ namespace Mono.Data.Sqlite
func.FuncStep(context, nArgs, argsptr);
}
- [MonoTouch.MonoPInvokeCallback(typeof(SQLiteFinalCallback))]
+ [Mono.Util.MonoPInvokeCallback(typeof(SQLiteFinalCallback))]
internal static void final_callback(IntPtr context)
{
var handle = GCHandle.FromIntPtr(UnsafeNativeMethods.sqlite3_user_data(context));
@@ -730,7 +730,7 @@ namespace Mono.Data.Sqlite
func.FuncFinal(context);
}
- [MonoTouch.MonoPInvokeCallback(typeof(SQLiteFinalCallback))]
+ [Mono.Util.MonoPInvokeCallback(typeof(SQLiteFinalCallback))]
internal static void destroy_callback(IntPtr context)
{
GCHandle.FromIntPtr(context).Free();
@@ -958,7 +958,7 @@ namespace Mono.Data.Sqlite
SQLiteCommitCallback commit_callback;
SQLiteRollbackCallback rollback_callback;
- [MonoTouch.MonoPInvokeCallback (typeof (SQLiteUpdateCallback))]
+ [Mono.Util.MonoPInvokeCallback (typeof (SQLiteUpdateCallback))]
static void update (IntPtr puser, int type, IntPtr database, IntPtr table, Int64 rowid)
{
SQLite3 instance = GCHandle.FromIntPtr (puser).Target as SQLite3;
@@ -974,7 +974,7 @@ namespace Mono.Data.Sqlite
UnsafeNativeMethods.sqlite3_update_hook (_sql, update, GCHandle.ToIntPtr (gch));
}
- [MonoTouch.MonoPInvokeCallback (typeof (SQLiteCommitCallback))]
+ [Mono.Util.MonoPInvokeCallback (typeof (SQLiteCommitCallback))]
static int commit (IntPtr puser)
{
SQLite3 instance = GCHandle.FromIntPtr (puser).Target as SQLite3;
@@ -990,7 +990,7 @@ namespace Mono.Data.Sqlite
UnsafeNativeMethods.sqlite3_commit_hook (_sql, commit, GCHandle.ToIntPtr (gch));
}
- [MonoTouch.MonoPInvokeCallback (typeof (SQLiteRollbackCallback))]
+ [Mono.Util.MonoPInvokeCallback (typeof (SQLiteRollbackCallback))]
static void rollback (IntPtr puser)
{
SQLite3 instance = GCHandle.FromIntPtr (puser).Target as SQLite3;
diff --git a/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLiteDataReader.cs b/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLiteDataReader.cs
index 4d9c7cad293..eda2283684d 100644
--- a/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLiteDataReader.cs
+++ b/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLiteDataReader.cs
@@ -555,8 +555,8 @@ namespace Mono.Data.Sqlite
return GetSchemaTable(true, false);
}
- static bool hasColumnMetadataSupport = true;
-
+ static bool hasColumnMetadataSupport = true;
+
internal DataTable GetSchemaTable(bool wantUniqueInfo, bool wantDefaultValue)
{
CheckClosed();
@@ -565,7 +565,9 @@ namespace Mono.Data.Sqlite
DataTable tblIndexes = null;
DataTable tblIndexColumns;
DataRow row;
+#if !MONOTOUCH
string temp;
+#endif
string strCatalog = "";
string strTable = "";
string strColumn = "";
@@ -622,34 +624,34 @@ namespace Mono.Data.Sqlite
row[SchemaTableColumn.DataType] = GetFieldType(n);
row[SchemaTableOptionalColumn.IsHidden] = false;
- // HACK: Prevent exploding if Sqlite was built without the SQLITE_ENABLE_COLUMN_METADATA option.
- //
- // This code depends on sqlite3_column_origin_name, which only exists if Sqlite was built with
- // the SQLITE_ENABLE_COLUMN_METADATA option. This is not the case on iOS, MacOS or (most?)
- // Androids, so we exclude it from the MONOTOUCH build, and degrade on other systems by simply
- // omitting the metadata from the result.
- //
- // TODO: we could implement better fallbacks as proposed in
- // https://bugzilla.xamarin.com/show_bug.cgi?id=2128
- //
-#if !MONOTOUCH
- if (hasColumnMetadataSupport) {
- try {
- strColumn = _command.Connection._sql.ColumnOriginalName(_activeStatement, n);
- if (String.IsNullOrEmpty(strColumn) == false) row[SchemaTableColumn.BaseColumnName] = strColumn;
-
- row[SchemaTableColumn.IsExpression] = String.IsNullOrEmpty(strColumn);
- row[SchemaTableColumn.IsAliased] = (String.Compare(GetName(n), strColumn, true, CultureInfo.InvariantCulture) != 0);
-
- temp = _command.Connection._sql.ColumnTableName(_activeStatement, n);
- if (String.IsNullOrEmpty(temp) == false) row[SchemaTableColumn.BaseTableName] = temp;
-
- temp = _command.Connection._sql.ColumnDatabaseName(_activeStatement, n);
- if (String.IsNullOrEmpty(temp) == false) row[SchemaTableOptionalColumn.BaseCatalogName] = temp;
- } catch (EntryPointNotFoundException) {
- hasColumnMetadataSupport = false;
- }
- }
+ // HACK: Prevent exploding if Sqlite was built without the SQLITE_ENABLE_COLUMN_METADATA option.
+ //
+ // This code depends on sqlite3_column_origin_name, which only exists if Sqlite was built with
+ // the SQLITE_ENABLE_COLUMN_METADATA option. This is not the case on iOS, MacOS or (most?)
+ // Androids, so we exclude it from the MONOTOUCH build, and degrade on other systems by simply
+ // omitting the metadata from the result.
+ //
+ // TODO: we could implement better fallbacks as proposed in
+ // https://bugzilla.xamarin.com/show_bug.cgi?id=2128
+ //
+#if !MONOTOUCH
+ if (hasColumnMetadataSupport) {
+ try {
+ strColumn = _command.Connection._sql.ColumnOriginalName(_activeStatement, n);
+ if (String.IsNullOrEmpty(strColumn) == false) row[SchemaTableColumn.BaseColumnName] = strColumn;
+
+ row[SchemaTableColumn.IsExpression] = String.IsNullOrEmpty(strColumn);
+ row[SchemaTableColumn.IsAliased] = (String.Compare(GetName(n), strColumn, true, CultureInfo.InvariantCulture) != 0);
+
+ temp = _command.Connection._sql.ColumnTableName(_activeStatement, n);
+ if (String.IsNullOrEmpty(temp) == false) row[SchemaTableColumn.BaseTableName] = temp;
+
+ temp = _command.Connection._sql.ColumnDatabaseName(_activeStatement, n);
+ if (String.IsNullOrEmpty(temp) == false) row[SchemaTableOptionalColumn.BaseCatalogName] = temp;
+ } catch (EntryPointNotFoundException) {
+ hasColumnMetadataSupport = false;
+ }
+ }
#endif
string dataType = null;
diff --git a/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLiteFunction.cs b/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLiteFunction.cs
index 6aefe804586..db1e14db02a 100644
--- a/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLiteFunction.cs
+++ b/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLiteFunction.cs
@@ -528,7 +528,7 @@ namespace Mono.Data.Sqlite
}
#if MONOTOUCH
- [MonoTouch.MonoPInvokeCallback (typeof (SQLiteCollation))]
+ [Mono.Util.MonoPInvokeCallback (typeof (SQLiteCollation))]
internal static int collation_callback (IntPtr puser, int len1, IntPtr pv1, int len2, IntPtr pv2)
{
var handle = GCHandle.FromIntPtr (puser);
@@ -536,7 +536,7 @@ namespace Mono.Data.Sqlite
return func._CompareFunc (IntPtr.Zero, len1, pv1, len2, pv2);
}
- [MonoTouch.MonoPInvokeCallback (typeof (SQLiteCollation))]
+ [Mono.Util.MonoPInvokeCallback (typeof (SQLiteCollation))]
internal static int collation_callback16 (IntPtr puser, int len1, IntPtr pv1, int len2, IntPtr pv2)
{
var handle = GCHandle.FromIntPtr (puser);