kou commented on PR #1152:
URL: https://github.com/apache/arrow-adbc/pull/1152#issuecomment-1758758816
For Vala:
```diff
diff --git a/glib/example/meson.build b/glib/example/meson.build
index bc365d72..76a07079 100644
--- a/glib/example/meson.build
+++ b/glib/example/meson.build
@@ -17,8 +17,10 @@
# specific language governing permissions and limitations
# under the License.
+arrow_glib = dependency('arrow-glib')
+
executable('sqlite', 'sqlite.c',
- dependencies: [adbc_glib],
+ dependencies: [adbc_glib, arrow_glib],
link_language: 'c')
install_data('README.md',
diff --git a/glib/example/vala/meson.build b/glib/example/vala/meson.build
index f5debcd7..731e0439 100644
--- a/glib/example/vala/meson.build
+++ b/glib/example/vala/meson.build
@@ -25,10 +25,11 @@ if generate_vapi
],
'dependencies': [
adbc_glib_vapi,
- dependency('gobject-2.0'),
+ arrow_glib,
],
'vala_args': [
'--pkg', 'posix',
+ '--vapidir', arrow_glib.get_variable('vapidir'),
],
}
executable('sqlite', 'sqlite.vala',
diff --git a/glib/example/vala/sqlite.vala b/glib/example/vala/sqlite.vala
index dedb42a3..8d7d2068 100644
--- a/glib/example/vala/sqlite.vala
+++ b/glib/example/vala/sqlite.vala
@@ -29,10 +29,18 @@ int main (string[] args) {
GLib.message ("Connection to database initialized...");
try {
var stm = new GADBC.Statement (conn);
- string sql = "CREATE TABLE IF NOT EXISTS test (id INTEGER, name
TEXT)";
+ string sql = "SELECT sqlite_version() AS version";
stm.set_sql_query (sql);
- stm.execute (false, null, null);
- GLib.message ("Statement executed: %s", sql);
+ void *c_abi_array_stream = null;
+ stm.execute (true, out c_abi_array_stream, null);
+ try {
+ GLib.message ("Statement executed: %s", sql);
+ var reader = GArrow.RecordBatchReader.import
(c_abi_array_stream);
+ var table = reader.read_all ();
+ GLib.message ("Executed result: %s", table.to_string ());
+ } finally {
+ GLib.free (c_abi_array_stream);
+ }
}
catch (GLib.Error e) {
GLib.message ("Error executing statement: %s", e.message);
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]