SQLitening Support Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Welcome to the SQLitening support forums!

Author Topic: Invalid column with too many functions (duplicate column names)  (Read 324 times)

cj

  • Master Geek
  • ****
  • Posts: 696
    • View Profile

Is there a limit to the number of functions called in a SELECT statement?
Each of the strftime function calls work if broken into shorter Select statements.

#INCLUDE "sqlitening.inc"
FUNCTION PBMAIN () AS LONG
 DIM sArray() AS STRING
 slOpen "junk.db3","C"
 slexe "drop table if exists t1"
 slexe "create table if not exists t1(c1)"
 slselAry "select strftime('%Y',c1),strftime('%m',c1),strftime('%d',c1)," +_
                 "strftime('%H',c1),strftime('%M',c1),strftime('%S',c1) from t1",sArray()
 ? JOIN$(sArray(),$CR)
END FUNCTION
« Last Edit: August 02, 2018, 02:55:44 PM by cj »
Logged
CJ

Bern Ertl

  • Master Geek
  • ****
  • Posts: 496
  • Excellent
    • View Profile
    • InterPlan Systems
Re: Invalid column with too many functions
« Reply #1 on: August 01, 2018, 05:56:04 PM »

I'm not at my programming rig, so I haven't tested your code, but have you tried:

slselAry "select strftime('%Y',c1) AS Col1,strftime('%m',c1) AS Col2,strftime('%d',c1) AS Col3," +_
                 "strftime('%H',c1) AS Col4,strftime('%M',c1) AS Col5,strftime('%S',c1) AS Col6 from t1",sArray()

cj

  • Master Geek
  • ****
  • Posts: 696
    • View Profile
Re: Invalid column with too many functions (duplicate column names solved)
« Reply #2 on: August 01, 2018, 11:36:09 PM »

That works. Thanks Bern Ertl!

Note:
Duplicate Column Names Raises Error -13 (in the docs.)

"D" modchar does not work as mentioned in the SQLitening docs slsel  "Pragma full_column_names=1"
https://www.sqlite.org/pragma.html#pragma_full_column_names

This pragma is deprecated and exists for backwards compatibility only. New applications should avoid using this pragma. Older applications should discontinue use of this pragma at the earliest opportunity. This pragma may be omitted from the build when SQLite is compiled using SQLITE_OMIT_DEPRECATED.





« Last Edit: August 03, 2018, 09:15:19 AM by cj »
Logged
CJ

Bern Ertl

  • Master Geek
  • ****
  • Posts: 496
  • Excellent
    • View Profile
    • InterPlan Systems
Re: Invalid column with too many functions (duplicate column names)
« Reply #3 on: August 03, 2018, 01:35:38 PM »

Glad it solved the issue.  I've had similar issues in the past so I've gotten into the habit of assigning column aliases now (to expression results) even when I'm not referencing columns by name.