DBI problem

Antonis Kanavouras ankan at med.auth.gr
Mon Dec 4 12:16:01 EET 2000


To parakatw query otan dinetai apo to DBI me ton driver ths MySql oxi
mono den vgazei ayta pou 8a' prepe alla mou dinei kai ari8mo eggrafwn
($sth->rows) -2.  
To idio query apo ton mysql client douleyei kanonika (kai gia na eimai
sigouros oti einai to idio to evala na to vgazei sthn output opote to
pairnw me copy/paste apo ton Netscape sthn command line ths mysql)

---------------------------------------------
SELECT aggelies.id , aggelies.timh , aggelies.emvadon,
aggelies.descript, mesites.telefon , mesites.name , mesites.url FROM
aggelies,
nomoi , mesites WHERE aggelies.nid = nomoi.nid AND aggelies.mid =
mesites.mid AND nomoi.nomos="ΘΕΣΣΑΛΟΝΙΚΗΣ" AND
aggelies.place="ΑΝΑΤΟΛIΚΗ" AND aggelies.subplace="ΚΑΛΑΜΑΡΙΑ" AND
aggelies.pwlen="S" AND ( aggelies.eidos="ΔΙΑΜΕΡΙΣΜΑ" ) ORDER BY
aggelies.timh , mesites.prior ; 
----------------------------------------------

H plaka einai oti an anti gia ( aggelies.eidos="ΔΙΑΜΕΡΙΣΜΑ" ) dwsw (
aggelies.eidos="ΔΙΑΜΕΡΙΣΜΑ" OR aggelies.eidos="KATIALLO" ) douleyei
kanonika...
To idio provlhma yphrxe kai otan edina to idio ousiastika query alla me
INNER JOINS 

oi pinakes (an kai den nomizw na xreiazontai) exoun ws exhs:

aggelies
------------+----------+--------------+------+-----+------------+----------------+
| Field    | Type         | Null | Key | Default    | Extra          |
+----------+--------------+------+-----+------------+----------------+
| id       | int(10)      |      | PRI | 0          | auto_increment |
| nid      | tinyint(3)   |      | MUL | 0          |                |
| place    | varchar(20)  |      | MUL |            |                |
| subplace | varchar(20)  |      | MUL |            |                |
| pwlen    | char(1)      |      | MUL |            |                |
| eidos    | varchar(20)  |      | MUL |            |                |
| descript | varchar(255) | YES  |     | NULL       |                |
| date     | date         |      |     | 0000-00-00 |                |
| mid      | smallint(5)  |      |     | 0          |                |
| timh     | int(11)      |      | MUL | 0          |                |
| emvadon  | mediumint(8) | YES  |     | NULL       |                |
| kwdbymes | smallint(5)  | YES  |     | NULL       |                |
+----------+--------------+------+-----+------------+----------------+    

nomoi
+-------+-------------+------+-----+---------+----------------+
| Field | Type        | Null | Key | Default | Extra          |
+-------+-------------+------+-----+---------+----------------+
| nid   | tinyint(3)  |      | PRI | 0       | auto_increment |
| nomos | varchar(40) |      |     |         |                |
+-------+-------------+------+-----+---------+----------------+          

mesites
+---------+-------------+------+-----+---------+----------------+
| Field   | Type        | Null | Key | Default | Extra          |
+---------+-------------+------+-----+---------+----------------+
| mid     | smallint(5) |      | PRI | 0       | auto_increment |
| name    | varchar(40) |      |     |         |                |
| telefon | varchar(15) | YES  |     | NULL    |                |
| url     | varchar(50) | YES  |     | NULL    |                |
| prior   | tinyint(3)  |      |     | 0       |                |
| address | varchar(50) | YES  |     | NULL    |                |
+---------+-------------+------+-----+---------+----------------+
                                                  

Any ideas ? Ti mporei na trexei me to DBI?

Eyxaristw

Antonis



More information about the Linux-greek-users mailing list