Am Tue, 10 Mar 2015 20:06:57 +0100
schrieb Guido Seifert <warg...@gmx.de>:

> Hi,
> just 'discovered' that bindValue does not seem to work with CREATE TABLE 
> statements. One could ask, why would anyone want to use
> a bound value in a CREATE TABLE statement. Here my query:
> 
> > CREATE TEMP TABLE selectseriestable AS SELECT title FROM titlegroup,title 
> > WHERE titlegroup.seriesID=(SELECT 
> > seriesid FROM series WHERE series=:series AND version=:version) AND 
> > titlegroup.titleID=title.titleID;";
> 
> Works fine when I replace :series and :version with concrete values. Now the 
> question is... is this supposed to work? Is it a bug?
> Or should it be ignored as some strange fringe use case and at best be 
> documented?
> 
> Ok, there is also the remote possibility that I overlooked something or made 
> a mistake. ;-)
> The database I currently use is postgresql.
> 
> Guido

works at my side, qt4.8.6:

  query.prepare("CREATE TEMP TABLE selectseriestable AS SELECT title FROM 
titlegroup,title "
    "WHERE titlegroup.seriesID=(SELECT seriesid FROM series WHERE 
series=:series AND version=:version) AND titlegroup.titleID=title.titleID;");
  QString series="bla";
  QString version="blabla";
  query.bindValue(":series",series);
  query.bindValue(":version",version);

besides that my ms sql server don't like the syntax...
in my case the QSqlQuery emulates preparing and binding, but the query is 
prepared successfully and the values are bound. and the statement is executed 
by the sql server.

i think in view of the drivers theres no difference in the exact statement, 
whether you have a insert, create, whatever, is of no concern.

alex

-- 
/*
 *  panic("Damn it Jim! I'm a doctor, not a programmer! "
 *                  "Oh, wait a sec, I am a programmer. "
 *                  "And, who's Jim?!?!\n"
 *                  "Arrgghh! We've done it again!\n");
 *          linux-2.6.6/drivers/message/fusion/mptlan.c
 */

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to