Re: [PHP-DEV] Advice on design issues (long)...

2002-03-25 Thread l0t3k


"Lukas Smith" <[EMAIL PROTECTED]> wrote in message
008a01c1d2fb$952b4630$4d00a8c0@vandal">news:008a01c1d2fb$952b4630$4d00a8c0@vandal...
>
> There is currently an effort underway to merge Metabase with PEAR DB.
> I have just commited the first code into the pear cvs (package is called
> "MDB" for now). The merge is still not complete. But the idea was that
> this merged DB abstraction layer could down the road be ported to C ...
> the sooner the better.
ive downloaded alreay. i keep track of development of PEAR::DB, Metabase and
ADOdb.


> In terms of how to abstract things, its quite obvious that Metabase is
> very far ahead (is there even something similar in other languages?). So
> I guess Metabase, or MDB when its ready, will be the best place to turn
> to if you seek this knowledge for a C Extension.
the abstraction work is primarily done, the blob spec is the main thing
pending. the hard part now is producing a set of test drivers.

> Anyways if you are interested then you may want to join the discussion
> on this new package. All discussion goes to the binarycloud, metabase
> and pear-dev mailinglists, since there is no dedicated mailinglist for
> this project, but all of the above the mailinglists are participating.
im an active lurker on the binarycloud and metabase lists. i throw my $0.02
in periodically.

l0t3k




-- 
PHP Development Mailing List 
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] Advice on design issues (long)...

2002-03-25 Thread l0t3k


"John Lim" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...

> I have always wondered, how do you pronounce L0t3k?
actually "low-tech". most days i dream of woodworking 

> Seriously, if you are duplicating Metabase's effort, but in C,
> why not work with the Manuel Lemos then? This will fix any speed issues
> that Metabase has, and you will get his feedback.
the DB abstraction problem is a much larger one, which Manuel (and yourself)
have been struggling against with serious handicaps. for instance, one of
the reasons Manuel had to put so much work into Metabase is that the
original extension writers did not provide metadata which is readily
available from the database itself, or the metadata supplied is inconsistent
across back-ends.

the current database extensions were written as needed, so there was no
over-arching and unifiying design.
im attempting to consolidate and refactor the code in the existing
extensions into a framework which makes driver development much easier and a
lot more flexible. the upshot is that features can be implemented in the
core that
are immediately available across DB backends (like disconnected resultsets,
resultset serialization, and XML import/export which is nearly done).  in
addition, features like connection management can be handled consistently
across supported backends.

> Many db abstraction classes I have seen are skewed towards
mysql/postgresql,
> so prove to be useless when migrating to mssql or oracle.
ive done quite a lot of legwork on this, and i think i have a framework
which accomodates everything from MySQL to Oracle. i did MySQL first because
1) the API is simple 2) i needed to quickly write a driver to test some
basic design decisions (navigation and bulk-fetching).

>Manuel really
> knows a lot about databases and can teach everyone a lot about these
issues.
>
> Or if you or anyone else would like to port ADOdb to a C extension,
> let me know.
i actually wrote to Manuel about this last summer, but he was (justifiably)
skeptical about the doability of the project and the prospects of its
adoption, given its scope and the fact that most people were comfortably
either using the base extensions, or something like Metabase, PEAR or ADODB.
instead of long discussions, i decided to wait until i had something
tangible to demonstrate. im very near to that point right now.

note that i dont think that Metabase or ADOdb will necessarily go away if
this extension works out. there are things that you and Manuel do that i
think belong in user-space and not in an extension. for instance your
sequence emulation code modifies the DB schema, which crosses the line of an
access layer. also Manuel's schema abstraction and transformation is another
example. i only really care at this point about data and metadata acess
abstraction. what it means though, is that your PHP code will be
considerably smaller and faster ( i think i can eliminate the need for at
least 65% of Metabase's code).

l0t3k



-- 
PHP Development Mailing List 
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DEV] Advice on design issues (long)...

2002-03-23 Thread Lukas Smith

> (2) im working on a database access abstraction, again inspired by
Java
> and
> JDBC (MySQL driver is written and works, BTW). in Java you have the
> Resultset.getXXX methods which gets the value of a given column as a
> particular type. Java of course is strongly typed, whereas PHP is not.
Is
> it
> useful to implement the getXXX methods natively. i lean toward it
> primarily
> because 1) folks coming from Java will be right at home 2) sometimes
you
> need to enforce a particular return type coming from a column 3)
Metabase
> does it for portability, and although it can be done in PHP, its more
> efficient to do it in the extension. On the downside there is the
issue of
> bloat.

