alternative to assert
[gtkD.git] / gtkD / srcgda / gda / Gda.d
bloba0c86852a8b981a2f563b41905b451ab13e6b2cc
1 /*
2 * This file is part of gtkD.
4 * gtkD is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * gtkD is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with gtkD; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = libgda-libgda.html
26 * outPack = gda
27 * outFile = Gda
28 * strct =
29 * realStrct=
30 * ctorStrct=
31 * clss = Gda
32 * interf =
33 * class Code: Yes
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - gda_
40 * omit structs:
41 * omit prefixes:
42 * omit code:
43 * - gda_init
44 * imports:
45 * - glib.HashTable
46 * - glib.ListG
47 * - gda.ParameterList
48 * structWrap:
49 * module aliases:
50 * local aliases:
53 module gda.Gda;
55 version(noAssert)
57 version(Tango)
59 import tango.io.Stdout; // use the tango loging?
63 private import gdac.gdatypes;
65 private import gdac.gda;
68 private import glib.HashTable;
69 private import glib.ListG;
70 private import gda.ParameterList;
75 /**
76 * Description
78 public class Gda
81 /**
82 * Initializes the GDA library.
83 * app_id :
84 * name of the program.
85 * version :
86 * revision number of the program.
87 * args :
88 * args from main().
90 public static void init(char[] appId, char[] versio, char[][] args)
92 // void gda_init (const gchar *app_id, const gchar *version, gint nargs, gchar *args[]);
93 gchar*[] argv = (new char*[args.length]);
94 int argc = 0;
95 foreach (char[] p; args)
97 argv[argc++] = cast(gchar*)p;
100 gda_init(Str.toStringz(appId), Str.toStringz(versio), argc, argv);
107 * Description
113 * Runs the GDA main loop, which is nothing more than the Bonobo main
114 * loop, but with internally added stuff specific for applications using
115 * libgda.
116 * You can specify a function to be called after everything has been correctly
117 * initialized (that is, for initializing your own stuff).
118 * init_func :
119 * function to be called when everything has been initialized.
120 * user_data :
121 * data to be passed to the init function.
123 public static void mainRun(GdaInitFunc initFunc, void* userData)
125 // void gda_main_run (GdaInitFunc init_func, gpointer user_data);
126 gda_main_run(initFunc, userData);
130 * Exits the main loop.
132 public static void mainQuit()
134 // void gda_main_quit (void);
135 gda_main_quit();
139 * type :
140 * Type to convert from.
141 * Returns :
142 * the string representing the given GdaValueType.
143 * This is not necessarily the same string used to describe the column type in a SQL statement.
144 * Use gda_connection_get_schema() with GDA_CONNECTION_SCHEMA_TYPES to get the actual types supported by the provider.
146 public static char[] typeToString(GdaValueType type)
148 // const gchar* gda_type_to_string (GdaValueType type);
149 return Str.toString(gda_type_to_string(type) );
153 * str :
154 * the name of a GdaValueType, as returned by gda_type_to_string().
155 * Returns :
156 * the GdaValueType represented by the given str.
158 public static GdaValueType typeFromString(char[] str)
160 // GdaValueType gda_type_from_string (const gchar *str);
161 return gda_type_from_string(Str.toStringz(str));
165 * Creates a new list of strings, which contains all keys of a given hash
166 * table. After using it, you should free this list by calling g_list_free.
167 * hash_table :
168 * a hash table.
169 * Returns :
170 * a new GList.
172 public static ListG stringHashToList(HashTable hashTable)
174 // GList* gda_string_hash_to_list (GHashTable *hash_table);
175 return new ListG( gda_string_hash_to_list((hashTable is null) ? null : hashTable.getHashTableStruct()) );
179 * Replaces the placeholders (:name) in the given SQL command with
180 * the values from the GdaParameterList specified as the params
181 * argument.
182 * sql :
183 * a SQL command containing placeholders for values.
184 * params :
185 * a list of values for the placeholders.
186 * Returns :
187 * the SQL string with all placeholders replaced, or NULL
188 * on error. On success, the returned string must be freed by the caller
189 * when no longer needed.
191 public static char[] sqlReplacePlaceholders(char[] sql, ParameterList params)
193 // gchar* gda_sql_replace_placeholders (const gchar *sql, GdaParameterList *params);
194 return Str.toString(gda_sql_replace_placeholders(Str.toStringz(sql), (params is null) ? null : params.getParameterListStruct()) );
198 * Loads a file, specified by the given uri, and returns the file
199 * contents as a string.
200 * It is the caller's responsibility to free the returned value.
201 * filename :
202 * path for the file to be loaded.
203 * Returns :
204 * the file contents as a newly-allocated string, or NULL
205 * if there is an error.
207 public static char[] fileLoad(char[] filename)
209 // gchar* gda_file_load (const gchar *filename);
210 return Str.toString(gda_file_load(Str.toStringz(filename)) );
214 * Saves a chunk of data into a file.
215 * filename :
216 * path for the file to be saved.
217 * buffer :
218 * contents of the file.
219 * len :
220 * size of buffer.
221 * Returns :
222 * TRUE if successful, FALSE on error.
224 public static int fileSave(char[] filename, char[] buffer, int len)
226 // gboolean gda_file_save (const gchar *filename, const gchar *buffer, gint len);
227 return gda_file_save(Str.toStringz(filename), Str.toStringz(buffer), len);