System.Data.SQLite

Check-in [e90af0978f]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Adjustments to the native library pre-loading logic for the .NET Compact Framework.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | refactorNativeLibraryPreLoader
Files: files | file ages | folders
SHA1: e90af0978f10d8bfddbe349680cdd1f715c68058
User & Date: mistachkin 2013-12-27 08:36:14.252
Context
2013-12-27
11:02
Modify the native library pre-loader to optionally support searching for the SQLite native library in more than one location. Bump all versions to 1.0.91.0. Update version history docs. check-in: ae2e6767b5 user: mistachkin tags: refactorNativeLibraryPreLoader
08:36
Adjustments to the native library pre-loading logic for the .NET Compact Framework. check-in: e90af0978f user: mistachkin tags: refactorNativeLibraryPreLoader
07:41
Update the Eagle core script library and test suite infrastructure to better support testing the native library pre-loading code. check-in: 9e3b23cb78 user: mistachkin tags: refactorNativeLibraryPreLoader
Changes
Unified Diff Ignore Whitespace Patch
Changes to System.Data.SQLite/UnsafeNativeMethods.cs.
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
      /// specified by <paramref name="default" /> if it has not been set
      /// explicitly or cannot be determined.  By default, all references to
      /// existing environment will be expanded within the value to be returned
      /// unless either the "No_Expand" or "No_Expand_<paramref name="name" />"
      /// environment variables are set [to anything].
      /// </returns>
      internal static string GetSettingValue(
          string name,
          string @default
          )
      {
          if (name == null)
              return @default;

          string value = null;








|
|







120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
      /// specified by <paramref name="default" /> if it has not been set
      /// explicitly or cannot be determined.  By default, all references to
      /// existing environment will be expanded within the value to be returned
      /// unless either the "No_Expand" or "No_Expand_<paramref name="name" />"
      /// environment variables are set [to anything].
      /// </returns>
      internal static string GetSettingValue(
          string name,    /* in */
          string @default /* in */
          )
      {
          if (name == null)
              return @default;

          string value = null;

535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
      /// The original dynamic link library file name to inspect.
      /// </param>
      /// <returns>
      /// The dynamic link library file name, possibly modified to include an
      /// extension.
      /// </returns>
      private static string FixUpDllFileName(
          string fileName
          )
      {
          if (!String.IsNullOrEmpty(fileName))
          {
              PlatformID platformId = Environment.OSVersion.Platform;

              if ((platformId == PlatformID.Win32S) ||







|







535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
      /// The original dynamic link library file name to inspect.
      /// </param>
      /// <returns>
      /// The dynamic link library file name, possibly modified to include an
      /// extension.
      /// </returns>
      private static string FixUpDllFileName(
          string fileName /* in */
          )
      {
          if (!String.IsNullOrEmpty(fileName))
          {
              PlatformID platformId = Environment.OSVersion.Platform;

              if ((platformId == PlatformID.Win32S) ||
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682


683
684

685


686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
              }
              catch
              {
                  // do nothing.
              }
#endif
          }
#endif

          /////////////////////////////////////////////////////////////////////

#if PLATFORM_COMPACTFRAMEWORK
          //
          // NOTE: On the .NET Compact Framework, attempt to use the native
          //       Win32 API function (via P/Invoke) that can provide us with
          //       the processor architecture.
          //
          try
          {
              //
              // NOTE: The output of the GetSystemInfo function will be placed
              //       here.  Only the processor architecture field is used by
              //       this method.
              //
              SYSTEM_INFO systemInfo;

              //
              // NOTE: Query the system information via P/Invoke, thus filling
              //       the structure.
              //
              GetSystemInfo(out systemInfo);

              //
              // NOTE: Return the processor architecture value as a string.
              //
              processorArchitecture =
                  systemInfo.wProcessorArchitecture.ToString();
          }
          catch
          {
              // do nothing.
          }

          //
          // NOTE: Upon failure, return an empty string.


          //
          processorArchitecture = String.Empty;

#endif



          return processorArchitecture;
      }

      /////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// Given the processor architecture, returns the name of the platform.
      /// </summary>
      /// <param name="processorArchitecture">
      /// The processor architecture to be translated to a platform name.
      /// </param>
      /// <returns>
      /// The platform name for the specified processor architecture -OR- null
      /// if it cannot be determined.
      /// </returns>
      private static string GetPlatformName(
          string processorArchitecture
          )
      {
          if (String.IsNullOrEmpty(processorArchitecture))
              return null;

          lock (staticSyncRoot)
          {







|
|
<
|
<
|
|
|
|
|
|
|
|
|
|
|
|
|

|
|
|
|
|

|
|
|
|
|
|
|
|
|
|

|
|
>
>
|
|
>

>
>
















|







638
639
640
641
642
643
644
645
646

647

648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
              }
              catch
              {
                  // do nothing.
              }
#endif
          }
#else
          if (processorArchitecture == null)

          {

              //
              // NOTE: On the .NET Compact Framework, attempt to use the native
              //       Win32 API function (via P/Invoke) that can provide us
              //       with the processor architecture.
              //
              try
              {
                  //
                  // NOTE: The output of the GetSystemInfo function will be
                  //       placed here.  Only the processor architecture field
                  //       is used by this method.
                  //
                  SYSTEM_INFO systemInfo;

                  //
                  // NOTE: Query the system information via P/Invoke, thus
                  //       filling the structure.
                  //
                  GetSystemInfo(out systemInfo);

                  //
                  // NOTE: Return the processor architecture value as a string.
                  //
                  processorArchitecture =
                      systemInfo.wProcessorArchitecture.ToString();
              }
              catch
              {
                  // do nothing.
              }

              //
              // NOTE: Upon failure, return an empty string.  This will prevent
              //       the calling method from considering this method call a
              //       "failure".
              //
              processorArchitecture = String.Empty;
          }
#endif

          /////////////////////////////////////////////////////////////////////

          return processorArchitecture;
      }

      /////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// Given the processor architecture, returns the name of the platform.
      /// </summary>
      /// <param name="processorArchitecture">
      /// The processor architecture to be translated to a platform name.
      /// </param>
      /// <returns>
      /// The platform name for the specified processor architecture -OR- null
      /// if it cannot be determined.
      /// </returns>
      private static string GetPlatformName(
          string processorArchitecture /* in */
          )
      {
          if (String.IsNullOrEmpty(processorArchitecture))
              return null;

          lock (staticSyncRoot)
          {
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
      /// LoadLibrary fails.
      /// </param>
      /// <returns>
      /// Non-zero if the native module was loaded successfully; otherwise,
      /// zero.
      /// </returns>
      private static bool PreLoadSQLiteDll(
          string directory,
          string processorArchitecture,
          ref string nativeModuleFileName,
          ref IntPtr nativeModuleHandle
          )
      {
          //
          // NOTE: If the specified base directory is null, use the default
          //       (i.e. attempt to automatically detect it).
          //
          if (directory == null)







|
|
|
|







750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
      /// LoadLibrary fails.
      /// </param>
      /// <returns>
      /// Non-zero if the native module was loaded successfully; otherwise,
      /// zero.
      /// </returns>
      private static bool PreLoadSQLiteDll(
          string directory,                /* in */
          string processorArchitecture,    /* in */
          ref string nativeModuleFileName, /* out */
          ref IntPtr nativeModuleHandle    /* out */
          )
      {
          //
          // NOTE: If the specified base directory is null, use the default
          //       (i.e. attempt to automatically detect it).
          //
          if (directory == null)