There is currently an effort underway to merge Metabase with PEAR DB.
I have just commited the first code into the pear cvs (package is called
"MDB" for now). The merge is still not complete. But the idea was that
this merged DB abstraction layer could down the road be ported to C ...
the sooner the better.

In terms of how to abstract things, its quite obvious that Metabase is
very far ahead (is there even something similar in other languages?). So
I guess Metabase, or MDB when its ready, will be the best place to turn
to if you seek this knowledge for a C Extension.

Anyways if you are interested then you may want to join the discussion
on this new package. All discussion goes to the binarycloud, metabase
and pear-dev mailinglists, since there is no dedicated mailinglist for
this project, but all of the above the mailinglists are participating.

Best regards,
Lukas Smith
[EMAIL PROTECTED]
___
 DybNet Internet Solutions GbR
 Alt Moabit 89
 10559 Berlin
 Germany
 Tel. : +49 30 83 22 50 00
 Fax : +49 30 83 22 50 07
 www.dybnet.de [EMAIL PROTECTED]
___



-- 
PHP Development Mailing List 
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] Advice on design issues (long)...

2002-03-23 Thread John Lim


L0t3k <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> im looking for opinions on two OOP related design issues for code im
> targeting to PHP5.
> (2) im working on a database access abstraction, again inspired by Java
and
> JDBC (MySQL driver is written and works, BTW). in Java you have the
> Resultset.getXXX methods which gets the value of a given column as a
> particular type. Java of course is strongly typed, whereas PHP is not. Is
it
> useful to implement the getXXX methods natively. i lean toward it
primarily
> because 1) folks coming from Java will be right at home 2) sometimes you
> need to enforce a particular return type coming from a column 3) Metabase
> does it for portability, and although it can be done in PHP, its more
> efficient to do it in the extension. On the downside there is the issue of
> bloat.

Hi,

I have always wondered, how do you pronounce L0t3k?

Seriously, if you are duplicating Metabase's effort, but in C,
why not work with the Manuel Lemos then? This will fix any speed issues
that Metabase has, and you will get his feedback.

Many db abstraction classes I have seen are skewed towards mysql/postgresql,
so prove to be useless when migrating to mssql or oracle. Manuel really
knows a lot about databases and can teach everyone a lot about these issues.

Or if you or anyone else would like to port ADOdb to a C extension,
let me know.

Regards, John



-- 
PHP Development Mailing List 
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DEV] Advice on design issues (long)...

2002-03-22 Thread l0t3k

im looking for opinions on two OOP related design issues for code im
targeting to PHP5.

(1) im writing (actually porting) a DateTime class which matches the
functionality of the Java Date class. it actually does much more, and that's
the issue. in looking at the Javadocs reference page for Date, a lot of what
i have scheduled for my class has been deprecated in Date for various
reasons. in specific, display formatting, parsing and interval math are
moved into other classes.
what do you think about having this functionality in one class or
splitting. i agree somewhat in a separation of concerns, but one reason i
tend not to like Java for web development is the fact that there can be too
many classes involved in getting basic things accomplished.

(2) im working on a database access abstraction, again inspired by Java and
JDBC (MySQL driver is written and works, BTW). in Java you have the
Resultset.getXXX methods which gets the value of a given column as a
particular type. Java of course is strongly typed, whereas PHP is not. Is it
useful to implement the getXXX methods natively. i lean toward it primarily
because 1) folks coming from Java will be right at home 2) sometimes you
need to enforce a particular return type coming from a column 3) Metabase
does it for portability, and although it can be done in PHP, its more
efficient to do it in the extension. On the downside there is the issue of
bloat.


BTW : is there sufficient interest in starting a new newsgroup to discuss
PHP5 ?

l0t3k



-- 
PHP Development Mailing List 
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] Advice wanted on function arguments

2002-01-05 Thread Andi Gutmans

Just be aware that POST/GET/COOKIE data is always saved as a string. So if 
someone sends you 2 it'll be the string "2".
If the arguments to your function won't originate from the above but are 
written by the developer then overloading will work well. If not you might 
want to consider splitting the function into two.

Andi

