fixup sqlacexpr
[scpubgit/Q-Branch.git] / maint / sqlacexpr
CommitLineData
cd979d19 1#!/usr/bin/env perl
2
514d92f1 3use lib 'lib';
c95da5ee 4use strictures 2;
e2fe5d95 5use SQL::Abstract;
3be8bc78 6use SQL::Abstract::ExtraClauses;
e2fe5d95 7use Devel::DDCWarn;
3be8bc78 8
e2fe5d95 9warn $ARGV[1]."\n";
3be8bc78 10
e2fe5d95 11my $sqlac = SQL::Abstract->new(
b3b54441 12 unknown_unop_always_func => 1,
13 lazy_join_sql_parts => 1,
14);
3be8bc78 15
e2fe5d95 16SQL::Abstract::ExtraClauses->apply_to($sqlac);
17
c95da5ee 18my @args = ($ARGV[1] =~ /^\.\// ? do $ARGV[1] : eval '+('.$ARGV[1].')');
3be8bc78 19
c95da5ee 20die $@ if $@;
3be8bc78 21
b3b54441 22my ($q, @bind) = $sqlac->${\$ARGV[0]}(@args);
23
e2fe5d95 24print STDERR +(ref($q) ? $q->format : $q)."\n";
07070f1a 25Dwarn [ @bind ];