@@ -555,7 +555,7 @@ def concatQuery(self, query, unpack=True):
555
555
556
556
return concatenatedQuery
557
557
558
- def forgeInbandQuery (self , query , position , count , comment , prefix , suffix , char , where , multipleUnions = None , limited = False ):
558
+ def forgeInbandQuery (self , query , position , count , comment , prefix , suffix , char , where , multipleUnions = None , limited = False , fromTable = None ):
559
559
"""
560
560
Take in input an query (pseudo query) string and return its
561
561
processed UNION ALL SELECT query.
@@ -586,6 +586,8 @@ def forgeInbandQuery(self, query, position, count, comment, prefix, suffix, char
586
586
@rtype: C{str}
587
587
"""
588
588
589
+ fromTable = fromTable or FROM_DUMMY_TABLE .get (Backend .getIdentifiedDbms (), "" )
590
+
589
591
if query .startswith ("SELECT " ):
590
592
query = query [len ("SELECT " ):]
591
593
@@ -598,7 +600,7 @@ def forgeInbandQuery(self, query, position, count, comment, prefix, suffix, char
598
600
599
601
if limited :
600
602
inbandQuery += ',' .join (char if _ != position else '(SELECT %s)' % query for _ in xrange (0 , count ))
601
- inbandQuery += FROM_DUMMY_TABLE . get ( Backend . getIdentifiedDbms (), "" )
603
+ inbandQuery += fromTable
602
604
inbandQuery = self .suffixQuery (inbandQuery , comment , suffix )
603
605
604
606
return inbandQuery
@@ -615,8 +617,8 @@ def forgeInbandQuery(self, query, position, count, comment, prefix, suffix, char
615
617
intoRegExp = intoRegExp .group (1 )
616
618
query = query [:query .index (intoRegExp )]
617
619
618
- if Backend . getIdentifiedDbms () in FROM_DUMMY_TABLE and inbandQuery .endswith (FROM_DUMMY_TABLE [ Backend . getIdentifiedDbms ()] ):
619
- inbandQuery = inbandQuery [:- len (FROM_DUMMY_TABLE [ Backend . getIdentifiedDbms ()] )]
620
+ if fromTable and inbandQuery .endswith (fromTable ):
621
+ inbandQuery = inbandQuery [:- len (fromTable )]
620
622
621
623
for element in xrange (0 , count ):
622
624
if element > 0 :
@@ -635,9 +637,9 @@ def forgeInbandQuery(self, query, position, count, comment, prefix, suffix, char
635
637
conditionIndex = query .index (" FROM " )
636
638
inbandQuery += query [conditionIndex :]
637
639
638
- if Backend . getIdentifiedDbms () in FROM_DUMMY_TABLE :
640
+ if fromTable :
639
641
if " FROM " not in inbandQuery or "(CASE " in inbandQuery or "(IIF" in inbandQuery :
640
- inbandQuery += FROM_DUMMY_TABLE [ Backend . getIdentifiedDbms ()]
642
+ inbandQuery += fromTable
641
643
642
644
if intoRegExp :
643
645
inbandQuery += intoRegExp
@@ -654,8 +656,8 @@ def forgeInbandQuery(self, query, position, count, comment, prefix, suffix, char
654
656
else :
655
657
inbandQuery += char
656
658
657
- if Backend . getIdentifiedDbms () in FROM_DUMMY_TABLE :
658
- inbandQuery += FROM_DUMMY_TABLE [ Backend . getIdentifiedDbms ()]
659
+ if fromTable :
660
+ inbandQuery += fromTable
659
661
660
662
inbandQuery = self .suffixQuery (inbandQuery , comment , suffix )
661
663
0 commit comments