On 26 May 2014, at 9:17pm, Staffan Tylen <[email protected]> wrote:

> This is why I've tried to get SQL to dynamically resolve the table and
> column names using the example I posted. But as that doesn't work I need to
> look for a different solution. I hope all this is not too vague to
> understand.

No.  That was a good explanation.  The only solution I can suggest is that you 
don't use a fixed SQL command but instead remember that the SQL command you 
pass to _exec() or _prepare() is just another C string.  You can use C commands 
to concatenate that string from components.  It doesn't have to be fixed in 
your program.  So do (untested pseudocode)

theCommand = "SELECT PFX"
theCommand += thePFXNum
theCommand += "_COL"
theCommand += theCOLNum
theCommand += " FROM "
theCommand += theTableName

and then pass that to _prepare() or _exec() or whatever you're doing.

If your legacy tables don't change often (or if you have plenty of runtime 
available each time on changes) I might just make a conversion routine which 
takes data from the legacy tables and makes some tables with it which have a 
more convenient schema.  Then run that routine when needed.

Simon.
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to