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
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
;
82 * Initializes the GDA library.
84 * name of the program.
86 * revision number of the program.
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
]);
95 foreach (char[] p
; args
)
97 argv
[argc
++] = cast(gchar
*)p
;
100 gda_init(Str
.toStringz(appId
), Str
.toStringz(versio
), argc
, argv
);
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
116 * You can specify a function to be called after everything has been correctly
117 * initialized (that is, for initializing your own stuff).
119 * function to be called when everything has been initialized.
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);
140 * Type to convert from.
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
) );
154 * the name of a GdaValueType, as returned by gda_type_to_string().
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.
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
183 * a SQL command containing placeholders for values.
185 * a list of values for the placeholders.
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.
202 * path for the file to be loaded.
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.
216 * path for the file to be saved.
218 * contents of the file.
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
);