SQLite

Check-in Differences
Login

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

Difference From caaef4c592c98088 To 689137e1b5bc78b0

2022-02-12
13:12
For .import auto-column, aid build-time override of rename decoration. (check-in: 433e5ead2b user: larrybr tags: auto-column)
10:48
Fix auto-column bug noted by post https://sqlite.org/forum/forumpost/d102c15d63 (check-in: 689137e1b5 user: larrybr tags: auto-column)
02:15
Sync w/trunk, allow build-time override of auto-column decorating character (check-in: caaef4c592 user: larrybr tags: auto-column)
2022-02-11
21:20
Fix a test in without_rowid1.test so that it is disabled without ALTER TABLE support, as it uses ALTER TABLE. (check-in: ca22a64e6f user: drh tags: trunk)
13:40
Upon .import column renaming, issue message saying so. Test this. (check-in: 8b6ca9304b user: larrybr tags: auto-column)

Changes to src/shell.c.in.
7273
7274
7275
7276
7277
7278
7279
7280
7281
7282
7283
7284
7285
7286
7287
 name TEXT, nlen INT, chop INT, reps INT, suff TEXT)\
";
  static const char const *zTabFill = "\
INSERT INTO ColNames(name,nlen,chop,reps,suff)\
 VALUES(iif(length(?1)>0,?1,'?'),max(length(?1),1),0,0,'')\
";
  static const char const *zHasDupes = "\
SELECT count(DISTINCT substring(name,1,nlen-chop)||suff)\
 <count(name) FROM ColNames\
";
  static const char const *zDedoctor = "\
WITH chopped AS ( \
 WITH RECURSIVE chopping(cpos, name, chop, nlen) AS ( \
  SELECT cpos, name, 0, nlen FROM ColNames \
  WHERE cpos IN ( \







|







7273
7274
7275
7276
7277
7278
7279
7280
7281
7282
7283
7284
7285
7286
7287
 name TEXT, nlen INT, chop INT, reps INT, suff TEXT)\
";
  static const char const *zTabFill = "\
INSERT INTO ColNames(name,nlen,chop,reps,suff)\
 VALUES(iif(length(?1)>0,?1,'?'),max(length(?1),1),0,0,'')\
";
  static const char const *zHasDupes = "\
SELECT count(DISTINCT (substring(name,1,nlen-chop)||suff) COLLATE NOCASE)\
 <count(name) FROM ColNames\
";
  static const char const *zDedoctor = "\
WITH chopped AS ( \
 WITH RECURSIVE chopping(cpos, name, chop, nlen) AS ( \
  SELECT cpos, name, 0, nlen FROM ColNames \
  WHERE cpos IN ( \
7307
7308
7309
7310
7311
7312
7313

7314
7315
7316
7317
7318
7319
7320
) UPDATE ColNames AS c \
  SET chop=n.chop FROM chopped n WHERE c.cpos=n.cpos \
";
  static const char const *zSetReps = "\
UPDATE ColNames AS t SET reps=\
(SELECT count(*) FROM ColNames d \
 WHERE substring(t.name,1,t.nlen-t.chop)=substring(d.name,1,d.nlen-d.chop)\

)\
";
#ifdef SQLITE_ENABLE_MATH_FUNCTIONS
  static const char const *zColDigits = "\
SELECT CAST(ceil(log(count(*)+0.5)) AS INT) FROM ColNames \
";
#endif







>







7307
7308
7309
7310
7311
7312
7313
7314
7315
7316
7317
7318
7319
7320
7321
) UPDATE ColNames AS c \
  SET chop=n.chop FROM chopped n WHERE c.cpos=n.cpos \
";
  static const char const *zSetReps = "\
UPDATE ColNames AS t SET reps=\
(SELECT count(*) FROM ColNames d \
 WHERE substring(t.name,1,t.nlen-t.chop)=substring(d.name,1,d.nlen-d.chop)\
 COLLATE NOCASE\
)\
";
#ifdef SQLITE_ENABLE_MATH_FUNCTIONS
  static const char const *zColDigits = "\
SELECT CAST(ceil(log(count(*)+0.5)) AS INT) FROM ColNames \
";
#endif
Changes to test/shell5.test.
495
496
497
498
499
500
501
















502
  x_2 = ex2
  x_3 = ex3
    y = wye4
  z_5 = zee5
  z_6 = zee6
Columns renamed during .import shell5.csv due to duplicates.}}

















finish_test







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
  x_2 = ex2
  x_3 = ex3
    y = wye4
  z_5 = zee5
  z_6 = zee6
Columns renamed during .import shell5.csv due to duplicates.}}

do_test shell5-5.1 {
  set out [open shell5.csv w]
  fconfigure $out -translation lf
  puts $out {"COW","cow","CoW","cOw"}
  puts $out {"uuu","lll","ulu","lul"}
  close $out
  forcedelete test.db
  catchcmd test.db {.import -csv shell5.csv t1
.mode line
SELECT * FROM t1;}
} {1 {COW_1 = uuu
cow_2 = lll
CoW_3 = ulu
cOw_4 = lul
Columns renamed during .import shell5.csv due to duplicates.}}

finish_test