System.Data.SQLite

Check-in [5c1ed740db]
Login

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

Overview
Comment:Merge updates from trunk.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | netStandard20
Files: files | file ages | folders
SHA1: 5c1ed740db0a8174e3b5b803908d692c8fe3d580
User & Date: mistachkin 2018-04-18 15:59:23.481
Context
2018-04-23
02:09
Pickup changes to Eagle script library in externals. check-in: 6aad7b515d user: mistachkin tags: netStandard20
2018-04-18
15:59
Merge updates from trunk. check-in: 5c1ed740db user: mistachkin tags: netStandard20
15:48
Update version history docs. check-in: 6f0089d0c2 user: mistachkin tags: trunk
2018-04-13
12:59
Merge updates from trunk. check-in: 940912844b user: mistachkin tags: netStandard20
Changes
Unified Diff Ignore Whitespace Patch
Changes to Doc/Extra/Provider/version.html.
44
45
46
47
48
49
50

51
52
53
54
55
56
57
    <div id="mainBody">
    <h1 class="heading">Version History</h1>
    <p><b>1.0.109.0 - May XX, 2018 <font color="red">(release scheduled)</font></b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_23_1.html">SQLite 3.23.1</a>.</li>
      <li>Prevent GetSchemaTable from throwing InvalidCastException. Fix for <a href="https://system.data.sqlite.org/index.html/info/baf42ee135">[baf42ee135]</a>.</li>
      <li>Add preliminary support for .NET Core 2.0 and the .NET Standard 2.0.</li>

      <li>Add GetFieldAffinity method to the SQLiteDataReader class.</li>
    </ul>
    <p><b>1.0.108.0 - March 2, 2018</b></p>
    <ul>
      <li>Support extended result codes when messages are looked up without the SQLite core library.</li>
      <li>Override System.Object members for the SQLiteException class to improve its ToString return value. Pursuant to <a href="https://system.data.sqlite.org/index.html/info/53962f9eff">[53962f9eff]</a>.</li>
      <li>More database connection configuration options for the <a href="https://www.sqlite.org/c3ref/db_config.html">sqlite3_db_config()</a> interface.&nbsp;<b>** Potentially Incompatible Change **</b></li>







>







44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
    <div id="mainBody">
    <h1 class="heading">Version History</h1>
    <p><b>1.0.109.0 - May XX, 2018 <font color="red">(release scheduled)</font></b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_23_1.html">SQLite 3.23.1</a>.</li>
      <li>Prevent GetSchemaTable from throwing InvalidCastException. Fix for <a href="https://system.data.sqlite.org/index.html/info/baf42ee135">[baf42ee135]</a>.</li>
      <li>Add preliminary support for .NET Core 2.0 and the .NET Standard 2.0.</li>
      <li>Add simpler overload for the SQLiteBlob.Create method. Pursuant to <a href="https://system.data.sqlite.org/index.html/info/dfc8133ba2">[dfc8133ba2]</a>.</li>
      <li>Add GetFieldAffinity method to the SQLiteDataReader class.</li>
    </ul>
    <p><b>1.0.108.0 - March 2, 2018</b></p>
    <ul>
      <li>Support extended result codes when messages are looked up without the SQLite core library.</li>
      <li>Override System.Object members for the SQLiteException class to improve its ToString return value. Pursuant to <a href="https://system.data.sqlite.org/index.html/info/53962f9eff">[53962f9eff]</a>.</li>
      <li>More database connection configuration options for the <a href="https://www.sqlite.org/c3ref/db_config.html">sqlite3_db_config()</a> interface.&nbsp;<b>** Potentially Incompatible Change **</b></li>
Changes to System.Data.SQLite/SQLiteBlob.cs.
70
71
72
73
74
75
76












































77
78




79

