[mapguide-commits] r8696 - sandbox/VC140/Oem/SQLite/src/SqliteDotNet

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Wed Jul 8 01:42:33 PDT 2015


Author: christinebao
Date: 2015-07-08 01:42:33 -0700 (Wed, 08 Jul 2015)
New Revision: 8696

Modified:
   sandbox/VC140/Oem/SQLite/src/SqliteDotNet/SqliteDotNet.cpp
   sandbox/VC140/Oem/SQLite/src/SqliteDotNet/SqliteDotNet.h
   sandbox/VC140/Oem/SQLite/src/SqliteDotNet/SqliteDotNet.vcxproj
Log:
RFC 150: MapGuide RFC 150 - Support Visual Studio 2015 
http://trac.osgeo.org/mapguide/wiki/MapGuideRfc150

Update SqliteDotNet project to CLR syntax. 

Modified: sandbox/VC140/Oem/SQLite/src/SqliteDotNet/SqliteDotNet.cpp
===================================================================
--- sandbox/VC140/Oem/SQLite/src/SqliteDotNet/SqliteDotNet.cpp	2015-07-06 07:39:56 UTC (rev 8695)
+++ sandbox/VC140/Oem/SQLite/src/SqliteDotNet/SqliteDotNet.cpp	2015-07-08 08:42:33 UTC (rev 8696)
@@ -26,14 +26,14 @@
 using namespace System::Runtime::InteropServices;
 
 
-wstring SToWs(System::String* str)
+wstring SToWs(System::String^ str)
 {
     System::IntPtr strPtr = Marshal::StringToCoTaskMemUni(str);
     wstring retStr = (wchar_t*) strPtr.ToPointer();
     return retStr;
 }
 
-System::String* WsToS(wstring str)
+System::String^ WsToS(wstring str)
 {
     System::IntPtr ptr((void*)str.c_str());
     return Marshal::PtrToStringUni(ptr);
@@ -74,9 +74,9 @@
 }
 
 ///Returns current error message
