Adodb.inc.php version

yehster wrote on Tuesday, December 13, 2011:

https://github.com/yehster/openemr/commit/84e8d5b93fc62c71041c9abdb2829f5b2de851ff

More clean up…

bradymiller wrote on Wednesday, December 14, 2011:

Hi,

Here’s a diff of adodb from openemr 2.8.3 to current:

[00:32][brady2@ubuntu:~/git/openemr(master)]$ diff --ignore-all-space -r ../testing_adodb library/adodb | less
diff --ignore-all-space -r ../testing_adodb/adodb.inc.php library/adodb/adodb.inc.php
733a734
>               include_once(dirname(__FILE__) . "/../log.inc");
783a785,792
>               // Added for the OpenEMR audit engine
>                 if ($ret === false) {
>                       auditSQLEvent($sql,false);
>               }
>               else {
>                       auditSQLEvent($sql,true);
>               }
>
873a883
>
diff --ignore-all-space -r ../testing_adodb/drivers/adodb-mysql.inc.php library/adodb/drivers/adodb-mysql.inc.php
205a206,212
>
>               // ViSolve : Sep 24,2010
>               // Instead of returning the generated LAST_INSERT_ID, the manipulated value
>               // from the $GLOBALS['lastidado'] is returned.
>               if($GLOBALS['lastidado'])
>                  return $GLOBALS['lastidado'];
>               else

Pretty minimal mods there, so no more hurdles. If your stuff is testing well, then seems like a good plan. Hopefully this will fix the bugs in newer xampp versions.

-brady

bradymiller wrote on Thursday, December 15, 2011:

Hi,
Is this code ready to commit or need more testing time?
-brady

yehster wrote on Thursday, December 15, 2011:

I just realized that the apt package I installed in step 4 is actually this extension which claims to improve performance.

http://adodb.sourceforge.net/#download
Speed Up Your PHP Code with the ADOdb extension
Adodb-ext-504.zip provides up to 100% speedup by replacing parts of ADOdb with C code. ADOdb will auto-detect if this extension is installed and use it automatically. This extension is compatible with ADOdb 3.32 or later, and PHP 4.3 - 5.x.x. Source code is included. Please note that you will need to compile it yourself. Instructions included.

yehster wrote on Thursday, December 15, 2011:

https://github.com/yehster/openemr/commit/1df6a73ad61a9a4fca5f84102bbf651cdd39cef7
https://github.com/yehster/openemr/tree/adodbUpgrade

I think this is ready for commit, or at least for others to test it out on their own systems.

There are changes to 2 files that are part of openemr, library/sql.inc and library/log.inc
The rest of the changes are all in library/adodb

For this branch, I deleted everything in adodb first, then copied in the contents of the latest adodb package
https://sourceforge.net/projects/adodb/files/

I used git rm for the files which aren’t part of the adodb package anymore such as
https://github.com/openemr/openemr/blob/master/library/adodb/tute.htm
and
https://github.com/openemr/openemr/blob/master/library/adodb/adodb-time.zip

jason0 wrote on Thursday, December 15, 2011:

Hi,

I have been reading through the pro git book: it might be a good idea to look into using submodules.  Git provides a mechanism to have dependencies on other git repositories.  In theory then we would be keeping our commits separate from adodb’s or jquery’s for example.  Our git repository would have the submodule’s commit tag in it so it could rebuild the submodule as needed.  There’s more details, and it does get more complex, but it is a way to keep our work separate from others, and allow us to upgrade modules separately.

-jason

bradymiller wrote on Friday, December 16, 2011:

Hi Kevin,
Committed your changes to sourceforge. Thank you for the awesome contribution.
Placed a quick wiki page to document/track this module: http://www.open-emr.org/wiki/index.php/ADODB
-brady

bradymiller wrote on Tuesday, April 10, 2012:

Hi,

New bug in Adminsitration->Language->‘Edit Definitions’ . Get a sql error whenever click the Search button:

When English, get:

ERROR: query failed: SELECT lc.cons_id, lc.constant_name, ld.def_id, ld.definition, ld.lang_id FROM lang_definitions AS ld RIGHT JOIN ( lang_constants AS lc, lang_languages AS ll ) ON ( lc.cons_id = ld.cons_id AND ll.lang_id = ld.lang_id ) WHERE lc.constant_name COLLATE utf8_general_ci LIKE ? AND ( ll.lang_id = 1 ) ORDER BY lc.constant_name COLLATE utf8_general_ci

when non-english get:

Input Array does not match ?: SELECT lc.cons_id, lc.constant_name, ld.def_id, ld.definition, ld.lang_id FROM lang_definitions AS ld RIGHT JOIN ( lang_constants AS lc, lang_languages AS ll ) ON ( lc.cons_id = ld.cons_id AND ll.lang_id = ld.lang_id ) WHERE lc.constant_name COLLATE utf8_general_ci LIKE Array AND ( ll.lang_id = 1 OR ll.lang_id=
ERROR: query failed: SELECT lc.cons_id, lc.constant_name, ld.def_id, ld.definition, ld.lang_id FROM lang_definitions AS ld RIGHT JOIN ( lang_constants AS lc, lang_languages AS ll ) ON ( lc.cons_id = ld.cons_id AND ll.lang_id = ld.lang_id ) WHERE lc.constant_name COLLATE utf8_general_ci LIKE ? AND ( ll.lang_id = 1 OR ll.lang_id=? ) ORDER BY lc.constant_name COLLATE utf8_general_ci

This code hasn’t changed for two years and works fine 4.1.0(9); and considering the main change in the codebase of 4.1.1 and 4.1.0(9) is the above changes, I’m guessing it’s related. The query is from interface/language/lang_definition.php :

  $lang_id = (int)formData('language_select');
  $lang_filter = isset($_POST['filter_cons']) ? $_POST['filter_cons'] : '';
  $lang_filter .= '%';
  $lang_filter_def = isset($_POST['filter_def']) ? $_POST['filter_def'] : '';
  $lang_filter_def .= '%';
  $bind_sql_array = array();
  array_push($bind_sql_array, $lang_filter);
        $sql = "SELECT lc.cons_id, lc.constant_name, ld.def_id, ld.definition, ld.lang_id " .
    "FROM lang_definitions AS ld " .
    "RIGHT JOIN ( lang_constants AS lc, lang_languages AS ll ) ON " .
    "( lc.cons_id = ld.cons_id AND ll.lang_id = ld.lang_id ) " .
    "WHERE lc.constant_name ".$case_insensitive_collation." LIKE ? AND ( ll.lang_id = 1 ";
  if ($lang_id != 1) {
                array_push($bind_sql_array, $lang_id);
                $sql .= "OR ll.lang_id=? ";
                $what = "SELECT * from lang_languages where lang_id=? LIMIT 1";
                $res = SqlStatement($what, array($lang_id) );
                $row = SqlFetchArray($res);
                $lang_name = $row['lang_description'];
        }
        $sql .= ") ORDER BY lc.constant_name ".$case_insensitive_collation;
        $res = SqlStatement($sql, array($bind_sql_array) );

-brady
OpenEMR

yehster wrote on Wednesday, April 11, 2012:

$res = SqlStatement($sql, array($bind_sql_array) );

This looks like the offending code.  $bind_sql_array is already an array, so wrapping it again as an array causes the problem.
Old adodb probably just let it slide.

bradymiller wrote on Wednesday, April 11, 2012:

Hi yehster,
Nice catch. Just applied your fix (which worked) and committed to sourceforge.
-brady