bcit-ci / CodeIgniter

Open Source PHP Framework (originally from EllisLab)
https://codeigniter.com/
MIT License
18.27k stars 7.6k forks source link

bug: ODBC does not return correctly the results aliasing #5594

Closed mckaygerhard closed 6 years ago

mckaygerhard commented 6 years ago

HI, as posted by @narfbg i posted a new issue event try to explain that older issues was "partially" resolved ..

we cannot do complex joins, call to procedures recursivelly or as simple we cannot make alias of a column:, and as a note, the fixeds of current odbc does not permit handle resultset due are using arrays to that.. causing out of memory in manny maners

THE SQL: SELECT top 1 cedula as codficha, ValorEgreso as condicion FROM dbo.Historia.

RESULT OBTAINED:

array(1) { [0]=> array(2) { ["cedula"]=> string(8) "11618438" ["ValorEgreso"]=> string(1) "1" } }

application/views/welcome_message.php

EXPECTED RESULT:

array(1) { [0]=> array(2) { ["codficha"]=> string(8) "11618438" ["condicion"]=> string(1) "1" } }

application/views/welcome_message.php

procedure to reporduce:

  1. define a odbc access to msssql/sybase/etc db in database.php (here names "saint" the group)
  2. download and setup the CI3 stable
  3. open the welcome controller and paste/sustitute index method code by:
public function index()
 {
  $this->load->database('saintdb',TRUE);
  $sql = "
            SELECT top 1 
             cedula as codficha, ValorEgreso as condicion 
            FROM 
             dbo.Historia
            ";
        $query = $this->db->query($sql);
        $arr_rst = $query->result_array();

        var_dump($arr_rst);

CHECKS:

  1. There is not already an open Issue about ODBC, all checked and closed
  2. The issue has already been fixed? : checked devbeloper brand and closed and seems was bad resolved
  3. Is it something really obvious that you can fix yourself? Obviously not!
mckaygerhard commented 6 years ago

ok i revised the odbc_result.php and see that there's a alrady own made resultset management, as i posted we need to find a way to handle without using arrays unless to return final out! i need more helpo obviously,

NOTES:

narfbg commented 6 years ago

If you specify an alias in SQL and the result set is returned without it, that's the database's fault. It's not CI's job to inspect your raw SQLs and mangle result sets based on that.

And for the last time, we don't care about CI2. CI2 is dead and gone, officially so for almost 3 years, and you're a fool for pursuing anything related to it.

mckaygerhard commented 6 years ago

@narfbg are you very close to hear the ovvious, with other frameworks the qeury works pleny! and with the isql command line are working! and with the freedts command line are working!

the issue are agian CI3 men! open your eyes!

tyronelucero commented 6 years ago

hey @narfbg are you blind? see picture! DB problem! i pleny setup sameproblem

if you made the query agains the isql command works!