put all unicode convert stuff in iconv.c. Use SQLGetPrivateProfile() if available (handles odbc.ini file in different places). Fix bug for list tables/describe in odbc.

This commit is contained in:
brianb
2004-03-06 05:13:27 +00:00
parent f016c9cc88
commit 6920daaf1e
9 changed files with 91 additions and 63 deletions

View File

@@ -1,4 +1,4 @@
lib_LTLIBRARIES = libmdb.la
libmdb_la_SOURCES= catalog.c mem.c file.c kkd.c table.c data.c dump.c backend.c money.c sargs.c index.c like.c write.c stats.c map.c props.c worktable.c options.c
libmdb_la_SOURCES= catalog.c mem.c file.c kkd.c table.c data.c dump.c backend.c money.c sargs.c index.c like.c write.c stats.c map.c props.c worktable.c options.c iconv.c
AM_CPPFLAGS = -I$(top_srcdir)/include $(GLIB_CFLAGS)
LIBS = $(GLIB_LIBS) -lm

View File

@@ -557,13 +557,14 @@ int mdb_rewind_table(MdbTableDef *table)
return 0;
}
int mdb_fetch_row(MdbTableDef *table)
int
mdb_fetch_row(MdbTableDef *table)
{
MdbHandle *mdb = table->entry->mdb;
MdbFormatConstants *fmt = mdb->fmt;
int rows;
int rc;
guint32 pg;
MdbHandle *mdb = table->entry->mdb;
MdbFormatConstants *fmt = mdb->fmt;
int rows;
int rc;
guint32 pg;
if (table->num_rows==0)
return 0;
@@ -1168,20 +1169,3 @@ int mdb_col_fixed_size(MdbColumn *col)
}
return 0;
}
int
mdb_unicode2ascii(MdbHandle *mdb, unsigned char *buf, int offset, int len, char *dest)
{
int i;
if (buf[offset]==0xff &&
buf[offset+1]==0xfe) {
strncpy(dest, &buf[offset+2], len-2);
dest[len-2]='\0';
} else {
/* convert unicode to ascii, rather sloppily */
for (i=0;i<len;i+=2)
dest[i/2] = buf[offset + i];
dest[len/2]='\0';
}
return len;
}