80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
        /// </returns>
        public static SQLiteBlob Create(
            SQLiteDataReader dataReader,
            int i,
            bool readOnly
            )
        {












































            SQLiteConnection connection = SQLiteDataReader.GetConnection(
                dataReader);






            if (connection == null)
                throw new InvalidOperationException("Connection not available");

            SQLite3 sqlite3 = connection._sql as SQLite3;

            if (sqlite3 == null)
                throw new InvalidOperationException("Connection has no wrapper");

            SQLiteConnectionHandle handle = sqlite3._sql;

            if (handle == null)
                throw new InvalidOperationException("Connection has an invalid handle.");

            long? rowId = dataReader.GetRowId(i);

            if (rowId == null)
                throw new InvalidOperationException("No RowId is available");

            SQLiteBlobHandle blob = null;

            try
            {
                // do nothing.
            }
            finally /* NOTE: Thread.Abort() protection. */
            {
                IntPtr ptrBlob = IntPtr.Zero;

                SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3_blob_open(
                    handle, SQLiteConvert.ToUTF8(
                        dataReader.GetDatabaseName(i)), SQLiteConvert.ToUTF8(
                    dataReader.GetTableName(i)), SQLiteConvert.ToUTF8(
                        dataReader.GetName(i)), (long)rowId, readOnly ? 0 : 1,
                    ref ptrBlob);

                if (rc != SQLiteErrorCode.Ok)
                    throw new SQLiteException(rc, null);

                blob = new SQLiteBlobHandle(handle, ptrBlob);
            }

            SQLiteConnection.OnChanged(null, new ConnectionEventArgs(
                SQLiteConnectionEventType.NewCriticalHandle, null,
                null, null, dataReader, blob, null, new object[] {
                typeof(SQLiteBlob), dataReader, i, readOnly }));

            return new SQLiteBlob(sqlite3, blob);
        }
        #endregion

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








>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
>
>
>
>
|
>

|











<
<
<
<
<











|
|
<
|
<







|
|
|
|







70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141





142
143
144
145
146
147
148
149
150
151
152
153
154

155

156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
        /// </returns>
        public static SQLiteBlob Create(
            SQLiteDataReader dataReader,
            int i,
            bool readOnly
            )
        {
            if (dataReader == null)
                throw new ArgumentNullException("dataReader");

            long? rowId = dataReader.GetRowId(i);

            if (rowId == null)
                throw new InvalidOperationException("No RowId is available");

            return Create(
                SQLiteDataReader.GetConnection(dataReader),
                dataReader.GetDatabaseName(i), dataReader.GetTableName(i),
                dataReader.GetName(i), (long)rowId, readOnly);
        }

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

        /// <summary>
        /// Creates a <see cref="SQLiteBlob" /> object.  This will not work
        /// for tables that were created WITHOUT ROWID.
        /// </summary>
        /// <param name="connection">
        /// The connection to use when opening the blob object.
        /// </param>
        /// <param name="databaseName">
        /// The name of the database containing the blob object.
        /// </param>
        /// <param name="tableName">
        /// The name of the table containing the blob object.
        /// </param>
        /// <param name="columnName">
        /// The name of the column containing the blob object.
        /// </param>
        /// <param name="rowId">
        /// The integer identifier for the row associated with the desired
        /// blob object.
        /// </param>
        /// <param name="readOnly">
        /// Non-zero to open the blob object for read-only access.
        /// </param>
        /// <returns>
        /// The newly created <see cref="SQLiteBlob" /> instance -OR- null
        /// if an error occurs.
        /// </returns>
        public static SQLiteBlob Create(
            SQLiteConnection connection,
            string databaseName,
            string tableName,
            string columnName,
            long rowId,
            bool readOnly
            )
        {
            if (connection == null)
                throw new ArgumentNullException("connection");

            SQLite3 sqlite3 = connection._sql as SQLite3;

            if (sqlite3 == null)
                throw new InvalidOperationException("Connection has no wrapper");

            SQLiteConnectionHandle handle = sqlite3._sql;

            if (handle == null)
                throw new InvalidOperationException("Connection has an invalid handle.");






            SQLiteBlobHandle blob = null;

            try
            {
                // do nothing.
            }
            finally /* NOTE: Thread.Abort() protection. */
            {
                IntPtr ptrBlob = IntPtr.Zero;

                SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3_blob_open(
                    handle, SQLiteConvert.ToUTF8(databaseName),
                    SQLiteConvert.ToUTF8(tableName), SQLiteConvert.ToUTF8(

                    columnName), rowId, readOnly ? 0 : 1, ref ptrBlob);


                if (rc != SQLiteErrorCode.Ok)
                    throw new SQLiteException(rc, null);

                blob = new SQLiteBlobHandle(handle, ptrBlob);
            }

            SQLiteConnection.OnChanged(connection, new ConnectionEventArgs(
                SQLiteConnectionEventType.NewCriticalHandle, null, null,
                null, null, blob, null, new object[] { typeof(SQLiteBlob),
                databaseName, tableName, columnName, rowId, readOnly }));

            return new SQLiteBlob(sqlite3, blob);
        }
        #endregion

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

