Changeset 257
- Timestamp:
- 12/01/08 05:44:57
- Files:
-
- trunk/geniusql/providers/mysql.py (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/geniusql/providers/mysql.py
r256 r257 67 67 68 68 if ignore_case: 69 return ("CONVERT(" + op1.sql + " ) USING utf8LIKE '" +69 return ("CONVERT(" + op1.sql + " USING utf8) LIKE '" + 70 70 start + likeexpr.lower() + end + "'") 71 71 else: … … 91 91 pass 92 92 93 class MySQL_CHAR_Adapter(MySQL_String_Mixin, adapters.str_to_SQL92 CHAR):93 class MySQL_CHAR_Adapter(MySQL_String_Mixin, adapters.str_to_SQL92VARCHAR): 94 94 pass 95 95 … … 261 261 default_adapters[str] = MySQL_CHAR_Adapter() 262 262 default_adapters[unicode] = MySQL_CHAR_Adapter() 263 264 def ddl(self): 265 """Return the type for use in CREATE or ALTER statements.""" 266 return "CHAR(%s)" % self.bytes 267 268 class CHAR411(CHAR): 269 synonyms = ['CHAR'] 270 default_adapters = CHAR.default_adapters.copy() 271 default_adapters[str] = MySQL_CHAR_Adapter411() 272 default_adapters[unicode] = MySQL_CHAR_Adapter411() 273 263 274 264 275 class VARCHAR(dbtypes.SQL92VARCHAR): … … 269 280 default_adapters[str] = MySQL_VARCHAR_Adapter() 270 281 default_adapters[unicode] = MySQL_VARCHAR_Adapter() 271 272 class VARCHAR503(VARCHAR): 282 283 def ddl(self): 284 """Return the type for use in CREATE or ALTER statements.""" 285 return "VARCHAR(%s)" % self.bytes 286 287 class VARCHAR411(VARCHAR): 288 synonyms = ['VARCHAR'] 289 default_adapters = VARCHAR.default_adapters.copy() 290 default_adapters[str] = MySQL_VARCHAR_Adapter411() 291 default_adapters[unicode] = MySQL_VARCHAR_Adapter411() 292 293 class VARCHAR503(VARCHAR411): 273 294 # "The maximum effective length of a VARCHAR in MySQL 5.0.3 and 274 295 # later is determined by the maximum row size and the character … … 277 298 max_bytes = 65535 278 299 synonyms = ['VARCHAR'] 279 280 def ddl(self):281 """Return the type for use in CREATE or ALTER statements."""282 return "VARCHAR(%s)" % self.bytes283 300 284 301 … … 289 306 default_adapters[str] = MySQL_VARCHAR_Adapter() 290 307 default_adapters[unicode] = MySQL_VARCHAR_Adapter() 308 309 def ddl(self): 310 """Return the type for use in CREATE or ALTER statements.""" 311 return "BINARY(%s)" % self.bytes 312 313 class BINARY411(BINARY): 314 synonyms = ['BINARY'] 315 default_adapters = BINARY.default_adapters.copy() 316 default_adapters[str] = MySQL_VARCHAR_Adapter411() 317 default_adapters[unicode] = MySQL_VARCHAR_Adapter411() 318 291 319 292 320 class VARBINARY(dbtypes.SQL92VARCHAR): … … 294 322 bytes = 255 295 323 max_bytes = 255 296 297 class VARBINARY503(VARBINARY): 324 325 def ddl(self): 326 """Return the type for use in CREATE or ALTER statements.""" 327 return "VARBINARY(%s)" % self.bytes 328 329 class VARBINARY411(VARBINARY): 330 synonyms = ['VARBINARY'] 331 default_adapters = VARBINARY.default_adapters.copy() 332 default_adapters[str] = MySQL_VARCHAR_Adapter411() 333 default_adapters[unicode] = MySQL_VARCHAR_Adapter411() 334 335 class VARBINARY503(VARBINARY411): 298 336 # "The maximum effective length of a VARCHAR in MySQL 5.0.3 and 299 337 # later is determined by the maximum row size and the character … … 302 340 max_bytes = 65535 303 341 synonyms = ['VARBINARY'] 304 305 def ddl(self): 306 """Return the type for use in CREATE or ALTER statements.""" 307 return "VARBINARY(%s)" % self.bytes 342 308 343 309 344 class MySQL_TEXT(dbtypes.TEXT): … … 312 347 default_adapters[unicode] = MySQL_VARCHAR_Adapter() 313 348 349 class MySQL_TEXT411(MySQL_TEXT): 350 default_adapters = MySQL_TEXT.default_adapters.copy() 351 default_adapters[str] = MySQL_VARCHAR_Adapter411() 352 default_adapters[unicode] = MySQL_VARCHAR_Adapter411() 353 314 354 class TINYBLOB(MySQL_TEXT): 315 355 bytes = max_bytes = (2 ** 8) - 1 356 357 def ddl(self): 358 """Return the type for use in CREATE or ALTER statements.""" 359 return "TINYBLOB" 360 class TINYBLOB411(MySQL_TEXT411): 361 bytes = max_bytes = (2 ** 8) - 1 362 synonyms = ['TINYBLOB'] 363 364 def ddl(self): 365 """Return the type for use in CREATE or ALTER statements.""" 366 return "TINYBLOB" 316 367 317 368 class BLOB(MySQL_TEXT): 318 369 bytes = max_bytes = (2 ** 16) - 1 370 371 def ddl(self): 372 """Return the type for use in CREATE or ALTER statements.""" 373 return "BLOB" 374 class BLOB411(MySQL_TEXT411): 375 bytes = max_bytes = (2 ** 16) - 1 376 synonyms = ['BLOB'] 377 378 def ddl(self): 379 """Return the type for use in CREATE or ALTER statements.""" 380 return "BLOB" 319 381 320 382 class MEDIUMBLOB(MySQL_TEXT): 321 383 bytes = max_bytes = (2 ** 24) - 1 384 385 def ddl(self): 386 """Return the type for use in CREATE or ALTER statements.""" 387 return "MEDIUMBLOB" 388 class MEDIUMBLOB411(MySQL_TEXT411): 389 bytes = max_bytes = (2 ** 24) - 1 390 synonyms = ['MEDIUMBLOB'] 391 392 def ddl(self): 393 """Return the type for use in CREATE or ALTER statements.""" 394 return "MEDIUMBLOB" 322 395 323 396 class LONGBLOB(MySQL_TEXT): 324 397 bytes = max_bytes = (2 ** 32) - 1 398 399 def ddl(self): 400 """Return the type for use in CREATE or ALTER statements.""" 401 return "LONGBLOB" 402 class LONGBLOB411(MySQL_TEXT411): 403 bytes = max_bytes = (2 ** 32) - 1 404 synonyms = ['LONGBLOB'] 405 406 def ddl(self): 407 """Return the type for use in CREATE or ALTER statements.""" 408 return "LONGBLOB" 325 409 326 410 327 411 class TINYTEXT(MySQL_TEXT): 328 412 bytes = max_bytes = (2 ** 8) - 1 413 414 def ddl(self): 415 """Return the type for use in CREATE or ALTER statements.""" 416 return "TINYTEXT" 417 class TINYTEXT411(MySQL_TEXT411): 418 bytes = max_bytes = (2 ** 8) - 1 419 synonyms = ['TINYTEXT'] 420 421 def ddl(self): 422 """Return the type for use in CREATE or ALTER statements.""" 423 return "TINYTEXT" 329 424 330 425 class TEXT(MySQL_TEXT): 331 426 bytes = max_bytes = (2 ** 16) - 1 427 428 def ddl(self): 429 """Return the type for use in CREATE or ALTER statements.""" 430 return "TEXT" 431 class TEXT411(MySQL_TEXT411): 432 bytes = max_bytes = (2 ** 16) - 1 433 synonyms = ['TEXT'] 434 435 def ddl(self): 436 """Return the type for use in CREATE or ALTER statements.""" 437 return "TEXT" 332 438 333 439 class MEDIUMTEXT(MySQL_TEXT): 334 440 bytes = max_bytes = (2 ** 24) - 1 441 442 def ddl(self): 443 """Return the type for use in CREATE or ALTER statements.""" 444 return "MEDIUMTEXT" 445 class MEDIUMTEXT411(MySQL_TEXT411): 446 bytes = max_bytes = (2 ** 24) - 1 447 synonyms = ['MEDIUMTEXT'] 448 449 def ddl(self): 450 """Return the type for use in CREATE or ALTER statements.""" 451 return "MEDIUMTEXT" 335 452 336 453 class LONGTEXT(MySQL_TEXT): 337 454 bytes = max_bytes = (2 ** 32) - 1 455 456 def ddl(self): 457 """Return the type for use in CREATE or ALTER statements.""" 458 return "LONGTEXT" 459 class LONGTEXT411(MySQL_TEXT411): 460 bytes = max_bytes = (2 ** 32) - 1 461 synonyms = ['LONGTEXT'] 462 463 def ddl(self): 464 """Return the type for use in CREATE or ALTER statements.""" 465 return "LONGTEXT" 338 466 339 467 … … 378 506 if self.version >= providers.Version("5.0.3"): 379 507 self.known_types['numeric'] = [DECIMAL503] 380 self.known_types['varchar'] = [VARBINARY503, TINYBLOB503, BLOB503, 381 MEDIUMBLOB503, LONGBLOB503] 508 self.known_types['other'] = [CHAR411, VARCHAR503], 382 509 if self.version >= providers.Version("5.0.5"): 383 510 self.known_types['numeric'] = [DECIMAL505]
