cvs: pecl /mdbtools mdbtools.xml
| From: | Hartmut Holzgraefe | Date: | Thu, 11 Nov 2004 16:37:58 +0000 |
| Subject: | cvs: pecl /mdbtools mdbtools.xml | ||
| Groups: | php.pecl.cvs | ||
| Request: | Send a blank email to pecl-cvs+get-2023@lists.php.net to get a copy of this message | ||
hholzgra Thu Nov 11 11:37:58 2004 EDT
Modified files:
/pecl/mdbtools mdbtools.xml
Log:
- updated to mdbtools 0.6pre1 API
- config.m4 snippet for glib2 inclusion added
- potential crashes on resource destruction fixed
- started to work on experimental index support
http://cvs.php.net/diff.php/pecl/mdbtools/mdbtools.xml?r1=1.2&r2=1.3&ty=u
Index: pecl/mdbtools/mdbtools.xml
diff -u pecl/mdbtools/mdbtools.xml:1.2 pecl/mdbtools/mdbtools.xml:1.3
--- pecl/mdbtools/mdbtools.xml:1.2 Wed Mar 31 12:34:23 2004
+++ pecl/mdbtools/mdbtools.xml Thu Nov 11 11:37:57 2004
@@ -48,15 +48,36 @@
<with defaults='/usr:/usr/local' testfile='include/mdbtools.h'>mdbtools
installation prefix</with>
<lib name="mdb" function="mdb_init"/>
<header name="mdbtools.h"/>
+ <configm4>
+ AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
+
+ if test $PKG_CONFIG = "no"; then
+ AC_MSG_ERROR("pkg-config not found")
+ fi
+
+ if ! $PKG_CONFIG glib-2.0; then
+ AC_MSG_ERROR("glib-2.0 not found by pkg-config")
+ fi
+
+ GLIB_INCS=
$PKG_CONFIG --cflags-only-I glib-2.0
+ PHP_EVAL_INCLINE($GLIB_INCS)
+ CPPFLAGS="$CFLAGS $GLIB_INCS"
+ CFLAGS="$CFLAGS $GLIB_INCS"
+
+ GLIB_LIBS=$PKG_CONFIG --libs glib-2.0' -lm'
+ PHP_EVAL_LIBLINE($GLIB_LIBS)
+ LDFLAGS="$CFLAGS $GLIB_LIBS"
+ </configm4>
</deps>
+
<resources>
<resource name="MdbDatabase" payload="MdbHandle" alloc="no">
<description>
A MDB database resource connected to a *.mdb file.
</description>
<destruct>
- mdb_free_handle(resource);
+ mdb_close(resource);
</destruct>
</resource>
@@ -69,15 +90,12 @@
int i;
for (i = 0; i < resource->num_cols; i++) {
- efree(resource->column_names[i]);
efree(resource->bound_values[i]);
}
efree(resource->column_names);
efree(resource->bound_values);
- /* there is no free function for tables in the API?
- mdb_free_table(resource->table);
- */
+ mdb_free_tabledef(resource->table);
]]>
</destruct>
</resource>
@@ -117,7 +135,6 @@
<constant name="MDB_NUMERIC">Type 'Numeric'</constant>
</constants>
- <functions>
<function role="internal" name="MINIT">
<code>mdb_init();</code>
</function>
@@ -125,9 +142,7 @@
<function role="internal" name="MSHUTDOWN">
<code>mdb_exit();</code>
</function>
- </functions>
- <functions>
<function name="mdb_open">
<proto>resource MdbDatabase mdb_open(string path)</proto>
<summary>Open an Access .mdb file for reading</summary>
@@ -142,11 +157,9 @@
]]>
</description>
<code>
- return_res = mdb_open(path);
+ return_res = mdb_open(path, MDB_NOFLAGS);
if (!return_res) RETURN_FALSE;
-
- ZEND_REGISTER_RESOURCE(return_value, return_res, le_MdbDatabase);
</code>
</function>
@@ -162,7 +175,7 @@
]]>
</description>
<code>
- zval_dtor(db);
+ zend_list_delete(Z_LVAL_P(db));
</code>
</function>
@@ -222,14 +235,7 @@
<summary>Open a table in an .mdb file for reading</summary>
<proto>resource MdbTable mdb_table_open(resource MdbDatabase db, string
table)</proto>
<description>
-<![CDATA[
- <para>
- Return the names of all tables within the database <parameter>db</parameter>
- as an array of strings. Internal system tables like
<literal>MSysObjects</literal>
- are ignored unless the optional parameter <parameter>systabs</parameter> is set
- to &true;.
- </para>
-]]>
+...
</description>
<code>
<![CDATA[
@@ -250,7 +256,7 @@
return_res->num_cols = return_res->table->num_cols;
mdb_read_columns(return_res->table);
-
+ mdb_read_indices(return_res->table);
mdb_rewind_table(return_res->table);
return_res->column_names = ecalloc(return_res->num_cols, sizeof(char *));
@@ -269,8 +275,6 @@
}
if (!return_res->table) RETURN_FALSE;
-
- ZEND_REGISTER_RESOURCE(return_value, return_res, le_MdbTable);
]]>
</code>
</function>
@@ -352,7 +356,7 @@
</description>
<code>
<![CDATA[
- RETURN_LONG(mdb_rewind_table(res_table));
+ RETURN_LONG(mdb_rewind_table(res_table->table));
]]>
</code>
</function>
@@ -368,7 +372,7 @@
]]>
</description>
<code>
- zval_dtor(table);
+ zend_list_delete(Z_LVAL_P(table));
</code>
</function>
@@ -479,6 +483,51 @@
</code>
</function>
+
+
+
+ <function name="mdb_table_indexes">
+ <proto>array mdb_table_indexes(resource MdbTable table)</proto>
+ <summary>Get index type information for all indexes in a table</summary>
+ <description>
+...
+ </description>
+ <code>
+<![CDATA[
+ int i,j;
+ zval *row;
+ MdbIndex *idx;
+ char buf[256];
+
+ array_init(return_value);
+
+ for (i = 0; i < res_table->table->num_idxs; i++)
+ {
+ MAKE_STD_ZVAL(row);
+ array_init(row);
+
+ idx = g_ptr_array_index (res_table->table->indices, i);
+
+ add_assoc_long( row, "num", idx->index_num);
+ add_assoc_string(row, "name", idx->name, 1);
+ add_assoc_long( row, "type", idx->index_type);
+ add_assoc_long( row, "rows", idx->num_rows);
+ add_assoc_long( row, "keys", idx->num_keys);
+ add_assoc_long( row, "flags", idx->flags);
+
+ for (j=0; j < idx->num_keys; j++) {
+ sprintf(buf, "key_col_%d", j);
+ add_assoc_long(row, buf, idx->key_col_num[j]);
+ sprintf(buf, "key_col_order_%d", j);
+ add_assoc_long(row, buf, idx->key_col_order[j]);
+ }
+
+ add_next_index_zval(return_value, row);
+ }
+]]>
+ </code>
+ </function>
+
<function name="mdb_type_name">
<proto>string mdb_type_name(resource MdbDatabase db, int typecode)</proto>
<summary>Look up the name for a field type</summary>
@@ -495,6 +544,4 @@
</code>
</function>
- </functions>
-
</extension>
\ No newline at end of file