SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Jul 2003
    Location
    Haifa, Israel
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    .Net DataSet in PHP??!

    Hi,

    I know of the debate that has been going here on PHP vs ASP .Net. I've played with ASP .Net a bit and the only feature that realy caught my eye was the DataSet - a replica of a whole database that can be kept in the IIS cache as an object and accessed by clients for bits of data, instead of sending them to the server for new queries.
    Does anyone has an idea how to perform such a stunt in PHP?

    Thanks

  2. #2
    public static void brain Gybbyl's Avatar
    Join Date
    Jun 2002
    Location
    Montana, USA
    Posts
    647
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's called Database abstraction, and it's probably just as fast as DataSets.

    PHP Code:
    mysql_query()
    odbc_query()
    msql_query()
    postgresql_query() 
    I'm sure you could also just pull a generic query on all the tables in the database with one of these functions, store all of the results in sessions as objects, and then abstract the access to the session variables with more functions that parse the database data. There are probably some fancy apache directives you could use to make a cache, as well, and then load that up -- It's not worth all the work.

    Unix motto -- We don't reinvent the wheel.
    Microsoft motto -- We can make a better wheel.

    In this case, they probably wasted like 50-100 man hours saving 2 microseconds accessing data. (What am I saying? It was SQL Server, they probably saved like 20 minutes on their queries ()

    Or you could just use mysql_query().



    Also, is it only on SQL Server, or does it work for all the odbc sources?
    Ryan

  3. #3
    SitePoint Wizard gold trophysilver trophy
    Join Date
    Nov 2000
    Location
    Switzerland
    Posts
    2,479
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I know of the debate that has been going here on PHP vs ASP .Net. I've played with ASP .Net a bit and the only feature that realy caught my eye was the DataSet - a replica of a whole database that can be kept in the IIS cache as an object and accessed by clients for bits of data, instead of sending them to the server for new queries.
    Does anyone has an idea how to perform such a stunt in PHP?
    I may be mistaken but I think Martin Fowler is talking about this when looking at the "Unit of Work" patterns in Patterns of Enterprise Application Architecture - he mentions .NET but calls it the "disconnected dataset".

    The basic idea is you have an object which keeps copies of all "objects" (records) an application has "checked out" of a database. The "Unit of Work" then checks the data back in when the app has finished a batch of procedures, meaning you perform all database updates / inserts in one go.

    It's certainly do-able methinks in PHP although to be really useful (IMO) it needs to "live" between page requests (plus ideally you have a DB which can run multiple queries in one go - not MySQL). PHP5's new SQLite (embedded DB) might be a useful tool here as it seems to be able to store data in memory (while still providing SQL access to it!).

    Suggest read up on ".NET disconnected dataset" and you'll probably be able to "reverse engineer" into PHP.

  4. #4
    SitePoint Member
    Join Date
    Jul 2003
    Location
    Haifa, Israel
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    ...store all of the results in sessions as objects, ...
    I thought the idea was to keep one instance of the data for all users.

    ----It's not worth all the work....
    Maybe, but it looked like an elegant idea.

    BTW, the Japha link gives a DNS error. Looks like a great thing.

    10x

  5. #5
    SitePoint Member
    Join Date
    Jul 2003
    Location
    Haifa, Israel
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi HarryF,

    Thanks for your reply. It's always a pleasure to visit your patterns site.

    10x


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •