Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //PRZYKŁADOWE LOGOWANIE
- char logData[150]="host=localhost port=5432 dbname=projekt user=dlipinski password=";
- char pass[30]={'\0'};
- printf("Password: ");
- system("stty -echo");
- scanf("%s",&pass);
- system("stty echo");
- system("clear");
- strcpy(passT,pass);
- strcat(logData,pass);
- PGconn *conn = PQconnectdb(logData);
- //PRZYKŁADOWE KLEJENIE KOMEND
- //----------------------------------------DROP
- char dropTable[200]={'\0'};
- strcat(dropTable,"DROP TABLE ");
- strcat(dropTable, tableName);
- strcat(dropTable, ";");
- doSQL(conn, dropTable);
- strcat(tableId,"id_");
- strcat(tableId,tableName);
- //----------------------------------------CREATE
- char createTable[200]={'\0'};
- strcat(createTable,"CREATE TABLE ");
- strcat(createTable, tableName);
- strcat(createTable, "(");
- strcat(createTable, tableId);
- strcat(createTable," SERIAL PRIMARY KEY ");
- for(i=0;i<counter;i++){
- strcat(createTable,", ");
- strcat(createTable,columnNames[i]);
- strcat(createTable," VARCHAR");
- }
- strcat(createTable,");");
- doSQL(conn, createTable);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement