Re: [gnome-db] SQL Query Types



On Sat, 2003-08-23 at 22:08, Rodrigo Moya wrote:
> On Sat, 2003-08-23 at 16:32 +0000, Chris Silles wrote:
> > Hi,
> > Just to explain what it is I'm working on- I'm currently in the
initial stages 
> > of developing a PHP extension for libgda, and although progress has
been good 
> > so far, I've got a little issue regarding the different methods of
executing 
> > commands on a data source depending upon whether the statement is a
'query' 
> > or 'non-query'. The problem being, I'd like to implement a generic
'query' 
> > function which accepts the statement as a parameter, however so far
there is 
> > no clear way of deciding how to execute it...
> > 
> > Although the parser in libsql recognises a few types of query, there
is 
> > nothing to determine provider-specific statements. Should a method
of doing 
> > this be included it would aid tremendously the addition of text-mode
clients 
> > or other such scenarios where a query of unknown type may be
presented by the 
> > user.
> > 
> > What is the feeling of the team on adding such a thing?
> > 
> I am not clear on what exactly you want to add. Could you ellaborate a
> bit more please?

php database modules provide a single method to execute queries. in that
case it would be gda_query() or something and it returns a single result
set resource. the results can then be evaluated with gda_numrows() or
gda_affected_rows().

> You can always execute any kind of commands using the
> gda_connection_execute_command/execute_single_command. You don't
really
> need to know what kind of statement it is, unless you want to do some
> pre-processing.

well if that behaviour is guaranteed it would be safe to use it - if I
understood that correctly it should be possible to use the following
sequence to determine the outcome :

if (number_of_columns==0) {
  /* non-query insert,update,delete or similar */ 
} else {
  /* select-like query */
}

is that correct ?

> If it is a non-query statement, the data model returned will have 0
> columns, and the number of rows will be the number of rows affected by
> the statement, as returned by the provider.
> 
> So, what is exactly what you are intending to do?

plan is to have a gda module for php providing the same set of functions
like the php_mysql extension for instance. That would make websites
greatly independent from the underlying database. 
many php systems (like forums or content management systems) have to
provide their database components as time-consuming
php-database-wrapppers. a gda module for php would greatly reduce that
disadvantage. 

cheers

> cheers
> 
> cheers
> 
> _______________________________________________
> gnome-db-list mailing list
> gnome-db-list gnome org
> http://mail.gnome.org/mailman/listinfo/gnome-db-list




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]