PHP code example of ronpinkas / dbbridge

1. Go to this page and download the library: Download ronpinkas/dbbridge library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ronpinkas / dbbridge example snippets


    

     use dbBridge\dbAbstractor;

   // Example of setting PDO connection for source database
   $pdoMsSql = new PDO("dblib:host=your_hostname;dbname=your_db;charset=utf8", "your_username", "your_password");

   // Example of setting PDO connection for target database
   $pdoMySql = new PDO("mysql:host=your_hostname;dbname=your_db;charset=utf8", "your_username", "your_password");

   // Create dbBridge wrapper instances for the source and target databases
   $dbSource = new dbAbstractor($pdoMsSql, 'YourDB-Name');
   $dbTarget = new dbAbstractor($pdoMySql);

   // Import the database
   $dbTarget->importDb($dbSource);
   

   log_dbBridge("This is a transformation message", debugFlags::DEBUG_TRANSFORM_ALL );
   

   // To enable logging of transformation messages
   debugFlags::$debugLogFlags |= debugFlags::DEBUG_TRANSFORM_ALL;

   // To enable displaying of transformation messages
   debugFlags::$debugShowFlags |= debugFlags::DEBUG_TRANSFORM_ALL;

   // To disable logging of transformation messages
   debugFlags::$debugLogFlags &= ~debugFlags::DEBUG_TRANSFORM_ALL;

   // To disable displaying of transformation messages
   debugFlags::$debugShowFlags &= ~debugFlags::DEBUG_TRANSFORM_ALL;