test1.pgc.in

来自「postgresql8.3.4源码,开源数据库」· IN 代码 · 共 75 行

IN
75
字号
/* * this file tests all sorts of connecting to one single database. */#include <stdlib.h>#include <string.h>#include <stdlib.h>#include <stdio.h>/* do not include regression.h */intmain(void){exec sql begin declare section;	char db[200];	char pw[200];exec sql end declare section;	ECPGdebug(1, stderr);	exec sql connect to connectdb as main;	exec sql alter user connectuser ENCRYPTED PASSWORD 'connectpw';	exec sql disconnect;  /* <-- "main" not specified */	exec sql connect to connectdb@localhost as main;	exec sql disconnect main;	exec sql connect to @localhost as main user connectdb;	exec sql disconnect main;	exec sql connect to connectdb@localhost:@TEMP_PORT@ as main;	exec sql disconnect main;	exec sql connect to @localhost:@TEMP_PORT@ as main user connectdb;	exec sql disconnect main;	exec sql connect to connectdb:@TEMP_PORT@ as main;	exec sql disconnect main;	exec sql connect to :@TEMP_PORT@ as main user connectdb;	exec sql disconnect main;	exec sql connect to tcp:postgresql://localhost:@TEMP_PORT@/connectdb user connectuser identified by connectpw;	exec sql disconnect;	exec sql connect to tcp:postgresql://localhost:@TEMP_PORT@/ user connectdb;	exec sql disconnect;	strcpy(pw, "connectpw");	strcpy(db, "tcp:postgresql://localhost:@TEMP_PORT@/connectdb");	exec sql connect to :db user connectuser using :pw;	exec sql disconnect;	exec sql connect to unix:postgresql://localhost:@TEMP_PORT@/connectdb user connectuser using "connectpw";	exec sql disconnect;	exec sql connect to unix:postgresql://localhost:@TEMP_PORT@/connectdb user connectuser;	exec sql disconnect;	/* wrong db */	exec sql connect to tcp:postgresql://localhost:@TEMP_PORT@/nonexistant user connectuser identified by connectpw;	exec sql disconnect;	/* wrong port */	exec sql connect to tcp:postgresql://localhost:20/connectdb user connectuser identified by connectpw;	/* no disconnect necessary */	/* wrong password */	exec sql connect to unix:postgresql://localhost:@TEMP_PORT@/connectdb user connectuser identified by "wrongpw";	/* no disconnect necessary */	return (0);}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?