Re: [PHP-DB] naming conventions

2003-03-30 Thread Roberto Plomp
In essence it doesn't matter so much which convention you use as long you
use a convention, use it consistently and the convention itself doesn't come
with too much complexity of it's own and is based on a clear philosophy.

The naming convention I use in any environment or language uses simple
prefixes and is based on two points:
1. the name should show the origin of the variable/function/table/query and
what
more;
2. it should show the functional context / meaning

In other words:
1. Where can I find it;
2. What does it mean.

Of course, the naming convention must be combined with structure
conventions.

Just thinking along ...
Roberto


- Original Message -
From: "Paul Burney" <[EMAIL PROTECTED]>
To: "Charles Kline" <[EMAIL PROTECTED]>; "PHP Database List"
<[EMAIL PROTECTED]>
Sent: Sunday, March 30, 2003 5:19 PM
Subject: Re: [PHP-DB] naming conventions


> on 3/30/03 9:52 AM, Charles Kline at [EMAIL PROTECTED] appended the
> following bits to my mbox:
>
> > i was just wondering if there are any naming conventions when creating
> > database connections. most of my books use
> >
> > $sql = "SQL STRING";
> >
> > and
> >
> > $sth = $db->query() or $result = $db->query()
> >
> > I have no idea what sth stands for in this case, but was curious how
> > others name stuff.
>
> I usually just use $query or $q for "query," $res or $r for "result," $row
> or $s for the returned array, and $dbh for the database connection.  I got
> the latter from the standard Perl database connection, "dbh -> Data Base
> Handle."
>
> If I recall correctly, the $sth also comes from the standard perl
examples.
> The standard PHP example, from http://www.php.net/manual/en/ref.mysql.php
,
> uses $link for the connection, $query for the query, and $line for the
> returned record array.
>
> A lot of database classes use $db as the new object.
>
> Hope that helps.
>
> Sincerely,
>
> Paul Burney
> <http://paulburney.com/>
>
>  while ($self != "asleep") {
> $sheep_count++;
> }
> ?>
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



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



Re: [PHP-DB] naming conventions

2003-03-30 Thread Paul Burney
on 3/30/03 9:52 AM, Charles Kline at [EMAIL PROTECTED] appended the
following bits to my mbox:

> i was just wondering if there are any naming conventions when creating
> database connections. most of my books use
> 
> $sql = "SQL STRING";
> 
> and
> 
> $sth = $db->query() or $result = $db->query()
> 
> I have no idea what sth stands for in this case, but was curious how
> others name stuff.

I usually just use $query or $q for "query," $res or $r for "result," $row
or $s for the returned array, and $dbh for the database connection.  I got
the latter from the standard Perl database connection, "dbh -> Data Base
Handle."

If I recall correctly, the $sth also comes from the standard perl examples.
The standard PHP example, from http://www.php.net/manual/en/ref.mysql.php ,
uses $link for the connection, $query for the query, and $line for the
returned record array.

A lot of database classes use $db as the new object.

Hope that helps.

Sincerely,

Paul Burney






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