j4mie / idiorm

A lightweight nearly-zero-configuration object-relational mapper and fluent query builder for PHP5.
http://j4mie.github.com/idiormandparis/
2.01k stars 369 forks source link

DOException Code: HY000 Message: SQLSTATE[HY000]: General error #356

Closed adriano-ghezzi closed 4 years ago

adriano-ghezzi commented 4 years ago

error Details Type: PDOException Code: HY000 Message: SQLSTATE[HY000]: General error File: /var/development/masi-fase2/web/vendor/j4mie/idiorm/idiorm.php Line: 1913 Trace

0 /var/development/masi-fase2/web/vendor/j4mie/idiorm/idiorm.php(1913): PDOStatement->fetch(2)

1 /var/development/masi-fase2/web/vendor/j4mie/idiorm/idiorm.php(718): ORM->_run()

2 /var/development/masi-fase2/web/vendor/j4mie/idiorm/idiorm.php(707): ORM->_find_many()

3 /var/development/masi-fase2/web/vendor/j4mie/idiorm/idiorm.php(2269): ORM->find_many()

4 /var/development/masi-fase2/web/src/models/experienceModel.php(559): ORM->__call('findMany', Array)

source line $records=\ORM::forTable('ana_experiences')->raw_query($sql)->findMany();

ORM settings

["connection_string"]=> string(33) "mysql:host=xxx.xom;dbname=name" ["id_column"]=> string(2) "id" ["id_column_overrides"]=> array(0) { } ["error_mode"]=> int(2) ["username"]=> string(4) "xxx" ["password"]=> string(18) "xxx" ["driver_options"]=> array(1) { [1002]=> string(14) "SET NAMES utf8" } ["identifier_quote_character"]=> NULL ["limit_clause_style"]=> NULL ["logging"]=> bool(true) ["logger"]=> NULL ["caching"]=> bool(false) ["caching_auto_clear"]=> bool(false) ["return_result_sets"]=> bool(false) }

all the tables are in utf8mb4_general_ci

the query

1 home page items

        SET @elemType='experience';
        SET @lang='it';
        SET @=@permalinkType='slug';
        SET @imageType='main';
        SET @deleted=0;
        SELECT
            meta_experiences.title,
            experience_calendar.tmstp,
            FROM_UNIXTIME(experience_calendar.tmstp) as dt,
            experience_calendar.id AS calId,
            ana_experiences.*,
            (SELECT ana_locations.name FROM ana_locations where ana_locations.id=ana_experiences.ana_locations_id) AS location,
            #price-----
            (
            SELECT ana_experiences_details.price
            FROM ana_experiences_details
            WHERE ana_experiences_details.ana_experiences_id = ana_experiences.id
            ORDER BY price DESC LIMIT 1
            ) AS price,
            #permalink----------------------------------------------------
            (
                SELECT routes.pattern
                FROM routes
                WHERE routes.id IN
                (
                    SELECT experience_routes.routes_id
                    FROM experience_routes
                    WHERE experience_routes.experience_id = ana_experiences.id
                    AND experience_routes.languages_id=@lang
                    AND experience_routes.route_type=@permalinkType
                )
            )
            AS permalink,
       #image---- -------------------------------------------------------
            (
                SELECT
                    concat
                    (@imageUrl, rel_path,rel_url,file_name)
                    FROM ana_files
                 WHERE ana_files.id IN
                 ( SELECT experience_files.ana_files_id
                    FROM experience_files
                    WHERE experience_files.ana_experiences_id = ana_experiences.id
                    AND img_type = @imageType
                 )
            )
            AS image
        FROM ana_experiences
        #slot for date and availability--------------------------------------------------------------
        LEFT OUTER JOIN experience_calendar ON ana_experiences.id = experience_calendar.experience_id
        AND experience_calendar.id =
        (
          select experience_calendar.id FROM experience_calendar
          WHERE experience_calendar.experience_id= ana_experiences.id
          ORDER BY tmstp DESC LIMIT 1
        )
        #meta for title and des------------------------------------------------------------------------
        LEFT OUTER JOIN meta_experiences  ON  ana_experiences.id =  meta_experiences.ana_experiences_id
            AND meta_experiences.ana_languages_id=@lang

        WHERE
        type=@elemType
        AND
        experience_calendar.id IS NOT NULL
        AND
        _deleted=@deleted
        AND #published language
            (
              SELECT id
              FROM experience_lingue_pubblicate
              WHERE experience_lingue_pubblicate.ana_languages_id=@lang
              AND experience_lingue_pubblicate.ana_experiences_id=ana_experiences.id
            ) is not NULL
        ORDER BY  experience_calendar.tmstp DESC
        LIMIT 4

result from mysql prompt

*************************** 1. row ***************************
             title: esperienza uno
             tmstp: 1575129600
                dt: 2019-11-30 16:00:00
             calId: 37
                id: 5
              type: experience
              name: esperienza 1
  ana_merchants_id: 1
           ev_date: 2019-11-21 16:29:46
         home_page: 1
            durata: 120
  ana_locations_id: 11
        max_ospiti: 10
           og_type: NULL
          bookable: 1
            n_vini: 1
ana_restaurants_id: NULL
     ana_hotels_id: NULL
          _deleted: 0
          location: cantina rossi
             price: 11
         permalink: NULL
             image: NULL
1 row in set (0.00 sec)
treffynnon commented 4 years ago

Could you narrow this down to the smallest reproducible example and open a new issue if you're still having this issue. There is too much noise in the details here to really understand what is going.