Archive

Archive for the ‘Classes’ Category

MySqlToMongoDB importer

21 August 2014 1 comment

Hello everybody, finally after many requests….

I create this class that import MySQL database into MongoDB.
It can connect to a given MySQL server to retrieve the records of the tables.
The class can recreate the table records and indexes in a given MongoDB.

In this version I limit the import to insert new records and don’t update
existing ones.If you want to update existing records just change the insert() method to save()
and mongodb library will update the object reference with new values.

You can download following this link:
Thanks to everybody to support me.
I’m avaiable for all your questions and suggests.

I appreciate if you fill the following pool:

Principe Orazio

Categories: Classes, MongoDB Tags: , , ,

PhpUtils

8 September 2012 Leave a comment

Hello word! Hi unify a lot of functions used every day by me and others developers
in a static class ready to use into your projects.

Why a static class?
Simply ’cause with it if you already have a function with the same name your script
will not crash 🙂

Download it here

You can find complete documentation here:

http://www.dbpersister.com/phputils-documentation/class-PhpUtils.html

Please post your comments and request on the main site

www.dbpersister.com

and not here.

Thanks to all contributors

DBPersister version 1.0 stable


dbpersister logo

DBPersister (Open Souce – LGPL licence)

I released the first stable version of this new library written for php that will easy you life with your classes and most mysql operations.

DBPersister will let you simply call CRUD methods like insert, update, delete, replace or simply “save” to persist data into database.

Moreover give you a lot of others possibility with all posted data by forms
or other infinite ways.

Download and try it
http://www.dbpersister.com

Follow the project on facebook at:
https://www.facebook.com/dbpersister

Categories: Classes, MySQL

Trasformare una classe in un array


Con questa funzione è possibile trasformare una classe in un array


function objectToArray( $object ) {

    if ( is_array( $object ))
        return $object ;

    if ( !is_object( $object ))
        return false ;

    $serial = serialize( $object ) ;
    $serial = preg_replace( '/O:\d+:".+?"/' ,'a' , $serial ) ;
    if( preg_match_all( '/s:\d+:"\.+?\(.+?)"/' , $serial, $ms, PREG_SET_ORDER )) {
        foreach( $ms as $m ) {
            $serial = str_replace( $m[0], 's:'. strlen( $m[1] ) . ':"'.$m[1] . '"', $serial ) ;
        }
    }

    return @unserialize( $serial ) ;

}

Categories: Classes, Functions, PHP
%d bloggers like this: