Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1
    Join Date
    Mar 2005
    Posts
    229
    Plugin Contributions
    0

    Default Store Database Queries

    Hello,

    I'm in the process of upgrading and modifying my site and just discovered this setting.
    As I want to reduce to the max the downtime of the site I was planning to make a bunch of modifications by using SQL queries directly on the database.

    I found the syntaxe of some of the queries I need (by myself) but I would like to see what's happening behind the curtain, to be sure to not make any mistake and to take some queries as examples.

    Unfortunately, by setting Store Database Queries to true I only get SELECTs.

    That would be wonderful if I could get UPDATEs and INSERTs.

    Is there a setting that I'm missing ?
    Any modification to do on query_factory.php to get this ?


    Thanks for your help.

    Regards

    Hubert

  2. #2
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,755
    Plugin Contributions
    9

    Default Re: Store Database Queries

    As I want to reduce to the max the downtime of the site I was planning to make a bunch of modifications by using SQL queries directly on the database
    If you are following the recommended method for upgrading - there should be no need for what you are describing - which is dangerous at best

    PLEASE Back up your database before doing any of this
    Zen-Venom Get Bitten

  3. #3
    Join Date
    Mar 2005
    Posts
    229
    Plugin Contributions
    0

    Default Re: Store Database Queries

    You're right Kobra, it is dangerous and I know that.
    That's why I want to see Insert and Upgrade queries made by ZC so that I'm sure the ones I build are not wrong.

    More, my modifications are, for example, mass moving products from one category to another, or mass changing price to zero (because the product is becoming priced by attributes).

    Making that from admin takes a long time, making it using a query is very fast.

    I'm planning to queue all these modificcations using queries.
    That's why I need to see, not only SELECTs but also UPDATEs and INSERTs.

    Hubert

  4. #4
    Join Date
    Jan 2004
    Location
    N of San Antonio TX
    Posts
    9,684
    Plugin Contributions
    11

    Default Re: Store Database Queries

    Why are you insisting on such a radical process? What is it you expect to gain from avoiding the tried and true method of upgrade?

    Have you looked at http://www.zen-cart.com/entry.php?3-...-of-upgrading?
    A little help with colors.
    myZenCartHost.com - Zen Cart Certified, PCI Compatible Hosting by JEANDRET
    Free SSL & Domain with semi-annual and longer hosting. Updating 1.5.2 and Up.

  5. #5
    Join Date
    Mar 2005
    Posts
    229
    Plugin Contributions
    0

    Default Re: Store Database Queries

    I've already done that guys, but while upgrading I'm also updating, changing look and feel, adding some new modules, two of theme are custom modules. This simplify the structure of my categories and products.

    My only question was how to get sql INSERT and UPDATE queries in the logs.

  6. #6
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: Store Database Queries

    you will have to rewrite the query-factory code
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  7. #7
    Join Date
    Mar 2005
    Posts
    229
    Plugin Contributions
    0

    Default Re: Store Database Queries

    So sad, seems too complicated for me.
    I took a look into query_factory but I don't see where it is said to only log SELECTs.

    I also was wondering if all and every queries are going thru query_factory.
    Perhaps it's the case for everything done from admin ?
    If not, this is not my solution.

    That's really sad, it would have been a good debugging tool.

  8. #8
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: Store Database Queries

    I don't mean to sound uncooperative. However it's important to note that there's a lot more business logic going on in the PHP code beyond just mere SQL queries, including safeties and keeping relational records intact and ensuring related dependencies exist. This logic will not be evident in mere SQL queries alone. The logic is all there in the PHP files for you to review.

    And, yes, query_factory is used for all queries executed by original Zen Cart files.
    That said, addons/contributions may have taken shortcuts and thus there are no guarantees that they've embraced the ZC framework methods for doing db queries, and therefore can't be certain that they're using query_factory as it was intended.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  9. #9
    Join Date
    Mar 2005
    Posts
    229
    Plugin Contributions
    0

    Default Re: Store Database Queries

    Thanks for your reply DrByte.

    Are you meaning that there's No safe SQL queries if they are made directly on the database ?
    Even if it's only a simple price update, or a category id change ?

  10. #10
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: Store Database Queries

    Quote Originally Posted by hubert View Post
    Thanks for your reply DrByte.

    Are you meaning that there's No safe SQL queries if they are made directly on the database ?
    Even if it's only a simple price update, or a category id change ?
    I didn't say that. I was responding to your post where your question implied that reverse-reviewing logged queries would be suitable for relying upon for general updates.
    My post was intended to convey the fact that taking information out of context can result in problems. That includes looking at queries independent of business logic.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. v154 How to keep database queries down and store optimized.
    By sports guy in forum General Questions
    Replies: 2
    Last Post: 15 Apr 2015, 05:45 AM
  2. v150 [Done v1.6.0] Store Database Queries
    By hubert in forum Bug Reports
    Replies: 0
    Last Post: 3 Jun 2013, 02:02 AM
  3. Database queries - too many?
    By Anna718 in forum General Questions
    Replies: 10
    Last Post: 6 Dec 2008, 11:34 PM
  4. [Not a Bug] Logging :: Store Database Queries
    By shrimp-gumbo-mmmhhh in forum Bug Reports
    Replies: 4
    Last Post: 14 Aug 2008, 06:06 PM
  5. Store Database Queries?
    By SaveYourPhone in forum Basic Configuration
    Replies: 2
    Last Post: 18 Oct 2006, 05:10 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg