Jump to content

Delete records LIKE


Yarnell

Recommended Posts

Using CubeCart's Database class, the statement would be:

Database::getInstance()->delete('CubeCart_sessions', array('location' => "~2022"));

The third parameter (false) is not necessary. It defaults to an empty string. That third parameter limits how many records get deleted.

Link to comment
Share on other sites

I have no idea why 'location' is varbinary. CubeCart uses that column to store the web address used to access the site, including any querystring. Nothing in that textual string would require the table column to handle binary (that is, non-textual) data.

Let's review what you actually need to accomplish.

What is the nature of the content that is in the 'location' column that contains 2022?

 

Edited by bsmither
Link to comment
Share on other sites

2022 was just an example.

I would like to weed out any sessions that I don't need to track.

cron jobs for example. I have a wget command running every 30 mins or so and cubecart creates a new session each time it runs.

So would it be ok for me to just change the field to varchar... it won't effect anything?

Link to comment
Share on other sites

I would think you would have the same problem.

"I would like to weed out any sessions that I don't need to track."

Where are you tracking sessions? In admin, Statistics, Users Online tab? If so, is there a link above the table to Display Customers Only?

The database table CubeCart_sessions gets trimmed of records that are older than seven days.

 

Link to comment
Share on other sites

If the traffic chart on the dashboard does not have a comparable way to limit the results to Customers Only, then perhaps your solution is to rewrite the custom code to add more to the WHERE clause:

AND `session_last` > `session_start`

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...