Using literal SQL

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Using literal SQL

RAPPAZ Francois

Hi there,

 

Can I send a raw sql string to a mysql DB using DBIX::Class ?

 

If

$schema =  Dbc::Schema->connect( …):

 

From the doc (under ResultSet->Search_litteral ) it seems that a $schema->search function exists

 

But

$schema->search(\[“select * from  …”]); does not work  (no search method in schema)

 

Thanks for any suggestion

 

François

 


_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@...
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

FW: Using literal SQL

RAPPAZ Francois
Hi there,
My first mail as be truncated, so I repost:
Can I send a raw sql string to a mysql DB using DBIX::Class ?
If
$schema =  Dbc::Schema->connect( .);
From the doc (under ResultSet->Search_litteral ) it seems that a $schema->search function exists
But
$schema->search(\["select * from  ."]); does not work  (no search method in schema)
Thanks for any suggestion

François

_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@...

ATT00001.txt (390 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: FW: Using literal SQL

Dagfinn Ilmari Mannsåker
Hi Francois,

RAPPAZ Francois <[hidden email]> writes:

> Hi there,
> My first mail as be truncated, so I repost:
> Can I send a raw sql string to a mysql DB using DBIX::Class ?
> If
> $schema =  Dbc::Schema->connect( .);
> From the doc (under ResultSet->Search_litteral ) it seems that a $schema->search function exists
> But
> $schema->search(\["select * from  ."]); does not work  (no search method in schema)

That is a typo in the documentation, it should be '$rs->search(\[])'.
Sorry for the confusion.

> Thanks for any suggestion

For completely arbitrary SQL queries you need to use a virtual view:

https://metacpan.org/pod/DBIx::Class::ResultSource::View

> François

Regards,

Ilmari

--
"The surreality of the universe tends towards a maximum" -- Skud's Law
"Never formulate a law or axiom that you're not prepared to live with
 the consequences of."                              -- Skud's Meta-Law


_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@...
Loading...