This is what i've been doing for that last while, and i think i've finally got all the bugs worked out. after you load the class, do
stream_wrapper_register('db','db_wrapper');
then
fopen('db://dbtype/user:pw@host/dbname.tables/options');
where
dbtype := "mysql" | "pgsql" | "sqlite" | ("oci8" | "oracle") | ("sybase" |
"sybasect" | "sybase-ct") | "mssql" | "fbsql" | "odbc"
user := regex( /[\w.]+/ )
pw := regex( /[\x21-\x7e]/+ | "" )
host := regex( /[\w.-]+/ )
dbname := regex( /[\w-]+/ )
tables := table_name["=" table_alias]["," ...]
table_name := regex( /\w+/ )
table_alias := regex( /\w+/ )
options := columns | where | order | group
columns := "columns=" column_part["," ...]
column_part := col_name["=" col_alias]
col_name := regex( /[\w.]/ ) | "*"
col_alias := regex( /[\w.]/ )
where := "where=" '"' regex( /.*?/ ) '"'
order := "order=" (col_name ["|" direction])["," ...]
direction := "asc" | "desc"
hope that makes it easy to understand the syntax.
stat() is unsupported, as is unlink() as of yet. feof(), fseek(), read and write funcs are supported. full cleanup included.
also there's a poll.... do you think i should keep posting my useless work of shut up about it? [edit]2 week timeout on the poll[/edit]