Skip to content
This repository has been archived by the owner on Nov 1, 2018. It is now read-only.

Full support of SqliteConnectionStringBuilder #309

Closed
NimaAra opened this issue Dec 15, 2016 · 1 comment
Closed

Full support of SqliteConnectionStringBuilder #309

NimaAra opened this issue Dec 15, 2016 · 1 comment

Comments

@NimaAra
Copy link

NimaAra commented Dec 15, 2016

Firstly great implementation and thank you for that :-)

I am planning on migrating an existing code-base currently using System.Data.Sqlite over to Microsoft.Data.Sqlite however I have the following method which allows me to build my connection string:

private static string GetConnectionString(
            string dataSource, 
            bool binaryGuid, 
            DateTimeKind dateTimeKind,
            SQLiteDateFormats dateTimeFormat,
            SQLiteJournalModeEnum journalMode,
            SynchronizationModes syncMode,
            int pageSize,
            int cacheSize)
        {
            return new SqliteConnectionStringBuilder
            {
                DataSource = dataSource,
                Mode = 
                FailIfMissing = false,
                Pooling = false,
                BinaryGUID = binaryGuid,
                DateTimeKind = dateTimeKind,
                DateTimeFormat = dateTimeFormat,
                JournalMode = journalMode,
                SyncMode = syncMode,
                UseUTF16Encoding = false,
                LegacyFormat = false,
                PageSize = pageSize,
                CacheSize = cacheSize
            }.ToString();
        }

None of these flags or properties seem to be supported in Microsoft.Data.Sqlite. Is there a plan to support them?

@bricelam
Copy link
Contributor

bricelam commented Dec 15, 2016

In general, we would consider them on a per-feature basis, and they may not necessarily be implemented as connection string parameters. Here are some specific comments.

Parameter Comments
BinaryGUID We always read and write Guid objects as BLOB. #273 & #191 are about using TEXT
CacheSize You can send PRAGMA cache_size = <pages>;
DateTimeFormat We read using DateTime.Parse and write using yyyy-MM-dd HH:mm:ss.FFFFFFF
DateTimeKind We ignore DateTime.DateTimeKind
FailIfMissing You can use Mode = SqliteOpenMode.ReadWrite
JournalMode You can send PRAGMA journal_mode = <mode>;
LegacyFormat You can send PRAGMA legacy_file_format = 1;
PageSize You can send PRAGMA page_size = <bytes>;
Pooling We don't pool connections. It's not as important as on other databases where there's a network connection
SyncMode You can send PRAGMA synchronous = <mode>;
UseUTF16Encoding You can send PRAGMA encoding = 'UTF-16';

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants