code.fastix.org

Dateiansicht:

Datei:Projekte -> PHP:Erweiterte PDO-Klasse für den Zugriff auf sqlite-Datenbanken -> ftxPDO.class-mit-Tests.php
md5:5531f21e3a4cf2cbf97e47587a1410fa
sha1:4686762b1b31087931c822783d5640221fbfcc30
Download-Link:Download
  1. <?php
  2.  
  3. /*
  4. * LastUpdate:   2020-03-14     
  5. * Version:      1.0.1 (Nur Kommentar geändert.)
  6. * Author:       Jörg Reinholz, fastix WebDesign & Consult Kassel, http://www.fastix.org        
  7. * Requirements: PHP > 7.0      
  8. * Licence:      https://code.fastix.org/lizenz.php      
  9. * Non-Warranty: https://code.fastix.org/haftung.php
  10. */
  11.  
  12. require_once 'ftxPDO.class.php';
  13.  
  14. /** Tests: **/
  15.  
  16. #/*
  17. $pdo = new ftxPDO ( 'sqlite: values.sqlite3', E_USER_NOTICE );
  18. #$pdo = new ftxPDO ( 'sqlite:readonlyFile.sqlite3', E_USER_NOTICE );
  19. #$pdo = new ftxPDO ( 'sqlite:readonlyFile.sqlite3', E_USER_ERROR );
  20. #$pdo = new ftxPDO ( 'sqlite:notExistFile', E_USER_ERROR );
  21. $sql = 'SELECT id, timestamp, url_effective FROM speed LIMIT 2';
  22. try {
  23.         $stmt = $pdo->prepare( $sql );
  24.         if ( $stmt ) {
  25.                 $stmt -> execute();
  26.                 while  ( $result = $stmt -> fetch( PDO::FETCH_ASSOC ) ) {
  27.                         print_r( $result );
  28.                 }
  29.         } else {
  30.                 trigger_error( 'SQL-Error: ' . ( $pdo->errorInfo() )[2] . ' in "' . $sql .'"', E_USER_ERROR );
  31.         }
  32. } catch ( PDOException $e ) {
  33.     trigger_error( $e -> __toString(), E_USER_ERROR );
  34. }
  35. # */
  36.