Tcl bindins problem, once again

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Tcl bindins problem, once again

Paweł Salawa-3
  Hi,

I mentioned the problem before but it seems to be ignored for now. I'd
really appreciate some response, at least confirmation or denial that
I'm right about the problem.

Quoting from previous thread:

--- QUOTE ---
select a1.txt, a2.txt
   from a a1
   join a a2
        using (ref)
  where a1.lang = 'french'
        and
        a2.lang = 'english';
--- END OF QUOTE ---

Note, that the "SELECT" is not known to application - it's custom select
typed by end-user, so I don't deciede about "AS" aliases for columns.

--- QUOTE ---
We can either use:
db eval $query arr {
   parray arr
}

But then we would have arr(*) = a.txt a.txt but only one array entry:
arr(a.txt).

Other way is to use:

set results [db eval $query]
foreach cellValue $results {
   puts $cellValue
}

But then we lose informations about column names in results.

One of possible solutions would be to add some prefix or suffix to array
indexes.

Other one would be to provide column names in results of [db eval $query],
using for example flag, like: [db eval $query -withColumnNames] or
something
like that. The results would be: [list $columnList $tableDataList]
--- END OF QUOTE ---

Currently I implemented workaround with 2 calls mixed. First is "db eval
$query arr {...}" to collect list of result columns and second "set
results [db eval $query]" to get all values.
It works, but it causes additional query execution. It's a workaround,
not a solution.
Shouldn't it be fixed?

Regards,
Googie

_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Tcl bindins problem, once again

Richard Hipp-3
On Fri, Oct 8, 2010 at 2:55 AM, Paweł Salawa <[hidden email]> wrote:

>  Hi,
>
> I mentioned the problem before but it seems to be ignored for now. I'd
> really appreciate some response, at least confirmation or denial that
> I'm right about the problem.
>
>
You are correct - duplicate column names means that the TCL interface can
only access the latter of the two columns.  We do not have any plans to
address this in the near future.  Please make your column names distinct
when using the TCL interface.


> Quoting from previous thread:
>
> --- QUOTE ---
> select a1.txt, a2.txt
>   from a a1
>   join a a2
>        using (ref)
>  where a1.lang = 'french'
>        and
>        a2.lang = 'english';
> --- END OF QUOTE ---
>
> Note, that the "SELECT" is not known to application - it's custom select
> typed by end-user, so I don't deciede about "AS" aliases for columns.
>
> --- QUOTE ---
> We can either use:
> db eval $query arr {
>   parray arr
> }
>
> But then we would have arr(*) = a.txt a.txt but only one array entry:
> arr(a.txt).
>
> Other way is to use:
>
> set results [db eval $query]
> foreach cellValue $results {
>   puts $cellValue
> }
>
> But then we lose informations about column names in results.
>
> One of possible solutions would be to add some prefix or suffix to array
> indexes.
>
> Other one would be to provide column names in results of [db eval $query],
> using for example flag, like: [db eval $query -withColumnNames] or
> something
> like that. The results would be: [list $columnList $tableDataList]
> --- END OF QUOTE ---
>
> Currently I implemented workaround with 2 calls mixed. First is "db eval
> $query arr {...}" to collect list of result columns and second "set
> results [db eval $query]" to get all values.
> It works, but it causes additional query execution. It's a workaround,
> not a solution.
> Shouldn't it be fixed?
>
> Regards,
> Googie
>
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



--
D. Richard Hipp
[hidden email]
_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users