File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
SQLite4Unity3d/SQLite4Unity3d Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -418,8 +418,18 @@ public int CreateTable(Type ty, CreateFlags createFlags = CreateFlags.None)
418
418
419
419
foreach ( var indexName in indexes . Keys ) {
420
420
var index = indexes [ indexName ] ;
421
- var columns = index . Columns . OrderBy ( i => i . Order ) . Select ( i => i . ColumnName ) . ToArray ( ) ;
422
- count += CreateIndex ( indexName , index . TableName , columns , index . Unique ) ;
421
+ string [ ] columnNames = new string [ index . Columns . Count ] ;
422
+ if ( index . Columns . Count == 1 ) {
423
+ columnNames [ 0 ] = index . Columns [ 0 ] . ColumnName ;
424
+ } else {
425
+ index . Columns . Sort ( ( lhs , rhs ) => {
426
+ return lhs . Order - rhs . Order ;
427
+ } ) ;
428
+ for ( int i = 0 , end = index . Columns . Count ; i < end ; ++ i ) {
429
+ columnNames [ i ] = index . Columns [ i ] . ColumnName ;
430
+ }
431
+ }
432
+ count += CreateIndex ( indexName , index . TableName , columnNames , index . Unique ) ;
423
433
}
424
434
425
435
return count ;
You can’t perform that action at this time.
0 commit comments