Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4267180
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T06:51:49+00:00 2026-05-21T06:51:49+00:00

I have a table in a SQLite database where a column stores file mtimes

  • 0

I have a table in a SQLite database where a column stores file mtimes in epoch seconds.

I would now like to search in that table files that were modified in a certain month?

In raw SQL I would do:

 select * from my_table where strftime('%Y-%m', mtime, "unixepoch") = "2009-08"

Is there a way to do this efficiently via DBIx::Class? Is it possible to do

 $m->search({ \'strftime('%Y-%m', mtime, "unixepoch")' => "2009-08" })

I tried understanding if there’s a way with DBIx::Class::InflateColumn::DateTime but I didn’t find it.

Thanks

Simone

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T06:51:50+00:00Added an answer on May 21, 2026 at 6:51 am

    The syntax you’re looking for is:

    $m->search(
      \[ q{strftime('%Y-%m', mtime, "unixepoch") = ?}, "2009-08" ]
    );
    

    Yes, that’s an array-ref-ref. The first element is literal SQL which is permitted to use ? placeholders, and the remaining elements are values to bind to those placeholders, and DBIC will make sure to reorder everything internally so that those values get put into the right place in the bind list when the query runs.

    If you need to combine one of these with other criteria, since an arrayrefref isn’t a valid hash key, you need to use the -and syntax:

    $m->search({ 
      -and => [
        foo => 'bar',
        \[ q{ SQL }, $bind ],
      ],
    });
    

    Here is the section of the SQL::Abstract docs for this construct.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a program in Ruby that downloads a file from an RSS feed
I have a table having data. id type 1 max 1 sam 1 rom
Hello everybody i hope everybody is doin well, Actually i have a table in
I'm using Python/SQLite for accessing database. After running the query, and getting the result,
I am trying to select all the records from a sqlite db I have
I'm having a bit of a problem deciding how to store some data. To
I'm kind of stuck working out where I'm going wrong with the below entity
I'm using SubSonic 3.0.0.3 and I can't seem to get the ActiveRecord .tt files
(related to Finding the lowest unused unique id in a list and Getting unused
I m trying to delete a record from a SQLiteDB via Android Application,This is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.