At 02:10 PM 1/5/2002 -0600, Brian Foddy wrote:
>In an external php module project (php-tuxedo),
>we have a group of about 7 php functions that,
>depending on how we design them, could take two different types
>of arguments.
>1.  A integer argument
>2.  A string argument.
>
>If the string argument is given, there is another routine that can
>convert it to the corresponding integer argument, but its not
>guarenteed to match.  Using the integer argument is guarenteed
>to work; hence we really need to support the integer args.
>
>However, the majority of users will want to use the string argument
>because its more intuitive and they should provide the translation
>tables to allow strings to work.
>
>I'd like to come up with a solution flexible enough for both.  And I have
>come up with three different solutions...
>1.  Create two different function names/entry points, one set for ints,
> one set for strings.
>2.  Overload the function arguments and check which type of arg is being
>passed.
>3.  Screw it and just accept the ints, and let the users nest a function
>(in their PHP code) to convert to strings if they want.
>
>Questions...
>1.  Any slick way to do solution 1, say with aliases or something?
>2.  How difficult / successful is it to test the arg type for solution 2.
>
>Let me re-stress, I'm talking about a PHP C code module, not
>PHP code.
>
>I can provide more detailed description if you need.
>Thoughts?
>Brian
>
>
>
>--
>PHP Development Mailing List 
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] Advice wanted on function arguments

2002-01-05 Thread Markus Fischer

On Sat, Jan 05, 2002 at 02:10:17PM -0600, Brian Foddy wrote : 
> 2.  Overload the function arguments and check which type of arg is being
>passed.

Just accept a ZVAL and do your appropriate conversion later
on.
> 
> Questions...
> 2.  How difficult / successful is it to test the arg type for solution 2.

It's a matter of

switch(Z_TYPE_P(zval_container)) {
case IS_STRING:
// do appropriate conversion
break;
case IS_LONG:
// everythings fine
break;
default:
php_error(E_WARNING, "%s(): argument 1 must be integer or string", 
  get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}

IMHO. Watch out, YMMV; HTH.
-- 
Please always Cc to me when replying to me on the lists.

-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DEV] Advice wanted on function arguments

2002-01-05 Thread Brian Foddy

In an external php module project (php-tuxedo), 
we have a group of about 7 php functions that,
depending on how we design them, could take two different types
of arguments.
1.  A integer argument
2.  A string argument.

If the string argument is given, there is another routine that can
convert it to the corresponding integer argument, but its not
guarenteed to match.  Using the integer argument is guarenteed 
to work; hence we really need to support the integer args.

However, the majority of users will want to use the string argument
because its more intuitive and they should provide the translation
tables to allow strings to work.

I'd like to come up with a solution flexible enough for both.  And I have
come up with three different solutions...
1.  Create two different function names/entry points, one set for ints,
one set for strings.
2.  Overload the function arguments and check which type of arg is being
   passed.
3.  Screw it and just accept the ints, and let the users nest a function
   (in their PHP code) to convert to strings if they want.

Questions...
1.  Any slick way to do solution 1, say with aliases or something?
2.  How difficult / successful is it to test the arg type for solution 2.

Let me re-stress, I'm talking about a PHP C code module, not
PHP code.

I can provide more detailed description if you need.
Thoughts?  
Brian



-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DEV] advice

2001-03-19 Thread Marc Boeren


Hi

>If there aren't any guides, then some sample code would be much appreciated
:)

I can give you some samples for creating an object and adding members, but I
haven't added any member functions, but this shouldn't be more difficult, I
feel...

if (object_init(return_value) != SUCCESS) {
zend_error(E_ERROR, "dbx: unable to create resulting object...");
RETURN_LONG(0);
}
zend_hash_update(return_value->value.obj.properties, "handle", 7, (void
*)&(rv_dbx_result_handle), sizeof(zval *), NULL);
add_property_long(return_value, "rows", row_count);

zend_hash_update can be used vor zval that are already allocated etc.,
add_property_* for other values

Hope this helps!

Cheerio, Marc.

-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] advice

2001-03-18 Thread Rasmus Lerdorf

Did you read README.EXT_SKEL?

On Sun, 18 Mar 2001, Barry Mitchelson wrote:

> hi all,
>
> can anyone give me the url to a tutorial on creating a php extension - specifically 
>creating a new class which will be available to all scripts.  I've read through the 
>Zend api docs, and have created a new function, but haven't found any good guides to 
>adding a new class.  If there aren't any guides, then some sample code would be much 
>appreciated :)
>
>
> regards,
>
> Barry
>
> --
> http://www.theshining.org
>
> --
> PHP Development Mailing List 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>


-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DEV] advice

2001-03-18 Thread Barry Mitchelson

hi all,

can anyone give me the url to a tutorial on creating a php extension - specifically 
creating a new class which will be available to all scripts.  I've read through the 
Zend api docs, and have created a new function, but haven't found any good guides to 
adding a new class.  If there aren't any guides, then some sample code would be much 
appreciated :)


regards,

Barry

-- 
http://www.theshining.org

-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]