We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
  • I think you can safely assume it’s coming very soon.
      Ryan Thrash, MODX Co-Founder
      Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
    • I checked in the changes to SVN (see the SVN info for xPDO at http://www.xpdo.org/development.html as it is different than MODx and has moved from it’s original home), I just need some time to package it up; I will do so as soon as I get a moment...
      • You seriously rock, Jason. wink Here, have a cold-one on me! cool
          Mike Reid - www.pixelchutes.com
          MODx Ambassador / Contributor
          [Module] MultiMedia Manager / [Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
          ________________________________
          Where every pixel matters.
        • Quote from: OpenGeek at Jan 23, 2007, 07:12 PM

          Indeed, I am modifying the xpdo class to allow this by simply defining the constant XPDO_MODE with a value of 2 before including the main xpdo.class.php. Will be available in the next release...

          Pretty sure I did this right, but doesn’t seem to be working... am I missing something:

          My Snippet:
          <?php
          	global $modx;		
          	define('XPDO_MODE', 2 );
          	// Require magic beans
          	include_once ( $modx->config['base_path'] . 'xpdo/xpdo.class.php');
          	// Plant bean
          	$xpdo= new xPDO('mysql:host=localhost;dbname=modx', "user", "pass");
          
          	$sample= $xpdo->newObject('xpdosample');
          
          	$sample->set('parent', null );
          	$sample->set('unique_varchar', 'row_one');
          	$sample->set('varchar', 'hello world');
          	$sample->set('text', 'xPDO Sample');
          	$sample->set('timestamp', date('H:i:s'));
          	$sample->set('unix_timestamp', time() );
          	$sample->set('date_time', date('Y-m-d H:i:s'));
          	$sample->set('date', date('Y-m-d'));
          	$sample->set('enum', 'T');
          	$sample->set('password', md5('password'));
          	$sample->set('integer', 13);
          	$sample->set('boolean', 1);
          
          	$sample->save();
          
          	return var_export($sample->_fields); //'working... ;)
          ?>
          



          Fatal error: Uncaught exception ’PDOException’ with message ’could not find driver’

          I grabbed the newest SVN from: svn://victorland.com/xpdo/trunk

          I even tried the following (outside of the snippet):
          <?php
              /**#@+
               * @var integer
               * @access public
               */
              define('XPDO_MODE', 2); // pixelchutes disabled MySQL drivers test (non-native PDO)
              define('XPDO_MODE_NATIVE', 1);
              define('XPDO_MODE_EMULATED', 2);
              //...
          


          No cigar.

          ...looking around, I couldn’t find any other references to:

          $this->_nativeMode
          


          ... so when $this->_nativeMode evaluates to FALSE (XPDO_MODE, 2||Emulated), where does _nativeMode attribute control loading the emulated PDO class? Oh, here it is:

                      # Original // if (class_exists('PDO') || include_once (XPDO_CORE_PATH . 'pdo.class.php')) {
          
          // So I try this way...
          
          if ( include_once (XPDO_CORE_PATH . 'pdo.class.php')) {
          


          Unfortunately, I never make it past the || because in my case, PDO class exists, just that the drivers are missing. Guess I’ll have to uncomment that class_exists...

          ...and the result:


          Fatal error: Cannot redeclare class pdo in /home/username/public_html/xpdo/pdo.class.php on line 49

          :( Looks like PDO is auto_loading as a result of class_exists(’PDO’) call (by nature of the function in PHP 5.1+) ...removing it unfortunately does not prevent its creation, as it seems PHP is auto_loading PHP anyhow sad
            Mike Reid - www.pixelchutes.com
            MODx Ambassador / Contributor
            [Module] MultiMedia Manager / [Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
            ________________________________
            Where every pixel matters.
          • Revision 20 of xPDO will now work when PDO is available, but the MySQL driver is not. Just write the following code before including the xpdo.class.php file:

            define(’XPDO_MODE’, 2);

            Cheers...
            • Cheers, indeed! Enjoy the game (those of you watching)... Enjoy the beer (those of you drinking!) wink
                Mike Reid - www.pixelchutes.com
                MODx Ambassador / Contributor
                [Module] MultiMedia Manager / [Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
                ________________________________
                Where every pixel matters.
                • 24719
                • 194 Posts
                hi,

                i’m having problems with my xpdo site. i’ve uploaded it to a host who has a pdo driver, but not for mysql. i’ve set XPDO_MODE to 2, but am still getting the following in my error logs:

                [Tue May 15 17:47:29 2007] [error] [client 80.47.113.251] PHP Fatal error:  Uncaught exception 'PDOException' with message 'could not find driver' in /asdf.com/public_html/xpdo/xpdo.class.php:294
                [Tue May 15 17:47:29 2007] [error] [client 80.47.113.251] Stack trace:
                [Tue May 15 17:47:29 2007] [error] [client 80.47.113.251] #0 /asdf.com/public_html/xpdo/xpdo.class.php(294): PDO->__construct('mysql:host=loca...', 'un', 'pw', NULL)
                [Tue May 15 17:47:29 2007] [error] [client 80.47.113.251] #1 /asdf.com/public_html/xpdo/xpdo.class.php(1115): xPDO->connect()
                [Tue May 15 17:47:29 2007] [error] [client 80.47.113.251] #2 /asdf.com/public_html/xpdo/xpdo.class.php(1209): xPDO->prepare('SELECT * FROM `...')
                [Tue May 15 17:47:29 2007] [error] [client 80.47.113.251] #3 /asdf.com/public_html/xpdo/om/mysql/xpdoobject.class.php(346): xPDOCriteria->xPDOCriteria(Object(xPDO), 'SELECT * FROM `...', Array, false)
                [Tue May 15 17:47:29 2007] [error] [client 80.47.113.251] #4 /asdf.com/public_html/xpdo/xpdo.class.php(479): xPDOObject->loadCriteria(Object(xPDO), 'Property', Array, false)
                [Tue May 15 17:47:29 2007] [error] [client 80.47.113.251] #5 /asdf.com/public_html/xpdo/om/mysql/xpdoobject.class.php(160): xPDO->getCriteria('Property', Array, false)
                [Tue May 15 17:47:29 2007] [error] [client 80.47.113.251] #6 /asdf.com/public_html/xpdo/xpdo.class.php(436): xPDOObject in /asdf.com/public_html/xpdo/xpdo.class.php on line 294
                [Tue May 15 17:49:32 2007] [warn] Cannot get media type from 'cgi-script'
                [Tue May 15 17:49:32 2007] [error] [client 80.47.113.251] PHP Fatal error:  Cannot redeclare class pdo in /asdf.com/public_html/xpdo/pdo.class.php on line 49


                how can i fix this please?
                  • 24719
                  • 194 Posts
                  ok, i don’t think i’ve got revision 20. i think i’m using revision 16. where can i get the latest revision that doesn’t require changing the map locations, etc (for the beta) - revision 35 i think? i don’t want to fiddle too much with my setup at this stage.

                  thanks
                  • Quote from: redman at May 15, 2007, 05:06 PM

                    ok, i don’t think i’ve got revision 20. i think i’m using revision 16. where can i get the latest revision that doesn’t require changing the map locations, etc (for the beta) - revision 35 i think? i don’t want to fiddle too much with my setup at this stage.

                    thanks

                    svn://victorland.com/xpdo/trunk, I believe.

                    thanks Jason:
                    http://svn.xpdo.org:8000/svn/xpdo/trunk/
                      Mike Reid - www.pixelchutes.com
                      MODx Ambassador / Contributor
                      [Module] MultiMedia Manager / [Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
                      ________________________________
                      Where every pixel matters.
                    • The official SVN URL is http://svn.xpdo.org:8000/svn/xpdo/trunk/
                      Yes, revision 35 is the one you want.