Changes to readme.htm.
210
211
212
213
214
215
216

217
218
219
220
221
222
223
<p>
    <b>1.0.109.0 - May XX, 2018 <font color="red">(release scheduled)</font></b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_23_1.html">SQLite 3.23.1</a>.</li>
    <li>Prevent GetSchemaTable from throwing InvalidCastException. Fix for [baf42ee135].</li>
    <li>Add preliminary support for .NET Core 2.0 and the .NET Standard 2.0.</li>

    <li>Add GetFieldAffinity method to the SQLiteDataReader class.</li>
</ul>
<p>
    <b>1.0.XXX.0 - March 2, 2018</b>
</p>
<ul>
    <li>Support extended result codes when messages are looked up without the SQLite core library.</li>







>







210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
<p>
    <b>1.0.109.0 - May XX, 2018 <font color="red">(release scheduled)</font></b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_23_1.html">SQLite 3.23.1</a>.</li>
    <li>Prevent GetSchemaTable from throwing InvalidCastException. Fix for [baf42ee135].</li>
    <li>Add preliminary support for .NET Core 2.0 and the .NET Standard 2.0.</li>
    <li>Add simpler overload for the SQLiteBlob.Create method. Pursuant to [dfc8133ba2].</li>
    <li>Add GetFieldAffinity method to the SQLiteDataReader class.</li>
</ul>
<p>
    <b>1.0.XXX.0 - March 2, 2018</b>
</p>
<ul>
    <li>Support extended result codes when messages are looked up without the SQLite core library.</li>
Changes to www/news.wiki.
47
48
49
50
51
52
53

54
55
56
57
58
59
60
<p>
    <b>1.0.109.0 - May XX, 2018 <font color="red">(release scheduled)</font></b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_23_1.html|SQLite 3.23.1].</li>
    <li>Prevent GetSchemaTable from throwing InvalidCastException. Fix for [baf42ee135].</li>
    <li>Add preliminary support for .NET Core 2.0 and the .NET Standard 2.0.</li>

    <li>Add GetFieldAffinity method to the SQLiteDataReader class.</li>
</ul>
<p>
    <b>1.0.108.0 - March 2, 2018</b>
</p>
<ul>
    <li>Support extended result codes when messages are looked up without the SQLite core library.</li>







>







47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<p>
    <b>1.0.109.0 - May XX, 2018 <font color="red">(release scheduled)</font></b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_23_1.html|SQLite 3.23.1].</li>
    <li>Prevent GetSchemaTable from throwing InvalidCastException. Fix for [baf42ee135].</li>
    <li>Add preliminary support for .NET Core 2.0 and the .NET Standard 2.0.</li>
    <li>Add simpler overload for the SQLiteBlob.Create method. Pursuant to [dfc8133ba2].</li>
    <li>Add GetFieldAffinity method to the SQLiteDataReader class.</li>
</ul>
<p>
    <b>1.0.108.0 - March 2, 2018</b>
</p>
<ul>
    <li>Support extended result codes when messages are looked up without the SQLite core library.</li>