00001 00005 /* GtkSQL -- an interactive graphical query tool for PostgreSQL 00006 * Copyright (C) 1998-2002 Lionel ULMER, Darryl Luff. 00007 * 00008 * This program is free software; you can redistribute it and/or modify 00009 * it under the terms of the GNU General Public License as published by 00010 * the Free Software Foundation; either version 2 of the License, or 00011 * (at your option) any later version. 00012 * 00013 * This program is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU General Public License 00019 * along with this program; if not, write to the Free Software 00020 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00021 * ========================================================================== 00022 * 00023 */ 00024 00025 #include <stdlib.h> 00026 #include <string.h> 00027 #include "querydata.h" 00028 00032 QueryData *querydata_free(QueryData *qd) { 00033 if (qd) { 00034 if (qd->filename) 00035 free(qd->filename); 00036 } 00037 return NULL; 00038 } 00039 00043 char *querydata_get_filename(QueryData *qd) { 00044 if (! qd) 00045 return NULL; 00046 00047 return qd->filename; 00048 } 00049 00053 int querydata_is_changed(QueryData *qd) { 00054 if (! qd) 00055 return 0; 00056 00057 return qd->changed; 00058 } 00059 00062 void querydata_set_unchanged(QueryData *qd) { 00063 if (! qd) 00064 return; 00065 00066 qd->changed = 0; 00067 } 00068 00071 void querydata_set_filename(QueryData *qd, char *fn) { 00072 if (! qd) 00073 return; 00074 00075 if (qd->filename) 00076 free(qd->filename); 00077 00078 if (fn) 00079 qd->filename = strdup(fn); 00080 else 00081 qd->filename = NULL; 00082 } 00083 00086 QueryData *querydata_new() { 00087 return (QueryData *) calloc(1, sizeof(QueryData)); 00088 } 00089 00093 void querydata_set_changed(QueryData *qd, int c) { 00094 if (! qd) 00095 return; 00096 00097 qd->changed = c; 00098 }