Re: SQL failures, new navigation system and other things
Brought to you by:
iridium
|
From: Martin G. <gim...@gi...> - 2002-08-28 10:31:42
|
Ondrej Jombik <ne...@po...> writes:
Hi Ondrej and others,
>> If you plan to continue in this pace, then why don't get yourself a
>> CVS account? I can add nepto as a developer if you're interested...
>
> Yes, that's not bad idea. It should make 2.x development
> slight flexible and faster. So I'm interested. Thanks.
Great - I've added you to the project.
> ... I glace at queries and see that I need to add addsleshes($icao)
> into almost every query.
I've left most of the addslashes in the code, but I also think that
some of them are unnecessary.
We have two cases:
1) We're looking something up in the database. If the data can come
directly from the user, we need to use addslashes().
2) We're returning something from the database. If it comes from the
stations and countries databases, then we don't need to
stripslashes(). The data in those databases comes from
stations.csv and should be safe.
If the data comes from the METARs database, then we have to
stripslashes() because slashes might have been added when the
data was inserted.
> I must admin that finally it was unneccessary. Sorry for that,
> but I think that buinding queries with sprintf() gets more
> readability. I like this way.
I see - it actually get's more readable when you use sprintf() on a
long SQL query.
>> Apart from that, I'll probably commit them tomorrow (or to be
>> correct: later today, it's getting late... :-) I'm sure that I can
>> patch the null and dba database backends to handle the lookup for
>> country code.
I've just commited the patches along with updated pw_db_null and
pw_db_dba classes. I've tested all four backends, but it would be nice
to have someone double check it on another system.
> Thanks. I was affraid that I will study DBA interface.
The DBA databases are just like an array on disk: you can lookup a
value by a key and that's it. So when I have to store data about ICAOs
I do it by combining the name, country, and country code and then the
whole thing using the ICAO as a key.
The same applies to the null database - both backends use two
constants (PW_FIELD_SEPERATOR and PW_FIELD_REPLACEMENT) to seperate
the fields.
> Without get_country() method in pw_db_dba.php it will not works.
> That's fact.
Yes. I've renamed the method to get_country_code() because we now also
have a get_name() and get_country() that returns the name of a station
and the name of the country. Is this OK?
--
Martin Geisler My GnuPG Key: 0xF7F6B57B
See http://gimpster.com/ and http://phpweather.net/ for:
PHP Weather => Shows the current weather on your webpage and
PHP Shell => A telnet-connection (almost :-) in a PHP page.
|