У меня есть база данных, созданная из
CREATE TABLE `ip` (
`idip` int(11) NOT NULL AUTO_INCREMENT,
`ip` decimal(45,0) DEFAULT NULL,
`mask` int(11) DEFAULT NULL,
PRIMARY KEY (`idip`),
UNIQUE KEY `ip_UNIQUE` (`ip`)
)
И я сделал несколько вставок в эту таблицу
Но когда я пытаюсь выполнить на python:
sql = "select idip from ip where ip=%s and mask=%s" % (long(next_hop), 'DEFAULT')
cursor.execute(sql)
idnext_hop = cursor.fetchone()[0]
Я получаю следующую ошибку:
Inserting routes into table routes (1/377)...('insere_tabela_routes: Error on insertion at table routes, - SQL: ', 'select idip from ip where ip=0 and mask=DEFAULT')
1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
Кто-нибудь знает, в чем проблема?