-System::String* SqliteDb::GetErrMsg()
+System::String^ SqliteDb::GetErrMsg()
 {
-    System::String* str = NULL;
+    System::String^ str = nullptr;
     if (database != NULL)
     {
         wstring msg = database->GetErrMsg();
@@ -86,9 +86,9 @@
 }
 
 ///Returns the database name
-System::String* SqliteDb::GetName()
+System::String^ SqliteDb::GetName()
 {
-    System::String* str = NULL;
+    System::String^ str = nullptr;
     if (database != NULL)
     {
         wstring msg = database->GetName();
@@ -108,7 +108,7 @@
 }
 
 ///Initializes a database object
-int SqliteDb::Open(System::String* newName)
+int SqliteDb::Open(System::String^ newName)
 {
     if (database != NULL)
     {
@@ -119,7 +119,7 @@
 }
 
 ///Dumps binary SQLite database into a SQL text format.
-void SqliteDb::DumpDatabase(System::String* iniFileName)
+void SqliteDb::DumpDatabase(System::String^ iniFileName)
 {
     if (database != NULL)
     {
@@ -129,7 +129,7 @@
 }
 
 ///Generates binary database from a SQL text file
-void SqliteDb::GenerateDatabase(System::String* dumpFileName, System::String* dbFileName)
+void SqliteDb::GenerateDatabase(System::String^ dumpFileName, System::String^ dbFileName)
 {
     if (database != NULL)
     {
@@ -145,7 +145,7 @@
 }
 
 ///Overloaded constructor that initializes the database connection
-SqliteVm::SqliteVm(SqliteDb* newDb, bool noThrow)
+SqliteVm::SqliteVm(SqliteDb^ newDb, bool noThrow)
 {
     vm = new SqliteVM(newDb->Database(), noThrow);
 }
@@ -161,9 +161,9 @@
 };
 
 ///Returns the name of the column specified
-System::String* SqliteVm::ColumnName(int colNum)
+System::String^ SqliteVm::ColumnName(int colNum)
 {
-    System::String* str = NULL;
+    System::String^ str = nullptr;
     if (vm != NULL)
     {
         wstring wstr = vm->ColumnName(colNum);
@@ -172,7 +172,7 @@
     return str;
 }
 
-int SqliteVm::ColumnNumber(System::String* colName)
+int SqliteVm::ColumnNumber(System::String^ colName)
 {
     int num = -1;
     if (vm != NULL)
@@ -184,9 +184,9 @@
 }
 
 ///Returns the type of the column specified
-System::String* SqliteVm::ColumnType(System::String* colName)
+System::String^ SqliteVm::ColumnType(System::String^ colName)
 {
-    System::String* str = NULL;
+    System::String^ str = nullptr;
     if (vm != NULL)
     {
         wstring wstrIn = SToWs(colName);
@@ -197,7 +197,7 @@
 }
 
 ///Executes a query. Creates a new virtual machine
-int SqliteVm::Execute(System::String* newQuery)
+int SqliteVm::Execute(System::String^ newQuery)
 {
     int sqlErr = SQLITE_ERROR;
     if (vm != NULL)
@@ -209,9 +209,9 @@
 }
 
 ///Returns the sql query being executed
-System::String* SqliteVm::GetSqlQuery()
+System::String^ SqliteVm::GetSqlQuery()
 {
-    System::String* str = NULL;
+    System::String^ str = nullptr;
     if (vm != NULL)
     {
         wstring wstr = vm->GetSqlQuery();
@@ -221,9 +221,9 @@
 }
 
 ///Returns the tail of an SQL query
-System::String* SqliteVm::GetQueryTail()
+System::String^ SqliteVm::GetQueryTail()
 {
-    System::String* str = NULL;
+    System::String^ str = nullptr;
     if (vm != NULL)
     {
         wstring wstr = vm->GetQueryTail();
@@ -233,7 +233,7 @@
 }
 
 ///Returns an integer
-int SqliteVm::GetInt(System::String* colName)
+int SqliteVm::GetInt(System::String^ colName)
 {
     int ret = 0;
     if (vm != NULL)
@@ -245,9 +245,9 @@
 }
 
 ///Returns a string
-System::String* SqliteVm::GetString(System::String* colName)
+System::String^ SqliteVm::GetString(System::String^ colName)
 {
-    System::String* ret = NULL;
+    System::String^ ret = nullptr;
     if (vm != NULL)
     {
         wstring wstrIn = SToWs(colName);
@@ -258,7 +258,7 @@
 }
 
 ///Returns double
-double SqliteVm::GetDouble(System::String* colName)
+double SqliteVm::GetDouble(System::String^ colName)
 {
     double ret = 0;
     if (vm != NULL)
@@ -270,9 +270,9 @@
 }
 
 ///Returns BLOB
-SqliteGcBlob* SqliteVm::GetBlob(System::String* colName)
+SqliteGcBlob^ SqliteVm::GetBlob(System::String^ colName)
 {
-    SqliteGcBlob* blob = NULL;
+    SqliteGcBlob^ blob = nullptr;
 
     if (vm != NULL)
     {
@@ -281,7 +281,7 @@
         SqliteBlob* tmpBlob = vm->GetBlob(wstrIn);
         if (tmpBlob != NULL)
         {
-            blob = new SqliteGcBlob(tmpBlob);
+            blob = gcnew SqliteGcBlob(tmpBlob);
         }
     }
     return blob;
@@ -299,9 +299,9 @@
 }
 
 ///Returns an error message
-System::String* SqliteVm::GetErrMsg()
+System::String^ SqliteVm::GetErrMsg()
 {
-    System::String* ret = NULL;
+    System::String^ ret = nullptr;
     if (vm != NULL)
     {
         wstring wstr = vm->GetErrMsg();
@@ -370,7 +370,7 @@
     this->blob = blob;
 }
 
-System::Byte SqliteGcBlob::Read()[]
+cli::array<System::Byte>^ SqliteGcBlob::Read()
 {
     int bufSize = 0;
     char* buf = NULL;
@@ -394,12 +394,12 @@
 
         nBytes = blob->Read(tmpBuf, 8192);
     }
+		
+	cli::array<System::Byte>^ bytes = nullptr;
 
-    System::Byte bytes[] = NULL;
-
     if (bufSize > 0)
     {
-        bytes = new System::Byte[bufSize];
+        bytes = gcnew cli::array<System::Byte>(bufSize);
         System::IntPtr bufPtr(buf);
         Marshal::Copy(bufPtr, bytes, 0, bufSize);
         delete [] buf;

Modified: sandbox/VC140/Oem/SQLite/src/SqliteDotNet/SqliteDotNet.h
===================================================================
--- sandbox/VC140/Oem/SQLite/src/SqliteDotNet/SqliteDotNet.h	2015-07-06 07:39:56 UTC (rev 8695)
+++ sandbox/VC140/Oem/SQLite/src/SqliteDotNet/SqliteDotNet.h	2015-07-08 08:42:33 UTC (rev 8696)
@@ -25,16 +25,16 @@
 
 namespace SqliteDotNet
 {
-    public __gc class SqliteGcBlob
+    public ref class SqliteGcBlob
     {
     public:
         SqliteGcBlob(SqliteBlob* blob);
-        System::Byte Read()[];
+		cli::array<System::Byte>^ Read();
     private:
         SqliteBlob* blob;
     };
 
-    public __gc class Sqlite
+    public ref class Sqlite
     {
     public:
         static const int Ok = 0;
@@ -43,7 +43,7 @@
         static const int Done = 101;
     };
 
-    public __gc class SqliteDb
+    public ref class SqliteDb
     {
     public:
         ///Default constructor
@@ -56,22 +56,22 @@
         int Close();
 
         ///Returns current error message
-        System::String* GetErrMsg();
+        System::String^ GetErrMsg();
 
         ///Returns the database name
-        System::String* GetName();
+        System::String^ GetName();
 
         ///Checks if there exist connection
         bool IsConnected();
 
         ///Initializes a database object
-        int Open(System::String* newName);
+        int Open(System::String^ newName);
 
         ///Dumps binary SQLite database into a SQL text format.
-        void DumpDatabase(System::String* iniFileName);
+        void DumpDatabase(System::String^ iniFileName);
 
         ///Generates binary database from a SQL text file
-        void GenerateDatabase(System::String* dumpFileName, System::String* dbFileName);
+        void GenerateDatabase(System::String^ dumpFileName, System::String^ dbFileName);
 
         SqliteDB* Database();
 
@@ -80,49 +80,49 @@
 
     };
 
-    public __gc class SqliteVm
+    public ref class SqliteVm
     {
     public:
         ///Overloaded constructor that initializes the database connection
-        SqliteVm(SqliteDb* newDb, bool noThrow);
+        SqliteVm(SqliteDb^ newDb, bool noThrow);
 
         //Destructor. Deletes the virtual machine
         ~SqliteVm();
 
         ///Returns the name of the column specified
-        System::String* ColumnName(int colNum);
+        System::String^ ColumnName(int colNum);
 
-        int ColumnNumber(System::String* colName);
+        int ColumnNumber(System::String^ colName);
 
         ///Returns the type of the column specified
-        System::String* ColumnType(System::String* colName);
+        System::String^ ColumnType(System::String^ colName);
 
         ///Executes a query. Creates a new virtual machine
-        int Execute(System::String* newQuery); // do compile and first step here
+        int Execute(System::String^ newQuery); // do compile and first step here
 
         ///Returns the sql query being executed
-        System::String* GetSqlQuery();
+        System::String^ GetSqlQuery();
 
         ///Returns the tail of an SQL query
-        System::String* GetQueryTail();
+        System::String^ GetQueryTail();
 
         ///Returns an integer
-        int GetInt(System::String* colName);
+        int GetInt(System::String^ colName);
 
         ///Returns a string
-        System::String* GetString(System::String* colName);
+        System::String^ GetString(System::String^ colName);
 
         ///Returns double
-        double GetDouble(System::String* colName);
+        double GetDouble(System::String^ colName);
 
         ///Returns BLOB
-        SqliteGcBlob* GetBlob(System::String* colName);
+        SqliteGcBlob^ GetBlob(System::String^ colName);
 
         ///Returns the number of columns in a  table
         int NumCols();
 
         ///Returns an error message
-        System::String* GetErrMsg();
+        System::String^ GetErrMsg();
 
         ///Checks if the database objects is still connected to a database
         bool IsConnected();

Modified: sandbox/VC140/Oem/SQLite/src/SqliteDotNet/SqliteDotNet.vcxproj
===================================================================
--- sandbox/VC140/Oem/SQLite/src/SqliteDotNet/SqliteDotNet.vcxproj	2015-07-06 07:39:56 UTC (rev 8695)
+++ sandbox/VC140/Oem/SQLite/src/SqliteDotNet/SqliteDotNet.vcxproj	2015-07-08 08:42:33 UTC (rev 8696)
@@ -27,25 +27,25 @@
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
     <ConfigurationType>DynamicLibrary</ConfigurationType>
     <CharacterSet>Unicode</CharacterSet>
-    <CLRSupport>OldSyntax</CLRSupport>
+    <CLRSupport>true</CLRSupport>
     <PlatformToolset>v110</PlatformToolset>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
     <ConfigurationType>DynamicLibrary</ConfigurationType>
     <CharacterSet>Unicode</CharacterSet>
-    <CLRSupport>OldSyntax</CLRSupport>
+    <CLRSupport>true</CLRSupport>
     <PlatformToolset>v110</PlatformToolset>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
     <ConfigurationType>DynamicLibrary</ConfigurationType>
     <CharacterSet>Unicode</CharacterSet>
-    <CLRSupport>OldSyntax</CLRSupport>
+    <CLRSupport>true</CLRSupport>
     <PlatformToolset>v110</PlatformToolset>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
     <ConfigurationType>DynamicLibrary</ConfigurationType>
     <CharacterSet>Unicode</CharacterSet>
-    <CLRSupport>OldSyntax</CLRSupport>
+    <CLRSupport>true</CLRSupport>
     <PlatformToolset>v110</PlatformToolset>
   </PropertyGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />



More information about the mapguide-commits mailing list