ajout storage.pgsql
This commit is contained in:
		
							parent
							
								
									ec82ea80ee
								
							
						
					
					
						commit
						aaa99825f0
					
				
							
								
								
									
										7
									
								
								bin/storage.pgsql.php
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										7
									
								
								bin/storage.pgsql.php
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,7 @@ | |||||||
|  | #!/usr/bin/php
 | ||||||
|  | <?php | ||||||
|  | require $_composer_autoload_path?? __DIR__.'/../vendor/autoload.php'; | ||||||
|  | 
 | ||||||
|  | use nulib\cli\StoragePgsqlApp; | ||||||
|  | 
 | ||||||
|  | StoragePgsqlApp::run(); | ||||||
| @ -85,6 +85,7 @@ | |||||||
| 		"bin/yml2json.php", | 		"bin/yml2json.php", | ||||||
| 		"bin/storage.sqlite.php", | 		"bin/storage.sqlite.php", | ||||||
| 		"bin/storage.mysql.php", | 		"bin/storage.mysql.php", | ||||||
|  | 		"bin/storage.pgsql.php", | ||||||
| 		"nur_bin/compctl.php", | 		"nur_bin/compctl.php", | ||||||
| 		"nur_bin/compdep.php", | 		"nur_bin/compdep.php", | ||||||
| 		"nur_bin/datectl.php", | 		"nur_bin/datectl.php", | ||||||
|  | |||||||
							
								
								
									
										41
									
								
								src/cli/StoragePgsqlApp.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										41
									
								
								src/cli/StoragePgsqlApp.php
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,41 @@ | |||||||
|  | <?php | ||||||
|  | namespace nulib\cli; | ||||||
|  | 
 | ||||||
|  | use nulib\A; | ||||||
|  | use nulib\db\pgsql\PgsqlStorage; | ||||||
|  | use nur\config; | ||||||
|  | 
 | ||||||
|  | class StoragePgsqlApp extends AbstractStorageApp { | ||||||
|  |   const ARGS = [ | ||||||
|  |     "merge" => parent::ARGS, | ||||||
|  |     "purpose" => "gestion d'un capacitor pgsql", | ||||||
|  |     "usage" => [ | ||||||
|  |       "DBCONN [CHANNEL_NAME | -t TABLE | -c CHANNEL_CLASS] [--query] key=value...", | ||||||
|  |       "DBCONN [CHANNEL_NAME | -t TABLE | -c CHANNEL_CLASS] --sql-create", | ||||||
|  |     ], | ||||||
|  |     ["-t", "--table-name", "args" => 1, | ||||||
|  |       "help" => "nom de la table porteuse du canal de données", | ||||||
|  |     ], | ||||||
|  |     ["-c", "--channel-class", "args" => 1, | ||||||
|  |       "help" => "nom de la classe dérivée de CapacitorChannel", | ||||||
|  |     ], | ||||||
|  |     ["-z", "--reset", "name" => "action", "value" => self::ACTION_RESET, | ||||||
|  |       "help" => "réinitialiser le canal", | ||||||
|  |     ], | ||||||
|  |     ["--query", "name" => "action", "value" => self::ACTION_QUERY, | ||||||
|  |       "help" => "lister les lignes correspondant aux valeurs spécifiées. c'est l'action par défaut", | ||||||
|  |     ], | ||||||
|  |     ["-s", "--sql-create", "name" => "action", "value" => self::ACTION_SQL, | ||||||
|  |       "help" => "afficher la requête pour créer la table", | ||||||
|  |     ], | ||||||
|  |   ]; | ||||||
|  |   function main() { | ||||||
|  |     $dbconn = A::shift($this->args); | ||||||
|  |     if ($dbconn === null) self::die("Vous devez spécifier la base de données"); | ||||||
|  |     $tmp = config::db($dbconn); | ||||||
|  |     if ($tmp === null) self::die("$dbconn: base de données invalide"); | ||||||
|  |     $storage = new PgsqlStorage($tmp); | ||||||
|  | 
 | ||||||
|  |     $this->storageCtl($storage); | ||||||
|  |   } | ||||||
|  | } | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user