System.Data.SQLite

Check-in [b8d115e87d]
Login

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

Overview
Comment:The initial result code for SQLITE_DBCONFIG_MAINDBNAME must be an error in order to make the finally cleanup logic correct.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: b8d115e87d4fc99629d8dbc487873d87ffd96667
User & Date: mistachkin 2018-02-26 17:36:34.353
Context
2018-02-26
19:17
Add tests for the database option values added via check-in [b7ba6996c1]. check-in: b3872ff42e user: mistachkin tags: trunk
17:36
The initial result code for SQLITE_DBCONFIG_MAINDBNAME must be an error in order to make the finally cleanup logic correct. check-in: b8d115e87d user: mistachkin tags: trunk
17:32
Update version history docs. check-in: 2d61f3fabf user: mistachkin tags: trunk
Changes
Unified Diff Show Whitespace Changes Patch
Changes to System.Data.SQLite/SQLite3.cs.
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887

2888

2889
2890
2891
2892
2893
2894
2895
                    {
                        throw new SQLiteException(HelperMethods.StringFormat(
                            CultureInfo.CurrentCulture,
                            "configuration value type mismatch, must be of type {0}",
                            typeof(string)));
                    }

                    SQLiteErrorCode rc = SQLiteErrorCode.Ok;
                    IntPtr pDbName = IntPtr.Zero;

                    try
                    {
                        pDbName = SQLiteString.Utf8IntPtrFromString(
                            (string)value);

                        if (pDbName == IntPtr.Zero)
                        {
                            throw new SQLiteException(
                                SQLiteErrorCode.NoMem,
                                "cannot allocate database name");
                        }

                        rc = UnsafeNativeMethods.sqlite3_db_config_charptr(
                            _sql, option, pDbName);

                        if (rc == SQLiteErrorCode.Ok)
                        {
                            FreeDbName(true);

                            dbName = pDbName;

                        }
                    }
                    finally
                    {
                        if ((rc != SQLiteErrorCode.Ok) &&
                            (pDbName != IntPtr.Zero))
                        {







|




















>

>







2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
                    {
                        throw new SQLiteException(HelperMethods.StringFormat(
                            CultureInfo.CurrentCulture,
                            "configuration value type mismatch, must be of type {0}",
                            typeof(string)));
                    }

                    SQLiteErrorCode rc = SQLiteErrorCode.Error;
                    IntPtr pDbName = IntPtr.Zero;

                    try
                    {
                        pDbName = SQLiteString.Utf8IntPtrFromString(
                            (string)value);

                        if (pDbName == IntPtr.Zero)
                        {
                            throw new SQLiteException(
                                SQLiteErrorCode.NoMem,
                                "cannot allocate database name");
                        }

                        rc = UnsafeNativeMethods.sqlite3_db_config_charptr(
                            _sql, option, pDbName);

                        if (rc == SQLiteErrorCode.Ok)
                        {
                            FreeDbName(true);

                            dbName = pDbName;
                            pDbName = IntPtr.Zero;
                        }
                    }
                    finally
                    {
                        if ((rc != SQLiteErrorCode.Ok) &&
                            (pDbName != IntPtr.Zero))
                        {