Mercurial > vim
comparison runtime/doc/sql.txt @ 844:d3bbb5dd3913 v7.0f02
updated for version 7.0f02
author | vimboss |
---|---|
date | Thu, 27 Apr 2006 00:02:13 +0000 |
parents | a209672376fd |
children | 8cd729851562 |
comparison
equal
deleted
inserted
replaced
843:9f279ebda751 | 844:d3bbb5dd3913 |
---|---|
1 *sql.txt* For Vim version 7.0f. Last change: Fri Apr 21 2006 10:39:11 PM | 1 *sql.txt* For Vim version 7.0f. Last change: Wed Apr 26 2006 3:05:33 PM |
2 | 2 |
3 by David Fishburn | 3 by David Fishburn |
4 | 4 |
5 This is a filetype plugin to work with SQL files. | 5 This is a filetype plugin to work with SQL files. |
6 | 6 |
409 Table List - <C-C>t | 409 Table List - <C-C>t |
410 - <C-X><C-O> (the default map assumes tables) | 410 - <C-X><C-O> (the default map assumes tables) |
411 Stored Procedure List - <C-C>p | 411 Stored Procedure List - <C-C>p |
412 View List - <C-C>v | 412 View List - <C-C>v |
413 Column List - <C-C>c | 413 Column List - <C-C>c |
414 - Windows platform only | 414 |
415 - When viewing a popup window displaying the list | 415 Windows platform only - When viewing a popup window displaying the list |
416 of tables, you can press <C-Right>, this will | 416 of tables, you can press <C-Right>, this will |
417 replace the table currently highlighted with | 417 replace the table currently highlighted with |
418 the column list for that table. | 418 the column list for that table. |
419 - When viewing a popup window displaying the list | 419 - When viewing a popup window displaying the list |
420 of columns, you can press <C-Left>, this will | 420 of columns, you can press <C-Left>, this will |
421 replace the column list with the list of tables. | 421 replace the column list with the list of tables. |
422 - This allows you to quickly drill down into a | |
423 table to view it's columns and back again. | |
422 | 424 |
423 The SQL completion plugin caches various lists that are displayed in | 425 The SQL completion plugin caches various lists that are displayed in |
424 the popup window. This makes the re-displaying of these lists very | 426 the popup window. This makes the re-displaying of these lists very |
425 fast. If new tables or columns are added to the database it may become | 427 fast. If new tables or columns are added to the database it may become |
426 necessary to clear the plugins cache. The default map for this is: > | 428 necessary to clear the plugins cache. The default map for this is: > |
498 | 500 |
499 NOTE: The following example uses <C-Right> to trigger a column list while | 501 NOTE: The following example uses <C-Right> to trigger a column list while |
500 the popup window is active. This map is only available on the Windows | 502 the popup window is active. This map is only available on the Windows |
501 platforms since *nix does not recognize CTRL and the right arrow held down | 503 platforms since *nix does not recognize CTRL and the right arrow held down |
502 together. If you wish to enable this functionality on a *nix platform choose | 504 together. If you wish to enable this functionality on a *nix platform choose |
503 a key and create this mapping (see |sql-completion-maps| for further | 505 a key and create one of these mappings (see |sql-completion-maps| for further |
504 details on where to create this imap): > | 506 details on where to create this imap): > |
505 imap <buffer> <your_keystroke> <CR><C-\><C-O>:call sqlcomplete#Map('column')<CR><C-X><C-O> | 507 imap <buffer> <your_keystroke> <C-R>=sqlcomplete#DrillIntoTable()<CR> |
508 imap <buffer> <your_keystroke> <C-Y><C-\><C-O>:call sqlcomplete#Map('column')<CR><C-X><C-O> | |
506 | 509 |
507 Example of using column completion: | 510 Example of using column completion: |
508 - Press <C-C>t again to display the list of tables. | 511 - Press <C-C>t again to display the list of tables. |
509 - When the list is displayed in the completion window, press <C-Right>, | 512 - When the list is displayed in the completion window, press <C-Right>, |
510 this will replace the list of tables, with a list of columns for the | 513 this will replace the list of tables, with a list of columns for the |
515 - Press <C-Right> again while the same table is highlighted. You will | 518 - Press <C-Right> again while the same table is highlighted. You will |
516 notice there is no delay since the column list has been cached. If you | 519 notice there is no delay since the column list has been cached. If you |
517 change the schema of a cached table you can press <C-C>R, which | 520 change the schema of a cached table you can press <C-C>R, which |
518 clears the SQL completion cache. | 521 clears the SQL completion cache. |
519 - NOTE: <C-Right> and <C-Left> have been designed to work while the | 522 - NOTE: <C-Right> and <C-Left> have been designed to work while the |
520 completion window is active. If you use these maps when the completion | 523 completion window is active. If the completion popup window is |
521 window is not active a carriage return will be inadvertently entered in | 524 not active, a normal <C-Right> or <C-Left> will be executed. |
522 your buffer. | |
523 | 525 |
524 Lets look how we can build a SQL statement dynamically. A select statement | 526 Lets look how we can build a SQL statement dynamically. A select statement |
525 requires a list of columns. There are two ways to build a column list using | 527 requires a list of columns. There are two ways to build a column list using |
526 the SQL completion plugin. > | 528 the SQL completion plugin. > |
527 One column at a time: | 529 One column at a time: |
547 either accept of change the alias. Press OK. | 549 either accept of change the alias. Press OK. |
548 6. The table name is replaced with the column list of the table is | 550 6. The table name is replaced with the column list of the table is |
549 replaced with the comma separate list of columns with the alias | 551 replaced with the comma separate list of columns with the alias |
550 prepended to each of the columns. | 552 prepended to each of the columns. |
551 7. Step 3 and 4 can be replaced by pressing <C-C>L, which has | 553 7. Step 3 and 4 can be replaced by pressing <C-C>L, which has |
552 a <CR> embedded in the map to choose the currently highlighted | 554 a <C-Y> embedded in the map to choose the currently highlighted |
553 table in the list. | 555 table in the list. |
554 | 556 |
555 There is a special provision when writing select statements. Consider the | 557 There is a special provision when writing select statements. Consider the |
556 following statement: > | 558 following statement: > |
557 select * | 559 select * |
685 <C-Right> | 687 <C-Right> |
686 < - Displays a list of columns for the table currently highlighted in | 688 < - Displays a list of columns for the table currently highlighted in |
687 the completion window. <C-Right> is not recognized on most Unix | 689 the completion window. <C-Right> is not recognized on most Unix |
688 systems, so this maps is only created on the Windows platform. | 690 systems, so this maps is only created on the Windows platform. |
689 If you would like the same feature on Unix, choose a different key | 691 If you would like the same feature on Unix, choose a different key |
690 and make the same map in your vimrc. | 692 and make the same map in your vimrc. > |
691 This should only be used when the completion window is active. > | |
692 <C-Left> | 693 <C-Left> |
693 < - Displays the list of tables. | 694 < - Displays the list of tables. |
694 <C-Left> is not recognized on most Unix systems, so this maps is | 695 <C-Left> is not recognized on most Unix systems, so this maps is |
695 only created on the Windows platform. If you would like the same | 696 only created on the Windows platform. If you would like the same |
696 feature on Unix, choose a different key and make the same map in | 697 feature on Unix, choose a different key and make the same map in |
697 your vimrc. | 698 your vimrc. > |
698 This should only be used when the completion window is active. > | |
699 <C-C>R | 699 <C-C>R |
700 < - This maps removes all cached items and forces the SQL completion | 700 < - This maps removes all cached items and forces the SQL completion |
701 to regenerate the list of items. | 701 to regenerate the list of items. |
702 | 702 |
703 Customizing Maps | 703 Customizing Maps |