sdk/dotnet/src/Microsoft.Datasync.Client.SQLiteStore/Utils/SqlStatements.cs
/// <summary>
/// Produces a <c>CREATE TABLE IF NOT EXISTS</c> SQL statement.
/// </summary>
/// <param name="tableName">The name of the table.</param>
/// <param name="primaryKey">The column definition of the primary key</param>
/// <param name="otherColumns">The column definitions of the other columns.</param>
/// <returns>The SQL statement.</returns>
Produces a CREATE TABLE IF NOT EXISTS
Produces a CREATE TABLE IF NOT EXISTS
internal static string CreateTableFromColumns(string tableName, ColumnDefinition primaryKey, IEnumerable<ColumnDefinition> otherColumns)
        {
            var columnDefinitions = otherColumns.Select(c => $"{FormatColumnName(c.Name)} {c.StoreType}").ToList();
            columnDefinitions.Insert(0, $"{FormatColumnName(primaryKey.Name)} {primaryKey.StoreType} PRIMARY KEY");
            return $"CREATE TABLE IF NOT EXISTS {FormatTableName(tableName)} ({string.Join(", ", columnDefinitions)})";
        }
internal static string CreateTableFromColumns ( string tableName , ColumnDefinition primaryKey , IEnumerable < ColumnDefinition > otherColumns ) { var columnDefinitions = otherColumns . Select ( c => $" { FormatColumnName ( c . Name ) } { c . StoreType } " ) . ToList ( ) ; columnDefinitions . Insert ( 0 , $" { FormatColumnName ( primaryKey . Name ) } { primaryKey . StoreType }  PRIMARY KEY " ) ; return $" CREATE TABLE IF NOT EXISTS  { FormatTableName ( tableName ) }  ( { string . Join ( " " , columnDefinitions ) } ) " ; }
Produces a CREATE TABLE IF NOT EXISTS
Produces a CREATE TABLE IF NOT EXISTS
The SQL statement.
The SQL statement .
tableName
string
The name of the table.
The name of the table .
primaryKey
ColumnDefinition
The column definition of the primary key
The column definition of the primary key
otherColumns
IEnumerable<ColumnDefinition>
The column definitions of the other columns.
The column definitions of the other columns .