Re: [PHP] 2 Questions.



Tom Shaw schreef:
Can anybody give me any good reasons not to use a time stamp as an order
number in my shopping cart. It seems to me that the number is guaranteed to
be random and it saves having to make an extra time column to keep track of
the order. The only small concern I have is the chance that somebody orders
at the exact same time as somebody else but the chance of that has got to be
incredibly small but possible.


1. order number are often *required* (for accounting purposes) to be consecutive
2. the chance is small, yet it is there ... agravated by the fact that most orders
are placed during a concentrated period of the day.

I have no idea what you mean by 'extra time column' and/or using it to keep
track of an order... but most DBMSs have the ability to auto store a timestamp
into a field when the given record is created.

oh ... timestamps are hardly random.



My second question is I've designed a very simple Postgres database wrapper.
The methods are exactly what you would assume to see in any db wrapper a
pg_query, pg_fetch_array. My question is in the db wrapper, is there an easy
way to always include the table name as an index in all my pg_fetch_array
returned results? The reason I ask is when designing my tables I'm delegated
to prefixing my column names i.e. users_name instead of just name or
forum_posts instead of just posts to make sure there's no collision.


have your simple wrapper do something like:

$sql = "SELECT foo AS {$tablename}_foo FROM {$tablename} WHERE 1";

with regard to generating the query. if your wrapper doesn't generate the
SQL then you'll have to parse the given SQL and rewrite it ... good luck with that.



Cheers



Thomas Shaw

Php.coder@xxxxxxxxx





.



Relevant Pages

  • Re: [PHP] 2 Questions.
    ... My question is in the db wrapper, ... SQL then you'll have to parse the given SQL and rewrite it ... ... use generators or sequences or 'auto increment ids' or whatever your DB ... my soul that the guys that built it know the difference between an order ...
    (php.general)
  • Re: Generating SQL
    ... Java reflection is uuuuuugly. ... Some of SQL is easy to wrap and some is ... > wrapper. ... cannot find the documentation for your custom query API, ...
    (comp.object)
  • Re: Invoking .NET dll from SQL Server
    ... > We have an existing ASP application that is supported by SQL 2000. ... > on utilizing a third party COM object for which we'll be writing a ... > stored procedures offered by SQL Server to invoke the wrapper, ... it from SQL Server. ...
    (microsoft.public.sqlserver.programming)
  • Re: Computing Averages in MS Excel
    ... > particular wrapper. ... If the underlying engine was incapable of passing missing data toSQL as ... SQL was less than satisfactory in its presentation of the data. ... > theory while I do recall that in practice there was definitely a ...
    (comp.databases.theory)
  • RE: VB.NET Null to SQL Null (ASP.NET 2.0 GridView)
    ... application rewrite (change in your wrapper method only). ... "Kivak Wolf" wrote: ... > I am getting data from, then I am sending them to a SQL database. ...
    (microsoft.public.dotnet.framework.aspnet)