version 1.12, 2007/04/18 16:18:58
|
version 1.14, 2007/07/31 11:28:48
|
Line 98 class xml_handler:
|
Line 98 class xml_handler:
|
@param options.keep_fields: (optional) don't add fields to SQL database |
@param options.keep_fields: (optional) don't add fields to SQL database |
@param options.ascii_db: (optional) assume ascii encoding in db |
@param options.ascii_db: (optional) assume ascii encoding in db |
@param options.replace_table: (optional) delete and re-insert data |
@param options.replace_table: (optional) delete and re-insert data |
|
@param options.backup_table: (optional) create backup of old table (breaks indices) |
""" |
""" |
|
|
# set up parser |
# set up parser |
Line 133 class xml_handler:
|
Line 134 class xml_handler:
|
logging.debug("keep_fields: "+repr(self.keep_fields)) |
logging.debug("keep_fields: "+repr(self.keep_fields)) |
logging.debug("ascii_db: "+repr(self.ascii_db)) |
logging.debug("ascii_db: "+repr(self.ascii_db)) |
logging.debug("replace_table: "+repr(self.replace_table)) |
logging.debug("replace_table: "+repr(self.replace_table)) |
|
logging.debug("backup_table: "+repr(self.backup_table)) |
|
|
self.dbIDs = {} |
self.dbIDs = {} |
self.rowcnt = 0 |
self.rowcnt = 0 |
Line 229 class xml_handler:
|
Line 231 class xml_handler:
|
# check fields to update |
# check fields to update |
if self.update_fields is None: |
if self.update_fields is None: |
if self.keep_fields: |
if self.keep_fields: |
# update existing fields |
# update all existing fields from sql (when they are in the xml file) |
self.update_fields = self.sql_fields |
self.update_fields = {} |
|
for f in self.sql_fields.keys(): |
|
if self.sql_field_map.has_key(f): |
|
xf = self.sql_field_map[f] |
|
self.update_fields[f] = self.xml_field_map[xf] |
|
|
else: |
else: |
# update all fields |
# update all fields |
Line 451 class xml_handler:
|
Line 456 class xml_handler:
|
|
|
|
|
def importFMPXML(options): |
def importFMPXML(options): |
"""SAX handler to import FileMaker XML file (FMPXMLRESULT format) into the table. |
"""import FileMaker XML file (FMPXMLRESULT format) into the table. |
@param options: dict of options |
@param options: dict of options |
@param options.dsn: database connection string |
@param options.dsn: database connection string |
@param options.table: name of the table the xml shall be imported into |
@param options.table: name of the table the xml shall be imported into |
Line 463 def importFMPXML(options):
|
Line 468 def importFMPXML(options):
|
@param options.keep_fields: (optional) don't add fields to SQL database |
@param options.keep_fields: (optional) don't add fields to SQL database |
@param options.ascii_db: (optional) assume ascii encoding in db |
@param options.ascii_db: (optional) assume ascii encoding in db |
@param options.replace_table: (optional) delete and re-insert data |
@param options.replace_table: (optional) delete and re-insert data |
|
@param options.backup_table: (optional) create backup of old table (breaks indices) |
""" |
""" |
|
|
|
|